diff --git a/parser/asciidoc-grammar.peg b/parser/asciidoc-grammar.peg index 4df5563b..0b094f21 100644 --- a/parser/asciidoc-grammar.peg +++ b/parser/asciidoc-grammar.peg @@ -201,10 +201,12 @@ Section5Title <- attributes:(ElementAttribute)* level:("======") WS+ content:(In // ------------------------------------------ List <- attributes:(ListAttribute)* // list items can be followed by an optional, single blank line - elements:(UnorderedListItem / LabeledListItem)+ { + elements:ListItems { return types.NewList(elements.([]interface{}), attributes.([]interface{})) } +ListItems <- (OrderedListItem / UnorderedListItem / LabeledListItem)+ + ListAttribute <- attribute:(HorizontalLayout / ListID) NEWLINE { return attribute, nil } @@ -217,11 +219,17 @@ HorizontalLayout <- "[horizontal]" { return map[string]interface{}{"layout": "horizontal"}, nil } -ListParagraph <- lines:(!(ListItemContinuation) !(UnorderedListItemPrefix) !(LabeledListItemTerm LabeledListItemSeparator) InlineContentWithTrailingSpaces EOL)+ { +ListParagraph <- lines:( + !(OrderedListItemPrefix) + !(UnorderedListItemPrefix) + !(LabeledListItemTerm LabeledListItemSeparator) + !(ListItemContinuation) + !(ElementAttribute) + InlineContentWithTrailingSpaces EOL)+ { return types.NewListParagraph(lines.([]interface{})) } -ListItemContinuation <- "+" WS* NEWLINE { +ListItemContinuation <- "+" WS* EOL { return types.NewListItemContinuation() } @@ -230,26 +238,91 @@ ContinuedBlockElement <- ListItemContinuation element:BlockElement { } // ------------------------------------------ -// Unordered Lists +// Ordered List Items +// ------------------------------------------ +OrderedListItem <- attributes:(ElementAttribute)* prefix:(OrderedListItemPrefix) content:(OrderedListItemContent) BlankLine? { + return types.NewOrderedListItem(prefix.(types.OrderedListItemPrefix), content.([]types.DocElement), attributes.([]interface{})) +} + +OrderedListItemPrefix <- +// implicit numbering: '.' to '.....' +WS* style:(".") WS+ { // numbering style: "." + return types.NewOrderedListItemPrefix(types.Arabic, 1) +} / WS* style:("..") WS+ { // numbering style: ".." + return types.NewOrderedListItemPrefix(types.LowerAlpha, 2) +} / WS* style:("...") WS+ { // numbering style: "..." + return types.NewOrderedListItemPrefix(types.LowerRoman, 3) +} / WS* style:("....") WS+ { // numbering style: "...." + return types.NewOrderedListItemPrefix(types.UpperAlpha, 4) +} / WS* style:(".....") WS+ { // numbering style: "....." + return types.NewOrderedListItemPrefix(types.UpperRoman, 5) +// explicit numbering +} / WS* style:((!"." !WS !NEWLINE [0-9])+ ".") WS+ { // numbering style: "1." + return types.NewOrderedListItemPrefix(types.Arabic, 1) +} / WS* style:((!"." !WS !NEWLINE [a-z])+ ".") WS+ { // numbering style: "a." + return types.NewOrderedListItemPrefix(types.LowerAlpha, 1) +} / WS* style:((!"." !WS !NEWLINE [A-Z])+ ".") WS+ { // numbering style: "A." + return types.NewOrderedListItemPrefix(types.UpperAlpha, 1) +} / WS* style:((!")" !WS !NEWLINE [a-z])+ ")") WS+ { // numbering style: "i)" + return types.NewOrderedListItemPrefix(types.LowerRoman, 1) +} / WS* style:((!")" !WS !NEWLINE [A-Z])+ ")") WS+ { // numbering style: "I)" + return types.NewOrderedListItemPrefix(types.UpperRoman, 1) +} + +// OrderedListItemPrefix <- WS* prefix:(((!"." !WS .)+ ".") / ((!")" !WS .)+ ")") / ("."+)) WS+ { // ignore whitespaces, only return the relevant numbering characters +// return prefix, nil +// } + +// OrderedListItemPrefix <- OrderedListItemDefaultPrefix / OrderedListItemAlphaPrefix / OrderedListItemRomanPrefix +// // OrderedListItemPrefix <- OrderedListItemAlphaPrefix + +// OrderedListItemDefaultPrefix <- WS* prefix:("."+) WS+ { +// return prefix, nil +// } + +// OrderedListItemAlphaPrefix <- WS* prefix:((!"." !WS !NEWLINE .)+ ".") WS+ { +// return prefix, nil +// } + +// OrderedListItemRomanPrefix <- WS* prefix:((!")" !WS !NEWLINE .)+ ")") WS+ { +// return prefix, nil +// } + +OrderedListItemContent <- elements:(ListParagraph+ ContinuedBlockElement*) { // Another list or a literal paragraph immediately following a list item will be implicitly included in the list item + return types.NewListItemContent(elements.([]interface{})) +} + +// ------------------------------------------ +// Unordered List Items // ------------------------------------------ -UnorderedListItem <- level:(UnorderedListItemPrefix) content:(UnorderedListItemContent) BlankLine? { - return types.NewUnorderedListItem(level, content.([]types.DocElement)) +UnorderedListItem <- prefix:(UnorderedListItemPrefix) content:(UnorderedListItemContent) BlankLine? { + return types.NewUnorderedListItem(prefix.(types.UnorderedListItemPrefix), content.([]types.DocElement)) } -UnorderedListItemPrefix <- WS* level:("*"+ / "-") WS+ { // ignore whitespaces, only return the relevant "*"/"-" characters - return level, nil -} +UnorderedListItemPrefix <- WS* level:("*****") WS+ { // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.FiveAsterisks, 5) +} / WS* level:("****") WS+ { // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.FourAsterisks, 4) +} / WS* level:("***") WS+ { // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.ThreeAsterisks, 3) +} / WS* level:("**") WS+ { // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.TwoAsterisks, 2) +} / WS* level:("*") WS+ { // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.OneAsterisk, 1) +} / WS* level:("-") WS+ { // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.Dash, 1) +} UnorderedListItemContent <- elements:(ListParagraph+ ContinuedBlockElement*) { // Another list or a literal paragraph immediately following a list item will be implicitly included in the list item return types.NewListItemContent(elements.([]interface{})) } // ------------------------------------------ -// Labeled Lists +// Labeled List Items // ------------------------------------------ LabeledListItem <- term:(LabeledListItemTerm) LabeledListItemSeparator description:(LabeledListItemDescription) { return types.NewLabeledListItem(term.([]interface{}), description.([]types.DocElement)) -} / term:(LabeledListItemTerm) "::" WS* EOL { // here, WS is optional since there is no description afterwards +} / term:(LabeledListItemTerm) "::" WS* EOL { // here, WS is optional since there is no description afterwards return types.NewLabeledListItem(term.([]interface{}), nil) } @@ -260,7 +333,7 @@ LabeledListItemTerm <- term:(!NEWLINE !"::" .)* { // term separator: ('::') and at least one space or endline LabeledListItemSeparator <- "::" (WS / NEWLINE)+ -LabeledListItemDescription <- elements:(ListParagraph / ContinuedBlockElement)* { +LabeledListItemDescription <- elements:(ListParagraph / ContinuedBlockElement)* { // TODO: replace with (ListParagraph+ ContinuedBlockElement*) and use a single rule for all item contents ? return types.NewListItemContent(elements.([]interface{})) } @@ -283,7 +356,7 @@ InlineContent <- !BlockDelimiter elements:(WS* !InlineElementID InlineElement)+ return types.NewInlineContent(elements.([]interface{})) } -InlineElement <- (CrossReference / Passthrough / InlineImage / QuotedText / Link / DocumentAttributeSubstitution / Characters) +InlineElement <- CrossReference / Passthrough / InlineImage / QuotedText / Link / DocumentAttributeSubstitution / Characters // ------------------------------------------ // Admonitions @@ -512,16 +585,18 @@ ParagraphWithLiteralAttribute <- "[literal]" WS* NEWLINE content:(LiteralBlockCo // ------------------------------------------ // Element Attributes // ------------------------------------------ -ElementAttribute <- ElementLink / ElementID / ElementTitle / InvalidElementAttribute +ElementAttribute <- attr:(ElementLink / ElementID / ElementTitle / AttributeGroup / InvalidElementAttribute) EOL { + return attr, nil // avoid returning something like `[]interface{}{attr, EOL}` +} // a link attached to an element, such as a BlockImage -ElementLink <- "[link=" WS* path:URL WS* "]" EOL { +ElementLink <- "[link=" WS* path:URL WS* "]" { return types.NewElementLink(path.(string)) } -ElementID <- id:(InlineElementID) EOL { +ElementID <- id:(InlineElementID) { return id, nil -} / "[#" id:(ID) "]" EOL { +} / "[#" id:(ID) "]" { return types.NewElementID(id.(string)) } @@ -531,10 +606,31 @@ InlineElementID <- "[[" id:(ID) "]]" { // a title attached to an element, such as a BlockImage ( // a title starts with a single "." followed by the value, without space in-between -ElementTitle <- "." !"." !WS title:(!NEWLINE .)+ EOL { +ElementTitle <- "." !"." !WS title:(!NEWLINE .)+ { return types.NewElementTitle(title.([]interface{})) } +// one or more attributes. eg: [foo, key1=value1, key2=value2] +AttributeGroup <- "[" attributes:(GenericAttribute)* "]" { + return types.NewAttributeGroup(attributes.([]interface{})) +} + +GenericAttribute <- key:(AttributeKey) "=" value:(AttributeValue) ("," WS*)? { // value is set + return types.NewGenericAttribute(key.([]interface{}), value.([]interface{})) +} / key:(AttributeKey) ("," WS*)? { // value is not set + return types.NewGenericAttribute(key.([]interface{}), nil) +} + +AttributeKey <- key: (!WS !"=" !"," !"]" .)+ WS* { + // fmt.Printf("found attribute key: %v\n", key) + return key, nil +} + +AttributeValue <- WS* value:(!WS !"=" !"]" .)* WS* { + // fmt.Printf("found attribute value: %v\n", value) + return value, nil +} + InvalidElementAttribute <- "[" WS+ content:(!"]" .)* "]" { return types.NewInvalidElementAttribute(c.text) } diff --git a/parser/asciidoc_parser.go b/parser/asciidoc_parser.go index a326b5f1..69a37953 100644 --- a/parser/asciidoc_parser.go +++ b/parser/asciidoc_parser.go @@ -2229,55 +2229,67 @@ var g = &grammar{ &labeledExpr{ pos: position{line: 204, col: 5, offset: 8530}, label: "elements", - expr: &oneOrMoreExpr{ - pos: position{line: 204, col: 14, offset: 8539}, - expr: &choiceExpr{ - pos: position{line: 204, col: 15, offset: 8540}, - alternatives: []interface{}{ - &ruleRefExpr{ - pos: position{line: 204, col: 15, offset: 8540}, - name: "UnorderedListItem", - }, - &ruleRefExpr{ - pos: position{line: 204, col: 35, offset: 8560}, - name: "LabeledListItem", - }, - }, - }, + expr: &ruleRefExpr{ + pos: position{line: 204, col: 14, offset: 8539}, + name: "ListItems", }, }, }, }, }, }, + { + name: "ListItems", + pos: position{line: 208, col: 1, offset: 8633}, + expr: &oneOrMoreExpr{ + pos: position{line: 208, col: 14, offset: 8646}, + expr: &choiceExpr{ + pos: position{line: 208, col: 15, offset: 8647}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 208, col: 15, offset: 8647}, + name: "OrderedListItem", + }, + &ruleRefExpr{ + pos: position{line: 208, col: 33, offset: 8665}, + name: "UnorderedListItem", + }, + &ruleRefExpr{ + pos: position{line: 208, col: 53, offset: 8685}, + name: "LabeledListItem", + }, + }, + }, + }, + }, { name: "ListAttribute", - pos: position{line: 208, col: 1, offset: 8662}, + pos: position{line: 210, col: 1, offset: 8704}, expr: &actionExpr{ - pos: position{line: 208, col: 18, offset: 8679}, + pos: position{line: 210, col: 18, offset: 8721}, run: (*parser).callonListAttribute1, expr: &seqExpr{ - pos: position{line: 208, col: 18, offset: 8679}, + pos: position{line: 210, col: 18, offset: 8721}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 208, col: 18, offset: 8679}, + pos: position{line: 210, col: 18, offset: 8721}, label: "attribute", expr: &choiceExpr{ - pos: position{line: 208, col: 29, offset: 8690}, + pos: position{line: 210, col: 29, offset: 8732}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 208, col: 29, offset: 8690}, + pos: position{line: 210, col: 29, offset: 8732}, name: "HorizontalLayout", }, &ruleRefExpr{ - pos: position{line: 208, col: 48, offset: 8709}, + pos: position{line: 210, col: 48, offset: 8751}, name: "ListID", }, }, }, }, &ruleRefExpr{ - pos: position{line: 208, col: 56, offset: 8717}, + pos: position{line: 210, col: 56, offset: 8759}, name: "NEWLINE", }, }, @@ -2286,28 +2298,28 @@ var g = &grammar{ }, { name: "ListID", - pos: position{line: 212, col: 1, offset: 8756}, + pos: position{line: 214, col: 1, offset: 8798}, expr: &actionExpr{ - pos: position{line: 212, col: 11, offset: 8766}, + pos: position{line: 214, col: 11, offset: 8808}, run: (*parser).callonListID1, expr: &seqExpr{ - pos: position{line: 212, col: 11, offset: 8766}, + pos: position{line: 214, col: 11, offset: 8808}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 212, col: 11, offset: 8766}, + pos: position{line: 214, col: 11, offset: 8808}, val: "[#", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 212, col: 16, offset: 8771}, + pos: position{line: 214, col: 16, offset: 8813}, label: "id", expr: &ruleRefExpr{ - pos: position{line: 212, col: 20, offset: 8775}, + pos: position{line: 214, col: 20, offset: 8817}, name: "ID", }, }, &litMatcher{ - pos: position{line: 212, col: 24, offset: 8779}, + pos: position{line: 214, col: 24, offset: 8821}, val: "]", ignoreCase: false, }, @@ -2317,12 +2329,12 @@ var g = &grammar{ }, { name: "HorizontalLayout", - pos: position{line: 216, col: 1, offset: 8845}, + pos: position{line: 218, col: 1, offset: 8887}, expr: &actionExpr{ - pos: position{line: 216, col: 21, offset: 8865}, + pos: position{line: 218, col: 21, offset: 8907}, run: (*parser).callonHorizontalLayout1, expr: &litMatcher{ - pos: position{line: 216, col: 21, offset: 8865}, + pos: position{line: 218, col: 21, offset: 8907}, val: "[horizontal]", ignoreCase: false, }, @@ -2330,54 +2342,68 @@ var g = &grammar{ }, { name: "ListParagraph", - pos: position{line: 220, col: 1, offset: 8948}, + pos: position{line: 222, col: 1, offset: 8990}, expr: &actionExpr{ - pos: position{line: 220, col: 19, offset: 8966}, + pos: position{line: 222, col: 19, offset: 9008}, run: (*parser).callonListParagraph1, expr: &labeledExpr{ - pos: position{line: 220, col: 19, offset: 8966}, + pos: position{line: 222, col: 19, offset: 9008}, label: "lines", expr: &oneOrMoreExpr{ - pos: position{line: 220, col: 25, offset: 8972}, + pos: position{line: 222, col: 25, offset: 9014}, expr: &seqExpr{ - pos: position{line: 220, col: 26, offset: 8973}, + pos: position{line: 223, col: 5, offset: 9020}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 220, col: 26, offset: 8973}, + pos: position{line: 223, col: 5, offset: 9020}, expr: &ruleRefExpr{ - pos: position{line: 220, col: 28, offset: 8975}, - name: "ListItemContinuation", + pos: position{line: 223, col: 7, offset: 9022}, + name: "OrderedListItemPrefix", }, }, ¬Expr{ - pos: position{line: 220, col: 50, offset: 8997}, + pos: position{line: 224, col: 5, offset: 9050}, expr: &ruleRefExpr{ - pos: position{line: 220, col: 52, offset: 8999}, + pos: position{line: 224, col: 7, offset: 9052}, name: "UnorderedListItemPrefix", }, }, ¬Expr{ - pos: position{line: 220, col: 77, offset: 9024}, + pos: position{line: 225, col: 5, offset: 9082}, expr: &seqExpr{ - pos: position{line: 220, col: 79, offset: 9026}, + pos: position{line: 225, col: 7, offset: 9084}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 220, col: 79, offset: 9026}, + pos: position{line: 225, col: 7, offset: 9084}, name: "LabeledListItemTerm", }, &ruleRefExpr{ - pos: position{line: 220, col: 99, offset: 9046}, + pos: position{line: 225, col: 27, offset: 9104}, name: "LabeledListItemSeparator", }, }, }, }, + ¬Expr{ + pos: position{line: 226, col: 5, offset: 9135}, + expr: &ruleRefExpr{ + pos: position{line: 226, col: 7, offset: 9137}, + name: "ListItemContinuation", + }, + }, + ¬Expr{ + pos: position{line: 227, col: 5, offset: 9164}, + expr: &ruleRefExpr{ + pos: position{line: 227, col: 7, offset: 9166}, + name: "ElementAttribute", + }, + }, &ruleRefExpr{ - pos: position{line: 220, col: 125, offset: 9072}, + pos: position{line: 228, col: 5, offset: 9188}, name: "InlineContentWithTrailingSpaces", }, &ruleRefExpr{ - pos: position{line: 220, col: 157, offset: 9104}, + pos: position{line: 228, col: 37, offset: 9220}, name: "EOL", }, }, @@ -2388,28 +2414,28 @@ var g = &grammar{ }, { name: "ListItemContinuation", - pos: position{line: 224, col: 1, offset: 9173}, + pos: position{line: 232, col: 1, offset: 9289}, expr: &actionExpr{ - pos: position{line: 224, col: 25, offset: 9197}, + pos: position{line: 232, col: 25, offset: 9313}, run: (*parser).callonListItemContinuation1, expr: &seqExpr{ - pos: position{line: 224, col: 25, offset: 9197}, + pos: position{line: 232, col: 25, offset: 9313}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 224, col: 25, offset: 9197}, + pos: position{line: 232, col: 25, offset: 9313}, val: "+", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 224, col: 29, offset: 9201}, + pos: position{line: 232, col: 29, offset: 9317}, expr: &ruleRefExpr{ - pos: position{line: 224, col: 29, offset: 9201}, + pos: position{line: 232, col: 29, offset: 9317}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 224, col: 33, offset: 9205}, - name: "NEWLINE", + pos: position{line: 232, col: 33, offset: 9321}, + name: "EOL", }, }, }, @@ -2417,22 +2443,22 @@ var g = &grammar{ }, { name: "ContinuedBlockElement", - pos: position{line: 228, col: 1, offset: 9261}, + pos: position{line: 236, col: 1, offset: 9373}, expr: &actionExpr{ - pos: position{line: 228, col: 26, offset: 9286}, + pos: position{line: 236, col: 26, offset: 9398}, run: (*parser).callonContinuedBlockElement1, expr: &seqExpr{ - pos: position{line: 228, col: 26, offset: 9286}, + pos: position{line: 236, col: 26, offset: 9398}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 228, col: 26, offset: 9286}, + pos: position{line: 236, col: 26, offset: 9398}, name: "ListItemContinuation", }, &labeledExpr{ - pos: position{line: 228, col: 47, offset: 9307}, + pos: position{line: 236, col: 47, offset: 9419}, label: "element", expr: &ruleRefExpr{ - pos: position{line: 228, col: 55, offset: 9315}, + pos: position{line: 236, col: 55, offset: 9427}, name: "BlockElement", }, }, @@ -2440,85 +2466,854 @@ var g = &grammar{ }, }, }, + { + name: "OrderedListItem", + pos: position{line: 243, col: 1, offset: 9583}, + expr: &actionExpr{ + pos: position{line: 243, col: 20, offset: 9602}, + run: (*parser).callonOrderedListItem1, + expr: &seqExpr{ + pos: position{line: 243, col: 20, offset: 9602}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 243, col: 20, offset: 9602}, + label: "attributes", + expr: &zeroOrMoreExpr{ + pos: position{line: 243, col: 31, offset: 9613}, + expr: &ruleRefExpr{ + pos: position{line: 243, col: 32, offset: 9614}, + name: "ElementAttribute", + }, + }, + }, + &labeledExpr{ + pos: position{line: 243, col: 51, offset: 9633}, + label: "prefix", + expr: &ruleRefExpr{ + pos: position{line: 243, col: 59, offset: 9641}, + name: "OrderedListItemPrefix", + }, + }, + &labeledExpr{ + pos: position{line: 243, col: 82, offset: 9664}, + label: "content", + expr: &ruleRefExpr{ + pos: position{line: 243, col: 91, offset: 9673}, + name: "OrderedListItemContent", + }, + }, + &zeroOrOneExpr{ + pos: position{line: 243, col: 115, offset: 9697}, + expr: &ruleRefExpr{ + pos: position{line: 243, col: 115, offset: 9697}, + name: "BlankLine", + }, + }, + }, + }, + }, + }, + { + name: "OrderedListItemPrefix", + pos: position{line: 247, col: 1, offset: 9845}, + expr: &choiceExpr{ + pos: position{line: 249, col: 1, offset: 9909}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 249, col: 1, offset: 9909}, + run: (*parser).callonOrderedListItemPrefix2, + expr: &seqExpr{ + pos: position{line: 249, col: 1, offset: 9909}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 249, col: 1, offset: 9909}, + expr: &ruleRefExpr{ + pos: position{line: 249, col: 1, offset: 9909}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 249, col: 5, offset: 9913}, + label: "style", + expr: &litMatcher{ + pos: position{line: 249, col: 12, offset: 9920}, + val: ".", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 249, col: 17, offset: 9925}, + expr: &ruleRefExpr{ + pos: position{line: 249, col: 17, offset: 9925}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 251, col: 5, offset: 10018}, + run: (*parser).callonOrderedListItemPrefix10, + expr: &seqExpr{ + pos: position{line: 251, col: 5, offset: 10018}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 251, col: 5, offset: 10018}, + expr: &ruleRefExpr{ + pos: position{line: 251, col: 5, offset: 10018}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 251, col: 9, offset: 10022}, + label: "style", + expr: &litMatcher{ + pos: position{line: 251, col: 16, offset: 10029}, + val: "..", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 251, col: 22, offset: 10035}, + expr: &ruleRefExpr{ + pos: position{line: 251, col: 22, offset: 10035}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 253, col: 5, offset: 10133}, + run: (*parser).callonOrderedListItemPrefix18, + expr: &seqExpr{ + pos: position{line: 253, col: 5, offset: 10133}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 253, col: 5, offset: 10133}, + expr: &ruleRefExpr{ + pos: position{line: 253, col: 5, offset: 10133}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 253, col: 9, offset: 10137}, + label: "style", + expr: &litMatcher{ + pos: position{line: 253, col: 16, offset: 10144}, + val: "...", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 253, col: 23, offset: 10151}, + expr: &ruleRefExpr{ + pos: position{line: 253, col: 23, offset: 10151}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 255, col: 5, offset: 10250}, + run: (*parser).callonOrderedListItemPrefix26, + expr: &seqExpr{ + pos: position{line: 255, col: 5, offset: 10250}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 255, col: 5, offset: 10250}, + expr: &ruleRefExpr{ + pos: position{line: 255, col: 5, offset: 10250}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 255, col: 9, offset: 10254}, + label: "style", + expr: &litMatcher{ + pos: position{line: 255, col: 16, offset: 10261}, + val: "....", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 255, col: 24, offset: 10269}, + expr: &ruleRefExpr{ + pos: position{line: 255, col: 24, offset: 10269}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 257, col: 5, offset: 10369}, + run: (*parser).callonOrderedListItemPrefix34, + expr: &seqExpr{ + pos: position{line: 257, col: 5, offset: 10369}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 257, col: 5, offset: 10369}, + expr: &ruleRefExpr{ + pos: position{line: 257, col: 5, offset: 10369}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 257, col: 9, offset: 10373}, + label: "style", + expr: &litMatcher{ + pos: position{line: 257, col: 16, offset: 10380}, + val: ".....", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 257, col: 25, offset: 10389}, + expr: &ruleRefExpr{ + pos: position{line: 257, col: 25, offset: 10389}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 260, col: 5, offset: 10512}, + run: (*parser).callonOrderedListItemPrefix42, + expr: &seqExpr{ + pos: position{line: 260, col: 5, offset: 10512}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 260, col: 5, offset: 10512}, + expr: &ruleRefExpr{ + pos: position{line: 260, col: 5, offset: 10512}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 260, col: 9, offset: 10516}, + label: "style", + expr: &seqExpr{ + pos: position{line: 260, col: 16, offset: 10523}, + exprs: []interface{}{ + &oneOrMoreExpr{ + pos: position{line: 260, col: 16, offset: 10523}, + expr: &seqExpr{ + pos: position{line: 260, col: 17, offset: 10524}, + exprs: []interface{}{ + ¬Expr{ + pos: position{line: 260, col: 17, offset: 10524}, + expr: &litMatcher{ + pos: position{line: 260, col: 18, offset: 10525}, + val: ".", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 260, col: 22, offset: 10529}, + expr: &ruleRefExpr{ + pos: position{line: 260, col: 23, offset: 10530}, + name: "WS", + }, + }, + ¬Expr{ + pos: position{line: 260, col: 26, offset: 10533}, + expr: &ruleRefExpr{ + pos: position{line: 260, col: 27, offset: 10534}, + name: "NEWLINE", + }, + }, + &charClassMatcher{ + pos: position{line: 260, col: 35, offset: 10542}, + val: "[0-9]", + ranges: []rune{'0', '9'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 260, col: 43, offset: 10550}, + val: ".", + ignoreCase: false, + }, + }, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 260, col: 48, offset: 10555}, + expr: &ruleRefExpr{ + pos: position{line: 260, col: 48, offset: 10555}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 262, col: 5, offset: 10650}, + run: (*parser).callonOrderedListItemPrefix60, + expr: &seqExpr{ + pos: position{line: 262, col: 5, offset: 10650}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 262, col: 5, offset: 10650}, + expr: &ruleRefExpr{ + pos: position{line: 262, col: 5, offset: 10650}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 262, col: 9, offset: 10654}, + label: "style", + expr: &seqExpr{ + pos: position{line: 262, col: 16, offset: 10661}, + exprs: []interface{}{ + &oneOrMoreExpr{ + pos: position{line: 262, col: 16, offset: 10661}, + expr: &seqExpr{ + pos: position{line: 262, col: 17, offset: 10662}, + exprs: []interface{}{ + ¬Expr{ + pos: position{line: 262, col: 17, offset: 10662}, + expr: &litMatcher{ + pos: position{line: 262, col: 18, offset: 10663}, + val: ".", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 262, col: 22, offset: 10667}, + expr: &ruleRefExpr{ + pos: position{line: 262, col: 23, offset: 10668}, + name: "WS", + }, + }, + ¬Expr{ + pos: position{line: 262, col: 26, offset: 10671}, + expr: &ruleRefExpr{ + pos: position{line: 262, col: 27, offset: 10672}, + name: "NEWLINE", + }, + }, + &charClassMatcher{ + pos: position{line: 262, col: 35, offset: 10680}, + val: "[a-z]", + ranges: []rune{'a', 'z'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 262, col: 43, offset: 10688}, + val: ".", + ignoreCase: false, + }, + }, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 262, col: 48, offset: 10693}, + expr: &ruleRefExpr{ + pos: position{line: 262, col: 48, offset: 10693}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 264, col: 5, offset: 10791}, + run: (*parser).callonOrderedListItemPrefix78, + expr: &seqExpr{ + pos: position{line: 264, col: 5, offset: 10791}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 264, col: 5, offset: 10791}, + expr: &ruleRefExpr{ + pos: position{line: 264, col: 5, offset: 10791}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 264, col: 9, offset: 10795}, + label: "style", + expr: &seqExpr{ + pos: position{line: 264, col: 16, offset: 10802}, + exprs: []interface{}{ + &oneOrMoreExpr{ + pos: position{line: 264, col: 16, offset: 10802}, + expr: &seqExpr{ + pos: position{line: 264, col: 17, offset: 10803}, + exprs: []interface{}{ + ¬Expr{ + pos: position{line: 264, col: 17, offset: 10803}, + expr: &litMatcher{ + pos: position{line: 264, col: 18, offset: 10804}, + val: ".", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 264, col: 22, offset: 10808}, + expr: &ruleRefExpr{ + pos: position{line: 264, col: 23, offset: 10809}, + name: "WS", + }, + }, + ¬Expr{ + pos: position{line: 264, col: 26, offset: 10812}, + expr: &ruleRefExpr{ + pos: position{line: 264, col: 27, offset: 10813}, + name: "NEWLINE", + }, + }, + &charClassMatcher{ + pos: position{line: 264, col: 35, offset: 10821}, + val: "[A-Z]", + ranges: []rune{'A', 'Z'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 264, col: 43, offset: 10829}, + val: ".", + ignoreCase: false, + }, + }, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 264, col: 48, offset: 10834}, + expr: &ruleRefExpr{ + pos: position{line: 264, col: 48, offset: 10834}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 266, col: 5, offset: 10932}, + run: (*parser).callonOrderedListItemPrefix96, + expr: &seqExpr{ + pos: position{line: 266, col: 5, offset: 10932}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 266, col: 5, offset: 10932}, + expr: &ruleRefExpr{ + pos: position{line: 266, col: 5, offset: 10932}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 266, col: 9, offset: 10936}, + label: "style", + expr: &seqExpr{ + pos: position{line: 266, col: 16, offset: 10943}, + exprs: []interface{}{ + &oneOrMoreExpr{ + pos: position{line: 266, col: 16, offset: 10943}, + expr: &seqExpr{ + pos: position{line: 266, col: 17, offset: 10944}, + exprs: []interface{}{ + ¬Expr{ + pos: position{line: 266, col: 17, offset: 10944}, + expr: &litMatcher{ + pos: position{line: 266, col: 18, offset: 10945}, + val: ")", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 266, col: 22, offset: 10949}, + expr: &ruleRefExpr{ + pos: position{line: 266, col: 23, offset: 10950}, + name: "WS", + }, + }, + ¬Expr{ + pos: position{line: 266, col: 26, offset: 10953}, + expr: &ruleRefExpr{ + pos: position{line: 266, col: 27, offset: 10954}, + name: "NEWLINE", + }, + }, + &charClassMatcher{ + pos: position{line: 266, col: 35, offset: 10962}, + val: "[a-z]", + ranges: []rune{'a', 'z'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 266, col: 43, offset: 10970}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 266, col: 48, offset: 10975}, + expr: &ruleRefExpr{ + pos: position{line: 266, col: 48, offset: 10975}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 268, col: 5, offset: 11073}, + run: (*parser).callonOrderedListItemPrefix114, + expr: &seqExpr{ + pos: position{line: 268, col: 5, offset: 11073}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 268, col: 5, offset: 11073}, + expr: &ruleRefExpr{ + pos: position{line: 268, col: 5, offset: 11073}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 268, col: 9, offset: 11077}, + label: "style", + expr: &seqExpr{ + pos: position{line: 268, col: 16, offset: 11084}, + exprs: []interface{}{ + &oneOrMoreExpr{ + pos: position{line: 268, col: 16, offset: 11084}, + expr: &seqExpr{ + pos: position{line: 268, col: 17, offset: 11085}, + exprs: []interface{}{ + ¬Expr{ + pos: position{line: 268, col: 17, offset: 11085}, + expr: &litMatcher{ + pos: position{line: 268, col: 18, offset: 11086}, + val: ")", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 268, col: 22, offset: 11090}, + expr: &ruleRefExpr{ + pos: position{line: 268, col: 23, offset: 11091}, + name: "WS", + }, + }, + ¬Expr{ + pos: position{line: 268, col: 26, offset: 11094}, + expr: &ruleRefExpr{ + pos: position{line: 268, col: 27, offset: 11095}, + name: "NEWLINE", + }, + }, + &charClassMatcher{ + pos: position{line: 268, col: 35, offset: 11103}, + val: "[A-Z]", + ranges: []rune{'A', 'Z'}, + ignoreCase: false, + inverted: false, + }, + }, + }, + }, + &litMatcher{ + pos: position{line: 268, col: 43, offset: 11111}, + val: ")", + ignoreCase: false, + }, + }, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 268, col: 48, offset: 11116}, + expr: &ruleRefExpr{ + pos: position{line: 268, col: 48, offset: 11116}, + name: "WS", + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "OrderedListItemContent", + pos: position{line: 291, col: 1, offset: 11900}, + expr: &actionExpr{ + pos: position{line: 291, col: 27, offset: 11926}, + run: (*parser).callonOrderedListItemContent1, + expr: &labeledExpr{ + pos: position{line: 291, col: 27, offset: 11926}, + label: "elements", + expr: &seqExpr{ + pos: position{line: 291, col: 37, offset: 11936}, + exprs: []interface{}{ + &oneOrMoreExpr{ + pos: position{line: 291, col: 37, offset: 11936}, + expr: &ruleRefExpr{ + pos: position{line: 291, col: 37, offset: 11936}, + name: "ListParagraph", + }, + }, + &zeroOrMoreExpr{ + pos: position{line: 291, col: 52, offset: 11951}, + expr: &ruleRefExpr{ + pos: position{line: 291, col: 52, offset: 11951}, + name: "ContinuedBlockElement", + }, + }, + }, + }, + }, + }, + }, { name: "UnorderedListItem", - pos: position{line: 235, col: 1, offset: 9468}, + pos: position{line: 298, col: 1, offset: 12277}, expr: &actionExpr{ - pos: position{line: 235, col: 22, offset: 9489}, + pos: position{line: 298, col: 22, offset: 12298}, run: (*parser).callonUnorderedListItem1, expr: &seqExpr{ - pos: position{line: 235, col: 22, offset: 9489}, + pos: position{line: 298, col: 22, offset: 12298}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 235, col: 22, offset: 9489}, - label: "level", + pos: position{line: 298, col: 22, offset: 12298}, + label: "prefix", expr: &ruleRefExpr{ - pos: position{line: 235, col: 29, offset: 9496}, + pos: position{line: 298, col: 30, offset: 12306}, name: "UnorderedListItemPrefix", }, }, &labeledExpr{ - pos: position{line: 235, col: 54, offset: 9521}, + pos: position{line: 298, col: 55, offset: 12331}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 235, col: 63, offset: 9530}, + pos: position{line: 298, col: 64, offset: 12340}, name: "UnorderedListItemContent", }, }, - &zeroOrOneExpr{ - pos: position{line: 235, col: 89, offset: 9556}, - expr: &ruleRefExpr{ - pos: position{line: 235, col: 89, offset: 9556}, - name: "BlankLine", + &zeroOrOneExpr{ + pos: position{line: 298, col: 90, offset: 12366}, + expr: &ruleRefExpr{ + pos: position{line: 298, col: 90, offset: 12366}, + name: "BlankLine", + }, + }, + }, + }, + }, + }, + { + name: "UnorderedListItemPrefix", + pos: position{line: 302, col: 1, offset: 12490}, + expr: &choiceExpr{ + pos: position{line: 302, col: 28, offset: 12517}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 302, col: 28, offset: 12517}, + run: (*parser).callonUnorderedListItemPrefix2, + expr: &seqExpr{ + pos: position{line: 302, col: 28, offset: 12517}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 302, col: 28, offset: 12517}, + expr: &ruleRefExpr{ + pos: position{line: 302, col: 28, offset: 12517}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 302, col: 32, offset: 12521}, + label: "level", + expr: &litMatcher{ + pos: position{line: 302, col: 39, offset: 12528}, + val: "*****", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 302, col: 48, offset: 12537}, + expr: &ruleRefExpr{ + pos: position{line: 302, col: 48, offset: 12537}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 304, col: 5, offset: 12682}, + run: (*parser).callonUnorderedListItemPrefix10, + expr: &seqExpr{ + pos: position{line: 304, col: 5, offset: 12682}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 304, col: 5, offset: 12682}, + expr: &ruleRefExpr{ + pos: position{line: 304, col: 5, offset: 12682}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 304, col: 9, offset: 12686}, + label: "level", + expr: &litMatcher{ + pos: position{line: 304, col: 16, offset: 12693}, + val: "****", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 304, col: 24, offset: 12701}, + expr: &ruleRefExpr{ + pos: position{line: 304, col: 24, offset: 12701}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 306, col: 5, offset: 12846}, + run: (*parser).callonUnorderedListItemPrefix18, + expr: &seqExpr{ + pos: position{line: 306, col: 5, offset: 12846}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 306, col: 5, offset: 12846}, + expr: &ruleRefExpr{ + pos: position{line: 306, col: 5, offset: 12846}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 306, col: 9, offset: 12850}, + label: "level", + expr: &litMatcher{ + pos: position{line: 306, col: 16, offset: 12857}, + val: "***", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 306, col: 23, offset: 12864}, + expr: &ruleRefExpr{ + pos: position{line: 306, col: 23, offset: 12864}, + name: "WS", + }, + }, + }, + }, + }, + &actionExpr{ + pos: position{line: 308, col: 5, offset: 13010}, + run: (*parser).callonUnorderedListItemPrefix26, + expr: &seqExpr{ + pos: position{line: 308, col: 5, offset: 13010}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 308, col: 5, offset: 13010}, + expr: &ruleRefExpr{ + pos: position{line: 308, col: 5, offset: 13010}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 308, col: 9, offset: 13014}, + label: "level", + expr: &litMatcher{ + pos: position{line: 308, col: 16, offset: 13021}, + val: "**", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 308, col: 22, offset: 13027}, + expr: &ruleRefExpr{ + pos: position{line: 308, col: 22, offset: 13027}, + name: "WS", + }, + }, }, }, }, - }, - }, - }, - { - name: "UnorderedListItemPrefix", - pos: position{line: 239, col: 1, offset: 9647}, - expr: &actionExpr{ - pos: position{line: 239, col: 28, offset: 9674}, - run: (*parser).callonUnorderedListItemPrefix1, - expr: &seqExpr{ - pos: position{line: 239, col: 28, offset: 9674}, - exprs: []interface{}{ - &zeroOrMoreExpr{ - pos: position{line: 239, col: 28, offset: 9674}, - expr: &ruleRefExpr{ - pos: position{line: 239, col: 28, offset: 9674}, - name: "WS", + &actionExpr{ + pos: position{line: 310, col: 5, offset: 13171}, + run: (*parser).callonUnorderedListItemPrefix34, + expr: &seqExpr{ + pos: position{line: 310, col: 5, offset: 13171}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 310, col: 5, offset: 13171}, + expr: &ruleRefExpr{ + pos: position{line: 310, col: 5, offset: 13171}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 310, col: 9, offset: 13175}, + label: "level", + expr: &litMatcher{ + pos: position{line: 310, col: 16, offset: 13182}, + val: "*", + ignoreCase: false, + }, + }, + &oneOrMoreExpr{ + pos: position{line: 310, col: 21, offset: 13187}, + expr: &ruleRefExpr{ + pos: position{line: 310, col: 21, offset: 13187}, + name: "WS", + }, + }, }, }, - &labeledExpr{ - pos: position{line: 239, col: 32, offset: 9678}, - label: "level", - expr: &choiceExpr{ - pos: position{line: 239, col: 39, offset: 9685}, - alternatives: []interface{}{ - &oneOrMoreExpr{ - pos: position{line: 239, col: 39, offset: 9685}, - expr: &litMatcher{ - pos: position{line: 239, col: 39, offset: 9685}, - val: "*", - ignoreCase: false, - }, + }, + &actionExpr{ + pos: position{line: 312, col: 5, offset: 13330}, + run: (*parser).callonUnorderedListItemPrefix42, + expr: &seqExpr{ + pos: position{line: 312, col: 5, offset: 13330}, + exprs: []interface{}{ + &zeroOrMoreExpr{ + pos: position{line: 312, col: 5, offset: 13330}, + expr: &ruleRefExpr{ + pos: position{line: 312, col: 5, offset: 13330}, + name: "WS", }, - &litMatcher{ - pos: position{line: 239, col: 46, offset: 9692}, + }, + &labeledExpr{ + pos: position{line: 312, col: 9, offset: 13334}, + label: "level", + expr: &litMatcher{ + pos: position{line: 312, col: 16, offset: 13341}, val: "-", ignoreCase: false, }, }, - }, - }, - &oneOrMoreExpr{ - pos: position{line: 239, col: 51, offset: 9697}, - expr: &ruleRefExpr{ - pos: position{line: 239, col: 51, offset: 9697}, - name: "WS", + &oneOrMoreExpr{ + pos: position{line: 312, col: 21, offset: 13346}, + expr: &ruleRefExpr{ + pos: position{line: 312, col: 21, offset: 13346}, + name: "WS", + }, + }, }, }, }, @@ -2527,27 +3322,27 @@ var g = &grammar{ }, { name: "UnorderedListItemContent", - pos: position{line: 243, col: 1, offset: 9795}, + pos: position{line: 316, col: 1, offset: 13482}, expr: &actionExpr{ - pos: position{line: 243, col: 29, offset: 9823}, + pos: position{line: 316, col: 29, offset: 13510}, run: (*parser).callonUnorderedListItemContent1, expr: &labeledExpr{ - pos: position{line: 243, col: 29, offset: 9823}, + pos: position{line: 316, col: 29, offset: 13510}, label: "elements", expr: &seqExpr{ - pos: position{line: 243, col: 39, offset: 9833}, + pos: position{line: 316, col: 39, offset: 13520}, exprs: []interface{}{ &oneOrMoreExpr{ - pos: position{line: 243, col: 39, offset: 9833}, + pos: position{line: 316, col: 39, offset: 13520}, expr: &ruleRefExpr{ - pos: position{line: 243, col: 39, offset: 9833}, + pos: position{line: 316, col: 39, offset: 13520}, name: "ListParagraph", }, }, &zeroOrMoreExpr{ - pos: position{line: 243, col: 54, offset: 9848}, + pos: position{line: 316, col: 54, offset: 13535}, expr: &ruleRefExpr{ - pos: position{line: 243, col: 54, offset: 9848}, + pos: position{line: 316, col: 54, offset: 13535}, name: "ContinuedBlockElement", }, }, @@ -2558,33 +3353,33 @@ var g = &grammar{ }, { name: "LabeledListItem", - pos: position{line: 250, col: 1, offset: 10167}, + pos: position{line: 323, col: 1, offset: 13859}, expr: &choiceExpr{ - pos: position{line: 250, col: 20, offset: 10186}, + pos: position{line: 323, col: 20, offset: 13878}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 250, col: 20, offset: 10186}, + pos: position{line: 323, col: 20, offset: 13878}, run: (*parser).callonLabeledListItem2, expr: &seqExpr{ - pos: position{line: 250, col: 20, offset: 10186}, + pos: position{line: 323, col: 20, offset: 13878}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 250, col: 20, offset: 10186}, + pos: position{line: 323, col: 20, offset: 13878}, label: "term", expr: &ruleRefExpr{ - pos: position{line: 250, col: 26, offset: 10192}, + pos: position{line: 323, col: 26, offset: 13884}, name: "LabeledListItemTerm", }, }, &ruleRefExpr{ - pos: position{line: 250, col: 47, offset: 10213}, + pos: position{line: 323, col: 47, offset: 13905}, name: "LabeledListItemSeparator", }, &labeledExpr{ - pos: position{line: 250, col: 72, offset: 10238}, + pos: position{line: 323, col: 72, offset: 13930}, label: "description", expr: &ruleRefExpr{ - pos: position{line: 250, col: 85, offset: 10251}, + pos: position{line: 323, col: 85, offset: 13943}, name: "LabeledListItemDescription", }, }, @@ -2592,33 +3387,33 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 252, col: 6, offset: 10378}, + pos: position{line: 325, col: 6, offset: 14070}, run: (*parser).callonLabeledListItem9, expr: &seqExpr{ - pos: position{line: 252, col: 6, offset: 10378}, + pos: position{line: 325, col: 6, offset: 14070}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 252, col: 6, offset: 10378}, + pos: position{line: 325, col: 6, offset: 14070}, label: "term", expr: &ruleRefExpr{ - pos: position{line: 252, col: 12, offset: 10384}, + pos: position{line: 325, col: 12, offset: 14076}, name: "LabeledListItemTerm", }, }, &litMatcher{ - pos: position{line: 252, col: 34, offset: 10406}, + pos: position{line: 325, col: 33, offset: 14097}, val: "::", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 252, col: 39, offset: 10411}, + pos: position{line: 325, col: 38, offset: 14102}, expr: &ruleRefExpr{ - pos: position{line: 252, col: 39, offset: 10411}, + pos: position{line: 325, col: 38, offset: 14102}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 252, col: 43, offset: 10415}, + pos: position{line: 325, col: 42, offset: 14106}, name: "EOL", }, }, @@ -2629,35 +3424,35 @@ var g = &grammar{ }, { name: "LabeledListItemTerm", - pos: position{line: 256, col: 1, offset: 10552}, + pos: position{line: 329, col: 1, offset: 14243}, expr: &actionExpr{ - pos: position{line: 256, col: 24, offset: 10575}, + pos: position{line: 329, col: 24, offset: 14266}, run: (*parser).callonLabeledListItemTerm1, expr: &labeledExpr{ - pos: position{line: 256, col: 24, offset: 10575}, + pos: position{line: 329, col: 24, offset: 14266}, label: "term", expr: &zeroOrMoreExpr{ - pos: position{line: 256, col: 29, offset: 10580}, + pos: position{line: 329, col: 29, offset: 14271}, expr: &seqExpr{ - pos: position{line: 256, col: 30, offset: 10581}, + pos: position{line: 329, col: 30, offset: 14272}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 256, col: 30, offset: 10581}, + pos: position{line: 329, col: 30, offset: 14272}, expr: &ruleRefExpr{ - pos: position{line: 256, col: 31, offset: 10582}, + pos: position{line: 329, col: 31, offset: 14273}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 256, col: 39, offset: 10590}, + pos: position{line: 329, col: 39, offset: 14281}, expr: &litMatcher{ - pos: position{line: 256, col: 40, offset: 10591}, + pos: position{line: 329, col: 40, offset: 14282}, val: "::", ignoreCase: false, }, }, &anyMatcher{ - line: 256, col: 45, offset: 10596, + line: 329, col: 45, offset: 14287, }, }, }, @@ -2667,26 +3462,26 @@ var g = &grammar{ }, { name: "LabeledListItemSeparator", - pos: position{line: 261, col: 1, offset: 10687}, + pos: position{line: 334, col: 1, offset: 14378}, expr: &seqExpr{ - pos: position{line: 261, col: 30, offset: 10716}, + pos: position{line: 334, col: 30, offset: 14407}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 261, col: 30, offset: 10716}, + pos: position{line: 334, col: 30, offset: 14407}, val: "::", ignoreCase: false, }, &oneOrMoreExpr{ - pos: position{line: 261, col: 35, offset: 10721}, + pos: position{line: 334, col: 35, offset: 14412}, expr: &choiceExpr{ - pos: position{line: 261, col: 36, offset: 10722}, + pos: position{line: 334, col: 36, offset: 14413}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 261, col: 36, offset: 10722}, + pos: position{line: 334, col: 36, offset: 14413}, name: "WS", }, &ruleRefExpr{ - pos: position{line: 261, col: 41, offset: 10727}, + pos: position{line: 334, col: 41, offset: 14418}, name: "NEWLINE", }, }, @@ -2697,24 +3492,24 @@ var g = &grammar{ }, { name: "LabeledListItemDescription", - pos: position{line: 263, col: 1, offset: 10738}, + pos: position{line: 336, col: 1, offset: 14429}, expr: &actionExpr{ - pos: position{line: 263, col: 31, offset: 10768}, + pos: position{line: 336, col: 31, offset: 14459}, run: (*parser).callonLabeledListItemDescription1, expr: &labeledExpr{ - pos: position{line: 263, col: 31, offset: 10768}, + pos: position{line: 336, col: 31, offset: 14459}, label: "elements", expr: &zeroOrMoreExpr{ - pos: position{line: 263, col: 40, offset: 10777}, + pos: position{line: 336, col: 40, offset: 14468}, expr: &choiceExpr{ - pos: position{line: 263, col: 41, offset: 10778}, + pos: position{line: 336, col: 41, offset: 14469}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 263, col: 41, offset: 10778}, + pos: position{line: 336, col: 41, offset: 14469}, name: "ListParagraph", }, &ruleRefExpr{ - pos: position{line: 263, col: 57, offset: 10794}, + pos: position{line: 336, col: 57, offset: 14485}, name: "ContinuedBlockElement", }, }, @@ -2725,41 +3520,41 @@ var g = &grammar{ }, { name: "Paragraph", - pos: position{line: 272, col: 1, offset: 11144}, + pos: position{line: 345, col: 1, offset: 14942}, expr: &actionExpr{ - pos: position{line: 272, col: 14, offset: 11157}, + pos: position{line: 345, col: 14, offset: 14955}, run: (*parser).callonParagraph1, expr: &seqExpr{ - pos: position{line: 272, col: 14, offset: 11157}, + pos: position{line: 345, col: 14, offset: 14955}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 272, col: 14, offset: 11157}, + pos: position{line: 345, col: 14, offset: 14955}, label: "attributes", expr: &zeroOrMoreExpr{ - pos: position{line: 272, col: 25, offset: 11168}, + pos: position{line: 345, col: 25, offset: 14966}, expr: &ruleRefExpr{ - pos: position{line: 272, col: 26, offset: 11169}, + pos: position{line: 345, col: 26, offset: 14967}, name: "ElementAttribute", }, }, }, ¬Expr{ - pos: position{line: 272, col: 45, offset: 11188}, + pos: position{line: 345, col: 45, offset: 14986}, expr: &seqExpr{ - pos: position{line: 272, col: 47, offset: 11190}, + pos: position{line: 345, col: 47, offset: 14988}, exprs: []interface{}{ &oneOrMoreExpr{ - pos: position{line: 272, col: 47, offset: 11190}, + pos: position{line: 345, col: 47, offset: 14988}, expr: &litMatcher{ - pos: position{line: 272, col: 47, offset: 11190}, + pos: position{line: 345, col: 47, offset: 14988}, val: "=", ignoreCase: false, }, }, &oneOrMoreExpr{ - pos: position{line: 272, col: 52, offset: 11195}, + pos: position{line: 345, col: 52, offset: 14993}, expr: &ruleRefExpr{ - pos: position{line: 272, col: 52, offset: 11195}, + pos: position{line: 345, col: 52, offset: 14993}, name: "WS", }, }, @@ -2767,19 +3562,19 @@ var g = &grammar{ }, }, &labeledExpr{ - pos: position{line: 272, col: 57, offset: 11200}, + pos: position{line: 345, col: 57, offset: 14998}, label: "lines", expr: &oneOrMoreExpr{ - pos: position{line: 272, col: 63, offset: 11206}, + pos: position{line: 345, col: 63, offset: 15004}, expr: &seqExpr{ - pos: position{line: 272, col: 64, offset: 11207}, + pos: position{line: 345, col: 64, offset: 15005}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 272, col: 64, offset: 11207}, + pos: position{line: 345, col: 64, offset: 15005}, name: "InlineContentWithTrailingSpaces", }, &ruleRefExpr{ - pos: position{line: 272, col: 96, offset: 11239}, + pos: position{line: 345, col: 96, offset: 15037}, name: "EOL", }, }, @@ -2792,50 +3587,50 @@ var g = &grammar{ }, { name: "InlineContentWithTrailingSpaces", - pos: position{line: 278, col: 1, offset: 11529}, + pos: position{line: 351, col: 1, offset: 15327}, expr: &actionExpr{ - pos: position{line: 278, col: 36, offset: 11564}, + pos: position{line: 351, col: 36, offset: 15362}, run: (*parser).callonInlineContentWithTrailingSpaces1, expr: &seqExpr{ - pos: position{line: 278, col: 36, offset: 11564}, + pos: position{line: 351, col: 36, offset: 15362}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 278, col: 36, offset: 11564}, + pos: position{line: 351, col: 36, offset: 15362}, expr: &ruleRefExpr{ - pos: position{line: 278, col: 37, offset: 11565}, + pos: position{line: 351, col: 37, offset: 15363}, name: "BlockDelimiter", }, }, &labeledExpr{ - pos: position{line: 278, col: 52, offset: 11580}, + pos: position{line: 351, col: 52, offset: 15378}, label: "elements", expr: &oneOrMoreExpr{ - pos: position{line: 278, col: 61, offset: 11589}, + pos: position{line: 351, col: 61, offset: 15387}, expr: &seqExpr{ - pos: position{line: 278, col: 62, offset: 11590}, + pos: position{line: 351, col: 62, offset: 15388}, exprs: []interface{}{ &zeroOrMoreExpr{ - pos: position{line: 278, col: 62, offset: 11590}, + pos: position{line: 351, col: 62, offset: 15388}, expr: &ruleRefExpr{ - pos: position{line: 278, col: 62, offset: 11590}, + pos: position{line: 351, col: 62, offset: 15388}, name: "WS", }, }, ¬Expr{ - pos: position{line: 278, col: 66, offset: 11594}, + pos: position{line: 351, col: 66, offset: 15392}, expr: &ruleRefExpr{ - pos: position{line: 278, col: 67, offset: 11595}, + pos: position{line: 351, col: 67, offset: 15393}, name: "InlineElementID", }, }, &ruleRefExpr{ - pos: position{line: 278, col: 83, offset: 11611}, + pos: position{line: 351, col: 83, offset: 15409}, name: "InlineElement", }, &zeroOrMoreExpr{ - pos: position{line: 278, col: 97, offset: 11625}, + pos: position{line: 351, col: 97, offset: 15423}, expr: &ruleRefExpr{ - pos: position{line: 278, col: 97, offset: 11625}, + pos: position{line: 351, col: 97, offset: 15423}, name: "WS", }, }, @@ -2849,44 +3644,44 @@ var g = &grammar{ }, { name: "InlineContent", - pos: position{line: 282, col: 1, offset: 11737}, + pos: position{line: 355, col: 1, offset: 15535}, expr: &actionExpr{ - pos: position{line: 282, col: 18, offset: 11754}, + pos: position{line: 355, col: 18, offset: 15552}, run: (*parser).callonInlineContent1, expr: &seqExpr{ - pos: position{line: 282, col: 18, offset: 11754}, + pos: position{line: 355, col: 18, offset: 15552}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 282, col: 18, offset: 11754}, + pos: position{line: 355, col: 18, offset: 15552}, expr: &ruleRefExpr{ - pos: position{line: 282, col: 19, offset: 11755}, + pos: position{line: 355, col: 19, offset: 15553}, name: "BlockDelimiter", }, }, &labeledExpr{ - pos: position{line: 282, col: 34, offset: 11770}, + pos: position{line: 355, col: 34, offset: 15568}, label: "elements", expr: &oneOrMoreExpr{ - pos: position{line: 282, col: 43, offset: 11779}, + pos: position{line: 355, col: 43, offset: 15577}, expr: &seqExpr{ - pos: position{line: 282, col: 44, offset: 11780}, + pos: position{line: 355, col: 44, offset: 15578}, exprs: []interface{}{ &zeroOrMoreExpr{ - pos: position{line: 282, col: 44, offset: 11780}, + pos: position{line: 355, col: 44, offset: 15578}, expr: &ruleRefExpr{ - pos: position{line: 282, col: 44, offset: 11780}, + pos: position{line: 355, col: 44, offset: 15578}, name: "WS", }, }, ¬Expr{ - pos: position{line: 282, col: 48, offset: 11784}, + pos: position{line: 355, col: 48, offset: 15582}, expr: &ruleRefExpr{ - pos: position{line: 282, col: 49, offset: 11785}, + pos: position{line: 355, col: 49, offset: 15583}, name: "InlineElementID", }, }, &ruleRefExpr{ - pos: position{line: 282, col: 65, offset: 11801}, + pos: position{line: 355, col: 65, offset: 15599}, name: "InlineElement", }, }, @@ -2899,36 +3694,36 @@ var g = &grammar{ }, { name: "InlineElement", - pos: position{line: 286, col: 1, offset: 11923}, + pos: position{line: 359, col: 1, offset: 15721}, expr: &choiceExpr{ - pos: position{line: 286, col: 19, offset: 11941}, + pos: position{line: 359, col: 18, offset: 15738}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 286, col: 19, offset: 11941}, + pos: position{line: 359, col: 18, offset: 15738}, name: "CrossReference", }, &ruleRefExpr{ - pos: position{line: 286, col: 36, offset: 11958}, + pos: position{line: 359, col: 35, offset: 15755}, name: "Passthrough", }, &ruleRefExpr{ - pos: position{line: 286, col: 50, offset: 11972}, + pos: position{line: 359, col: 49, offset: 15769}, name: "InlineImage", }, &ruleRefExpr{ - pos: position{line: 286, col: 64, offset: 11986}, + pos: position{line: 359, col: 63, offset: 15783}, name: "QuotedText", }, &ruleRefExpr{ - pos: position{line: 286, col: 77, offset: 11999}, + pos: position{line: 359, col: 76, offset: 15796}, name: "Link", }, &ruleRefExpr{ - pos: position{line: 286, col: 84, offset: 12006}, + pos: position{line: 359, col: 83, offset: 15803}, name: "DocumentAttributeSubstitution", }, &ruleRefExpr{ - pos: position{line: 286, col: 116, offset: 12038}, + pos: position{line: 359, col: 115, offset: 15835}, name: "Characters", }, }, @@ -2936,44 +3731,44 @@ var g = &grammar{ }, { name: "Admonition", - pos: position{line: 293, col: 1, offset: 12310}, + pos: position{line: 366, col: 1, offset: 16106}, expr: &choiceExpr{ - pos: position{line: 293, col: 15, offset: 12324}, + pos: position{line: 366, col: 15, offset: 16120}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 293, col: 15, offset: 12324}, + pos: position{line: 366, col: 15, offset: 16120}, run: (*parser).callonAdmonition2, expr: &seqExpr{ - pos: position{line: 293, col: 15, offset: 12324}, + pos: position{line: 366, col: 15, offset: 16120}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 293, col: 15, offset: 12324}, + pos: position{line: 366, col: 15, offset: 16120}, label: "attributes", expr: &zeroOrMoreExpr{ - pos: position{line: 293, col: 26, offset: 12335}, + pos: position{line: 366, col: 26, offset: 16131}, expr: &ruleRefExpr{ - pos: position{line: 293, col: 27, offset: 12336}, + pos: position{line: 366, col: 27, offset: 16132}, name: "ElementAttribute", }, }, }, ¬Expr{ - pos: position{line: 293, col: 46, offset: 12355}, + pos: position{line: 366, col: 46, offset: 16151}, expr: &seqExpr{ - pos: position{line: 293, col: 48, offset: 12357}, + pos: position{line: 366, col: 48, offset: 16153}, exprs: []interface{}{ &oneOrMoreExpr{ - pos: position{line: 293, col: 48, offset: 12357}, + pos: position{line: 366, col: 48, offset: 16153}, expr: &litMatcher{ - pos: position{line: 293, col: 48, offset: 12357}, + pos: position{line: 366, col: 48, offset: 16153}, val: "=", ignoreCase: false, }, }, &oneOrMoreExpr{ - pos: position{line: 293, col: 53, offset: 12362}, + pos: position{line: 366, col: 53, offset: 16158}, expr: &ruleRefExpr{ - pos: position{line: 293, col: 53, offset: 12362}, + pos: position{line: 366, col: 53, offset: 16158}, name: "WS", }, }, @@ -2981,23 +3776,23 @@ var g = &grammar{ }, }, &labeledExpr{ - pos: position{line: 293, col: 58, offset: 12367}, + pos: position{line: 366, col: 58, offset: 16163}, label: "t", expr: &ruleRefExpr{ - pos: position{line: 293, col: 61, offset: 12370}, + pos: position{line: 366, col: 61, offset: 16166}, name: "AdmonitionKind", }, }, &litMatcher{ - pos: position{line: 293, col: 77, offset: 12386}, + pos: position{line: 366, col: 77, offset: 16182}, val: ": ", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 293, col: 82, offset: 12391}, + pos: position{line: 366, col: 82, offset: 16187}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 293, col: 91, offset: 12400}, + pos: position{line: 366, col: 91, offset: 16196}, name: "AdmonitionParagraph", }, }, @@ -3005,67 +3800,67 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 296, col: 1, offset: 12541}, + pos: position{line: 369, col: 1, offset: 16337}, run: (*parser).callonAdmonition18, expr: &seqExpr{ - pos: position{line: 296, col: 1, offset: 12541}, + pos: position{line: 369, col: 1, offset: 16337}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 296, col: 1, offset: 12541}, + pos: position{line: 369, col: 1, offset: 16337}, label: "attributes", expr: &zeroOrMoreExpr{ - pos: position{line: 296, col: 12, offset: 12552}, + pos: position{line: 369, col: 12, offset: 16348}, expr: &ruleRefExpr{ - pos: position{line: 296, col: 13, offset: 12553}, + pos: position{line: 369, col: 13, offset: 16349}, name: "ElementAttribute", }, }, }, &litMatcher{ - pos: position{line: 296, col: 32, offset: 12572}, + pos: position{line: 369, col: 32, offset: 16368}, val: "[", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 296, col: 36, offset: 12576}, + pos: position{line: 369, col: 36, offset: 16372}, label: "t", expr: &ruleRefExpr{ - pos: position{line: 296, col: 39, offset: 12579}, + pos: position{line: 369, col: 39, offset: 16375}, name: "AdmonitionKind", }, }, &litMatcher{ - pos: position{line: 296, col: 55, offset: 12595}, + pos: position{line: 369, col: 55, offset: 16391}, val: "]", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 296, col: 59, offset: 12599}, + pos: position{line: 369, col: 59, offset: 16395}, expr: &ruleRefExpr{ - pos: position{line: 296, col: 59, offset: 12599}, + pos: position{line: 369, col: 59, offset: 16395}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 296, col: 63, offset: 12603}, + pos: position{line: 369, col: 63, offset: 16399}, name: "NEWLINE", }, &labeledExpr{ - pos: position{line: 296, col: 71, offset: 12611}, + pos: position{line: 369, col: 71, offset: 16407}, label: "otherAttributes", expr: &zeroOrMoreExpr{ - pos: position{line: 296, col: 87, offset: 12627}, + pos: position{line: 369, col: 87, offset: 16423}, expr: &ruleRefExpr{ - pos: position{line: 296, col: 88, offset: 12628}, + pos: position{line: 369, col: 88, offset: 16424}, name: "ElementAttribute", }, }, }, &labeledExpr{ - pos: position{line: 296, col: 107, offset: 12647}, + pos: position{line: 369, col: 107, offset: 16443}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 296, col: 116, offset: 12656}, + pos: position{line: 369, col: 116, offset: 16452}, name: "AdmonitionParagraph", }, }, @@ -3077,24 +3872,24 @@ var g = &grammar{ }, { name: "AdmonitionParagraph", - pos: position{line: 300, col: 1, offset: 12835}, + pos: position{line: 373, col: 1, offset: 16631}, expr: &actionExpr{ - pos: position{line: 300, col: 24, offset: 12858}, + pos: position{line: 373, col: 24, offset: 16654}, run: (*parser).callonAdmonitionParagraph1, expr: &labeledExpr{ - pos: position{line: 300, col: 24, offset: 12858}, + pos: position{line: 373, col: 24, offset: 16654}, label: "lines", expr: &oneOrMoreExpr{ - pos: position{line: 300, col: 30, offset: 12864}, + pos: position{line: 373, col: 30, offset: 16660}, expr: &seqExpr{ - pos: position{line: 300, col: 31, offset: 12865}, + pos: position{line: 373, col: 31, offset: 16661}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 300, col: 31, offset: 12865}, + pos: position{line: 373, col: 31, offset: 16661}, name: "InlineContentWithTrailingSpaces", }, &ruleRefExpr{ - pos: position{line: 300, col: 63, offset: 12897}, + pos: position{line: 373, col: 63, offset: 16693}, name: "EOL", }, }, @@ -3105,51 +3900,51 @@ var g = &grammar{ }, { name: "AdmonitionKind", - pos: position{line: 304, col: 1, offset: 12971}, + pos: position{line: 377, col: 1, offset: 16767}, expr: &choiceExpr{ - pos: position{line: 304, col: 19, offset: 12989}, + pos: position{line: 377, col: 19, offset: 16785}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 304, col: 19, offset: 12989}, + pos: position{line: 377, col: 19, offset: 16785}, run: (*parser).callonAdmonitionKind2, expr: &litMatcher{ - pos: position{line: 304, col: 19, offset: 12989}, + pos: position{line: 377, col: 19, offset: 16785}, val: "TIP", ignoreCase: false, }, }, &actionExpr{ - pos: position{line: 306, col: 5, offset: 13027}, + pos: position{line: 379, col: 5, offset: 16823}, run: (*parser).callonAdmonitionKind4, expr: &litMatcher{ - pos: position{line: 306, col: 5, offset: 13027}, + pos: position{line: 379, col: 5, offset: 16823}, val: "NOTE", ignoreCase: false, }, }, &actionExpr{ - pos: position{line: 308, col: 5, offset: 13067}, + pos: position{line: 381, col: 5, offset: 16863}, run: (*parser).callonAdmonitionKind6, expr: &litMatcher{ - pos: position{line: 308, col: 5, offset: 13067}, + pos: position{line: 381, col: 5, offset: 16863}, val: "IMPORTANT", ignoreCase: false, }, }, &actionExpr{ - pos: position{line: 310, col: 5, offset: 13117}, + pos: position{line: 383, col: 5, offset: 16913}, run: (*parser).callonAdmonitionKind8, expr: &litMatcher{ - pos: position{line: 310, col: 5, offset: 13117}, + pos: position{line: 383, col: 5, offset: 16913}, val: "WARNING", ignoreCase: false, }, }, &actionExpr{ - pos: position{line: 312, col: 5, offset: 13163}, + pos: position{line: 385, col: 5, offset: 16959}, run: (*parser).callonAdmonitionKind10, expr: &litMatcher{ - pos: position{line: 312, col: 5, offset: 13163}, + pos: position{line: 385, col: 5, offset: 16959}, val: "CAUTION", ignoreCase: false, }, @@ -3159,32 +3954,32 @@ var g = &grammar{ }, { name: "QuotedText", - pos: position{line: 319, col: 1, offset: 13447}, + pos: position{line: 392, col: 1, offset: 17243}, expr: &choiceExpr{ - pos: position{line: 319, col: 15, offset: 13461}, + pos: position{line: 392, col: 15, offset: 17257}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 319, col: 15, offset: 13461}, + pos: position{line: 392, col: 15, offset: 17257}, name: "BoldText", }, &ruleRefExpr{ - pos: position{line: 319, col: 26, offset: 13472}, + pos: position{line: 392, col: 26, offset: 17268}, name: "ItalicText", }, &ruleRefExpr{ - pos: position{line: 319, col: 39, offset: 13485}, + pos: position{line: 392, col: 39, offset: 17281}, name: "MonospaceText", }, &ruleRefExpr{ - pos: position{line: 320, col: 13, offset: 13513}, + pos: position{line: 393, col: 13, offset: 17309}, name: "EscapedBoldText", }, &ruleRefExpr{ - pos: position{line: 320, col: 31, offset: 13531}, + pos: position{line: 393, col: 31, offset: 17327}, name: "EscapedItalicText", }, &ruleRefExpr{ - pos: position{line: 320, col: 51, offset: 13551}, + pos: position{line: 393, col: 51, offset: 17347}, name: "EscapedMonospaceText", }, }, @@ -3192,39 +3987,39 @@ var g = &grammar{ }, { name: "BoldText", - pos: position{line: 322, col: 1, offset: 13573}, + pos: position{line: 395, col: 1, offset: 17369}, expr: &choiceExpr{ - pos: position{line: 322, col: 13, offset: 13585}, + pos: position{line: 395, col: 13, offset: 17381}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 322, col: 13, offset: 13585}, + pos: position{line: 395, col: 13, offset: 17381}, run: (*parser).callonBoldText2, expr: &seqExpr{ - pos: position{line: 322, col: 13, offset: 13585}, + pos: position{line: 395, col: 13, offset: 17381}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 322, col: 13, offset: 13585}, + pos: position{line: 395, col: 13, offset: 17381}, expr: &litMatcher{ - pos: position{line: 322, col: 14, offset: 13586}, + pos: position{line: 395, col: 14, offset: 17382}, val: "\\\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 322, col: 19, offset: 13591}, + pos: position{line: 395, col: 19, offset: 17387}, val: "**", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 322, col: 24, offset: 13596}, + pos: position{line: 395, col: 24, offset: 17392}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 322, col: 33, offset: 13605}, + pos: position{line: 395, col: 33, offset: 17401}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 322, col: 52, offset: 13624}, + pos: position{line: 395, col: 52, offset: 17420}, val: "**", ignoreCase: false, }, @@ -3232,34 +4027,34 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 324, col: 5, offset: 13749}, + pos: position{line: 397, col: 5, offset: 17545}, run: (*parser).callonBoldText10, expr: &seqExpr{ - pos: position{line: 324, col: 5, offset: 13749}, + pos: position{line: 397, col: 5, offset: 17545}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 324, col: 5, offset: 13749}, + pos: position{line: 397, col: 5, offset: 17545}, expr: &litMatcher{ - pos: position{line: 324, col: 6, offset: 13750}, + pos: position{line: 397, col: 6, offset: 17546}, val: "\\\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 324, col: 11, offset: 13755}, + pos: position{line: 397, col: 11, offset: 17551}, val: "**", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 324, col: 16, offset: 13760}, + pos: position{line: 397, col: 16, offset: 17556}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 324, col: 25, offset: 13769}, + pos: position{line: 397, col: 25, offset: 17565}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 324, col: 44, offset: 13788}, + pos: position{line: 397, col: 44, offset: 17584}, val: "*", ignoreCase: false, }, @@ -3267,34 +4062,34 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 327, col: 5, offset: 13953}, + pos: position{line: 400, col: 5, offset: 17749}, run: (*parser).callonBoldText18, expr: &seqExpr{ - pos: position{line: 327, col: 5, offset: 13953}, + pos: position{line: 400, col: 5, offset: 17749}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 327, col: 5, offset: 13953}, + pos: position{line: 400, col: 5, offset: 17749}, expr: &litMatcher{ - pos: position{line: 327, col: 6, offset: 13954}, + pos: position{line: 400, col: 6, offset: 17750}, val: "\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 327, col: 10, offset: 13958}, + pos: position{line: 400, col: 10, offset: 17754}, val: "*", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 327, col: 14, offset: 13962}, + pos: position{line: 400, col: 14, offset: 17758}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 327, col: 23, offset: 13971}, + pos: position{line: 400, col: 23, offset: 17767}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 327, col: 42, offset: 13990}, + pos: position{line: 400, col: 42, offset: 17786}, val: "*", ignoreCase: false, }, @@ -3306,31 +4101,31 @@ var g = &grammar{ }, { name: "EscapedBoldText", - pos: position{line: 331, col: 1, offset: 14090}, + pos: position{line: 404, col: 1, offset: 17886}, expr: &choiceExpr{ - pos: position{line: 331, col: 20, offset: 14109}, + pos: position{line: 404, col: 20, offset: 17905}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 331, col: 20, offset: 14109}, + pos: position{line: 404, col: 20, offset: 17905}, run: (*parser).callonEscapedBoldText2, expr: &seqExpr{ - pos: position{line: 331, col: 20, offset: 14109}, + pos: position{line: 404, col: 20, offset: 17905}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 331, col: 20, offset: 14109}, + pos: position{line: 404, col: 20, offset: 17905}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 331, col: 33, offset: 14122}, + pos: position{line: 404, col: 33, offset: 17918}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 331, col: 33, offset: 14122}, + pos: position{line: 404, col: 33, offset: 17918}, val: "\\\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 331, col: 38, offset: 14127}, + pos: position{line: 404, col: 38, offset: 17923}, expr: &litMatcher{ - pos: position{line: 331, col: 38, offset: 14127}, + pos: position{line: 404, col: 38, offset: 17923}, val: "\\", ignoreCase: false, }, @@ -3339,20 +4134,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 331, col: 44, offset: 14133}, + pos: position{line: 404, col: 44, offset: 17929}, val: "**", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 331, col: 49, offset: 14138}, + pos: position{line: 404, col: 49, offset: 17934}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 331, col: 58, offset: 14147}, + pos: position{line: 404, col: 58, offset: 17943}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 331, col: 77, offset: 14166}, + pos: position{line: 404, col: 77, offset: 17962}, val: "**", ignoreCase: false, }, @@ -3360,26 +4155,26 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 333, col: 5, offset: 14321}, + pos: position{line: 406, col: 5, offset: 18117}, run: (*parser).callonEscapedBoldText13, expr: &seqExpr{ - pos: position{line: 333, col: 5, offset: 14321}, + pos: position{line: 406, col: 5, offset: 18117}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 333, col: 5, offset: 14321}, + pos: position{line: 406, col: 5, offset: 18117}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 333, col: 18, offset: 14334}, + pos: position{line: 406, col: 18, offset: 18130}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 333, col: 18, offset: 14334}, + pos: position{line: 406, col: 18, offset: 18130}, val: "\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 333, col: 22, offset: 14338}, + pos: position{line: 406, col: 22, offset: 18134}, expr: &litMatcher{ - pos: position{line: 333, col: 22, offset: 14338}, + pos: position{line: 406, col: 22, offset: 18134}, val: "\\", ignoreCase: false, }, @@ -3388,20 +4183,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 333, col: 28, offset: 14344}, + pos: position{line: 406, col: 28, offset: 18140}, val: "**", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 333, col: 33, offset: 14349}, + pos: position{line: 406, col: 33, offset: 18145}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 333, col: 42, offset: 14358}, + pos: position{line: 406, col: 42, offset: 18154}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 333, col: 61, offset: 14377}, + pos: position{line: 406, col: 61, offset: 18173}, val: "*", ignoreCase: false, }, @@ -3409,26 +4204,26 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 336, col: 5, offset: 14571}, + pos: position{line: 409, col: 5, offset: 18367}, run: (*parser).callonEscapedBoldText24, expr: &seqExpr{ - pos: position{line: 336, col: 5, offset: 14571}, + pos: position{line: 409, col: 5, offset: 18367}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 336, col: 5, offset: 14571}, + pos: position{line: 409, col: 5, offset: 18367}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 336, col: 18, offset: 14584}, + pos: position{line: 409, col: 18, offset: 18380}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 336, col: 18, offset: 14584}, + pos: position{line: 409, col: 18, offset: 18380}, val: "\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 336, col: 22, offset: 14588}, + pos: position{line: 409, col: 22, offset: 18384}, expr: &litMatcher{ - pos: position{line: 336, col: 22, offset: 14588}, + pos: position{line: 409, col: 22, offset: 18384}, val: "\\", ignoreCase: false, }, @@ -3437,20 +4232,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 336, col: 28, offset: 14594}, + pos: position{line: 409, col: 28, offset: 18390}, val: "*", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 336, col: 32, offset: 14598}, + pos: position{line: 409, col: 32, offset: 18394}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 336, col: 41, offset: 14607}, + pos: position{line: 409, col: 41, offset: 18403}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 336, col: 60, offset: 14626}, + pos: position{line: 409, col: 60, offset: 18422}, val: "*", ignoreCase: false, }, @@ -3462,39 +4257,39 @@ var g = &grammar{ }, { name: "ItalicText", - pos: position{line: 340, col: 1, offset: 14778}, + pos: position{line: 413, col: 1, offset: 18574}, expr: &choiceExpr{ - pos: position{line: 340, col: 15, offset: 14792}, + pos: position{line: 413, col: 15, offset: 18588}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 340, col: 15, offset: 14792}, + pos: position{line: 413, col: 15, offset: 18588}, run: (*parser).callonItalicText2, expr: &seqExpr{ - pos: position{line: 340, col: 15, offset: 14792}, + pos: position{line: 413, col: 15, offset: 18588}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 340, col: 15, offset: 14792}, + pos: position{line: 413, col: 15, offset: 18588}, expr: &litMatcher{ - pos: position{line: 340, col: 16, offset: 14793}, + pos: position{line: 413, col: 16, offset: 18589}, val: "\\\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 340, col: 21, offset: 14798}, + pos: position{line: 413, col: 21, offset: 18594}, val: "__", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 340, col: 26, offset: 14803}, + pos: position{line: 413, col: 26, offset: 18599}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 340, col: 35, offset: 14812}, + pos: position{line: 413, col: 35, offset: 18608}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 340, col: 54, offset: 14831}, + pos: position{line: 413, col: 54, offset: 18627}, val: "__", ignoreCase: false, }, @@ -3502,34 +4297,34 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 342, col: 5, offset: 14912}, + pos: position{line: 415, col: 5, offset: 18708}, run: (*parser).callonItalicText10, expr: &seqExpr{ - pos: position{line: 342, col: 5, offset: 14912}, + pos: position{line: 415, col: 5, offset: 18708}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 342, col: 5, offset: 14912}, + pos: position{line: 415, col: 5, offset: 18708}, expr: &litMatcher{ - pos: position{line: 342, col: 6, offset: 14913}, + pos: position{line: 415, col: 6, offset: 18709}, val: "\\\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 342, col: 11, offset: 14918}, + pos: position{line: 415, col: 11, offset: 18714}, val: "__", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 342, col: 16, offset: 14923}, + pos: position{line: 415, col: 16, offset: 18719}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 342, col: 25, offset: 14932}, + pos: position{line: 415, col: 25, offset: 18728}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 342, col: 44, offset: 14951}, + pos: position{line: 415, col: 44, offset: 18747}, val: "_", ignoreCase: false, }, @@ -3537,34 +4332,34 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 345, col: 5, offset: 15118}, + pos: position{line: 418, col: 5, offset: 18914}, run: (*parser).callonItalicText18, expr: &seqExpr{ - pos: position{line: 345, col: 5, offset: 15118}, + pos: position{line: 418, col: 5, offset: 18914}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 345, col: 5, offset: 15118}, + pos: position{line: 418, col: 5, offset: 18914}, expr: &litMatcher{ - pos: position{line: 345, col: 6, offset: 15119}, + pos: position{line: 418, col: 6, offset: 18915}, val: "\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 345, col: 10, offset: 15123}, + pos: position{line: 418, col: 10, offset: 18919}, val: "_", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 345, col: 14, offset: 15127}, + pos: position{line: 418, col: 14, offset: 18923}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 345, col: 23, offset: 15136}, + pos: position{line: 418, col: 23, offset: 18932}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 345, col: 42, offset: 15155}, + pos: position{line: 418, col: 42, offset: 18951}, val: "_", ignoreCase: false, }, @@ -3576,31 +4371,31 @@ var g = &grammar{ }, { name: "EscapedItalicText", - pos: position{line: 349, col: 1, offset: 15234}, + pos: position{line: 422, col: 1, offset: 19030}, expr: &choiceExpr{ - pos: position{line: 349, col: 22, offset: 15255}, + pos: position{line: 422, col: 22, offset: 19051}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 349, col: 22, offset: 15255}, + pos: position{line: 422, col: 22, offset: 19051}, run: (*parser).callonEscapedItalicText2, expr: &seqExpr{ - pos: position{line: 349, col: 22, offset: 15255}, + pos: position{line: 422, col: 22, offset: 19051}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 349, col: 22, offset: 15255}, + pos: position{line: 422, col: 22, offset: 19051}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 349, col: 35, offset: 15268}, + pos: position{line: 422, col: 35, offset: 19064}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 349, col: 35, offset: 15268}, + pos: position{line: 422, col: 35, offset: 19064}, val: "\\\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 349, col: 40, offset: 15273}, + pos: position{line: 422, col: 40, offset: 19069}, expr: &litMatcher{ - pos: position{line: 349, col: 40, offset: 15273}, + pos: position{line: 422, col: 40, offset: 19069}, val: "\\", ignoreCase: false, }, @@ -3609,20 +4404,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 349, col: 46, offset: 15279}, + pos: position{line: 422, col: 46, offset: 19075}, val: "__", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 349, col: 51, offset: 15284}, + pos: position{line: 422, col: 51, offset: 19080}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 349, col: 60, offset: 15293}, + pos: position{line: 422, col: 60, offset: 19089}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 349, col: 79, offset: 15312}, + pos: position{line: 422, col: 79, offset: 19108}, val: "__", ignoreCase: false, }, @@ -3630,26 +4425,26 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 351, col: 5, offset: 15467}, + pos: position{line: 424, col: 5, offset: 19263}, run: (*parser).callonEscapedItalicText13, expr: &seqExpr{ - pos: position{line: 351, col: 5, offset: 15467}, + pos: position{line: 424, col: 5, offset: 19263}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 351, col: 5, offset: 15467}, + pos: position{line: 424, col: 5, offset: 19263}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 351, col: 18, offset: 15480}, + pos: position{line: 424, col: 18, offset: 19276}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 351, col: 18, offset: 15480}, + pos: position{line: 424, col: 18, offset: 19276}, val: "\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 351, col: 22, offset: 15484}, + pos: position{line: 424, col: 22, offset: 19280}, expr: &litMatcher{ - pos: position{line: 351, col: 22, offset: 15484}, + pos: position{line: 424, col: 22, offset: 19280}, val: "\\", ignoreCase: false, }, @@ -3658,20 +4453,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 351, col: 28, offset: 15490}, + pos: position{line: 424, col: 28, offset: 19286}, val: "__", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 351, col: 33, offset: 15495}, + pos: position{line: 424, col: 33, offset: 19291}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 351, col: 42, offset: 15504}, + pos: position{line: 424, col: 42, offset: 19300}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 351, col: 61, offset: 15523}, + pos: position{line: 424, col: 61, offset: 19319}, val: "_", ignoreCase: false, }, @@ -3679,26 +4474,26 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 354, col: 5, offset: 15717}, + pos: position{line: 427, col: 5, offset: 19513}, run: (*parser).callonEscapedItalicText24, expr: &seqExpr{ - pos: position{line: 354, col: 5, offset: 15717}, + pos: position{line: 427, col: 5, offset: 19513}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 354, col: 5, offset: 15717}, + pos: position{line: 427, col: 5, offset: 19513}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 354, col: 18, offset: 15730}, + pos: position{line: 427, col: 18, offset: 19526}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 354, col: 18, offset: 15730}, + pos: position{line: 427, col: 18, offset: 19526}, val: "\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 354, col: 22, offset: 15734}, + pos: position{line: 427, col: 22, offset: 19530}, expr: &litMatcher{ - pos: position{line: 354, col: 22, offset: 15734}, + pos: position{line: 427, col: 22, offset: 19530}, val: "\\", ignoreCase: false, }, @@ -3707,20 +4502,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 354, col: 28, offset: 15740}, + pos: position{line: 427, col: 28, offset: 19536}, val: "_", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 354, col: 32, offset: 15744}, + pos: position{line: 427, col: 32, offset: 19540}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 354, col: 41, offset: 15753}, + pos: position{line: 427, col: 41, offset: 19549}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 354, col: 60, offset: 15772}, + pos: position{line: 427, col: 60, offset: 19568}, val: "_", ignoreCase: false, }, @@ -3732,39 +4527,39 @@ var g = &grammar{ }, { name: "MonospaceText", - pos: position{line: 358, col: 1, offset: 15924}, + pos: position{line: 431, col: 1, offset: 19720}, expr: &choiceExpr{ - pos: position{line: 358, col: 18, offset: 15941}, + pos: position{line: 431, col: 18, offset: 19737}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 358, col: 18, offset: 15941}, + pos: position{line: 431, col: 18, offset: 19737}, run: (*parser).callonMonospaceText2, expr: &seqExpr{ - pos: position{line: 358, col: 18, offset: 15941}, + pos: position{line: 431, col: 18, offset: 19737}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 358, col: 18, offset: 15941}, + pos: position{line: 431, col: 18, offset: 19737}, expr: &litMatcher{ - pos: position{line: 358, col: 19, offset: 15942}, + pos: position{line: 431, col: 19, offset: 19738}, val: "\\\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 358, col: 24, offset: 15947}, + pos: position{line: 431, col: 24, offset: 19743}, val: "``", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 358, col: 29, offset: 15952}, + pos: position{line: 431, col: 29, offset: 19748}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 358, col: 38, offset: 15961}, + pos: position{line: 431, col: 38, offset: 19757}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 358, col: 57, offset: 15980}, + pos: position{line: 431, col: 57, offset: 19776}, val: "``", ignoreCase: false, }, @@ -3772,34 +4567,34 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 360, col: 5, offset: 16110}, + pos: position{line: 433, col: 5, offset: 19906}, run: (*parser).callonMonospaceText10, expr: &seqExpr{ - pos: position{line: 360, col: 5, offset: 16110}, + pos: position{line: 433, col: 5, offset: 19906}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 360, col: 5, offset: 16110}, + pos: position{line: 433, col: 5, offset: 19906}, expr: &litMatcher{ - pos: position{line: 360, col: 6, offset: 16111}, + pos: position{line: 433, col: 6, offset: 19907}, val: "\\\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 360, col: 11, offset: 16116}, + pos: position{line: 433, col: 11, offset: 19912}, val: "``", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 360, col: 16, offset: 16121}, + pos: position{line: 433, col: 16, offset: 19917}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 360, col: 25, offset: 16130}, + pos: position{line: 433, col: 25, offset: 19926}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 360, col: 44, offset: 16149}, + pos: position{line: 433, col: 44, offset: 19945}, val: "`", ignoreCase: false, }, @@ -3807,34 +4602,34 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 363, col: 5, offset: 16319}, + pos: position{line: 436, col: 5, offset: 20115}, run: (*parser).callonMonospaceText18, expr: &seqExpr{ - pos: position{line: 363, col: 5, offset: 16319}, + pos: position{line: 436, col: 5, offset: 20115}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 363, col: 5, offset: 16319}, + pos: position{line: 436, col: 5, offset: 20115}, expr: &litMatcher{ - pos: position{line: 363, col: 6, offset: 16320}, + pos: position{line: 436, col: 6, offset: 20116}, val: "\\", ignoreCase: false, }, }, &litMatcher{ - pos: position{line: 363, col: 10, offset: 16324}, + pos: position{line: 436, col: 10, offset: 20120}, val: "`", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 363, col: 14, offset: 16328}, + pos: position{line: 436, col: 14, offset: 20124}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 363, col: 23, offset: 16337}, + pos: position{line: 436, col: 23, offset: 20133}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 363, col: 42, offset: 16356}, + pos: position{line: 436, col: 42, offset: 20152}, val: "`", ignoreCase: false, }, @@ -3846,31 +4641,31 @@ var g = &grammar{ }, { name: "EscapedMonospaceText", - pos: position{line: 367, col: 1, offset: 16483}, + pos: position{line: 440, col: 1, offset: 20279}, expr: &choiceExpr{ - pos: position{line: 367, col: 25, offset: 16507}, + pos: position{line: 440, col: 25, offset: 20303}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 367, col: 25, offset: 16507}, + pos: position{line: 440, col: 25, offset: 20303}, run: (*parser).callonEscapedMonospaceText2, expr: &seqExpr{ - pos: position{line: 367, col: 25, offset: 16507}, + pos: position{line: 440, col: 25, offset: 20303}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 367, col: 25, offset: 16507}, + pos: position{line: 440, col: 25, offset: 20303}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 367, col: 38, offset: 16520}, + pos: position{line: 440, col: 38, offset: 20316}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 367, col: 38, offset: 16520}, + pos: position{line: 440, col: 38, offset: 20316}, val: "\\\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 367, col: 43, offset: 16525}, + pos: position{line: 440, col: 43, offset: 20321}, expr: &litMatcher{ - pos: position{line: 367, col: 43, offset: 16525}, + pos: position{line: 440, col: 43, offset: 20321}, val: "\\", ignoreCase: false, }, @@ -3879,20 +4674,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 367, col: 49, offset: 16531}, + pos: position{line: 440, col: 49, offset: 20327}, val: "``", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 367, col: 54, offset: 16536}, + pos: position{line: 440, col: 54, offset: 20332}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 367, col: 63, offset: 16545}, + pos: position{line: 440, col: 63, offset: 20341}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 367, col: 82, offset: 16564}, + pos: position{line: 440, col: 82, offset: 20360}, val: "``", ignoreCase: false, }, @@ -3900,26 +4695,26 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 369, col: 5, offset: 16719}, + pos: position{line: 442, col: 5, offset: 20515}, run: (*parser).callonEscapedMonospaceText13, expr: &seqExpr{ - pos: position{line: 369, col: 5, offset: 16719}, + pos: position{line: 442, col: 5, offset: 20515}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 369, col: 5, offset: 16719}, + pos: position{line: 442, col: 5, offset: 20515}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 369, col: 18, offset: 16732}, + pos: position{line: 442, col: 18, offset: 20528}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 369, col: 18, offset: 16732}, + pos: position{line: 442, col: 18, offset: 20528}, val: "\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 369, col: 22, offset: 16736}, + pos: position{line: 442, col: 22, offset: 20532}, expr: &litMatcher{ - pos: position{line: 369, col: 22, offset: 16736}, + pos: position{line: 442, col: 22, offset: 20532}, val: "\\", ignoreCase: false, }, @@ -3928,20 +4723,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 369, col: 28, offset: 16742}, + pos: position{line: 442, col: 28, offset: 20538}, val: "``", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 369, col: 33, offset: 16747}, + pos: position{line: 442, col: 33, offset: 20543}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 369, col: 42, offset: 16756}, + pos: position{line: 442, col: 42, offset: 20552}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 369, col: 61, offset: 16775}, + pos: position{line: 442, col: 61, offset: 20571}, val: "`", ignoreCase: false, }, @@ -3949,26 +4744,26 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 372, col: 5, offset: 16969}, + pos: position{line: 445, col: 5, offset: 20765}, run: (*parser).callonEscapedMonospaceText24, expr: &seqExpr{ - pos: position{line: 372, col: 5, offset: 16969}, + pos: position{line: 445, col: 5, offset: 20765}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 372, col: 5, offset: 16969}, + pos: position{line: 445, col: 5, offset: 20765}, label: "backslashes", expr: &seqExpr{ - pos: position{line: 372, col: 18, offset: 16982}, + pos: position{line: 445, col: 18, offset: 20778}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 372, col: 18, offset: 16982}, + pos: position{line: 445, col: 18, offset: 20778}, val: "\\", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 372, col: 22, offset: 16986}, + pos: position{line: 445, col: 22, offset: 20782}, expr: &litMatcher{ - pos: position{line: 372, col: 22, offset: 16986}, + pos: position{line: 445, col: 22, offset: 20782}, val: "\\", ignoreCase: false, }, @@ -3977,20 +4772,20 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 372, col: 28, offset: 16992}, + pos: position{line: 445, col: 28, offset: 20788}, val: "`", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 372, col: 32, offset: 16996}, + pos: position{line: 445, col: 32, offset: 20792}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 372, col: 41, offset: 17005}, + pos: position{line: 445, col: 41, offset: 20801}, name: "QuotedTextContent", }, }, &litMatcher{ - pos: position{line: 372, col: 60, offset: 17024}, + pos: position{line: 445, col: 60, offset: 20820}, val: "`", ignoreCase: false, }, @@ -4002,28 +4797,28 @@ var g = &grammar{ }, { name: "QuotedTextContent", - pos: position{line: 376, col: 1, offset: 17176}, + pos: position{line: 449, col: 1, offset: 20972}, expr: &seqExpr{ - pos: position{line: 376, col: 22, offset: 17197}, + pos: position{line: 449, col: 22, offset: 20993}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 376, col: 22, offset: 17197}, + pos: position{line: 449, col: 22, offset: 20993}, name: "QuotedTextContentElement", }, &zeroOrMoreExpr{ - pos: position{line: 376, col: 47, offset: 17222}, + pos: position{line: 449, col: 47, offset: 21018}, expr: &seqExpr{ - pos: position{line: 376, col: 48, offset: 17223}, + pos: position{line: 449, col: 48, offset: 21019}, exprs: []interface{}{ &oneOrMoreExpr{ - pos: position{line: 376, col: 48, offset: 17223}, + pos: position{line: 449, col: 48, offset: 21019}, expr: &ruleRefExpr{ - pos: position{line: 376, col: 48, offset: 17223}, + pos: position{line: 449, col: 48, offset: 21019}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 376, col: 52, offset: 17227}, + pos: position{line: 449, col: 52, offset: 21023}, name: "QuotedTextContentElement", }, }, @@ -4034,20 +4829,20 @@ var g = &grammar{ }, { name: "QuotedTextContentElement", - pos: position{line: 378, col: 1, offset: 17255}, + pos: position{line: 451, col: 1, offset: 21051}, expr: &choiceExpr{ - pos: position{line: 378, col: 29, offset: 17283}, + pos: position{line: 451, col: 29, offset: 21079}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 378, col: 29, offset: 17283}, + pos: position{line: 451, col: 29, offset: 21079}, name: "QuotedText", }, &ruleRefExpr{ - pos: position{line: 378, col: 42, offset: 17296}, + pos: position{line: 451, col: 42, offset: 21092}, name: "QuotedTextCharacters", }, &ruleRefExpr{ - pos: position{line: 378, col: 65, offset: 17319}, + pos: position{line: 451, col: 65, offset: 21115}, name: "CharactersWithQuotePunctuation", }, }, @@ -4055,52 +4850,52 @@ var g = &grammar{ }, { name: "QuotedTextCharacters", - pos: position{line: 380, col: 1, offset: 17454}, + pos: position{line: 453, col: 1, offset: 21250}, expr: &oneOrMoreExpr{ - pos: position{line: 380, col: 25, offset: 17478}, + pos: position{line: 453, col: 25, offset: 21274}, expr: &seqExpr{ - pos: position{line: 380, col: 26, offset: 17479}, + pos: position{line: 453, col: 26, offset: 21275}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 380, col: 26, offset: 17479}, + pos: position{line: 453, col: 26, offset: 21275}, expr: &ruleRefExpr{ - pos: position{line: 380, col: 27, offset: 17480}, + pos: position{line: 453, col: 27, offset: 21276}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 380, col: 35, offset: 17488}, + pos: position{line: 453, col: 35, offset: 21284}, expr: &ruleRefExpr{ - pos: position{line: 380, col: 36, offset: 17489}, + pos: position{line: 453, col: 36, offset: 21285}, name: "WS", }, }, ¬Expr{ - pos: position{line: 380, col: 39, offset: 17492}, + pos: position{line: 453, col: 39, offset: 21288}, expr: &litMatcher{ - pos: position{line: 380, col: 40, offset: 17493}, + pos: position{line: 453, col: 40, offset: 21289}, val: "*", ignoreCase: false, }, }, ¬Expr{ - pos: position{line: 380, col: 44, offset: 17497}, + pos: position{line: 453, col: 44, offset: 21293}, expr: &litMatcher{ - pos: position{line: 380, col: 45, offset: 17498}, + pos: position{line: 453, col: 45, offset: 21294}, val: "_", ignoreCase: false, }, }, ¬Expr{ - pos: position{line: 380, col: 49, offset: 17502}, + pos: position{line: 453, col: 49, offset: 21298}, expr: &litMatcher{ - pos: position{line: 380, col: 50, offset: 17503}, + pos: position{line: 453, col: 50, offset: 21299}, val: "`", ignoreCase: false, }, }, &anyMatcher{ - line: 380, col: 54, offset: 17507, + line: 453, col: 54, offset: 21303, }, }, }, @@ -4108,31 +4903,31 @@ var g = &grammar{ }, { name: "CharactersWithQuotePunctuation", - pos: position{line: 382, col: 1, offset: 17550}, + pos: position{line: 455, col: 1, offset: 21346}, expr: &actionExpr{ - pos: position{line: 382, col: 35, offset: 17584}, + pos: position{line: 455, col: 35, offset: 21380}, run: (*parser).callonCharactersWithQuotePunctuation1, expr: &oneOrMoreExpr{ - pos: position{line: 382, col: 35, offset: 17584}, + pos: position{line: 455, col: 35, offset: 21380}, expr: &seqExpr{ - pos: position{line: 382, col: 36, offset: 17585}, + pos: position{line: 455, col: 36, offset: 21381}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 382, col: 36, offset: 17585}, + pos: position{line: 455, col: 36, offset: 21381}, expr: &ruleRefExpr{ - pos: position{line: 382, col: 37, offset: 17586}, + pos: position{line: 455, col: 37, offset: 21382}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 382, col: 45, offset: 17594}, + pos: position{line: 455, col: 45, offset: 21390}, expr: &ruleRefExpr{ - pos: position{line: 382, col: 46, offset: 17595}, + pos: position{line: 455, col: 46, offset: 21391}, name: "WS", }, }, &anyMatcher{ - line: 382, col: 50, offset: 17599, + line: 455, col: 50, offset: 21395, }, }, }, @@ -4141,22 +4936,22 @@ var g = &grammar{ }, { name: "UnbalancedQuotePunctuation", - pos: position{line: 387, col: 1, offset: 17844}, + pos: position{line: 460, col: 1, offset: 21640}, expr: &choiceExpr{ - pos: position{line: 387, col: 31, offset: 17874}, + pos: position{line: 460, col: 31, offset: 21670}, alternatives: []interface{}{ &litMatcher{ - pos: position{line: 387, col: 31, offset: 17874}, + pos: position{line: 460, col: 31, offset: 21670}, val: "*", ignoreCase: false, }, &litMatcher{ - pos: position{line: 387, col: 37, offset: 17880}, + pos: position{line: 460, col: 37, offset: 21676}, val: "_", ignoreCase: false, }, &litMatcher{ - pos: position{line: 387, col: 43, offset: 17886}, + pos: position{line: 460, col: 43, offset: 21682}, val: "`", ignoreCase: false, }, @@ -4165,20 +4960,20 @@ var g = &grammar{ }, { name: "Passthrough", - pos: position{line: 392, col: 1, offset: 17998}, + pos: position{line: 465, col: 1, offset: 21794}, expr: &choiceExpr{ - pos: position{line: 392, col: 16, offset: 18013}, + pos: position{line: 465, col: 16, offset: 21809}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 392, col: 16, offset: 18013}, + pos: position{line: 465, col: 16, offset: 21809}, name: "TriplePlusPassthrough", }, &ruleRefExpr{ - pos: position{line: 392, col: 40, offset: 18037}, + pos: position{line: 465, col: 40, offset: 21833}, name: "SinglePlusPassthrough", }, &ruleRefExpr{ - pos: position{line: 392, col: 64, offset: 18061}, + pos: position{line: 465, col: 64, offset: 21857}, name: "PassthroughMacro", }, }, @@ -4186,50 +4981,50 @@ var g = &grammar{ }, { name: "SinglePlusPassthrough", - pos: position{line: 394, col: 1, offset: 18079}, + pos: position{line: 467, col: 1, offset: 21875}, expr: &actionExpr{ - pos: position{line: 394, col: 26, offset: 18104}, + pos: position{line: 467, col: 26, offset: 21900}, run: (*parser).callonSinglePlusPassthrough1, expr: &seqExpr{ - pos: position{line: 394, col: 26, offset: 18104}, + pos: position{line: 467, col: 26, offset: 21900}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 394, col: 26, offset: 18104}, + pos: position{line: 467, col: 26, offset: 21900}, val: "+", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 394, col: 30, offset: 18108}, + pos: position{line: 467, col: 30, offset: 21904}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 394, col: 38, offset: 18116}, + pos: position{line: 467, col: 38, offset: 21912}, expr: &seqExpr{ - pos: position{line: 394, col: 39, offset: 18117}, + pos: position{line: 467, col: 39, offset: 21913}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 394, col: 39, offset: 18117}, + pos: position{line: 467, col: 39, offset: 21913}, expr: &ruleRefExpr{ - pos: position{line: 394, col: 40, offset: 18118}, + pos: position{line: 467, col: 40, offset: 21914}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 394, col: 48, offset: 18126}, + pos: position{line: 467, col: 48, offset: 21922}, expr: &litMatcher{ - pos: position{line: 394, col: 49, offset: 18127}, + pos: position{line: 467, col: 49, offset: 21923}, val: "+", ignoreCase: false, }, }, &anyMatcher{ - line: 394, col: 53, offset: 18131, + line: 467, col: 53, offset: 21927, }, }, }, }, }, &litMatcher{ - pos: position{line: 394, col: 57, offset: 18135}, + pos: position{line: 467, col: 57, offset: 21931}, val: "+", ignoreCase: false, }, @@ -4239,43 +5034,43 @@ var g = &grammar{ }, { name: "TriplePlusPassthrough", - pos: position{line: 398, col: 1, offset: 18230}, + pos: position{line: 471, col: 1, offset: 22026}, expr: &actionExpr{ - pos: position{line: 398, col: 26, offset: 18255}, + pos: position{line: 471, col: 26, offset: 22051}, run: (*parser).callonTriplePlusPassthrough1, expr: &seqExpr{ - pos: position{line: 398, col: 26, offset: 18255}, + pos: position{line: 471, col: 26, offset: 22051}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 398, col: 26, offset: 18255}, + pos: position{line: 471, col: 26, offset: 22051}, val: "+++", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 398, col: 32, offset: 18261}, + pos: position{line: 471, col: 32, offset: 22057}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 398, col: 40, offset: 18269}, + pos: position{line: 471, col: 40, offset: 22065}, expr: &seqExpr{ - pos: position{line: 398, col: 41, offset: 18270}, + pos: position{line: 471, col: 41, offset: 22066}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 398, col: 41, offset: 18270}, + pos: position{line: 471, col: 41, offset: 22066}, expr: &litMatcher{ - pos: position{line: 398, col: 42, offset: 18271}, + pos: position{line: 471, col: 42, offset: 22067}, val: "+++", ignoreCase: false, }, }, &anyMatcher{ - line: 398, col: 48, offset: 18277, + line: 471, col: 48, offset: 22073, }, }, }, }, }, &litMatcher{ - pos: position{line: 398, col: 52, offset: 18281}, + pos: position{line: 471, col: 52, offset: 22077}, val: "+++", ignoreCase: false, }, @@ -4285,34 +5080,34 @@ var g = &grammar{ }, { name: "PassthroughMacro", - pos: position{line: 402, col: 1, offset: 18378}, + pos: position{line: 475, col: 1, offset: 22174}, expr: &choiceExpr{ - pos: position{line: 402, col: 21, offset: 18398}, + pos: position{line: 475, col: 21, offset: 22194}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 402, col: 21, offset: 18398}, + pos: position{line: 475, col: 21, offset: 22194}, run: (*parser).callonPassthroughMacro2, expr: &seqExpr{ - pos: position{line: 402, col: 21, offset: 18398}, + pos: position{line: 475, col: 21, offset: 22194}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 402, col: 21, offset: 18398}, + pos: position{line: 475, col: 21, offset: 22194}, val: "pass:[", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 402, col: 30, offset: 18407}, + pos: position{line: 475, col: 30, offset: 22203}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 402, col: 38, offset: 18415}, + pos: position{line: 475, col: 38, offset: 22211}, expr: &ruleRefExpr{ - pos: position{line: 402, col: 39, offset: 18416}, + pos: position{line: 475, col: 39, offset: 22212}, name: "PassthroughMacroCharacter", }, }, }, &litMatcher{ - pos: position{line: 402, col: 67, offset: 18444}, + pos: position{line: 475, col: 67, offset: 22240}, val: "]", ignoreCase: false, }, @@ -4320,30 +5115,30 @@ var g = &grammar{ }, }, &actionExpr{ - pos: position{line: 404, col: 5, offset: 18535}, + pos: position{line: 477, col: 5, offset: 22331}, run: (*parser).callonPassthroughMacro9, expr: &seqExpr{ - pos: position{line: 404, col: 5, offset: 18535}, + pos: position{line: 477, col: 5, offset: 22331}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 404, col: 5, offset: 18535}, + pos: position{line: 477, col: 5, offset: 22331}, val: "pass:q[", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 404, col: 15, offset: 18545}, + pos: position{line: 477, col: 15, offset: 22341}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 404, col: 23, offset: 18553}, + pos: position{line: 477, col: 23, offset: 22349}, expr: &choiceExpr{ - pos: position{line: 404, col: 24, offset: 18554}, + pos: position{line: 477, col: 24, offset: 22350}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 404, col: 24, offset: 18554}, + pos: position{line: 477, col: 24, offset: 22350}, name: "QuotedText", }, &ruleRefExpr{ - pos: position{line: 404, col: 37, offset: 18567}, + pos: position{line: 477, col: 37, offset: 22363}, name: "PassthroughMacroCharacter", }, }, @@ -4351,7 +5146,7 @@ var g = &grammar{ }, }, &litMatcher{ - pos: position{line: 404, col: 65, offset: 18595}, + pos: position{line: 477, col: 65, offset: 22391}, val: "]", ignoreCase: false, }, @@ -4363,48 +5158,48 @@ var g = &grammar{ }, { name: "PassthroughMacroCharacter", - pos: position{line: 408, col: 1, offset: 18685}, + pos: position{line: 481, col: 1, offset: 22481}, expr: &seqExpr{ - pos: position{line: 408, col: 31, offset: 18715}, + pos: position{line: 481, col: 31, offset: 22511}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 408, col: 31, offset: 18715}, + pos: position{line: 481, col: 31, offset: 22511}, expr: &litMatcher{ - pos: position{line: 408, col: 32, offset: 18716}, + pos: position{line: 481, col: 32, offset: 22512}, val: "]", ignoreCase: false, }, }, &anyMatcher{ - line: 408, col: 36, offset: 18720, + line: 481, col: 36, offset: 22516, }, }, }, }, { name: "CrossReference", - pos: position{line: 413, col: 1, offset: 18836}, + pos: position{line: 486, col: 1, offset: 22632}, expr: &actionExpr{ - pos: position{line: 413, col: 19, offset: 18854}, + pos: position{line: 486, col: 19, offset: 22650}, run: (*parser).callonCrossReference1, expr: &seqExpr{ - pos: position{line: 413, col: 19, offset: 18854}, + pos: position{line: 486, col: 19, offset: 22650}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 413, col: 19, offset: 18854}, + pos: position{line: 486, col: 19, offset: 22650}, val: "<<", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 413, col: 24, offset: 18859}, + pos: position{line: 486, col: 24, offset: 22655}, label: "id", expr: &ruleRefExpr{ - pos: position{line: 413, col: 28, offset: 18863}, + pos: position{line: 486, col: 28, offset: 22659}, name: "ID", }, }, &litMatcher{ - pos: position{line: 413, col: 32, offset: 18867}, + pos: position{line: 486, col: 32, offset: 22663}, val: ">>", ignoreCase: false, }, @@ -4414,16 +5209,16 @@ var g = &grammar{ }, { name: "Link", - pos: position{line: 420, col: 1, offset: 19026}, + pos: position{line: 493, col: 1, offset: 22822}, expr: &choiceExpr{ - pos: position{line: 420, col: 9, offset: 19034}, + pos: position{line: 493, col: 9, offset: 22830}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 420, col: 9, offset: 19034}, + pos: position{line: 493, col: 9, offset: 22830}, name: "RelativeLink", }, &ruleRefExpr{ - pos: position{line: 420, col: 24, offset: 19049}, + pos: position{line: 493, col: 24, offset: 22845}, name: "ExternalLink", }, }, @@ -4431,52 +5226,52 @@ var g = &grammar{ }, { name: "ExternalLink", - pos: position{line: 422, col: 1, offset: 19064}, + pos: position{line: 495, col: 1, offset: 22860}, expr: &actionExpr{ - pos: position{line: 422, col: 17, offset: 19080}, + pos: position{line: 495, col: 17, offset: 22876}, run: (*parser).callonExternalLink1, expr: &seqExpr{ - pos: position{line: 422, col: 17, offset: 19080}, + pos: position{line: 495, col: 17, offset: 22876}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 422, col: 17, offset: 19080}, + pos: position{line: 495, col: 17, offset: 22876}, label: "url", expr: &seqExpr{ - pos: position{line: 422, col: 22, offset: 19085}, + pos: position{line: 495, col: 22, offset: 22881}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 422, col: 22, offset: 19085}, + pos: position{line: 495, col: 22, offset: 22881}, name: "URL_SCHEME", }, &ruleRefExpr{ - pos: position{line: 422, col: 33, offset: 19096}, + pos: position{line: 495, col: 33, offset: 22892}, name: "URL", }, }, }, }, &labeledExpr{ - pos: position{line: 422, col: 38, offset: 19101}, + pos: position{line: 495, col: 38, offset: 22897}, label: "text", expr: &zeroOrOneExpr{ - pos: position{line: 422, col: 43, offset: 19106}, + pos: position{line: 495, col: 43, offset: 22902}, expr: &seqExpr{ - pos: position{line: 422, col: 44, offset: 19107}, + pos: position{line: 495, col: 44, offset: 22903}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 422, col: 44, offset: 19107}, + pos: position{line: 495, col: 44, offset: 22903}, val: "[", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 422, col: 48, offset: 19111}, + pos: position{line: 495, col: 48, offset: 22907}, expr: &ruleRefExpr{ - pos: position{line: 422, col: 49, offset: 19112}, + pos: position{line: 495, col: 49, offset: 22908}, name: "URL_TEXT", }, }, &litMatcher{ - pos: position{line: 422, col: 60, offset: 19123}, + pos: position{line: 495, col: 60, offset: 22919}, val: "]", ignoreCase: false, }, @@ -4490,58 +5285,58 @@ var g = &grammar{ }, { name: "RelativeLink", - pos: position{line: 429, col: 1, offset: 19284}, + pos: position{line: 502, col: 1, offset: 23080}, expr: &actionExpr{ - pos: position{line: 429, col: 17, offset: 19300}, + pos: position{line: 502, col: 17, offset: 23096}, run: (*parser).callonRelativeLink1, expr: &seqExpr{ - pos: position{line: 429, col: 17, offset: 19300}, + pos: position{line: 502, col: 17, offset: 23096}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 429, col: 17, offset: 19300}, + pos: position{line: 502, col: 17, offset: 23096}, val: "link:", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 429, col: 25, offset: 19308}, + pos: position{line: 502, col: 25, offset: 23104}, label: "url", expr: &seqExpr{ - pos: position{line: 429, col: 30, offset: 19313}, + pos: position{line: 502, col: 30, offset: 23109}, exprs: []interface{}{ &zeroOrOneExpr{ - pos: position{line: 429, col: 30, offset: 19313}, + pos: position{line: 502, col: 30, offset: 23109}, expr: &ruleRefExpr{ - pos: position{line: 429, col: 30, offset: 19313}, + pos: position{line: 502, col: 30, offset: 23109}, name: "URL_SCHEME", }, }, &ruleRefExpr{ - pos: position{line: 429, col: 42, offset: 19325}, + pos: position{line: 502, col: 42, offset: 23121}, name: "URL", }, }, }, }, &labeledExpr{ - pos: position{line: 429, col: 47, offset: 19330}, + pos: position{line: 502, col: 47, offset: 23126}, label: "text", expr: &seqExpr{ - pos: position{line: 429, col: 53, offset: 19336}, + pos: position{line: 502, col: 53, offset: 23132}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 429, col: 53, offset: 19336}, + pos: position{line: 502, col: 53, offset: 23132}, val: "[", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 429, col: 57, offset: 19340}, + pos: position{line: 502, col: 57, offset: 23136}, expr: &ruleRefExpr{ - pos: position{line: 429, col: 58, offset: 19341}, + pos: position{line: 502, col: 58, offset: 23137}, name: "URL_TEXT", }, }, &litMatcher{ - pos: position{line: 429, col: 69, offset: 19352}, + pos: position{line: 502, col: 69, offset: 23148}, val: "]", ignoreCase: false, }, @@ -4554,41 +5349,41 @@ var g = &grammar{ }, { name: "BlockImage", - pos: position{line: 439, col: 1, offset: 19614}, + pos: position{line: 512, col: 1, offset: 23410}, expr: &actionExpr{ - pos: position{line: 439, col: 15, offset: 19628}, + pos: position{line: 512, col: 15, offset: 23424}, run: (*parser).callonBlockImage1, expr: &seqExpr{ - pos: position{line: 439, col: 15, offset: 19628}, + pos: position{line: 512, col: 15, offset: 23424}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 439, col: 15, offset: 19628}, + pos: position{line: 512, col: 15, offset: 23424}, label: "attributes", expr: &zeroOrMoreExpr{ - pos: position{line: 439, col: 26, offset: 19639}, + pos: position{line: 512, col: 26, offset: 23435}, expr: &ruleRefExpr{ - pos: position{line: 439, col: 27, offset: 19640}, + pos: position{line: 512, col: 27, offset: 23436}, name: "ElementAttribute", }, }, }, &labeledExpr{ - pos: position{line: 439, col: 46, offset: 19659}, + pos: position{line: 512, col: 46, offset: 23455}, label: "image", expr: &ruleRefExpr{ - pos: position{line: 439, col: 52, offset: 19665}, + pos: position{line: 512, col: 52, offset: 23461}, name: "BlockImageMacro", }, }, &zeroOrMoreExpr{ - pos: position{line: 439, col: 69, offset: 19682}, + pos: position{line: 512, col: 69, offset: 23478}, expr: &ruleRefExpr{ - pos: position{line: 439, col: 69, offset: 19682}, + pos: position{line: 512, col: 69, offset: 23478}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 439, col: 73, offset: 19686}, + pos: position{line: 512, col: 73, offset: 23482}, name: "EOL", }, }, @@ -4597,44 +5392,44 @@ var g = &grammar{ }, { name: "BlockImageMacro", - pos: position{line: 444, col: 1, offset: 19845}, + pos: position{line: 517, col: 1, offset: 23641}, expr: &actionExpr{ - pos: position{line: 444, col: 20, offset: 19864}, + pos: position{line: 517, col: 20, offset: 23660}, run: (*parser).callonBlockImageMacro1, expr: &seqExpr{ - pos: position{line: 444, col: 20, offset: 19864}, + pos: position{line: 517, col: 20, offset: 23660}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 444, col: 20, offset: 19864}, + pos: position{line: 517, col: 20, offset: 23660}, val: "image::", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 444, col: 30, offset: 19874}, + pos: position{line: 517, col: 30, offset: 23670}, label: "path", expr: &ruleRefExpr{ - pos: position{line: 444, col: 36, offset: 19880}, + pos: position{line: 517, col: 36, offset: 23676}, name: "URL", }, }, &litMatcher{ - pos: position{line: 444, col: 41, offset: 19885}, + pos: position{line: 517, col: 41, offset: 23681}, val: "[", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 444, col: 45, offset: 19889}, + pos: position{line: 517, col: 45, offset: 23685}, label: "attributes", expr: &zeroOrOneExpr{ - pos: position{line: 444, col: 57, offset: 19901}, + pos: position{line: 517, col: 57, offset: 23697}, expr: &ruleRefExpr{ - pos: position{line: 444, col: 57, offset: 19901}, + pos: position{line: 517, col: 57, offset: 23697}, name: "URL_TEXT", }, }, }, &litMatcher{ - pos: position{line: 444, col: 68, offset: 19912}, + pos: position{line: 517, col: 68, offset: 23708}, val: "]", ignoreCase: false, }, @@ -4644,15 +5439,15 @@ var g = &grammar{ }, { name: "InlineImage", - pos: position{line: 448, col: 1, offset: 19979}, + pos: position{line: 521, col: 1, offset: 23775}, expr: &actionExpr{ - pos: position{line: 448, col: 16, offset: 19994}, + pos: position{line: 521, col: 16, offset: 23790}, run: (*parser).callonInlineImage1, expr: &labeledExpr{ - pos: position{line: 448, col: 16, offset: 19994}, + pos: position{line: 521, col: 16, offset: 23790}, label: "image", expr: &ruleRefExpr{ - pos: position{line: 448, col: 22, offset: 20000}, + pos: position{line: 521, col: 22, offset: 23796}, name: "InlineImageMacro", }, }, @@ -4660,52 +5455,52 @@ var g = &grammar{ }, { name: "InlineImageMacro", - pos: position{line: 453, col: 1, offset: 20145}, + pos: position{line: 526, col: 1, offset: 23941}, expr: &actionExpr{ - pos: position{line: 453, col: 21, offset: 20165}, + pos: position{line: 526, col: 21, offset: 23961}, run: (*parser).callonInlineImageMacro1, expr: &seqExpr{ - pos: position{line: 453, col: 21, offset: 20165}, + pos: position{line: 526, col: 21, offset: 23961}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 453, col: 21, offset: 20165}, + pos: position{line: 526, col: 21, offset: 23961}, val: "image:", ignoreCase: false, }, ¬Expr{ - pos: position{line: 453, col: 30, offset: 20174}, + pos: position{line: 526, col: 30, offset: 23970}, expr: &litMatcher{ - pos: position{line: 453, col: 31, offset: 20175}, + pos: position{line: 526, col: 31, offset: 23971}, val: ":", ignoreCase: false, }, }, &labeledExpr{ - pos: position{line: 453, col: 35, offset: 20179}, + pos: position{line: 526, col: 35, offset: 23975}, label: "path", expr: &ruleRefExpr{ - pos: position{line: 453, col: 41, offset: 20185}, + pos: position{line: 526, col: 41, offset: 23981}, name: "URL", }, }, &litMatcher{ - pos: position{line: 453, col: 46, offset: 20190}, + pos: position{line: 526, col: 46, offset: 23986}, val: "[", ignoreCase: false, }, &labeledExpr{ - pos: position{line: 453, col: 50, offset: 20194}, + pos: position{line: 526, col: 50, offset: 23990}, label: "attributes", expr: &zeroOrOneExpr{ - pos: position{line: 453, col: 62, offset: 20206}, + pos: position{line: 526, col: 62, offset: 24002}, expr: &ruleRefExpr{ - pos: position{line: 453, col: 62, offset: 20206}, + pos: position{line: 526, col: 62, offset: 24002}, name: "URL_TEXT", }, }, }, &litMatcher{ - pos: position{line: 453, col: 73, offset: 20217}, + pos: position{line: 526, col: 73, offset: 24013}, val: "]", ignoreCase: false, }, @@ -4715,20 +5510,20 @@ var g = &grammar{ }, { name: "DelimitedBlock", - pos: position{line: 460, col: 1, offset: 20547}, + pos: position{line: 533, col: 1, offset: 24343}, expr: &choiceExpr{ - pos: position{line: 460, col: 19, offset: 20565}, + pos: position{line: 533, col: 19, offset: 24361}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 460, col: 19, offset: 20565}, + pos: position{line: 533, col: 19, offset: 24361}, name: "FencedBlock", }, &ruleRefExpr{ - pos: position{line: 460, col: 33, offset: 20579}, + pos: position{line: 533, col: 33, offset: 24375}, name: "ListingBlock", }, &ruleRefExpr{ - pos: position{line: 460, col: 48, offset: 20594}, + pos: position{line: 533, col: 48, offset: 24390}, name: "ExampleBlock", }, }, @@ -4736,24 +5531,24 @@ var g = &grammar{ }, { name: "BlockDelimiter", - pos: position{line: 462, col: 1, offset: 20608}, + pos: position{line: 535, col: 1, offset: 24404}, expr: &choiceExpr{ - pos: position{line: 462, col: 19, offset: 20626}, + pos: position{line: 535, col: 19, offset: 24422}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 462, col: 19, offset: 20626}, + pos: position{line: 535, col: 19, offset: 24422}, name: "LiteralBlockDelimiter", }, &ruleRefExpr{ - pos: position{line: 462, col: 43, offset: 20650}, + pos: position{line: 535, col: 43, offset: 24446}, name: "FencedBlockDelimiter", }, &ruleRefExpr{ - pos: position{line: 462, col: 66, offset: 20673}, + pos: position{line: 535, col: 66, offset: 24469}, name: "ListingBlockDelimiter", }, &ruleRefExpr{ - pos: position{line: 462, col: 90, offset: 20697}, + pos: position{line: 535, col: 90, offset: 24493}, name: "ExampleBlockDelimiter", }, }, @@ -4761,72 +5556,72 @@ var g = &grammar{ }, { name: "FencedBlockDelimiter", - pos: position{line: 464, col: 1, offset: 20720}, + pos: position{line: 537, col: 1, offset: 24516}, expr: &litMatcher{ - pos: position{line: 464, col: 25, offset: 20744}, + pos: position{line: 537, col: 25, offset: 24540}, val: "```", ignoreCase: false, }, }, { name: "FencedBlock", - pos: position{line: 466, col: 1, offset: 20751}, + pos: position{line: 539, col: 1, offset: 24547}, expr: &actionExpr{ - pos: position{line: 466, col: 16, offset: 20766}, + pos: position{line: 539, col: 16, offset: 24562}, run: (*parser).callonFencedBlock1, expr: &seqExpr{ - pos: position{line: 466, col: 16, offset: 20766}, + pos: position{line: 539, col: 16, offset: 24562}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 466, col: 16, offset: 20766}, + pos: position{line: 539, col: 16, offset: 24562}, name: "FencedBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 466, col: 37, offset: 20787}, + pos: position{line: 539, col: 37, offset: 24583}, expr: &ruleRefExpr{ - pos: position{line: 466, col: 37, offset: 20787}, + pos: position{line: 539, col: 37, offset: 24583}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 466, col: 41, offset: 20791}, + pos: position{line: 539, col: 41, offset: 24587}, name: "NEWLINE", }, &labeledExpr{ - pos: position{line: 466, col: 49, offset: 20799}, + pos: position{line: 539, col: 49, offset: 24595}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 466, col: 57, offset: 20807}, + pos: position{line: 539, col: 57, offset: 24603}, expr: &seqExpr{ - pos: position{line: 466, col: 58, offset: 20808}, + pos: position{line: 539, col: 58, offset: 24604}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 466, col: 58, offset: 20808}, + pos: position{line: 539, col: 58, offset: 24604}, expr: &ruleRefExpr{ - pos: position{line: 466, col: 59, offset: 20809}, + pos: position{line: 539, col: 59, offset: 24605}, name: "FencedBlockDelimiter", }, }, &anyMatcher{ - line: 466, col: 80, offset: 20830, + line: 539, col: 80, offset: 24626, }, }, }, }, }, &ruleRefExpr{ - pos: position{line: 466, col: 84, offset: 20834}, + pos: position{line: 539, col: 84, offset: 24630}, name: "FencedBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 466, col: 105, offset: 20855}, + pos: position{line: 539, col: 105, offset: 24651}, expr: &ruleRefExpr{ - pos: position{line: 466, col: 105, offset: 20855}, + pos: position{line: 539, col: 105, offset: 24651}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 466, col: 109, offset: 20859}, + pos: position{line: 539, col: 109, offset: 24655}, name: "EOL", }, }, @@ -4835,72 +5630,72 @@ var g = &grammar{ }, { name: "ListingBlockDelimiter", - pos: position{line: 470, col: 1, offset: 20952}, + pos: position{line: 543, col: 1, offset: 24748}, expr: &litMatcher{ - pos: position{line: 470, col: 26, offset: 20977}, + pos: position{line: 543, col: 26, offset: 24773}, val: "----", ignoreCase: false, }, }, { name: "ListingBlock", - pos: position{line: 472, col: 1, offset: 20985}, + pos: position{line: 545, col: 1, offset: 24781}, expr: &actionExpr{ - pos: position{line: 472, col: 17, offset: 21001}, + pos: position{line: 545, col: 17, offset: 24797}, run: (*parser).callonListingBlock1, expr: &seqExpr{ - pos: position{line: 472, col: 17, offset: 21001}, + pos: position{line: 545, col: 17, offset: 24797}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 472, col: 17, offset: 21001}, + pos: position{line: 545, col: 17, offset: 24797}, name: "ListingBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 472, col: 39, offset: 21023}, + pos: position{line: 545, col: 39, offset: 24819}, expr: &ruleRefExpr{ - pos: position{line: 472, col: 39, offset: 21023}, + pos: position{line: 545, col: 39, offset: 24819}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 472, col: 43, offset: 21027}, + pos: position{line: 545, col: 43, offset: 24823}, name: "NEWLINE", }, &labeledExpr{ - pos: position{line: 472, col: 51, offset: 21035}, + pos: position{line: 545, col: 51, offset: 24831}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 472, col: 59, offset: 21043}, + pos: position{line: 545, col: 59, offset: 24839}, expr: &seqExpr{ - pos: position{line: 472, col: 60, offset: 21044}, + pos: position{line: 545, col: 60, offset: 24840}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 472, col: 60, offset: 21044}, + pos: position{line: 545, col: 60, offset: 24840}, expr: &ruleRefExpr{ - pos: position{line: 472, col: 61, offset: 21045}, + pos: position{line: 545, col: 61, offset: 24841}, name: "ListingBlockDelimiter", }, }, &anyMatcher{ - line: 472, col: 83, offset: 21067, + line: 545, col: 83, offset: 24863, }, }, }, }, }, &ruleRefExpr{ - pos: position{line: 472, col: 87, offset: 21071}, + pos: position{line: 545, col: 87, offset: 24867}, name: "ListingBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 472, col: 109, offset: 21093}, + pos: position{line: 545, col: 109, offset: 24889}, expr: &ruleRefExpr{ - pos: position{line: 472, col: 109, offset: 21093}, + pos: position{line: 545, col: 109, offset: 24889}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 472, col: 113, offset: 21097}, + pos: position{line: 545, col: 113, offset: 24893}, name: "EOL", }, }, @@ -4909,66 +5704,66 @@ var g = &grammar{ }, { name: "ExampleBlockDelimiter", - pos: position{line: 476, col: 1, offset: 21191}, + pos: position{line: 549, col: 1, offset: 24987}, expr: &litMatcher{ - pos: position{line: 476, col: 26, offset: 21216}, + pos: position{line: 549, col: 26, offset: 25012}, val: "====", ignoreCase: false, }, }, { name: "ExampleBlock", - pos: position{line: 478, col: 1, offset: 21224}, + pos: position{line: 551, col: 1, offset: 25020}, expr: &actionExpr{ - pos: position{line: 478, col: 17, offset: 21240}, + pos: position{line: 551, col: 17, offset: 25036}, run: (*parser).callonExampleBlock1, expr: &seqExpr{ - pos: position{line: 478, col: 17, offset: 21240}, + pos: position{line: 551, col: 17, offset: 25036}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 478, col: 17, offset: 21240}, + pos: position{line: 551, col: 17, offset: 25036}, label: "attributes", expr: &zeroOrMoreExpr{ - pos: position{line: 478, col: 28, offset: 21251}, + pos: position{line: 551, col: 28, offset: 25047}, expr: &ruleRefExpr{ - pos: position{line: 478, col: 29, offset: 21252}, + pos: position{line: 551, col: 29, offset: 25048}, name: "ElementAttribute", }, }, }, &ruleRefExpr{ - pos: position{line: 478, col: 48, offset: 21271}, + pos: position{line: 551, col: 48, offset: 25067}, name: "ExampleBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 478, col: 70, offset: 21293}, + pos: position{line: 551, col: 70, offset: 25089}, expr: &ruleRefExpr{ - pos: position{line: 478, col: 70, offset: 21293}, + pos: position{line: 551, col: 70, offset: 25089}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 478, col: 74, offset: 21297}, + pos: position{line: 551, col: 74, offset: 25093}, name: "NEWLINE", }, &labeledExpr{ - pos: position{line: 478, col: 82, offset: 21305}, + pos: position{line: 551, col: 82, offset: 25101}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 478, col: 90, offset: 21313}, + pos: position{line: 551, col: 90, offset: 25109}, expr: &choiceExpr{ - pos: position{line: 478, col: 91, offset: 21314}, + pos: position{line: 551, col: 91, offset: 25110}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 478, col: 91, offset: 21314}, + pos: position{line: 551, col: 91, offset: 25110}, name: "List", }, &ruleRefExpr{ - pos: position{line: 478, col: 98, offset: 21321}, + pos: position{line: 551, col: 98, offset: 25117}, name: "Paragraph", }, &ruleRefExpr{ - pos: position{line: 478, col: 110, offset: 21333}, + pos: position{line: 551, col: 110, offset: 25129}, name: "BlankLine", }, }, @@ -4976,18 +5771,18 @@ var g = &grammar{ }, }, &ruleRefExpr{ - pos: position{line: 478, col: 123, offset: 21346}, + pos: position{line: 551, col: 123, offset: 25142}, name: "ExampleBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 478, col: 145, offset: 21368}, + pos: position{line: 551, col: 145, offset: 25164}, expr: &ruleRefExpr{ - pos: position{line: 478, col: 145, offset: 21368}, + pos: position{line: 551, col: 145, offset: 25164}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 478, col: 149, offset: 21372}, + pos: position{line: 551, col: 149, offset: 25168}, name: "EOL", }, }, @@ -4996,20 +5791,20 @@ var g = &grammar{ }, { name: "LiteralBlock", - pos: position{line: 485, col: 1, offset: 21756}, + pos: position{line: 558, col: 1, offset: 25552}, expr: &choiceExpr{ - pos: position{line: 485, col: 17, offset: 21772}, + pos: position{line: 558, col: 17, offset: 25568}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 485, col: 17, offset: 21772}, + pos: position{line: 558, col: 17, offset: 25568}, name: "ParagraphWithSpaces", }, &ruleRefExpr{ - pos: position{line: 485, col: 39, offset: 21794}, + pos: position{line: 558, col: 39, offset: 25590}, name: "ParagraphWithLiteralBlockDelimiter", }, &ruleRefExpr{ - pos: position{line: 485, col: 76, offset: 21831}, + pos: position{line: 558, col: 76, offset: 25627}, name: "ParagraphWithLiteralAttribute", }, }, @@ -5017,41 +5812,41 @@ var g = &grammar{ }, { name: "ParagraphWithSpaces", - pos: position{line: 488, col: 1, offset: 21926}, + pos: position{line: 561, col: 1, offset: 25722}, expr: &actionExpr{ - pos: position{line: 488, col: 24, offset: 21949}, + pos: position{line: 561, col: 24, offset: 25745}, run: (*parser).callonParagraphWithSpaces1, expr: &seqExpr{ - pos: position{line: 488, col: 24, offset: 21949}, + pos: position{line: 561, col: 24, offset: 25745}, exprs: []interface{}{ &labeledExpr{ - pos: position{line: 488, col: 24, offset: 21949}, + pos: position{line: 561, col: 24, offset: 25745}, label: "spaces", expr: &oneOrMoreExpr{ - pos: position{line: 488, col: 32, offset: 21957}, + pos: position{line: 561, col: 32, offset: 25753}, expr: &ruleRefExpr{ - pos: position{line: 488, col: 32, offset: 21957}, + pos: position{line: 561, col: 32, offset: 25753}, name: "WS", }, }, }, ¬Expr{ - pos: position{line: 488, col: 37, offset: 21962}, + pos: position{line: 561, col: 37, offset: 25758}, expr: &ruleRefExpr{ - pos: position{line: 488, col: 38, offset: 21963}, + pos: position{line: 561, col: 38, offset: 25759}, name: "NEWLINE", }, }, &labeledExpr{ - pos: position{line: 488, col: 46, offset: 21971}, + pos: position{line: 561, col: 46, offset: 25767}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 488, col: 55, offset: 21980}, + pos: position{line: 561, col: 55, offset: 25776}, name: "LiteralBlockContent", }, }, &ruleRefExpr{ - pos: position{line: 488, col: 76, offset: 22001}, + pos: position{line: 561, col: 76, offset: 25797}, name: "EndOfLiteralBlock", }, }, @@ -5060,36 +5855,36 @@ var g = &grammar{ }, { name: "LiteralBlockContent", - pos: position{line: 493, col: 1, offset: 22182}, + pos: position{line: 566, col: 1, offset: 25978}, expr: &actionExpr{ - pos: position{line: 493, col: 24, offset: 22205}, + pos: position{line: 566, col: 24, offset: 26001}, run: (*parser).callonLiteralBlockContent1, expr: &labeledExpr{ - pos: position{line: 493, col: 24, offset: 22205}, + pos: position{line: 566, col: 24, offset: 26001}, label: "content", expr: &oneOrMoreExpr{ - pos: position{line: 493, col: 32, offset: 22213}, + pos: position{line: 566, col: 32, offset: 26009}, expr: &seqExpr{ - pos: position{line: 493, col: 33, offset: 22214}, + pos: position{line: 566, col: 33, offset: 26010}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 493, col: 33, offset: 22214}, + pos: position{line: 566, col: 33, offset: 26010}, expr: &seqExpr{ - pos: position{line: 493, col: 35, offset: 22216}, + pos: position{line: 566, col: 35, offset: 26012}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 493, col: 35, offset: 22216}, + pos: position{line: 566, col: 35, offset: 26012}, name: "NEWLINE", }, &ruleRefExpr{ - pos: position{line: 493, col: 43, offset: 22224}, + pos: position{line: 566, col: 43, offset: 26020}, name: "BlankLine", }, }, }, }, &anyMatcher{ - line: 493, col: 54, offset: 22235, + line: 566, col: 54, offset: 26031, }, }, }, @@ -5099,29 +5894,29 @@ var g = &grammar{ }, { name: "EndOfLiteralBlock", - pos: position{line: 498, col: 1, offset: 22320}, + pos: position{line: 571, col: 1, offset: 26116}, expr: &choiceExpr{ - pos: position{line: 498, col: 22, offset: 22341}, + pos: position{line: 571, col: 22, offset: 26137}, alternatives: []interface{}{ &seqExpr{ - pos: position{line: 498, col: 22, offset: 22341}, + pos: position{line: 571, col: 22, offset: 26137}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 498, col: 22, offset: 22341}, + pos: position{line: 571, col: 22, offset: 26137}, name: "NEWLINE", }, &ruleRefExpr{ - pos: position{line: 498, col: 30, offset: 22349}, + pos: position{line: 571, col: 30, offset: 26145}, name: "BlankLine", }, }, }, &ruleRefExpr{ - pos: position{line: 498, col: 42, offset: 22361}, + pos: position{line: 571, col: 42, offset: 26157}, name: "NEWLINE", }, &ruleRefExpr{ - pos: position{line: 498, col: 52, offset: 22371}, + pos: position{line: 571, col: 52, offset: 26167}, name: "EOF", }, }, @@ -5129,63 +5924,63 @@ var g = &grammar{ }, { name: "ParagraphWithLiteralBlockDelimiter", - pos: position{line: 501, col: 1, offset: 22431}, + pos: position{line: 574, col: 1, offset: 26227}, expr: &actionExpr{ - pos: position{line: 501, col: 39, offset: 22469}, + pos: position{line: 574, col: 39, offset: 26265}, run: (*parser).callonParagraphWithLiteralBlockDelimiter1, expr: &seqExpr{ - pos: position{line: 501, col: 39, offset: 22469}, + pos: position{line: 574, col: 39, offset: 26265}, exprs: []interface{}{ &ruleRefExpr{ - pos: position{line: 501, col: 39, offset: 22469}, + pos: position{line: 574, col: 39, offset: 26265}, name: "LiteralBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 501, col: 61, offset: 22491}, + pos: position{line: 574, col: 61, offset: 26287}, expr: &ruleRefExpr{ - pos: position{line: 501, col: 61, offset: 22491}, + pos: position{line: 574, col: 61, offset: 26287}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 501, col: 65, offset: 22495}, + pos: position{line: 574, col: 65, offset: 26291}, name: "NEWLINE", }, &labeledExpr{ - pos: position{line: 501, col: 73, offset: 22503}, + pos: position{line: 574, col: 73, offset: 26299}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 501, col: 81, offset: 22511}, + pos: position{line: 574, col: 81, offset: 26307}, expr: &seqExpr{ - pos: position{line: 501, col: 82, offset: 22512}, + pos: position{line: 574, col: 82, offset: 26308}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 501, col: 82, offset: 22512}, + pos: position{line: 574, col: 82, offset: 26308}, expr: &ruleRefExpr{ - pos: position{line: 501, col: 83, offset: 22513}, + pos: position{line: 574, col: 83, offset: 26309}, name: "LiteralBlockDelimiter", }, }, &anyMatcher{ - line: 501, col: 105, offset: 22535, + line: 574, col: 105, offset: 26331, }, }, }, }, }, &ruleRefExpr{ - pos: position{line: 501, col: 109, offset: 22539}, + pos: position{line: 574, col: 109, offset: 26335}, name: "LiteralBlockDelimiter", }, &zeroOrMoreExpr{ - pos: position{line: 501, col: 131, offset: 22561}, + pos: position{line: 574, col: 131, offset: 26357}, expr: &ruleRefExpr{ - pos: position{line: 501, col: 131, offset: 22561}, + pos: position{line: 574, col: 131, offset: 26357}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 501, col: 135, offset: 22565}, + pos: position{line: 574, col: 135, offset: 26361}, name: "EOL", }, }, @@ -5194,48 +5989,48 @@ var g = &grammar{ }, { name: "LiteralBlockDelimiter", - pos: position{line: 505, col: 1, offset: 22649}, + pos: position{line: 578, col: 1, offset: 26445}, expr: &litMatcher{ - pos: position{line: 505, col: 26, offset: 22674}, + pos: position{line: 578, col: 26, offset: 26470}, val: "....", ignoreCase: false, }, }, { name: "ParagraphWithLiteralAttribute", - pos: position{line: 508, col: 1, offset: 22736}, + pos: position{line: 581, col: 1, offset: 26532}, expr: &actionExpr{ - pos: position{line: 508, col: 34, offset: 22769}, + pos: position{line: 581, col: 34, offset: 26565}, run: (*parser).callonParagraphWithLiteralAttribute1, expr: &seqExpr{ - pos: position{line: 508, col: 34, offset: 22769}, + pos: position{line: 581, col: 34, offset: 26565}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 508, col: 34, offset: 22769}, + pos: position{line: 581, col: 34, offset: 26565}, val: "[literal]", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 508, col: 46, offset: 22781}, + pos: position{line: 581, col: 46, offset: 26577}, expr: &ruleRefExpr{ - pos: position{line: 508, col: 46, offset: 22781}, + pos: position{line: 581, col: 46, offset: 26577}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 508, col: 50, offset: 22785}, + pos: position{line: 581, col: 50, offset: 26581}, name: "NEWLINE", }, &labeledExpr{ - pos: position{line: 508, col: 58, offset: 22793}, + pos: position{line: 581, col: 58, offset: 26589}, label: "content", expr: &ruleRefExpr{ - pos: position{line: 508, col: 67, offset: 22802}, + pos: position{line: 581, col: 67, offset: 26598}, name: "LiteralBlockContent", }, }, &ruleRefExpr{ - pos: position{line: 508, col: 88, offset: 22823}, + pos: position{line: 581, col: 88, offset: 26619}, name: "EndOfLiteralBlock", }, }, @@ -5244,132 +6039,352 @@ var g = &grammar{ }, { name: "ElementAttribute", - pos: position{line: 515, col: 1, offset: 23035}, - expr: &choiceExpr{ - pos: position{line: 515, col: 21, offset: 23055}, - alternatives: []interface{}{ - &ruleRefExpr{ - pos: position{line: 515, col: 21, offset: 23055}, - name: "ElementLink", - }, - &ruleRefExpr{ - pos: position{line: 515, col: 35, offset: 23069}, - name: "ElementID", - }, - &ruleRefExpr{ - pos: position{line: 515, col: 47, offset: 23081}, - name: "ElementTitle", - }, - &ruleRefExpr{ - pos: position{line: 515, col: 62, offset: 23096}, - name: "InvalidElementAttribute", + pos: position{line: 588, col: 1, offset: 26831}, + expr: &actionExpr{ + pos: position{line: 588, col: 21, offset: 26851}, + run: (*parser).callonElementAttribute1, + expr: &seqExpr{ + pos: position{line: 588, col: 21, offset: 26851}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 588, col: 21, offset: 26851}, + label: "attr", + expr: &choiceExpr{ + pos: position{line: 588, col: 27, offset: 26857}, + alternatives: []interface{}{ + &ruleRefExpr{ + pos: position{line: 588, col: 27, offset: 26857}, + name: "ElementLink", + }, + &ruleRefExpr{ + pos: position{line: 588, col: 41, offset: 26871}, + name: "ElementID", + }, + &ruleRefExpr{ + pos: position{line: 588, col: 53, offset: 26883}, + name: "ElementTitle", + }, + &ruleRefExpr{ + pos: position{line: 588, col: 68, offset: 26898}, + name: "AttributeGroup", + }, + &ruleRefExpr{ + pos: position{line: 588, col: 85, offset: 26915}, + name: "InvalidElementAttribute", + }, + }, + }, + }, + &ruleRefExpr{ + pos: position{line: 588, col: 110, offset: 26940}, + name: "EOL", + }, }, }, }, }, { name: "ElementLink", - pos: position{line: 518, col: 1, offset: 23176}, + pos: position{line: 593, col: 1, offset: 27086}, expr: &actionExpr{ - pos: position{line: 518, col: 16, offset: 23191}, + pos: position{line: 593, col: 16, offset: 27101}, run: (*parser).callonElementLink1, expr: &seqExpr{ - pos: position{line: 518, col: 16, offset: 23191}, + pos: position{line: 593, col: 16, offset: 27101}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 518, col: 16, offset: 23191}, + pos: position{line: 593, col: 16, offset: 27101}, val: "[link=", ignoreCase: false, }, &zeroOrMoreExpr{ - pos: position{line: 518, col: 25, offset: 23200}, + pos: position{line: 593, col: 25, offset: 27110}, expr: &ruleRefExpr{ - pos: position{line: 518, col: 25, offset: 23200}, + pos: position{line: 593, col: 25, offset: 27110}, name: "WS", }, }, &labeledExpr{ - pos: position{line: 518, col: 29, offset: 23204}, + pos: position{line: 593, col: 29, offset: 27114}, label: "path", expr: &ruleRefExpr{ - pos: position{line: 518, col: 34, offset: 23209}, + pos: position{line: 593, col: 34, offset: 27119}, name: "URL", }, }, &zeroOrMoreExpr{ - pos: position{line: 518, col: 38, offset: 23213}, + pos: position{line: 593, col: 38, offset: 27123}, expr: &ruleRefExpr{ - pos: position{line: 518, col: 38, offset: 23213}, + pos: position{line: 593, col: 38, offset: 27123}, name: "WS", }, }, &litMatcher{ - pos: position{line: 518, col: 42, offset: 23217}, + pos: position{line: 593, col: 42, offset: 27127}, val: "]", ignoreCase: false, }, - &ruleRefExpr{ - pos: position{line: 518, col: 46, offset: 23221}, - name: "EOL", - }, }, }, }, }, { name: "ElementID", - pos: position{line: 522, col: 1, offset: 23277}, + pos: position{line: 597, col: 1, offset: 27183}, expr: &choiceExpr{ - pos: position{line: 522, col: 14, offset: 23290}, + pos: position{line: 597, col: 14, offset: 27196}, alternatives: []interface{}{ &actionExpr{ - pos: position{line: 522, col: 14, offset: 23290}, + pos: position{line: 597, col: 14, offset: 27196}, run: (*parser).callonElementID2, + expr: &labeledExpr{ + pos: position{line: 597, col: 14, offset: 27196}, + label: "id", + expr: &ruleRefExpr{ + pos: position{line: 597, col: 18, offset: 27200}, + name: "InlineElementID", + }, + }, + }, + &actionExpr{ + pos: position{line: 599, col: 5, offset: 27242}, + run: (*parser).callonElementID5, expr: &seqExpr{ - pos: position{line: 522, col: 14, offset: 23290}, + pos: position{line: 599, col: 5, offset: 27242}, exprs: []interface{}{ + &litMatcher{ + pos: position{line: 599, col: 5, offset: 27242}, + val: "[#", + ignoreCase: false, + }, &labeledExpr{ - pos: position{line: 522, col: 14, offset: 23290}, + pos: position{line: 599, col: 10, offset: 27247}, label: "id", expr: &ruleRefExpr{ - pos: position{line: 522, col: 18, offset: 23294}, - name: "InlineElementID", + pos: position{line: 599, col: 14, offset: 27251}, + name: "ID", }, }, - &ruleRefExpr{ - pos: position{line: 522, col: 35, offset: 23311}, - name: "EOL", + &litMatcher{ + pos: position{line: 599, col: 18, offset: 27255}, + val: "]", + ignoreCase: false, + }, + }, + }, + }, + }, + }, + }, + { + name: "InlineElementID", + pos: position{line: 603, col: 1, offset: 27307}, + expr: &actionExpr{ + pos: position{line: 603, col: 20, offset: 27326}, + run: (*parser).callonInlineElementID1, + expr: &seqExpr{ + pos: position{line: 603, col: 20, offset: 27326}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 603, col: 20, offset: 27326}, + val: "[[", + ignoreCase: false, + }, + &labeledExpr{ + pos: position{line: 603, col: 25, offset: 27331}, + label: "id", + expr: &ruleRefExpr{ + pos: position{line: 603, col: 29, offset: 27335}, + name: "ID", + }, + }, + &litMatcher{ + pos: position{line: 603, col: 33, offset: 27339}, + val: "]]", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "ElementTitle", + pos: position{line: 609, col: 1, offset: 27534}, + expr: &actionExpr{ + pos: position{line: 609, col: 17, offset: 27550}, + run: (*parser).callonElementTitle1, + expr: &seqExpr{ + pos: position{line: 609, col: 17, offset: 27550}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 609, col: 17, offset: 27550}, + val: ".", + ignoreCase: false, + }, + ¬Expr{ + pos: position{line: 609, col: 21, offset: 27554}, + expr: &litMatcher{ + pos: position{line: 609, col: 22, offset: 27555}, + val: ".", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 609, col: 26, offset: 27559}, + expr: &ruleRefExpr{ + pos: position{line: 609, col: 27, offset: 27560}, + name: "WS", + }, + }, + &labeledExpr{ + pos: position{line: 609, col: 30, offset: 27563}, + label: "title", + expr: &oneOrMoreExpr{ + pos: position{line: 609, col: 36, offset: 27569}, + expr: &seqExpr{ + pos: position{line: 609, col: 37, offset: 27570}, + exprs: []interface{}{ + ¬Expr{ + pos: position{line: 609, col: 37, offset: 27570}, + expr: &ruleRefExpr{ + pos: position{line: 609, col: 38, offset: 27571}, + name: "NEWLINE", + }, + }, + &anyMatcher{ + line: 609, col: 46, offset: 27579, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "AttributeGroup", + pos: position{line: 614, col: 1, offset: 27707}, + expr: &actionExpr{ + pos: position{line: 614, col: 19, offset: 27725}, + run: (*parser).callonAttributeGroup1, + expr: &seqExpr{ + pos: position{line: 614, col: 19, offset: 27725}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 614, col: 19, offset: 27725}, + val: "[", + ignoreCase: false, + }, + &labeledExpr{ + pos: position{line: 614, col: 23, offset: 27729}, + label: "attributes", + expr: &zeroOrMoreExpr{ + pos: position{line: 614, col: 34, offset: 27740}, + expr: &ruleRefExpr{ + pos: position{line: 614, col: 35, offset: 27741}, + name: "GenericAttribute", + }, + }, + }, + &litMatcher{ + pos: position{line: 614, col: 54, offset: 27760}, + val: "]", + ignoreCase: false, + }, + }, + }, + }, + }, + { + name: "GenericAttribute", + pos: position{line: 618, col: 1, offset: 27832}, + expr: &choiceExpr{ + pos: position{line: 618, col: 21, offset: 27852}, + alternatives: []interface{}{ + &actionExpr{ + pos: position{line: 618, col: 21, offset: 27852}, + run: (*parser).callonGenericAttribute2, + expr: &seqExpr{ + pos: position{line: 618, col: 21, offset: 27852}, + exprs: []interface{}{ + &labeledExpr{ + pos: position{line: 618, col: 21, offset: 27852}, + label: "key", + expr: &ruleRefExpr{ + pos: position{line: 618, col: 26, offset: 27857}, + name: "AttributeKey", + }, + }, + &litMatcher{ + pos: position{line: 618, col: 40, offset: 27871}, + val: "=", + ignoreCase: false, + }, + &labeledExpr{ + pos: position{line: 618, col: 44, offset: 27875}, + label: "value", + expr: &ruleRefExpr{ + pos: position{line: 618, col: 51, offset: 27882}, + name: "AttributeValue", + }, + }, + &zeroOrOneExpr{ + pos: position{line: 618, col: 67, offset: 27898}, + expr: &seqExpr{ + pos: position{line: 618, col: 68, offset: 27899}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 618, col: 68, offset: 27899}, + val: ",", + ignoreCase: false, + }, + &zeroOrMoreExpr{ + pos: position{line: 618, col: 72, offset: 27903}, + expr: &ruleRefExpr{ + pos: position{line: 618, col: 72, offset: 27903}, + name: "WS", + }, + }, + }, + }, }, }, }, }, &actionExpr{ - pos: position{line: 524, col: 5, offset: 23340}, - run: (*parser).callonElementID7, + pos: position{line: 620, col: 5, offset: 28012}, + run: (*parser).callonGenericAttribute14, expr: &seqExpr{ - pos: position{line: 524, col: 5, offset: 23340}, + pos: position{line: 620, col: 5, offset: 28012}, exprs: []interface{}{ - &litMatcher{ - pos: position{line: 524, col: 5, offset: 23340}, - val: "[#", - ignoreCase: false, - }, &labeledExpr{ - pos: position{line: 524, col: 10, offset: 23345}, - label: "id", + pos: position{line: 620, col: 5, offset: 28012}, + label: "key", expr: &ruleRefExpr{ - pos: position{line: 524, col: 14, offset: 23349}, - name: "ID", + pos: position{line: 620, col: 10, offset: 28017}, + name: "AttributeKey", }, }, - &litMatcher{ - pos: position{line: 524, col: 18, offset: 23353}, - val: "]", - ignoreCase: false, - }, - &ruleRefExpr{ - pos: position{line: 524, col: 22, offset: 23357}, - name: "EOL", + &zeroOrOneExpr{ + pos: position{line: 620, col: 24, offset: 28031}, + expr: &seqExpr{ + pos: position{line: 620, col: 25, offset: 28032}, + exprs: []interface{}{ + &litMatcher{ + pos: position{line: 620, col: 25, offset: 28032}, + val: ",", + ignoreCase: false, + }, + &zeroOrMoreExpr{ + pos: position{line: 620, col: 29, offset: 28036}, + expr: &ruleRefExpr{ + pos: position{line: 620, col: 29, offset: 28036}, + name: "WS", + }, + }, + }, + }, }, }, }, @@ -5378,90 +6393,131 @@ var g = &grammar{ }, }, { - name: "InlineElementID", - pos: position{line: 528, col: 1, offset: 23409}, + name: "AttributeKey", + pos: position{line: 624, col: 1, offset: 28130}, expr: &actionExpr{ - pos: position{line: 528, col: 20, offset: 23428}, - run: (*parser).callonInlineElementID1, + pos: position{line: 624, col: 17, offset: 28146}, + run: (*parser).callonAttributeKey1, expr: &seqExpr{ - pos: position{line: 528, col: 20, offset: 23428}, + pos: position{line: 624, col: 17, offset: 28146}, exprs: []interface{}{ - &litMatcher{ - pos: position{line: 528, col: 20, offset: 23428}, - val: "[[", - ignoreCase: false, - }, &labeledExpr{ - pos: position{line: 528, col: 25, offset: 23433}, - label: "id", - expr: &ruleRefExpr{ - pos: position{line: 528, col: 29, offset: 23437}, - name: "ID", + pos: position{line: 624, col: 17, offset: 28146}, + label: "key", + expr: &oneOrMoreExpr{ + pos: position{line: 624, col: 22, offset: 28151}, + expr: &seqExpr{ + pos: position{line: 624, col: 23, offset: 28152}, + exprs: []interface{}{ + ¬Expr{ + pos: position{line: 624, col: 23, offset: 28152}, + expr: &ruleRefExpr{ + pos: position{line: 624, col: 24, offset: 28153}, + name: "WS", + }, + }, + ¬Expr{ + pos: position{line: 624, col: 27, offset: 28156}, + expr: &litMatcher{ + pos: position{line: 624, col: 28, offset: 28157}, + val: "=", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 624, col: 32, offset: 28161}, + expr: &litMatcher{ + pos: position{line: 624, col: 33, offset: 28162}, + val: ",", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 624, col: 37, offset: 28166}, + expr: &litMatcher{ + pos: position{line: 624, col: 38, offset: 28167}, + val: "]", + ignoreCase: false, + }, + }, + &anyMatcher{ + line: 624, col: 42, offset: 28171, + }, + }, + }, }, }, - &litMatcher{ - pos: position{line: 528, col: 33, offset: 23441}, - val: "]]", - ignoreCase: false, + &zeroOrMoreExpr{ + pos: position{line: 624, col: 46, offset: 28175}, + expr: &ruleRefExpr{ + pos: position{line: 624, col: 46, offset: 28175}, + name: "WS", + }, }, }, }, }, }, { - name: "ElementTitle", - pos: position{line: 534, col: 1, offset: 23636}, + name: "AttributeValue", + pos: position{line: 629, col: 1, offset: 28257}, expr: &actionExpr{ - pos: position{line: 534, col: 17, offset: 23652}, - run: (*parser).callonElementTitle1, + pos: position{line: 629, col: 19, offset: 28275}, + run: (*parser).callonAttributeValue1, expr: &seqExpr{ - pos: position{line: 534, col: 17, offset: 23652}, + pos: position{line: 629, col: 19, offset: 28275}, exprs: []interface{}{ - &litMatcher{ - pos: position{line: 534, col: 17, offset: 23652}, - val: ".", - ignoreCase: false, - }, - ¬Expr{ - pos: position{line: 534, col: 21, offset: 23656}, - expr: &litMatcher{ - pos: position{line: 534, col: 22, offset: 23657}, - val: ".", - ignoreCase: false, - }, - }, - ¬Expr{ - pos: position{line: 534, col: 26, offset: 23661}, + &zeroOrMoreExpr{ + pos: position{line: 629, col: 19, offset: 28275}, expr: &ruleRefExpr{ - pos: position{line: 534, col: 27, offset: 23662}, + pos: position{line: 629, col: 19, offset: 28275}, name: "WS", }, }, &labeledExpr{ - pos: position{line: 534, col: 30, offset: 23665}, - label: "title", - expr: &oneOrMoreExpr{ - pos: position{line: 534, col: 36, offset: 23671}, + pos: position{line: 629, col: 23, offset: 28279}, + label: "value", + expr: &zeroOrMoreExpr{ + pos: position{line: 629, col: 29, offset: 28285}, expr: &seqExpr{ - pos: position{line: 534, col: 37, offset: 23672}, + pos: position{line: 629, col: 30, offset: 28286}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 534, col: 37, offset: 23672}, + pos: position{line: 629, col: 30, offset: 28286}, expr: &ruleRefExpr{ - pos: position{line: 534, col: 38, offset: 23673}, - name: "NEWLINE", + pos: position{line: 629, col: 31, offset: 28287}, + name: "WS", + }, + }, + ¬Expr{ + pos: position{line: 629, col: 34, offset: 28290}, + expr: &litMatcher{ + pos: position{line: 629, col: 35, offset: 28291}, + val: "=", + ignoreCase: false, + }, + }, + ¬Expr{ + pos: position{line: 629, col: 39, offset: 28295}, + expr: &litMatcher{ + pos: position{line: 629, col: 40, offset: 28296}, + val: "]", + ignoreCase: false, }, }, &anyMatcher{ - line: 534, col: 46, offset: 23681, + line: 629, col: 44, offset: 28300, }, }, }, }, }, - &ruleRefExpr{ - pos: position{line: 534, col: 50, offset: 23685}, - name: "EOL", + &zeroOrMoreExpr{ + pos: position{line: 629, col: 48, offset: 28304}, + expr: &ruleRefExpr{ + pos: position{line: 629, col: 48, offset: 28304}, + name: "WS", + }, }, }, }, @@ -5469,50 +6525,50 @@ var g = &grammar{ }, { name: "InvalidElementAttribute", - pos: position{line: 538, col: 1, offset: 23750}, + pos: position{line: 634, col: 1, offset: 28391}, expr: &actionExpr{ - pos: position{line: 538, col: 28, offset: 23777}, + pos: position{line: 634, col: 28, offset: 28418}, run: (*parser).callonInvalidElementAttribute1, expr: &seqExpr{ - pos: position{line: 538, col: 28, offset: 23777}, + pos: position{line: 634, col: 28, offset: 28418}, exprs: []interface{}{ &litMatcher{ - pos: position{line: 538, col: 28, offset: 23777}, + pos: position{line: 634, col: 28, offset: 28418}, val: "[", ignoreCase: false, }, &oneOrMoreExpr{ - pos: position{line: 538, col: 32, offset: 23781}, + pos: position{line: 634, col: 32, offset: 28422}, expr: &ruleRefExpr{ - pos: position{line: 538, col: 32, offset: 23781}, + pos: position{line: 634, col: 32, offset: 28422}, name: "WS", }, }, &labeledExpr{ - pos: position{line: 538, col: 36, offset: 23785}, + pos: position{line: 634, col: 36, offset: 28426}, label: "content", expr: &zeroOrMoreExpr{ - pos: position{line: 538, col: 44, offset: 23793}, + pos: position{line: 634, col: 44, offset: 28434}, expr: &seqExpr{ - pos: position{line: 538, col: 45, offset: 23794}, + pos: position{line: 634, col: 45, offset: 28435}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 538, col: 45, offset: 23794}, + pos: position{line: 634, col: 45, offset: 28435}, expr: &litMatcher{ - pos: position{line: 538, col: 46, offset: 23795}, + pos: position{line: 634, col: 46, offset: 28436}, val: "]", ignoreCase: false, }, }, &anyMatcher{ - line: 538, col: 50, offset: 23799, + line: 634, col: 50, offset: 28440, }, }, }, }, }, &litMatcher{ - pos: position{line: 538, col: 54, offset: 23803}, + pos: position{line: 634, col: 54, offset: 28444}, val: "]", ignoreCase: false, }, @@ -5522,29 +6578,29 @@ var g = &grammar{ }, { name: "BlankLine", - pos: position{line: 545, col: 1, offset: 23969}, + pos: position{line: 641, col: 1, offset: 28610}, expr: &actionExpr{ - pos: position{line: 545, col: 14, offset: 23982}, + pos: position{line: 641, col: 14, offset: 28623}, run: (*parser).callonBlankLine1, expr: &seqExpr{ - pos: position{line: 545, col: 14, offset: 23982}, + pos: position{line: 641, col: 14, offset: 28623}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 545, col: 14, offset: 23982}, + pos: position{line: 641, col: 14, offset: 28623}, expr: &ruleRefExpr{ - pos: position{line: 545, col: 15, offset: 23983}, + pos: position{line: 641, col: 15, offset: 28624}, name: "EOF", }, }, &zeroOrMoreExpr{ - pos: position{line: 545, col: 19, offset: 23987}, + pos: position{line: 641, col: 19, offset: 28628}, expr: &ruleRefExpr{ - pos: position{line: 545, col: 19, offset: 23987}, + pos: position{line: 641, col: 19, offset: 28628}, name: "WS", }, }, &ruleRefExpr{ - pos: position{line: 545, col: 23, offset: 23991}, + pos: position{line: 641, col: 23, offset: 28632}, name: "EOL", }, }, @@ -5553,31 +6609,31 @@ var g = &grammar{ }, { name: "Characters", - pos: position{line: 552, col: 1, offset: 24138}, + pos: position{line: 648, col: 1, offset: 28779}, expr: &actionExpr{ - pos: position{line: 552, col: 15, offset: 24152}, + pos: position{line: 648, col: 15, offset: 28793}, run: (*parser).callonCharacters1, expr: &oneOrMoreExpr{ - pos: position{line: 552, col: 15, offset: 24152}, + pos: position{line: 648, col: 15, offset: 28793}, expr: &seqExpr{ - pos: position{line: 552, col: 16, offset: 24153}, + pos: position{line: 648, col: 16, offset: 28794}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 552, col: 16, offset: 24153}, + pos: position{line: 648, col: 16, offset: 28794}, expr: &ruleRefExpr{ - pos: position{line: 552, col: 17, offset: 24154}, + pos: position{line: 648, col: 17, offset: 28795}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 552, col: 25, offset: 24162}, + pos: position{line: 648, col: 25, offset: 28803}, expr: &ruleRefExpr{ - pos: position{line: 552, col: 26, offset: 24163}, + pos: position{line: 648, col: 26, offset: 28804}, name: "WS", }, }, &anyMatcher{ - line: 552, col: 29, offset: 24166, + line: 648, col: 29, offset: 28807, }, }, }, @@ -5586,47 +6642,47 @@ var g = &grammar{ }, { name: "URL", - pos: position{line: 556, col: 1, offset: 24206}, + pos: position{line: 652, col: 1, offset: 28847}, expr: &actionExpr{ - pos: position{line: 556, col: 8, offset: 24213}, + pos: position{line: 652, col: 8, offset: 28854}, run: (*parser).callonURL1, expr: &oneOrMoreExpr{ - pos: position{line: 556, col: 8, offset: 24213}, + pos: position{line: 652, col: 8, offset: 28854}, expr: &seqExpr{ - pos: position{line: 556, col: 9, offset: 24214}, + pos: position{line: 652, col: 9, offset: 28855}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 556, col: 9, offset: 24214}, + pos: position{line: 652, col: 9, offset: 28855}, expr: &ruleRefExpr{ - pos: position{line: 556, col: 10, offset: 24215}, + pos: position{line: 652, col: 10, offset: 28856}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 556, col: 18, offset: 24223}, + pos: position{line: 652, col: 18, offset: 28864}, expr: &ruleRefExpr{ - pos: position{line: 556, col: 19, offset: 24224}, + pos: position{line: 652, col: 19, offset: 28865}, name: "WS", }, }, ¬Expr{ - pos: position{line: 556, col: 22, offset: 24227}, + pos: position{line: 652, col: 22, offset: 28868}, expr: &litMatcher{ - pos: position{line: 556, col: 23, offset: 24228}, + pos: position{line: 652, col: 23, offset: 28869}, val: "[", ignoreCase: false, }, }, ¬Expr{ - pos: position{line: 556, col: 27, offset: 24232}, + pos: position{line: 652, col: 27, offset: 28873}, expr: &litMatcher{ - pos: position{line: 556, col: 28, offset: 24233}, + pos: position{line: 652, col: 28, offset: 28874}, val: "]", ignoreCase: false, }, }, &anyMatcher{ - line: 556, col: 32, offset: 24237, + line: 652, col: 32, offset: 28878, }, }, }, @@ -5635,63 +6691,63 @@ var g = &grammar{ }, { name: "ID", - pos: position{line: 560, col: 1, offset: 24277}, + pos: position{line: 656, col: 1, offset: 28918}, expr: &actionExpr{ - pos: position{line: 560, col: 7, offset: 24283}, + pos: position{line: 656, col: 7, offset: 28924}, run: (*parser).callonID1, expr: &oneOrMoreExpr{ - pos: position{line: 560, col: 7, offset: 24283}, + pos: position{line: 656, col: 7, offset: 28924}, expr: &seqExpr{ - pos: position{line: 560, col: 8, offset: 24284}, + pos: position{line: 656, col: 8, offset: 28925}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 560, col: 8, offset: 24284}, + pos: position{line: 656, col: 8, offset: 28925}, expr: &ruleRefExpr{ - pos: position{line: 560, col: 9, offset: 24285}, + pos: position{line: 656, col: 9, offset: 28926}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 560, col: 17, offset: 24293}, + pos: position{line: 656, col: 17, offset: 28934}, expr: &ruleRefExpr{ - pos: position{line: 560, col: 18, offset: 24294}, + pos: position{line: 656, col: 18, offset: 28935}, name: "WS", }, }, ¬Expr{ - pos: position{line: 560, col: 21, offset: 24297}, + pos: position{line: 656, col: 21, offset: 28938}, expr: &litMatcher{ - pos: position{line: 560, col: 22, offset: 24298}, + pos: position{line: 656, col: 22, offset: 28939}, val: "[", ignoreCase: false, }, }, ¬Expr{ - pos: position{line: 560, col: 26, offset: 24302}, + pos: position{line: 656, col: 26, offset: 28943}, expr: &litMatcher{ - pos: position{line: 560, col: 27, offset: 24303}, + pos: position{line: 656, col: 27, offset: 28944}, val: "]", ignoreCase: false, }, }, ¬Expr{ - pos: position{line: 560, col: 31, offset: 24307}, + pos: position{line: 656, col: 31, offset: 28948}, expr: &litMatcher{ - pos: position{line: 560, col: 32, offset: 24308}, + pos: position{line: 656, col: 32, offset: 28949}, val: "<<", ignoreCase: false, }, }, ¬Expr{ - pos: position{line: 560, col: 37, offset: 24313}, + pos: position{line: 656, col: 37, offset: 28954}, expr: &litMatcher{ - pos: position{line: 560, col: 38, offset: 24314}, + pos: position{line: 656, col: 38, offset: 28955}, val: ">>", ignoreCase: false, }, }, &anyMatcher{ - line: 560, col: 42, offset: 24318, + line: 656, col: 42, offset: 28959, }, }, }, @@ -5700,40 +6756,40 @@ var g = &grammar{ }, { name: "URL_TEXT", - pos: position{line: 564, col: 1, offset: 24358}, + pos: position{line: 660, col: 1, offset: 28999}, expr: &actionExpr{ - pos: position{line: 564, col: 13, offset: 24370}, + pos: position{line: 660, col: 13, offset: 29011}, run: (*parser).callonURL_TEXT1, expr: &oneOrMoreExpr{ - pos: position{line: 564, col: 13, offset: 24370}, + pos: position{line: 660, col: 13, offset: 29011}, expr: &seqExpr{ - pos: position{line: 564, col: 14, offset: 24371}, + pos: position{line: 660, col: 14, offset: 29012}, exprs: []interface{}{ ¬Expr{ - pos: position{line: 564, col: 14, offset: 24371}, + pos: position{line: 660, col: 14, offset: 29012}, expr: &ruleRefExpr{ - pos: position{line: 564, col: 15, offset: 24372}, + pos: position{line: 660, col: 15, offset: 29013}, name: "NEWLINE", }, }, ¬Expr{ - pos: position{line: 564, col: 23, offset: 24380}, + pos: position{line: 660, col: 23, offset: 29021}, expr: &litMatcher{ - pos: position{line: 564, col: 24, offset: 24381}, + pos: position{line: 660, col: 24, offset: 29022}, val: "[", ignoreCase: false, }, }, ¬Expr{ - pos: position{line: 564, col: 28, offset: 24385}, + pos: position{line: 660, col: 28, offset: 29026}, expr: &litMatcher{ - pos: position{line: 564, col: 29, offset: 24386}, + pos: position{line: 660, col: 29, offset: 29027}, val: "]", ignoreCase: false, }, }, &anyMatcher{ - line: 564, col: 33, offset: 24390, + line: 660, col: 33, offset: 29031, }, }, }, @@ -5742,32 +6798,32 @@ var g = &grammar{ }, { name: "URL_SCHEME", - pos: position{line: 568, col: 1, offset: 24430}, + pos: position{line: 664, col: 1, offset: 29071}, expr: &choiceExpr{ - pos: position{line: 568, col: 15, offset: 24444}, + pos: position{line: 664, col: 15, offset: 29085}, alternatives: []interface{}{ &litMatcher{ - pos: position{line: 568, col: 15, offset: 24444}, + pos: position{line: 664, col: 15, offset: 29085}, val: "http://", ignoreCase: false, }, &litMatcher{ - pos: position{line: 568, col: 27, offset: 24456}, + pos: position{line: 664, col: 27, offset: 29097}, val: "https://", ignoreCase: false, }, &litMatcher{ - pos: position{line: 568, col: 40, offset: 24469}, + pos: position{line: 664, col: 40, offset: 29110}, val: "ftp://", ignoreCase: false, }, &litMatcher{ - pos: position{line: 568, col: 51, offset: 24480}, + pos: position{line: 664, col: 51, offset: 29121}, val: "irc://", ignoreCase: false, }, &litMatcher{ - pos: position{line: 568, col: 62, offset: 24491}, + pos: position{line: 664, col: 62, offset: 29132}, val: "mailto:", ignoreCase: false, }, @@ -5776,9 +6832,9 @@ var g = &grammar{ }, { name: "DIGIT", - pos: position{line: 570, col: 1, offset: 24502}, + pos: position{line: 666, col: 1, offset: 29143}, expr: &charClassMatcher{ - pos: position{line: 570, col: 10, offset: 24511}, + pos: position{line: 666, col: 10, offset: 29152}, val: "[0-9]", ranges: []rune{'0', '9'}, ignoreCase: false, @@ -5787,22 +6843,22 @@ var g = &grammar{ }, { name: "NEWLINE", - pos: position{line: 572, col: 1, offset: 24518}, + pos: position{line: 668, col: 1, offset: 29159}, expr: &choiceExpr{ - pos: position{line: 572, col: 12, offset: 24529}, + pos: position{line: 668, col: 12, offset: 29170}, alternatives: []interface{}{ &litMatcher{ - pos: position{line: 572, col: 12, offset: 24529}, + pos: position{line: 668, col: 12, offset: 29170}, val: "\r\n", ignoreCase: false, }, &litMatcher{ - pos: position{line: 572, col: 21, offset: 24538}, + pos: position{line: 668, col: 21, offset: 29179}, val: "\r", ignoreCase: false, }, &litMatcher{ - pos: position{line: 572, col: 28, offset: 24545}, + pos: position{line: 668, col: 28, offset: 29186}, val: "\n", ignoreCase: false, }, @@ -5811,20 +6867,20 @@ var g = &grammar{ }, { name: "WS", - pos: position{line: 574, col: 1, offset: 24551}, + pos: position{line: 670, col: 1, offset: 29192}, expr: &choiceExpr{ - pos: position{line: 574, col: 7, offset: 24557}, + pos: position{line: 670, col: 7, offset: 29198}, alternatives: []interface{}{ &litMatcher{ - pos: position{line: 574, col: 7, offset: 24557}, + pos: position{line: 670, col: 7, offset: 29198}, val: " ", ignoreCase: false, }, &actionExpr{ - pos: position{line: 574, col: 13, offset: 24563}, + pos: position{line: 670, col: 13, offset: 29204}, run: (*parser).callonWS3, expr: &litMatcher{ - pos: position{line: 574, col: 13, offset: 24563}, + pos: position{line: 670, col: 13, offset: 29204}, val: "\t", ignoreCase: false, }, @@ -5834,26 +6890,26 @@ var g = &grammar{ }, { name: "EOF", - pos: position{line: 578, col: 1, offset: 24608}, + pos: position{line: 674, col: 1, offset: 29249}, expr: ¬Expr{ - pos: position{line: 578, col: 8, offset: 24615}, + pos: position{line: 674, col: 8, offset: 29256}, expr: &anyMatcher{ - line: 578, col: 9, offset: 24616, + line: 674, col: 9, offset: 29257, }, }, }, { name: "EOL", - pos: position{line: 580, col: 1, offset: 24619}, + pos: position{line: 676, col: 1, offset: 29260}, expr: &choiceExpr{ - pos: position{line: 580, col: 8, offset: 24626}, + pos: position{line: 676, col: 8, offset: 29267}, alternatives: []interface{}{ &ruleRefExpr{ - pos: position{line: 580, col: 8, offset: 24626}, + pos: position{line: 676, col: 8, offset: 29267}, name: "NEWLINE", }, &ruleRefExpr{ - pos: position{line: 580, col: 18, offset: 24636}, + pos: position{line: 676, col: 18, offset: 29277}, name: "EOF", }, }, @@ -6245,25 +7301,212 @@ func (p *parser) callonContinuedBlockElement1() (interface{}, error) { return p.cur.onContinuedBlockElement1(stack["element"]) } -func (c *current) onUnorderedListItem1(level, content interface{}) (interface{}, error) { - return types.NewUnorderedListItem(level, content.([]types.DocElement)) +func (c *current) onOrderedListItem1(attributes, prefix, content interface{}) (interface{}, error) { + return types.NewOrderedListItem(prefix.(types.OrderedListItemPrefix), content.([]types.DocElement), attributes.([]interface{})) +} + +func (p *parser) callonOrderedListItem1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItem1(stack["attributes"], stack["prefix"], stack["content"]) +} + +func (c *current) onOrderedListItemPrefix2(style interface{}) (interface{}, error) { + // numbering style: "." + return types.NewOrderedListItemPrefix(types.Arabic, 1) +} + +func (p *parser) callonOrderedListItemPrefix2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix2(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix10(style interface{}) (interface{}, error) { + // numbering style: ".." + return types.NewOrderedListItemPrefix(types.LowerAlpha, 2) +} + +func (p *parser) callonOrderedListItemPrefix10() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix10(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix18(style interface{}) (interface{}, error) { + // numbering style: "..." + return types.NewOrderedListItemPrefix(types.LowerRoman, 3) +} + +func (p *parser) callonOrderedListItemPrefix18() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix18(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix26(style interface{}) (interface{}, error) { + // numbering style: "...." + return types.NewOrderedListItemPrefix(types.UpperAlpha, 4) +} + +func (p *parser) callonOrderedListItemPrefix26() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix26(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix34(style interface{}) (interface{}, error) { + // numbering style: "....." + return types.NewOrderedListItemPrefix(types.UpperRoman, 5) + // explicit numbering +} + +func (p *parser) callonOrderedListItemPrefix34() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix34(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix42(style interface{}) (interface{}, error) { + // numbering style: "1." + return types.NewOrderedListItemPrefix(types.Arabic, 1) +} + +func (p *parser) callonOrderedListItemPrefix42() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix42(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix60(style interface{}) (interface{}, error) { + // numbering style: "a." + return types.NewOrderedListItemPrefix(types.LowerAlpha, 1) +} + +func (p *parser) callonOrderedListItemPrefix60() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix60(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix78(style interface{}) (interface{}, error) { + // numbering style: "A." + return types.NewOrderedListItemPrefix(types.UpperAlpha, 1) +} + +func (p *parser) callonOrderedListItemPrefix78() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix78(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix96(style interface{}) (interface{}, error) { + // numbering style: "i)" + return types.NewOrderedListItemPrefix(types.LowerRoman, 1) +} + +func (p *parser) callonOrderedListItemPrefix96() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix96(stack["style"]) +} + +func (c *current) onOrderedListItemPrefix114(style interface{}) (interface{}, error) { + // numbering style: "I)" + return types.NewOrderedListItemPrefix(types.UpperRoman, 1) +} + +func (p *parser) callonOrderedListItemPrefix114() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemPrefix114(stack["style"]) +} + +func (c *current) onOrderedListItemContent1(elements interface{}) (interface{}, error) { + // Another list or a literal paragraph immediately following a list item will be implicitly included in the list item + return types.NewListItemContent(elements.([]interface{})) +} + +func (p *parser) callonOrderedListItemContent1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onOrderedListItemContent1(stack["elements"]) +} + +func (c *current) onUnorderedListItem1(prefix, content interface{}) (interface{}, error) { + return types.NewUnorderedListItem(prefix.(types.UnorderedListItemPrefix), content.([]types.DocElement)) } func (p *parser) callonUnorderedListItem1() (interface{}, error) { stack := p.vstack[len(p.vstack)-1] _ = stack - return p.cur.onUnorderedListItem1(stack["level"], stack["content"]) + return p.cur.onUnorderedListItem1(stack["prefix"], stack["content"]) +} + +func (c *current) onUnorderedListItemPrefix2(level interface{}) (interface{}, error) { + // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.FiveAsterisks, 5) +} + +func (p *parser) callonUnorderedListItemPrefix2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUnorderedListItemPrefix2(stack["level"]) +} + +func (c *current) onUnorderedListItemPrefix10(level interface{}) (interface{}, error) { + // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.FourAsterisks, 4) +} + +func (p *parser) callonUnorderedListItemPrefix10() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUnorderedListItemPrefix10(stack["level"]) +} + +func (c *current) onUnorderedListItemPrefix18(level interface{}) (interface{}, error) { + // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.ThreeAsterisks, 3) +} + +func (p *parser) callonUnorderedListItemPrefix18() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUnorderedListItemPrefix18(stack["level"]) +} + +func (c *current) onUnorderedListItemPrefix26(level interface{}) (interface{}, error) { + // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.TwoAsterisks, 2) +} + +func (p *parser) callonUnorderedListItemPrefix26() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUnorderedListItemPrefix26(stack["level"]) +} + +func (c *current) onUnorderedListItemPrefix34(level interface{}) (interface{}, error) { + // ignore whitespaces, only return the relevant "*"/"-" characters + return types.NewUnorderedListItemPrefix(types.OneAsterisk, 1) +} + +func (p *parser) callonUnorderedListItemPrefix34() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onUnorderedListItemPrefix34(stack["level"]) } -func (c *current) onUnorderedListItemPrefix1(level interface{}) (interface{}, error) { +func (c *current) onUnorderedListItemPrefix42(level interface{}) (interface{}, error) { // ignore whitespaces, only return the relevant "*"/"-" characters - return level, nil + return types.NewUnorderedListItemPrefix(types.Dash, 1) } -func (p *parser) callonUnorderedListItemPrefix1() (interface{}, error) { +func (p *parser) callonUnorderedListItemPrefix42() (interface{}, error) { stack := p.vstack[len(p.vstack)-1] _ = stack - return p.cur.onUnorderedListItemPrefix1(stack["level"]) + return p.cur.onUnorderedListItemPrefix42(stack["level"]) } func (c *current) onUnorderedListItemContent1(elements interface{}) (interface{}, error) { @@ -6309,7 +7552,7 @@ func (p *parser) callonLabeledListItemTerm1() (interface{}, error) { } func (c *current) onLabeledListItemDescription1(elements interface{}) (interface{}, error) { - + // TODO: replace with (ListParagraph+ ContinuedBlockElement*) and use a single rule for all item contents ? return types.NewListItemContent(elements.([]interface{})) } @@ -6835,6 +8078,16 @@ func (p *parser) callonParagraphWithLiteralAttribute1() (interface{}, error) { return p.cur.onParagraphWithLiteralAttribute1(stack["content"]) } +func (c *current) onElementAttribute1(attr interface{}) (interface{}, error) { + return attr, nil // avoid returning something like `[]interface{}{attr, EOL}` +} + +func (p *parser) callonElementAttribute1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onElementAttribute1(stack["attr"]) +} + func (c *current) onElementLink1(path interface{}) (interface{}, error) { return types.NewElementLink(path.(string)) } @@ -6855,14 +8108,14 @@ func (p *parser) callonElementID2() (interface{}, error) { return p.cur.onElementID2(stack["id"]) } -func (c *current) onElementID7(id interface{}) (interface{}, error) { +func (c *current) onElementID5(id interface{}) (interface{}, error) { return types.NewElementID(id.(string)) } -func (p *parser) callonElementID7() (interface{}, error) { +func (p *parser) callonElementID5() (interface{}, error) { stack := p.vstack[len(p.vstack)-1] _ = stack - return p.cur.onElementID7(stack["id"]) + return p.cur.onElementID5(stack["id"]) } func (c *current) onInlineElementID1(id interface{}) (interface{}, error) { @@ -6885,6 +8138,60 @@ func (p *parser) callonElementTitle1() (interface{}, error) { return p.cur.onElementTitle1(stack["title"]) } +func (c *current) onAttributeGroup1(attributes interface{}) (interface{}, error) { + return types.NewAttributeGroup(attributes.([]interface{})) +} + +func (p *parser) callonAttributeGroup1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAttributeGroup1(stack["attributes"]) +} + +func (c *current) onGenericAttribute2(key, value interface{}) (interface{}, error) { + // value is set + return types.NewGenericAttribute(key.([]interface{}), value.([]interface{})) +} + +func (p *parser) callonGenericAttribute2() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onGenericAttribute2(stack["key"], stack["value"]) +} + +func (c *current) onGenericAttribute14(key interface{}) (interface{}, error) { + // value is not set + return types.NewGenericAttribute(key.([]interface{}), nil) +} + +func (p *parser) callonGenericAttribute14() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onGenericAttribute14(stack["key"]) +} + +func (c *current) onAttributeKey1(key interface{}) (interface{}, error) { + // fmt.Printf("found attribute key: %v\n", key) + return key, nil +} + +func (p *parser) callonAttributeKey1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAttributeKey1(stack["key"]) +} + +func (c *current) onAttributeValue1(value interface{}) (interface{}, error) { + // fmt.Printf("found attribute value: %v\n", value) + return value, nil +} + +func (p *parser) callonAttributeValue1() (interface{}, error) { + stack := p.vstack[len(p.vstack)-1] + _ = stack + return p.cur.onAttributeValue1(stack["value"]) +} + func (c *current) onInvalidElementAttribute1(content interface{}) (interface{}, error) { return types.NewInvalidElementAttribute(c.text) } diff --git a/parser/delimited_block_test.go b/parser/delimited_block_test.go index 48f48862..2661f9a7 100644 --- a/parser/delimited_block_test.go +++ b/parser/delimited_block_test.go @@ -384,9 +384,11 @@ with *bold content* }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ diff --git a/parser/element_attributes_test.go b/parser/element_attributes_test.go index d2bfdb85..f015b262 100644 --- a/parser/element_attributes_test.go +++ b/parser/element_attributes_test.go @@ -24,7 +24,7 @@ var _ = Describe("Element Attributes", func() { }) Context("invalid syntax", func() { - It("spaces before keywork", func() { + It("spaces before keyword", func() { actualContent := "[ link=http://foo.bar]" expectedResult := types.InvalidElementAttribute{Value: "[ link=http://foo.bar]"} verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("ElementAttribute")) diff --git a/parser/image_test.go b/parser/image_test.go index db2d7fa2..b9847139 100644 --- a/parser/image_test.go +++ b/parser/image_test.go @@ -83,7 +83,7 @@ var _ = Describe("Images", func() { verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockImage")) }) - It("block image with dimensions and i d link title meta", func() { + It("block image with dimensions and id link title meta", func() { actualContent := "[#img-foobar]\n" + ".A title to foobar\n" + "[link=http://foo.bar]\n" + diff --git a/parser/labeled_list_test.go b/parser/labeled_list_test.go index 23df5743..0ae422ea 100644 --- a/parser/labeled_list_test.go +++ b/parser/labeled_list_test.go @@ -13,6 +13,7 @@ var _ = Describe("labeled lists", func() { Item 1 description on 2 lines` expectedResult := types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item1", @@ -41,6 +42,7 @@ on 2 lines` It("labeled list with a single term and no description", func() { actualContent := `Item1::` expectedResult := types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item1", @@ -81,6 +83,7 @@ Item1:: foo` actualContent := `Item1:: ` expectedResult := types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item1", @@ -98,6 +101,7 @@ Item 2 description Item 3:: Item 3 description` expectedResult := types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item 1", @@ -152,14 +156,17 @@ Item 3 description` * bar Item with description:: something simple` expectedResult := types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Empty item", Elements: []types.DocElement{ types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -172,8 +179,9 @@ Item with description:: something simple` }, }, }, - types.UnorderedListItem{ - Level: 1, + { + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -221,6 +229,7 @@ a normal paragraph.` ElementReferences: map[string]interface{}{}, Elements: []types.DocElement{ types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item 1", @@ -273,6 +282,7 @@ another fenced block ElementReferences: map[string]interface{}{}, Elements: []types.DocElement{ types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item 1", @@ -331,6 +341,7 @@ another fenced block ElementReferences: map[string]interface{}{}, Elements: []types.DocElement{ types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item 1", @@ -346,6 +357,7 @@ another fenced block }, }, types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "Item 2", diff --git a/parser/ordered_list_test.go b/parser/ordered_list_test.go new file mode 100644 index 00000000..86102a04 --- /dev/null +++ b/parser/ordered_list_test.go @@ -0,0 +1,1437 @@ +package parser_test + +import ( + "github.com/bytesparadise/libasciidoc/parser" + "github.com/bytesparadise/libasciidoc/types" + . "github.com/onsi/ginkgo" +) + +var _ = Describe("ordered lists", func() { + + Context("ordered list item alone", func() { + + // same single item in the list for each test in this context + elements := []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item"}, + }, + }, + }, + }, + } + It("ordered list item with implicit numbering style", func() { + actualContent := `.. item` + expectedResult := types.OrderedListItem{ + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with arabic numbering style", func() { + actualContent := `1. item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with lower alpha numbering style", func() { + actualContent := `b. item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with upper alpha numbering style", func() { + actualContent := `B. item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.UpperAlpha, + Attributes: map[string]interface{}{}, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with lower roman numbering style", func() { + actualContent := `i) item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.LowerRoman, + Attributes: map[string]interface{}{}, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with upper roman numbering style", func() { + actualContent := `I) item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.UpperRoman, + Attributes: map[string]interface{}{}, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with explicit numbering type only", func() { + actualContent := `[lowerroman] +. item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{ + "lowerroman": nil, + }, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with explicit start only", func() { + actualContent := `[start=5] +. item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{ + "start": "5", + }, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + It("ordered list item with explicit quoted numbering and start", func() { + actualContent := `["lowerroman", start="5"] +. item` + expectedResult := types.OrderedListItem{ + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{ + "lowerroman": nil, + "start": "5", + }, + Elements: elements, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("OrderedListItem")) + }) + + }) + + Context("items without numbers", func() { + + It("ordered list with simple unnumbered items", func() { + actualContent := `. a +. b` + + expectedResult := types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "a"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "b"}, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) + }) + + It("ordered list with unnumbered items", func() { + actualContent := `. item 1 +. item 2` + + expectedResult := types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 2"}, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) + }) + + It("ordered list with custom numbering on child items", func() { + actualContent := `. item 1 +.. item 1.1 +[upperroman] +... item 1.1.1 +... item 1.1.2 +.. item 1.2 +. item 2 +.. item 2.1` + + expectedResult := types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1.1"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 3, + Position: 1, + NumberingStyle: types.UpperRoman, + Attributes: map[string]interface{}{ + "upperroman": nil, + }, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1.1.1"}, + }, + }, + }, + }, + }, + }, + { + Level: 3, + Position: 2, + NumberingStyle: types.UpperRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1.1.2"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 2, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1.2"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 2"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 2.1"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) + }) + + It("ordered list with all default styles", func() { + actualContent := `. Arabic (decimal) numbered list item. +.. Lower case alpha (letter) numbered list item. +... Lower case roman numbered list item. +.... Upper case alpha (letter) numbered list item. +..... Upper case roman numbered list item.` + expectedResult := types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Arabic (decimal) numbered list item."}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Lower case alpha (letter) numbered list item."}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 3, + Position: 1, + NumberingStyle: types.LowerRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Lower case roman numbered list item."}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 4, + Position: 1, + NumberingStyle: types.UpperAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Upper case alpha (letter) numbered list item."}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 5, + Position: 1, + NumberingStyle: types.UpperRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Upper case roman numbered list item."}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) + }) + }) + + Context("numbered items", func() { + + It("ordered list with simple numbered items", func() { + actualContent := `1. a +2. b` + expectedResult := types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "a"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "b"}, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) + }) + + It("ordered list with numbered items", func() { + actualContent := `1. item 1 +a. item 1.a +2. item 2 +b. item 2.a` + expectedResult := types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 1.a"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 2"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "item 2.a"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) + }) + }) + + Context("mixed lists", func() { + + It("ordered list with nested unordered lists", func() { + actualContent := `. Item 1 +* Item A +* Item B +. Item 2 +* Item C +* Item D` + expectedResult := types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Item 1"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 1, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Item A"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Item B"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Item 2"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 1, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Item C"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "Item D"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("List")) + }) + + It("ordered list mixed with unordered list - complex case 1", func() { + actualContent := `- unordered 1 + 1. ordered 1.1 + a. ordered 1.1.a + b. ordered 1.1.b + c. ordered 1.1.c + 2. ordered 1.2 + i) ordered 1.2.i + ii) ordered 1.2.ii + 3. ordered 1.3 + 4. ordered 1.4 + - unordered 2 + * unordered 2.1` + expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 1, + BulletStyle: types.Dash, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 1"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1.a"}, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 2, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1.b"}, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 3, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1.c"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.2"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.2.i"}, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 2, + NumberingStyle: types.LowerRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.2.ii"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 3, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.3"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 4, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.4"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + BulletStyle: types.Dash, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 2"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 2, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 2.1"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("List")) + }) + + It("ordered list mixed with unordered list - complex case 2", func() { + actualContent := `- unordered 1 +1. ordered 1.1 + a. ordered 1.1.a + b. ordered 1.1.b + c. ordered 1.1.c +2. ordered 1.2 + i) ordered 1.2.i + ii) ordered 1.2.ii +3. ordered 1.3 +4. ordered 1.4 +- unordered 2 +* unordered 2.1 +** unordered 2.1.1 + with some + extra lines. +** unordered 2.1.2 +* unordered 2.2 +- unordered 3 +. ordered 3.1 +. ordered 3.2 +[upperroman] + .. ordered 3.2.I + .. ordered 3.2.II +. ordered 3.3` + expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 1, + BulletStyle: types.Dash, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 1"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1.a"}, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 2, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1.b"}, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 3, + NumberingStyle: types.LowerAlpha, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.1.c"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.2"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.LowerRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.2.i"}, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 2, + NumberingStyle: types.LowerRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.2.ii"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 3, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.3"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 4, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 1.4"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + BulletStyle: types.Dash, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 2"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 2, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 2.1"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 3, + BulletStyle: types.TwoAsterisks, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 2.1.1"}, + }, + }, + { + Elements: []types.InlineElement{ + types.StringElement{Content: "\twith some"}, + }, + }, + { + Elements: []types.InlineElement{ + types.StringElement{Content: "\textra lines."}, + }, + }, + }, + }, + }, + }, + { + Level: 3, + BulletStyle: types.TwoAsterisks, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 2.1.2"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 2, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 2.2"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + BulletStyle: types.Dash, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "unordered 3"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 1, + Position: 1, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 3.1"}, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 2, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 3.2"}, + }, + }, + }, + }, + types.OrderedList{ + Attributes: map[string]interface{}{}, + Items: []types.OrderedListItem{ + { + Level: 2, + Position: 1, + NumberingStyle: types.UpperRoman, + Attributes: map[string]interface{}{ + "upperroman": nil, + }, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 3.2.I"}, + }, + }, + }, + }, + }, + }, + { + Level: 2, + Position: 2, + NumberingStyle: types.UpperRoman, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 3.2.II"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + Position: 3, + NumberingStyle: types.Arabic, + Attributes: map[string]interface{}{}, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "ordered 3.3"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("List")) + }) + }) + +}) diff --git a/parser/unordered_list_test.go b/parser/unordered_list_test.go index 5cb296d1..aeeb0102 100644 --- a/parser/unordered_list_test.go +++ b/parser/unordered_list_test.go @@ -13,9 +13,11 @@ var _ = Describe("unordered lists", func() { It("unordered list with a single item", func() { actualContent := "* a list item" expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -42,7 +44,8 @@ var _ = Describe("unordered lists", func() { }, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -64,9 +67,11 @@ var _ = Describe("unordered lists", func() { actualContent := "* a first item\n" + "* a second item with *bold content*" expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -80,7 +85,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -102,13 +108,16 @@ var _ = Describe("unordered lists", func() { } verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) }) + It("unordered list with 2 items with carets", func() { actualContent := "- a first item\n" + "- a second item with *bold content*" expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -122,7 +131,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -144,15 +154,122 @@ var _ = Describe("unordered lists", func() { } verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) }) + + It("unordered list with items with mixed styles", func() { + actualContent := `- a parent item + * a child item + - another parent item + * another child item + ** with a sub child item` + expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 1, + BulletStyle: types.Dash, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "a parent item"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 2, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "a child item"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + Level: 1, + BulletStyle: types.Dash, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "another parent item"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 2, + BulletStyle: types.OneAsterisk, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "another child item"}, + }, + }, + }, + }, + types.UnorderedList{ + Attributes: map[string]interface{}{}, + Items: []types.UnorderedListItem{ + { + Level: 3, + BulletStyle: types.TwoAsterisks, + Elements: []types.DocElement{ + types.ListParagraph{ + Lines: []types.InlineContent{ + { + Elements: []types.InlineElement{ + types.StringElement{Content: "with a sub child item"}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) + }) + It("unordered list with 2 items with empty line in-between", func() { // fist line after list item is swallowed actualContent := "* a first item\n" + "\n" + "* a second item with *bold content*" expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -166,7 +283,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -194,9 +312,11 @@ var _ = Describe("unordered lists", func() { "* item 2\n" + "on 2 lines, too." expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -215,7 +335,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -237,7 +358,7 @@ var _ = Describe("unordered lists", func() { } verify(GinkgoT(), expectedResult, actualContent, parser.Entrypoint("BlockElement")) }) - It("2 Uuordered lists with 2 empty lines in-between", func() { + It("2 unordered lists with 2 empty lines in-between", func() { // the first blank lines after the first list is swallowed (for the list item) actualContent := "* an item in the first list\n" + "\n" + @@ -248,9 +369,11 @@ var _ = Describe("unordered lists", func() { ElementReferences: map[string]interface{}{}, Elements: []types.DocElement{ types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -266,9 +389,11 @@ var _ = Describe("unordered lists", func() { }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -298,9 +423,11 @@ var _ = Describe("unordered lists", func() { * item 2 ** item 2.1` expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -312,9 +439,11 @@ var _ = Describe("unordered lists", func() { }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 2, + Level: 2, + BulletStyle: types.TwoAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -328,7 +457,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 2, + Level: 2, + BulletStyle: types.TwoAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -340,9 +470,11 @@ var _ = Describe("unordered lists", func() { }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 3, + Level: 3, + BulletStyle: types.ThreeAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -360,7 +492,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 2, + Level: 2, + BulletStyle: types.TwoAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -374,7 +507,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 2, + Level: 2, + BulletStyle: types.TwoAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -392,7 +526,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -404,9 +539,11 @@ var _ = Describe("unordered lists", func() { }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 2, + Level: 2, + BulletStyle: types.TwoAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -432,15 +569,17 @@ var _ = Describe("unordered lists", func() { Context("invalid content", func() { It("unordered list with items on 2 levels - bad numbering", func() { - actualContent := "* item 1\n" + - "*** item 1.1\n" + - "*** item 1.1.1\n" + - "** item 1.2\n" + - "* item 2" + actualContent := `* item 1 + *** item 1.1 + *** item 1.1.1 + ** item 1.2 + * item 2` expectedResult := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -452,9 +591,11 @@ var _ = Describe("unordered lists", func() { }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 2, + Level: 2, + BulletStyle: types.TwoAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -466,9 +607,11 @@ var _ = Describe("unordered lists", func() { }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 3, + Level: 3, + BulletStyle: types.ThreeAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -486,7 +629,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 2, + Level: 2, + BulletStyle: types.TwoAsterisks, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -504,7 +648,8 @@ var _ = Describe("unordered lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -555,11 +700,12 @@ another delimited block Attributes: map[string]interface{}{}, ElementReferences: map[string]interface{}{}, Elements: []types.DocElement{ - types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -589,7 +735,8 @@ another delimited block }, }, { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -622,11 +769,12 @@ another delimited block Attributes: map[string]interface{}{}, ElementReferences: map[string]interface{}{}, Elements: []types.DocElement{ - types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -650,9 +798,11 @@ another delimited block }, }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.ListParagraph{ Lines: []types.InlineContent{ @@ -678,8 +828,6 @@ another delimited block }, } verify(GinkgoT(), expectedResult, actualContent) - }) }) - }) diff --git a/renderer/html5/external_link.go b/renderer/html5/external_link.go index 583b1347..32417efb 100644 --- a/renderer/html5/external_link.go +++ b/renderer/html5/external_link.go @@ -10,11 +10,11 @@ import ( log "github.com/sirupsen/logrus" ) -var LinkTmpl template.Template +var linkTmpl template.Template // initializes the templates func init() { - LinkTmpl = newHTMLTemplate("external link", `{{ .Text }}`) + linkTmpl = newHTMLTemplate("external link", `{{ .Text }}`) } func renderLink(ctx *renderer.Context, l types.Link) ([]byte, error) { @@ -25,7 +25,7 @@ func renderLink(ctx *renderer.Context, l types.Link) ([]byte, error) { text = l.URL class = "bare" } - err := LinkTmpl.Execute(result, struct { + err := linkTmpl.Execute(result, struct { URL string Text string Class string diff --git a/renderer/html5/ordered_list.go b/renderer/html5/ordered_list.go new file mode 100644 index 00000000..7a2b60b5 --- /dev/null +++ b/renderer/html5/ordered_list.go @@ -0,0 +1,61 @@ +package html5 + +import ( + "bytes" + texttemplate "text/template" + + "github.com/bytesparadise/libasciidoc/renderer" + "github.com/bytesparadise/libasciidoc/types" + "github.com/pkg/errors" + log "github.com/sirupsen/logrus" +) + +var orderedListTmpl texttemplate.Template + +// initializes the templates +func init() { + orderedListTmpl = newTextTemplate("ordered list", + `{{ $ctx := .Context }}{{ with .Data }}{{ $items := .Items }}{{ $firstItem := index $items 0 }} +
    +{{ range $itemIndex, $item := $items }}
  1. +{{ $elements := $item.Elements }}{{ range $elementIndex, $element := $elements }}{{ renderElement $ctx $element | printf "%s" }}{{ if notLastItem $elementIndex $elements }}{{ print "\n" }}{{ end }}{{ end }} +
  2. +{{ end }}
+{{ end }}`, + texttemplate.FuncMap{ + "renderElement": renderElement, + "wrap": wrap, + "notLastItem": notLastItem, + "style": numberingType, + }) + +} + +func renderOrderedList(ctx *renderer.Context, l types.OrderedList) ([]byte, error) { + result := bytes.NewBuffer(nil) + // here we must preserve the HTML tags + err := orderedListTmpl.Execute(result, ContextualPipeline{ + Context: ctx, + Data: l, + }) + if err != nil { + return nil, errors.Wrapf(err, "unable to render ordered list") + } + log.Debugf("rendered ordered list of items: %s", result.Bytes()) + return result.Bytes(), nil +} + +func numberingType(s types.NumberingStyle) string { + switch s { + case types.LowerAlpha: + return ` type="a"` + case types.UpperAlpha: + return ` type="A"` + case types.LowerRoman: + return ` type="i"` + case types.UpperRoman: + return ` type="I"` + default: + return "" + } +} diff --git a/renderer/html5/ordered_list_test.go b/renderer/html5/ordered_list_test.go new file mode 100644 index 00000000..5e54d772 --- /dev/null +++ b/renderer/html5/ordered_list_test.go @@ -0,0 +1,224 @@ +package html5_test + +import . "github.com/onsi/ginkgo" + +var _ = Describe("ordered lists", func() { + + It("ordered list with unnumbered items", func() { + actualContent := `. item 1 + .. item 1.1 + ... item 1.1.1 + ... item 1.1.2 + .. item 1.2 + . item 2 + .. item 2.1` + expectedResult := `
+
    +
  1. +

    item 1

    +
    +
      +
    1. +

      item 1.1

      +
      +
        +
      1. +

        item 1.1.1

        +
      2. +
      3. +

        item 1.1.2

        +
      4. +
      +
      +
    2. +
    3. +

      item 1.2

      +
    4. +
    +
    +
  2. +
  3. +

    item 2

    +
    +
      +
    1. +

      item 2.1

      +
    2. +
    +
    +
  4. +
+
` + verify(GinkgoT(), expectedResult, actualContent) + }) + + It("ordered list mixed with unordered list - simple case", func() { + actualContent := `. Linux +* Fedora +* Ubuntu +* Slackware +. BSD +* FreeBSD +* NetBSD` + expectedResult := `
+
    +
  1. +

    Linux

    +
    +
      +
    • +

      Fedora

      +
    • +
    • +

      Ubuntu

      +
    • +
    • +

      Slackware

      +
    • +
    +
    +
  2. +
  3. +

    BSD

    +
    +
      +
    • +

      FreeBSD

      +
    • +
    • +

      NetBSD

      +
    • +
    +
    +
  4. +
+
` + verify(GinkgoT(), expectedResult, actualContent) + }) + + It("ordered list mixed with unordered list - complex case", func() { + actualContent := `- unordered 1 +1. ordered 1.1 + a. ordered 1.1.a + b. ordered 1.1.b + c. ordered 1.1.c +2. ordered 1.2 + i) ordered 1.2.i + ii) ordered 1.2.ii +3. ordered 1.3 +4. ordered 1.4 +- unordered 2 +* unordered 2.1 +** unordered 2.1.1 +with some +extra lines. +** unordered 2.1.2 +* unordered 2.2 +- unordered 3 +. ordered 3.1 +. ordered 3.2 +[upperroman] + .. ordered 3.2.I + .. ordered 3.2.II +. ordered 3.3` + expectedResult := `
+ +
` + verify(GinkgoT(), expectedResult, actualContent) + }) + +}) diff --git a/renderer/html5/renderer.go b/renderer/html5/renderer.go index 0dafa0e0..302a0f73 100644 --- a/renderer/html5/renderer.go +++ b/renderer/html5/renderer.go @@ -27,6 +27,8 @@ func renderElement(ctx *renderer.Context, element types.DocElement) ([]byte, err return renderPreamble(ctx, e) case types.LabeledList: return renderLabeledList(ctx, e) + case types.OrderedList: + return renderOrderedList(ctx, e) case types.UnorderedList: return renderUnorderedList(ctx, e) case types.Paragraph: diff --git a/renderer/html5/unordered_list.go b/renderer/html5/unordered_list.go index 20ce593e..c9e16cf6 100644 --- a/renderer/html5/unordered_list.go +++ b/renderer/html5/unordered_list.go @@ -38,55 +38,8 @@ func renderUnorderedList(ctx *renderer.Context, l types.UnorderedList) ([]byte, Data: l, }) if err != nil { - return nil, errors.Wrapf(err, "unable to render list of items") + return nil, errors.Wrapf(err, "unable to render unordered list") } log.Debugf("rendered unordered list of items: %s", result.Bytes()) return result.Bytes(), nil } - -// func renderUnorderedListItem(ctx *renderer.Context, i types.UnorderedListItem) ([]byte, error) { -// renderedItemContent, err := renderUnorderedListItemContent(ctx, i.Elements) -// if err != nil { -// return nil, errors.Wrapf(err, "unable to render list item") -// } -// result := bytes.NewBuffer(nil) -// var renderedChildrenOutput *template.HTML -// if i.Children != nil { -// childrenOutput, err := renderUnorderedList(ctx, i.Children) -// if err != nil { -// return nil, errors.Wrapf(err, "unable to render list item") -// } -// htmlChildrenOutput := template.HTML(string(childrenOutput)) -// renderedChildrenOutput = &htmlChildrenOutput -// } -// err = unorderedListItemTmpl.Execute(result, struct { -// Content template.HTML -// Children *template.HTML -// }{ -// Content: template.HTML(string(renderedItemContent)), -// Children: renderedChildrenOutput, -// }) -// if err != nil { -// return nil, errors.Wrapf(err, "unable to render list item") -// } -// log.Debugf("rendered item: %s", result.Bytes()) -// return result.Bytes(), nil -// } - -// func renderUnorderedListItemContent(ctx *renderer.Context, elements []types.DocElement) ([]byte, error) { -// renderedElementsBuff := bytes.NewBuffer(nil) -// for _, element := range elements { -// renderedElement, err := renderElement(ctx, element) -// if err != nil { -// return nil, errors.Wrapf(err, "failed to render list item content") -// } -// renderedElementsBuff.Write(renderedElement) -// } -// result := bytes.NewBuffer(nil) -// err := unorderedListItemContentTmpl.Execute(result, renderedElementsBuff.String()) -// if err != nil { -// return nil, errors.Wrapf(err, "unable to render list item") -// } -// log.Debugf("rendered item content: %s", result.Bytes()) -// return result.Bytes(), nil -// } diff --git a/renderer/html5/unordered_list_test.go b/renderer/html5/unordered_list_test.go index c4222517..eee582cb 100644 --- a/renderer/html5/unordered_list_test.go +++ b/renderer/html5/unordered_list_test.go @@ -3,6 +3,7 @@ package html5_test import . "github.com/onsi/ginkgo" var _ = Describe("unordered lists", func() { + It("simple unordered list with no title", func() { actualContent := `* item 1 * item 2 @@ -22,6 +23,7 @@ var _ = Describe("unordered lists", func() { ` verify(GinkgoT(), expectedResult, actualContent) }) + It("simple unordered list with a title", func() { actualContent := `[#foo] * item 1 @@ -38,6 +40,7 @@ var _ = Describe("unordered lists", func() { ` verify(GinkgoT(), expectedResult, actualContent) }) + It("nested unordered lists without a title", func() { actualContent := `* item 1 ** item 1.1 @@ -65,6 +68,7 @@ var _ = Describe("unordered lists", func() { ` verify(GinkgoT(), expectedResult, actualContent) }) + It("nested unordered lists with a title", func() { actualContent := `[#listID] * item 1 diff --git a/types/document_attributes.go b/types/document_attributes.go index ebd81daf..5089a45f 100644 --- a/types/document_attributes.go +++ b/types/document_attributes.go @@ -72,7 +72,7 @@ func (m DocumentAttributes) Add(key string, value interface{}) { } } -// Add adds the given attribute if its value is non-nil and non-empty +// AddNonEmpty adds the given attribute if its value is non-nil and non-empty // TODO: raise a warning if there was already a name/value func (m DocumentAttributes) AddNonEmpty(key string, value interface{}) { // do not add nil or empty values diff --git a/types/grammar_types.go b/types/grammar_types.go index 757a3561..e6b57259 100644 --- a/types/grammar_types.go +++ b/types/grammar_types.go @@ -3,6 +3,7 @@ package types import ( "fmt" "path/filepath" + "strconv" "strings" yaml "gopkg.in/yaml.v2" @@ -547,7 +548,7 @@ type SectionTitle struct { // In the attributes, only the ElementID is retained func NewSectionTitle(inlineContent InlineContent, attributes []interface{}) (SectionTitle, error) { // counting the lenght of the 'level' value (ie, the number of `=` chars) - id, _, _ := newElementAttributes(attributes) + id, _, _ := NewElementAttributes(attributes) // make a default id from the sectionTitle's inline content if id == (ElementID{}) { replacement, err := ReplaceNonAlphanumerics(inlineContent, "_") @@ -583,12 +584,14 @@ type ListItem interface { // NewList initializes a new `List` from the given content func NewList(elements []interface{}, attributes []interface{}) (List, error) { - log.Debugf("Initializing a new List from %d elements", len(elements)) + log.Debugf("Initializing a new List with %d elements", len(elements)) buffer := make(map[reflect.Type][]ListItem) rootType := reflect.TypeOf(toPtr(elements[0])) // elements types will be pointers previousType := rootType + stack := make([]reflect.Type, 0) + stack = append(stack, rootType) for _, element := range elements { - log.Debugf("Processing list item of type %T", element) + log.Debugf("processing list item of type %T", element) // val := reflect.ValueOf(element).Elem().Addr().Interface() item, ok := toPtr(element).(ListItem) if !ok { @@ -598,7 +601,7 @@ func NewList(elements []interface{}, attributes []interface{}) (List, error) { // each time a change of type is detected, except for the root type currentType := reflect.TypeOf(item) if currentType != previousType && previousType != rootType { - log.Debugf(" detected a switch of type when processing item of type %T", item) + log.Debugf(" detected a switch of type when processing item of type %T: currentType=%v != previousType=%v", item, currentType, previousType) // change of type: make a list from the buffer[t], reset and keep iterating sublist, err := newList(buffer[previousType], nil) if err != nil { @@ -609,20 +612,58 @@ func NewList(elements []interface{}, attributes []interface{}) (List, error) { parentItem := parentItems[len(parentItems)-1] parentItem.AddChild(sublist) buffer[previousType] = make([]ListItem, 0) + // add element type to stack if not already found + found := false + for _, t := range stack { + log.Debugf("comparing stack type %v to %v: %t", t, previousType, (t == previousType)) + if t == previousType { + found = true + break + } + } + if !found { + log.Debugf("adding element of type %v to stack", previousType) + stack = append(stack, previousType) + } } + previousType = currentType // add item to buffer buffer[currentType] = append(buffer[currentType], item) - previousType = currentType } + // end of processing: take into account the remainings in the buffer, by stack + log.Debugf("end of list init: stack=%v, buffer= %v", stack, buffer) + // process all sub lists + for i := len(stack) - 1; i > 0; i-- { + // skip if no item at this layer/level + if len(buffer[stack[i]]) == 0 { + continue + } + // look-up parent layer at the previous (ie, upper) level in the stack + parentItems := buffer[stack[i-1]] + // look-up parent in the layer + parentItem := parentItems[len(parentItems)-1] + // build a new list from the remaining items at the current level of the stack + sublist, err := newList(buffer[stack[i]], nil) + if err != nil { + return nil, errors.Wrapf(err, "failed to initialize a sublist") + } + // add this list to the parent + parentItem.AddChild(sublist) + } + + // log.Debugf("end of list init: current type=%v / previous type=%v / buffer= %v", currentType, previousType, buffer) // finally, the top-level list return newList(buffer[rootType], attributes) } func newList(items []ListItem, attributes []interface{}) (List, error) { + // log.Debugf("initializing a new list with %d items", len(items)) if len(items) == 0 { return nil, errors.Errorf("cannot build a list from an empty slice") } switch items[0].(type) { + case *OrderedListItem: + return NewOrderedList(items, attributes) case *UnorderedListItem: return NewUnorderedList(items, attributes) case *LabeledListItem: @@ -643,24 +684,232 @@ type ListParagraph struct { // NewListParagraph initializes a new `ListParagraph` func NewListParagraph(lines []interface{}) (ListParagraph, error) { - // log.Debugf("Initializing a new ListParagraph with %d line(s)", len(lines)) + // log.Debugf("Initializing a new ListParagraph with %d line(s): %v", len(lines), lines) elements := make([]InlineContent, 0) for _, line := range lines { if lineElements, ok := line.([]interface{}); ok { for _, lineElement := range lineElements { - if lineElement, ok := lineElement.(InlineContent); ok { - // log.Debugf(" processing paragraph line of type %T", lineElement) + if e, ok := lineElement.(InlineContent); ok { + // log.Debugf(" processing paragraph line of type %T", e) // each `line` element is an array with the actual `InlineContent` + `EOF` - elements = append(elements, lineElement) + elements = append(elements, e) } } } } + // log.Debugf("Initialized a new ListParagraph with %d element(s): %v", len(elements), elements) return ListParagraph{ Lines: elements, }, nil } +// ------------------------------------------ +// Ordered Lists +// ------------------------------------------ + +// OrderedList the structure for the Ordered Lists +type OrderedList struct { + Attributes map[string]interface{} + Items []OrderedListItem +} + +// NumberingStyle the type of numbering for items in an ordered list +type NumberingStyle string + +const ( + // UnknownNumberingStyle the default, unknown type + UnknownNumberingStyle NumberingStyle = "unknown" + // Arabic the arabic numbering (1, 2, 3, etc.) + Arabic NumberingStyle = "arabic" + // Decimal the decimal numbering (01, 02, 03, etc.) + Decimal NumberingStyle = "decimal" + // LowerAlpha the lower-alpha numbering (a, b, c, etc.) + LowerAlpha NumberingStyle = "loweralpha" + // UpperAlpha the upper-alpha numbering (A, B, C, etc.) + UpperAlpha NumberingStyle = "upperalpha" + // LowerRoman the lower-roman numbering (i, ii, iii, etc.) + LowerRoman NumberingStyle = "lowerroman" + // UpperRoman the upper-roman numbering (I, II, III, etc.) + UpperRoman NumberingStyle = "upperroman" + // LowerGreek the lower-greek numbering (alpha, beta, etc.) + LowerGreek NumberingStyle = "lowergreek" + // UpperGreek the upper-roman numbering (Alpha, Beta, etc.) + UpperGreek NumberingStyle = "uppergreek" +) + +var numberingStyles []NumberingStyle + +func init() { + numberingStyles = []NumberingStyle{Arabic, Decimal, LowerAlpha, UpperAlpha, LowerRoman, UpperRoman, LowerGreek, UpperGreek} +} + +// NewOrderedList initializes a new `OrderedList` from the given content +func NewOrderedList(elements []ListItem, attributes []interface{}) (OrderedList, error) { + log.Debugf("Initializing a new OrderedList from %d element(s)...", len(elements)) + result := make([]OrderedListItem, 0) + bufferedItemsPerLevel := make(map[int][]*OrderedListItem, 0) // buffered items for the current level + levelPerStyle := make(map[NumberingStyle]int, 0) + previousLevel := 0 + previousNumberingStyle := UnknownNumberingStyle + for _, element := range elements { + item, ok := element.(*OrderedListItem) + if !ok { + return OrderedList{}, errors.Errorf("element of type '%T' is not a valid unorderedlist item", element) + } + log.Debugf("processing list item: %v", item.Elements[0]) + if item.Level > previousLevel { + // force the current item level to (last seen level + 1) + item.Level = previousLevel + 1 + // log.Debugf("setting item level to %d (#1 - new level)", item.Level) + levelPerStyle[item.NumberingStyle] = item.Level + } else if item.NumberingStyle != previousNumberingStyle { + // check if this numbering type was already found previously + if level, found := levelPerStyle[item.NumberingStyle]; found { + item.Level = level // 0-based offset in the bufferedItemsPerLevel + // log.Debugf("setting item level to %d / %v (#2 - existing style)", item.Level, item.NumberingStyle) + } else { + item.Level = previousLevel + 1 + // log.Debugf("setting item level to %d (#3 - new level for numbering style %v)", item.Level, item.NumberingStyle) + levelPerStyle[item.NumberingStyle] = item.Level + } + } else if item.NumberingStyle == previousNumberingStyle { + item.Level = previousLevel + // log.Debugf("setting item level to %d (#4 - same as previous item)", item.Level) + } + // log.Debugf("list item %v -> level= %d", item.Elements[0], item.Level) + // join item *values* in the parent item when the level decreased + if item.Level < previousLevel { + parentLayer := bufferedItemsPerLevel[previousLevel-2] + parentItem := parentLayer[len(parentLayer)-1] + log.Debugf("moving buffered items at level %d (%v) in parent (%v) ", previousLevel, bufferedItemsPerLevel[previousLevel-1][0].NumberingStyle, parentItem.NumberingStyle) + childList := toOrderedList(bufferedItemsPerLevel[previousLevel-1]) + parentItem.Elements = append(parentItem.Elements, childList) + // clear the previously buffered items at level 'previousLevel' + delete(bufferedItemsPerLevel, previousLevel-1) + } + // new level of element: put it in the buffer + if item.Level > len(bufferedItemsPerLevel) { + // log.Debugf("initializing a new level of list items: %d", item.Level) + bufferedItemsPerLevel[item.Level-1] = make([]*OrderedListItem, 0) + } + // append item to buffer of its level + log.Debugf("adding list item %v in the current buffer at level %d", item.Elements[0], item.Level) + bufferedItemsPerLevel[item.Level-1] = append(bufferedItemsPerLevel[item.Level-1], item) + previousLevel = item.Level + previousNumberingStyle = item.NumberingStyle + } + log.Debugf("processing the rest of the buffer...") + // clear the remaining buffer and get the result in the reverse order of levels + for level := len(bufferedItemsPerLevel) - 1; level >= 0; level-- { + items := bufferedItemsPerLevel[level] + // top-level items + if level == 0 { + for idx, item := range items { + // set the position + // log.Debugf("setting item #%d position to %d+%d", (idx + 1), items[0].Position, idx) + item.Position = items[0].Position + idx + result = append(result, *item) + } + } else { + childList := toOrderedList(items) + parentLayer := bufferedItemsPerLevel[level-1] + parentItem := parentLayer[len(parentLayer)-1] + parentItem.Elements = append(parentItem.Elements, childList) + } + } + + return OrderedList{ + Attributes: mergeAttributes(attributes), + Items: result, + }, nil +} + +func toOrderedList(items []*OrderedListItem) OrderedList { + result := OrderedList{ + Attributes: map[string]interface{}{}, // avoid nil `attributes` + } + // set the position and numbering style based on the optional attributes of the first item + if len(items) == 0 { + return result + } + items[0].applyAttributes() + for idx, item := range items { + // log.Debugf("setting item #%d position to %d+%d", (idx + 1), bufferedItemsPerLevel[previousLevel-1][0].Position, idx) + item.Position = items[0].Position + idx + item.NumberingStyle = items[0].NumberingStyle + result.Items = append(result.Items, *item) + } + return result +} + +// OrderedListItem the structure for the ordered list items +type OrderedListItem struct { + Level int + Position int + NumberingStyle NumberingStyle + Elements []DocElement + Attributes map[string]interface{} +} + +// making sure that the `ListItem` interface is implemented by `OrderedListItem` +var _ ListItem = &OrderedListItem{} + +// NewOrderedListItem initializes a new `orderedListItem` from the given content +func NewOrderedListItem(prefix OrderedListItemPrefix, elements []DocElement, attributes []interface{}) (OrderedListItem, error) { + log.Debugf("Initializing a new OrderedListItem with attributes %v", attributes) + p := 1 // default position + return OrderedListItem{ + NumberingStyle: prefix.NumberingStyle, + Level: prefix.Level, + Position: p, + Elements: elements, + Attributes: mergeAttributes(attributes), + }, nil +} + +// AddChild appends the given item to the content of this OrderedListItem +func (i *OrderedListItem) AddChild(item interface{}) { + log.Debugf("Adding item %v to %v", item, i.Elements) + i.Elements = append(i.Elements, item) +} + +func (i *OrderedListItem) applyAttributes() error { + log.Debugf("applying attributes on %[1]v: %[2]v (%[2]T)", i.Elements[0], i.Attributes) + // numbering type override + for _, style := range numberingStyles { + if _, ok := i.Attributes[string(style)]; ok { + i.NumberingStyle = style + break + } + } + // numbering offset + if start, ok := i.Attributes["start"]; ok { + if start, ok := start.(string); ok { + s, err := strconv.ParseInt(start, 10, 64) + if err != nil { + return errors.Wrapf(err, "unable to parse 'start' value %v", start) + } + i.Position = int(s) + } + } + log.Debugf("applied attributes on %v: position=%d, numbering=%v", i.Elements[0], i.Position, i.NumberingStyle) + return nil +} + +// OrderedListItemPrefix the prefix used to construct an OrderedListItem +type OrderedListItemPrefix struct { + NumberingStyle NumberingStyle + Level int +} + +// NewOrderedListItemPrefix initializes a new OrderedListItemPrefix +func NewOrderedListItemPrefix(s NumberingStyle, l int) (OrderedListItemPrefix, error) { + return OrderedListItemPrefix{ + NumberingStyle: s, + Level: l, + }, nil +} + // ------------------------------------------ // Unordered Lists // ------------------------------------------ @@ -673,10 +922,12 @@ type UnorderedList struct { // NewUnorderedList initializes a new `UnorderedList` from the given content func NewUnorderedList(elements []ListItem, attributes []interface{}) (UnorderedList, error) { - log.Debugf("Initializing a new UnorderedList from %d elements", len(elements)) + log.Debugf("Initializing a new UnorderedList from %d element(s)...", len(elements)) result := make([]UnorderedListItem, 0) bufferedItemsPerLevel := make(map[int][]*UnorderedListItem, 0) // buffered items for the current level - previousLevel := 1 + levelPerStyle := make(map[BulletStyle]int, 0) + previousLevel := 0 + previousBulletStyle := UnknownBulletStyle for _, element := range elements { item, ok := element.(*UnorderedListItem) if !ok { @@ -684,19 +935,34 @@ func NewUnorderedList(elements []ListItem, attributes []interface{}) (UnorderedL } if item.Level > previousLevel { // force the current item level to (last seen level + 1) + item.adjustBulletStyle(previousBulletStyle) item.Level = previousLevel + 1 + levelPerStyle[item.BulletStyle] = item.Level + } else if item.BulletStyle != previousBulletStyle { + if level, found := levelPerStyle[item.BulletStyle]; found { + item.Level = level + } else { + item.Level = previousLevel + 1 + levelPerStyle[item.BulletStyle] = item.Level + } + } else if item.BulletStyle == previousBulletStyle { + // adjust level on previous item of same style (in case the level + // of the latter has been adjusted before) + item.Level = previousLevel } - log.Debugf("Processing list item of level %d: %v", item.Level, item) + log.Debugf("Processing list item of level %d: %v", item.Level, item.Elements[0]) // join item *values* in the parent item when the level decreased if item.Level < previousLevel { - log.Debugf("adding previously buffered items at level %d in parent", previousLevel) + log.Debugf("merging previously buffered items at level %d in parent", previousLevel) parentLayer := bufferedItemsPerLevel[previousLevel-2] parentItem := parentLayer[len(parentLayer)-1] - children := UnorderedList{} + childList := UnorderedList{ + Attributes: map[string]interface{}{}, // avoid nil `attributes` + } for _, i := range bufferedItemsPerLevel[previousLevel-1] { - children.Items = append(children.Items, *i) + childList.Items = append(childList.Items, *i) } - parentItem.Elements = append(parentItem.Elements, children) + parentItem.Elements = append(parentItem.Elements, childList) // clear the previously buffered items at level 'previousLevel' delete(bufferedItemsPerLevel, previousLevel-1) } @@ -706,11 +972,12 @@ func NewUnorderedList(elements []ListItem, attributes []interface{}) (UnorderedL bufferedItemsPerLevel[item.Level-1] = make([]*UnorderedListItem, 0) } // append item to buffer of its level - log.Debugf("adding list item %v in the current buffer", item) + log.Debugf("adding list item %v in the current buffer", item.Elements[0]) bufferedItemsPerLevel[item.Level-1] = append(bufferedItemsPerLevel[item.Level-1], item) previousLevel = item.Level + previousBulletStyle = item.BulletStyle } - log.Debugf("processing the rest of the buffer...") + log.Debugf("processing the rest of the buffer: %v", bufferedItemsPerLevel) // clear the remaining buffer and get the result in the reverse order of levels for level := len(bufferedItemsPerLevel) - 1; level >= 0; level-- { items := bufferedItemsPerLevel[level] @@ -720,13 +987,15 @@ func NewUnorderedList(elements []ListItem, attributes []interface{}) (UnorderedL result = append(result, *item) } } else { - children := UnorderedList{} + childList := UnorderedList{ + Attributes: map[string]interface{}{}, // avoid nil `attributes` + } for _, item := range items { - children.Items = append(children.Items, *item) + childList.Items = append(childList.Items, *item) } parentLayer := bufferedItemsPerLevel[level-1] parentItem := parentLayer[len(parentLayer)-1] - parentItem.Elements = append(parentItem.Elements, children) + parentItem.Elements = append(parentItem.Elements, childList) } } @@ -738,22 +1007,20 @@ func NewUnorderedList(elements []ListItem, attributes []interface{}) (UnorderedL // UnorderedListItem the structure for the unordered list items type UnorderedListItem struct { - Level int - Elements []DocElement + Level int + BulletStyle BulletStyle + Elements []DocElement } // NewUnorderedListItem initializes a new `UnorderedListItem` from the given content -func NewUnorderedListItem(level interface{}, elements []DocElement) (UnorderedListItem, error) { - switch vals := reflect.ValueOf(level); vals.Kind() { - case reflect.Slice: - log.Debugf("Initializing a new UnorderedListItem with content '%s' lines (%T) and input level '%d'", len(elements), elements, vals.Len()) - return UnorderedListItem{ - Level: vals.Len(), - Elements: elements, - }, nil - default: - return UnorderedListItem{}, errors.Errorf("Unable to initialize a UnorderedListItem with level '%v", level) - } +func NewUnorderedListItem(prefix UnorderedListItemPrefix, elements []DocElement) (UnorderedListItem, error) { + log.Debugf("Initializing a new UnorderedListItem...") + // log.Debugf("Initializing a new UnorderedListItem with '%d' lines (%T) and input level '%d'", len(elements), elements, lvl.Len()) + return UnorderedListItem{ + Level: prefix.Level, + BulletStyle: prefix.BulletStyle, + Elements: elements, + }, nil } // AddChild appends the given item to the content of this UnorderedListItem @@ -761,17 +1028,84 @@ func (i *UnorderedListItem) AddChild(item interface{}) { i.Elements = append(i.Elements, item) } +// adjustBulletStyle +func (i *UnorderedListItem) adjustBulletStyle(p BulletStyle) { + n := i.BulletStyle.nextLevelStyle(p) + log.Debugf("adjusting bullet style for item with level %v (previous=%v) to %v", i.BulletStyle, p, n) + i.BulletStyle = n +} + +// BulletStyle the type of bullet for items in an unordered list +type BulletStyle string + +const ( + // UnknownBulletStyle the default, unknown type + UnknownBulletStyle BulletStyle = "unkwown" + // Dash an unordered item can begin with a single dash + Dash BulletStyle = "dash" + // OneAsterisk an unordered item marked with a single asterisk + OneAsterisk BulletStyle = "1asterisk" + // TwoAsterisks an unordered item marked with two asterisks + TwoAsterisks BulletStyle = "2asterisks" + // ThreeAsterisks an unordered item marked with three asterisks + ThreeAsterisks BulletStyle = "3asterisks" + // FourAsterisks an unordered item marked with four asterisks + FourAsterisks BulletStyle = "4asterisks" + // FiveAsterisks an unordered item marked with five asterisks + FiveAsterisks BulletStyle = "5asterisks" +) + +// nextLevelStyle returns the BulletStyle for the next level: +// `-` -> `*` +// `*` -> `**` +// `**` -> `***` +// `***` -> `****` +// `****` -> `*****` +// `*****` -> `-` + +func (b BulletStyle) nextLevelStyle(p BulletStyle) BulletStyle { + switch p { + case Dash: + return OneAsterisk + case OneAsterisk: + return TwoAsterisks + case TwoAsterisks: + return ThreeAsterisks + case ThreeAsterisks: + return FourAsterisks + case FourAsterisks: + return FiveAsterisks + case FiveAsterisks: + return Dash + } + // default, return the level itself + return b +} + +// UnorderedListItemPrefix the prefix used to construct an UnorderedListItem +type UnorderedListItemPrefix struct { + BulletStyle BulletStyle + Level int +} + +// NewUnorderedListItemPrefix initializes a new UnorderedListItemPrefix +func NewUnorderedListItemPrefix(s BulletStyle, l int) (UnorderedListItemPrefix, error) { + return UnorderedListItemPrefix{ + BulletStyle: s, + Level: l, + }, nil +} + // NewListItemContent initializes a new `UnorderedListItemContent` func NewListItemContent(content []interface{}) ([]DocElement, error) { - log.Debugf("Initializing a new ListItemContent with %d line(s)", len(content)) + // log.Debugf("Initializing a new ListItemContent with %d line(s)", len(content)) elements := make([]DocElement, 0) for _, element := range content { - log.Debugf("Processing line element of type %T", element) + // log.Debugf("Processing line element of type %T", element) // here, `line` is an []interface{} in which we need to locate the relevant `*InlineContent` fragment switch element := element.(type) { case []interface{}: for _, e := range element { - log.Debugf("Processing line sub-element of type %T", e) if e, ok := e.(DocElement); ok { elements = append(elements, e) } @@ -780,7 +1114,7 @@ func NewListItemContent(content []interface{}) ([]DocElement, error) { elements = append(elements, element) } } - log.Debugf("Initialized a new ListItemContent with %d elements(s)", len(elements)) + // log.Debugf("Initialized a new ListItemContent with %d elements(s)", len(elements)) // no need to return an empty ListItemContent if len(elements) == 0 { return nil, nil @@ -831,7 +1165,7 @@ type LabeledListItem struct { // NewLabeledListItem initializes a new LabeledListItem func NewLabeledListItem(term []interface{}, elements []DocElement) (LabeledListItem, error) { - log.Debugf("Initializing a new LabeledListItem with '%s' elements (%T)", len(elements), elements) + log.Debugf("Initializing a new LabeledListItem with %d elements (%T)", len(elements), elements) t, err := stringify(term) if err != nil { return LabeledListItem{}, errors.Wrapf(err, "unable to get term while instanciating a new LabeledListItem element") @@ -865,7 +1199,7 @@ type Paragraph struct { // NewParagraph initializes a new `Paragraph` func NewParagraph(lines []interface{}, attributes []interface{}) (Paragraph, error) { log.Debugf("Initializing a new Paragraph with %d line(s)", len(lines)) - id, title, _ := newElementAttributes(attributes) + id, title, _ := NewElementAttributes(attributes) elements := make([]InlineContent, 0) for _, line := range lines { if lineElements, ok := line.([]interface{}); ok { @@ -916,7 +1250,7 @@ const ( // NewAdmonition returns a new Admonition element func NewAdmonition(kind AdmonitionKind, content DocElement, attributes []interface{}) (Admonition, error) { log.Debugf("Initializing a new Admonition...") - id, title, _ := newElementAttributes(attributes) + id, title, _ := NewElementAttributes(attributes) return Admonition{ ID: id, Kind: kind, @@ -1027,7 +1361,7 @@ type BlockImage struct { // NewBlockImage initializes a new `BlockImage` func NewBlockImage(imageMacro ImageMacro, attributes []interface{}) (BlockImage, error) { - id, title, link := newElementAttributes(attributes) + id, title, link := NewElementAttributes(attributes) return BlockImage{ Macro: imageMacro, ID: id, @@ -1120,7 +1454,7 @@ type DelimitedBlock struct { // NewDelimitedBlock initializes a new `DelimitedBlock` of the given kind with the given content func NewDelimitedBlock(kind DelimitedBlockKind, content []interface{}, attributes []interface{}) (DelimitedBlock, error) { - id, title, _ := newElementAttributes(attributes) + id, title, _ := NewElementAttributes(attributes) var elements []DocElement switch kind { case FencedBlock, ListingBlock: @@ -1175,10 +1509,11 @@ func NewLiteralBlock(spaces, content []interface{}) (LiteralBlock, error) { } // ------------------------------------------ -// Meta Elements +// Elements attributes // ------------------------------------------ -func newElementAttributes(attributes []interface{}) (ElementID, ElementTitle, ElementLink) { +// NewElementAttributes retrieves the ElementID, ElementTitle and ElementLink from the given slice of attributes +func NewElementAttributes(attributes []interface{}) (ElementID, ElementTitle, ElementLink) { var id ElementID var title ElementTitle var link ElementLink @@ -1236,6 +1571,55 @@ func NewElementTitle(value []interface{}) (ElementTitle, error) { return ElementTitle{Value: v}, nil } +// NewAttributeGroup initializes a group of attributes from the given generic attributes. +func NewAttributeGroup(attributes []interface{}) (map[string]interface{}, error) { + // log.Debugf("Initializing a new AttributeGroup with %v", attributes) + result := make(map[string]interface{}, 0) + for _, a := range attributes { + // log.Debugf("processing attribute group element of type %T", a) + if a, ok := a.(GenericAttribute); ok { + for k, v := range a { + result[k] = v + } + } + } + // log.Debugf("Initialized a new AttributeGroup: %v", result) + return result, nil +} + +// GenericAttribute the structure for single, generic attribute. +// If the attribute was specified in the form of [foo], then its key is 'foo' and its value is 'nil'. +type GenericAttribute map[string]interface{} + +// NewGenericAttribute initializes a new GenericAttribute from the given key and optional value +func NewGenericAttribute(key []interface{}, value []interface{}) (GenericAttribute, error) { + result := make(map[string]interface{}) + k, err := stringify(key, + // remove surrounding quotes + func(s string) (string, error) { + return strings.Trim(s, "\""), nil + }) + if err != nil { + return GenericAttribute{}, errors.Wrapf(err, "failed to initialize a new generic attribute") + } + if value != nil { + v, err := stringify(value, + // remove surrounding quotes + func(s string) (string, error) { + return strings.Trim(s, "\""), nil + }) + if err != nil { + return GenericAttribute{}, errors.Wrapf(err, "failed to initialize a new generic attribute") + } + result[k] = v + } else { + result[k] = nil + } + // log.Debugf("Initialized a new GenericAttribute: %v", result) + return result, nil + +} + // InvalidElementAttribute the struct for invalid element attributes type InvalidElementAttribute struct { Value string diff --git a/types/grammar_types_test.go b/types/grammar_types_test.go index faa2e62d..e3d91f73 100644 --- a/types/grammar_types_test.go +++ b/types/grammar_types_test.go @@ -16,7 +16,8 @@ var _ = Describe("lists", func() { // // given elements := []interface{}{ types.UnorderedListItem{ - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item 1", @@ -24,7 +25,8 @@ var _ = Describe("lists", func() { }, }, types.UnorderedListItem{ - Level: 2, + Level: 2, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.StringElement{ Content: "item 1.1", @@ -32,7 +34,8 @@ var _ = Describe("lists", func() { }, }, types.UnorderedListItem{ - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item 2", @@ -45,17 +48,21 @@ var _ = Describe("lists", func() { // then require.NoError(GinkgoT(), err) expectation := types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item 1", }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 2, + Level: 2, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.StringElement{ Content: "item 1.1", @@ -67,7 +74,8 @@ var _ = Describe("lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item 2", @@ -115,6 +123,7 @@ var _ = Describe("lists", func() { // then require.NoError(GinkgoT(), err) expectation := types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "item 1", @@ -159,7 +168,8 @@ var _ = Describe("lists", func() { }, }, types.UnorderedListItem{ - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item A.1", @@ -167,7 +177,8 @@ var _ = Describe("lists", func() { }, }, types.UnorderedListItem{ - Level: 2, + Level: 2, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.StringElement{ Content: "item A.1.1", @@ -175,7 +186,8 @@ var _ = Describe("lists", func() { }, }, types.UnorderedListItem{ - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item A.2", @@ -204,6 +216,7 @@ var _ = Describe("lists", func() { // then require.NoError(GinkgoT(), err) expectation := types.LabeledList{ + Attributes: map[string]interface{}{}, Items: []types.LabeledListItem{ { Term: "item A", @@ -212,17 +225,21 @@ var _ = Describe("lists", func() { Content: "item A", }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item A.1", }, types.UnorderedList{ + Attributes: map[string]interface{}{}, Items: []types.UnorderedListItem{ { - Level: 2, + Level: 2, + BulletStyle: types.OneAsterisk, Elements: []types.DocElement{ types.StringElement{ Content: "item A.1.1", @@ -234,7 +251,8 @@ var _ = Describe("lists", func() { }, }, { - Level: 1, + Level: 1, + BulletStyle: types.Dash, Elements: []types.DocElement{ types.StringElement{ Content: "item A.2", diff --git a/types/grammar_types_utils.go b/types/grammar_types_utils.go index e80840c2..232be602 100644 --- a/types/grammar_types_utils.go +++ b/types/grammar_types_utils.go @@ -106,20 +106,36 @@ func mergeElements(elements []interface{}, extraElements ...interface{}) []inter return result } -func mergeAttributes(attributes []interface{}) map[string]interface{} { - if attributes == nil || len(attributes) == 0 { - return nil +// DefaultAttribute a function to specify a default attribute +type DefaultAttribute func(map[string]interface{}) + +// WithNumberingStyle specifies the numbering type in an OrderedList +func WithNumberingStyle(t NumberingStyle) DefaultAttribute { + return func(attributes map[string]interface{}) { + attributes["numbering"] = t } +} + +func mergeAttributes(attributes []interface{}, defaults ...DefaultAttribute) map[string]interface{} { result := make(map[string]interface{}) + // fill with the default values, that can be overridden afterwards + for _, d := range defaults { + d(result) + } + if attributes == nil { + return result + } + log.Debugf("attributes with defaults: %v", result) for _, attr := range attributes { + log.Debugf("processing attributes of %T", attr) if attr, ok := attr.(map[string]interface{}); ok { for k, v := range attr { result[k] = v } } } + log.Debugf("merged attributes : %v", result) return result - } // appendBuffer appends the content of the given buffer to the given array of elements,