diff --git a/.scripts/make_docs.py b/.scripts/make_docs.py index 839acebd7..7b054d9cd 100644 --- a/.scripts/make_docs.py +++ b/.scripts/make_docs.py @@ -145,8 +145,18 @@ def make_doc_item(sess, lines: List[str], file: str, span: Tuple[int, int], """ item = {} # first line: meta info - for pair in lines[0].split(';'): - k, v = pair.strip().split(':') + first_line = lines[0].strip() + if first_line.endswith(';'): + first_line = first_line[:-1] + for pair in first_line.split(';'): + if pair == "": + sess.err(f"{file}:{span[0]+1}: too many semicolons in {HL_DOCS_KEYWORD} line") + continue + kvs = pair.strip().split(':') + if len(kvs) != 2: + sess.err(f"{file}:{span[0]+1}: not a key-value pair in {HL_DOCS_KEYWORD} line (expected key:value, got {pair})") + continue + k, v = kvs if k in item: sess.err(f"{file}:{span[0]+1}: duplicate key `{k}`") if k == "feature" or k == "ref": diff --git a/test/docs/test_output/docs/misc/ILikeSemicolons.md b/test/docs/test_output/docs/misc/ILikeSemicolons.md new file mode 100644 index 000000000..ea1d6d825 --- /dev/null +++ b/test/docs/test_output/docs/misc/ILikeSemicolons.md @@ -0,0 +1,11 @@ +Title: ILikeSemicolons + +# ILikeSemicolons + +Tracking Issue: [#53](https://github.com/X2CommunityCore/X2WOTCCommunityHighlander/issues/53) + +Deny this for aesthetic reasons + +## Source code references + +* [UnrealScriptFile2.uc:104-105](https://github.com/X2CommunityCore/X2WOTCCommunityHighlander/blob/master/test_src/UnrealScriptFile2.uc#L104-L105) diff --git a/test/docs/test_output/docs/misc/TrailingSemi.md b/test/docs/test_output/docs/misc/TrailingSemi.md new file mode 100644 index 000000000..eccc90858 --- /dev/null +++ b/test/docs/test_output/docs/misc/TrailingSemi.md @@ -0,0 +1,11 @@ +Title: TrailingSemi + +# TrailingSemi + +Tracking Issue: [#99999](https://github.com/X2CommunityCore/X2WOTCCommunityHighlander/issues/99999) + +Trailing semicolons are allowed + +## Source code references + +* [UnrealScriptFile2.uc:98-99](https://github.com/X2CommunityCore/X2WOTCCommunityHighlander/blob/master/test_src/UnrealScriptFile2.uc#L98-L99) diff --git a/test/docs/test_output/stdout.log b/test/docs/test_output/stdout.log index 6b6fca5a7..92b8821d7 100644 --- a/test/docs/test_output/stdout.log +++ b/test/docs/test_output/stdout.log @@ -16,9 +16,19 @@ error: ./test_src/UnrealScriptFile2.uc:73: event block has error: expected _Toke error: ./test_src/UnrealScriptFile2.uc:79: event block has error: expected _TokenType.KW (inoutness) while parsing tuple param, found _TokenType.IDENT (bool) error: ./test_src/UnrealScriptFile2.uc:85: event block has error: expected _TokenType.IDENT (local name) while parsing EventData, found _TokenType.LBRACE error: ./test_src/UnrealScriptFile2.uc:91: event block has error: expected _TokenType.COMMA (,) while parsing event specification after parsing EventData, found _TokenType.LBRACK -error: ./test_src/UnrealScriptFile2.uc:104: bad indentation for HL-Include: -error: ./test_src/UnrealScriptFile2.uc:107: bad indentation for HL-Include: -error: ./test_src/UnrealScriptFile2.uc:100: unclosed HL-Include: +error: ./test_src/UnrealScriptFile2.uc:98: missing key `issue` +error: ./test_src/UnrealScriptFile2.uc:98: missing key `tags` +note: use `tags:` to specify an empty tag list +error: ./test_src/UnrealScriptFile2.uc:101: not a key-value pair in HL-Docs: line (expected key:value, got feature) +error: ./test_src/UnrealScriptFile2.uc:101: not a key-value pair in HL-Docs: line (expected key:value, got NotAKVP) +error: ./test_src/UnrealScriptFile2.uc:101: missing key `feature` or `ref` +error: ./test_src/UnrealScriptFile2.uc:104: too many semicolons in HL-Docs: line +error: ./test_src/UnrealScriptFile2.uc:104: too many semicolons in HL-Docs: line +error: ./test_src/UnrealScriptFile2.uc:104: missing key `tags` +note: use `tags:` to specify an empty tag list +error: ./test_src/UnrealScriptFile2.uc:113: bad indentation for HL-Include: +error: ./test_src/UnrealScriptFile2.uc:116: bad indentation for HL-Include: +error: ./test_src/UnrealScriptFile2.uc:109: unclosed HL-Include: error: duplicate feature definition `Bugfixes` note: first definition due to builtin feature note: this definition at ./test_src/UnrealScriptFile2.uc:35 @@ -34,8 +44,10 @@ ok: ./test_output/docs/misc/DupeFeature.md ok: ./test_output/docs/misc/FeatWithBadTag.md ok: ./test_output/docs/misc/FeatWithoutRest.md ok: ./test_output/docs/strategy/FeatureFile1.md +ok: ./test_output/docs/misc/ILikeSemicolons.md ok: ./test_output/docs/tactical/IncorrectIndentation.md ok: ./test_output/docs/misc/TestEvent.md +ok: ./test_output/docs/misc/TrailingSemi.md ok: ./test_output/docs/events.md error: file ./test_output/docs/noncooltag.md not found (`noncooltag` is an unknown tag) note: referred to by `FeatWithBadTag` diff --git a/test/docs/test_src/UnrealScriptFile2.uc b/test/docs/test_src/UnrealScriptFile2.uc index ed262ee77..9afc2cf92 100644 --- a/test/docs/test_src/UnrealScriptFile2.uc +++ b/test/docs/test_src/UnrealScriptFile2.uc @@ -95,6 +95,15 @@ class UnrealScriptFile2 extends Object; /// NewGameState: none, /// ``` +/// HL-Docs: feature:TrailingSemi; +/// Trailing semicolons are allowed + +/// HL-Docs: feature;NotAKVP; issue:777 +/// Semicolon instead of colon... + +/// HL-Docs: feature:ILikeSemicolons;;; issue:53 +/// Deny this for aesthetic reasons + function Abc() { /// HL-Docs: feature:IffyInclude; issue:9; tags: