Parsing wiki information

Anything related to the content on our wiki (https://wiki.factorio.com/)

Moderator: Bilka

Post Reply
jcranmer
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Wed Jun 29, 2016 9:59 pm
Contact:

Parsing wiki information

Post by jcranmer »

I've been working on a tool to automatically convert the Factorio Lua data into a JSON format more reasonable for other tooling. To this end, I'm looking at parsing the Wiki data to automatically write the parser [1]. One thing I've noticed is that the semantic mediawiki information for the prototype definitions don't have the default information. The template for parsing a file only adds information on the name, type, and optionality:

Code: Select all

 |Prototype property name={{{1}}}
 |Prototype property type={{{2}}}
 |Prototype property optional={{{optional|false}}}
 |Prototype property pagename={{FULLPAGENAME}}
 
But there's no inclusion of the default value (which would be {{{3}}} in wiki terms). Could this be added?


[1] So it's kind of like a compiler compiler compiler. Don't you love getting all meta?

Bilka
Factorio Staff
Factorio Staff
Posts: 2624
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Parsing wiki information

Post by Bilka »

jcranmer wrote:
Sat Aug 22, 2020 7:03 pm
But there's no inclusion of the default value (which would be {{{3}}} in wiki terms). Could this be added?
Theoretically, yes. Practically, it is not there because it does not have consistent formatting, making it basically useless for "machine reading". To illustrate, the value may or may not be wrapped in nowiki tags, may have extra text describing what it does, may only be that extra text without the actual value, or may be completely missing for some properties while existing for others that have the same default.
It may be added to the properties in the future when I have the time to unify the formatting/values, however this is would not happen anytime soon as other things, such as updating the prototype documentation to 1.0.0 in the first place, have much higher priority.

Aside from this, how do you plan to handle the fact that the Types/ pages are not part of the SMW information?
Furthermore, could you explain to me why you need the prototype definitions to convert the data.raw Lua table to Json in the first place? The Json conversion should be pretty easily done by writing a mod that just stringifies the data.raw table to Json using using a Lua Json library, no need for external syntax definitions.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Wiki Talk”

Who is online

Users browsing this forum: No registered users