Page 2 of 6

Re: Changelog tutorial

Posted: Sat Mar 16, 2019 2:01 pm
by themadgunman
This whole tab hatred thing really needs fixing, especially as most IDE's will automatically add a tab when you do a new line from an already indented line, I think I spend more time debugging my changelog than I do my actual mod code atm :evil:

I suspect this is why 90% of mod changelogs don't actually work in game

Re: Changelog tutorial

Posted: Sat Mar 16, 2019 2:15 pm
by DaveMcW
themadgunman wrote:
Sat Mar 16, 2019 2:01 pm
This whole tab hatred thing really needs fixing, especially as most IDE's will automatically add a tab when you do a new line from an already indented line,
Spaces won the whitespace war. If your IDE is any good you can configure it to convert tabs to spaces when it saves the file.

Re: Changelog tutorial

Posted: Sat Mar 16, 2019 2:42 pm
by themadgunman
DaveMcW wrote:
Sat Mar 16, 2019 2:15 pm
Spaces won the whitespace war. If your IDE is any good you can configure it to convert tabs to spaces when it saves the file.
I just switched it to automatically indent with spaces rather than tabs, for some reason this never occured to me before, thanks for the tip

Re: Changelog tutorial

Posted: Sat Mar 16, 2019 3:14 pm
by Schallfalke
themadgunman wrote:
Sat Mar 16, 2019 2:42 pm
DaveMcW wrote:
Sat Mar 16, 2019 2:15 pm
Spaces won the whitespace war. If your IDE is any good you can configure it to convert tabs to spaces when it saves the file.
Interesting, time for Uncle Google to earn his keep today and inform me on how to do this in VS, thanks for the tip
Some text editors allow changing tabs to spaces, can save you a lot of time.
For example, I am using "Sublime Text". Under menu "View" → "Indentation", there are whole bunch of options including "Indent Using Spaces", setting "Tab Width", "Convert Indentation to Spaces".
I am sure other (free) modern text editors have similar functions as well.

Re: Changelog tutorial

Posted: Sat Mar 16, 2019 3:19 pm
by themadgunman
Schallfalke wrote:
Sat Mar 16, 2019 3:14 pm
Some text editors allow changing tabs to spaces, can save you a lot of time.
For example, I am using "Sublime Text". Under menu "View" → "Indentation", there are whole bunch of options including "Indent Using Spaces", setting "Tab Width", "Convert Indentation to Spaces".
I am sure other (free) modern text editors have similar functions as well.
yeah it was actually just a simple setting change, it just never occured to me to look tbh :oops:

Re: Changelog tutorial

Posted: Tue Mar 19, 2019 2:12 am
by Pi-C
Updated the text again. I actually fixed a changelog to try out a few things. Now the tutorial contains a lot of boring stuff about where to use spaces and how many, or how to indent lists correctly. :-)

Re: Changelog tutorial

Posted: Sat Mar 23, 2019 3:48 pm
by Bilka
The changelog cannot be encoded in UTF-8-BOM, this will cause Factorio to error on line 1. I recommend to use plain UTF-8 (no Byte Order Mark) instead.

Re: Changelog tutorial

Posted: Sat Mar 23, 2019 4:09 pm
by Pi-C
Thank you, updated!

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 12:51 pm
by BlueTemplar
Is changelog.txt in the YAML format or the JSON format, or neither ?
viewtopic.php?p=416982#p416982

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 1:16 pm
by Muppet9010
Where is it said it's in JSON format?
Btw it very clearly isn't json

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 2:53 pm
by BlueTemplar
I gave a link !?

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 2:57 pm
by Muppet9010
Doing a search on the linked thread (both pages) found no reference to JSON. Hence why I asked as the format is so visually different to JSON.

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 3:21 pm
by BlueTemplar
YAML is a superset of JSON.

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 5:49 pm
by Muppet9010
Does Factorio changelog support the JSON type syntax of YAML 1.2 or the full YAML syntax?
As my understanding was that it only supported a simplified syntax that is YAML compliment.

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 6:37 pm
by Omnifarious
BlueTemplar wrote:
Tue Mar 26, 2019 3:21 pm
YAML is a superset of JSON.
No... YAML is an alternative to JSON. It might be that you can represent more kinds of data with YAML (though I suspect not because YAML doesn't really have a distinction between integers and strings), but superset implies that all JSON files are YAML files, which is definitely not the case. JSON is a curly-brace based syntax, and YAML is whitespace (and some special delimiter characters) based.

Re: Changelog tutorial

Posted: Tue Mar 26, 2019 11:14 pm
by BlueTemplar
https://yaml.org/spec/1.2/spec.html#id2759572
YAML can therefore be viewed as a natural superset of JSON, offering improved human readability and a more complete information model. This is also the case in practice; every JSON file is also a valid YAML file. This makes it easy to migrate from JSON to YAML if/when the additional features are required.
(Though this seems to be morphing into a pointless discussion about the definition of "superset", my bad...)

Re: Changelog tutorial

Posted: Wed Mar 27, 2019 6:44 pm
by Omnifarious
BlueTemplar wrote:
Tue Mar 26, 2019 11:14 pm
https://yaml.org/spec/1.2/spec.html#id2759572
YAML can therefore be viewed as a natural superset of JSON, offering improved human readability and a more complete information model. This is also the case in practice; every JSON file is also a valid YAML file. This makes it easy to migrate from JSON to YAML if/when the additional features are required.
(Though this seems to be morphing into a pointless discussion about the definition of "superset", my bad...)
Interesting. I'm going to have to test out a few YAML parsers and do some investigations to see if that means what it seems it should mean based on a plain reading. In practice, YAML files typically do not use curly or square brackets. Anyway, you're right. This is kind of silly. The changelog parser seems simplistic, and I suspect that it does not support the full YAML syntax, and only a restrictive subset.

Re: Changelog tutorial

Posted: Fri Mar 29, 2019 6:14 am
by badtouchatr
I've found another picky requirement of the changelog parser: The header line of dashes (and subsequent dashed lines between versions) must have exactly 99 dashes. I've tried it with 80, 98, 99, and 100. The only one that works is 99.

Re: Changelog tutorial

Posted: Fri Mar 29, 2019 6:50 am
by Pi-C
badtouchatr wrote:
Fri Mar 29, 2019 6:14 am
I've found another picky requirement of the changelog parser:
Thanks! I've included that information.

Re: Changelog tutorial

Posted: Sat Apr 06, 2019 4:06 pm
by Pi-C
Update: Empty lines must be really empty -- spaces or even tabs will cause a parsing error!