Skip to content

Commit

Permalink
feat(parser/renderer): support optional label in cross-references (#174)
Browse files Browse the repository at this point in the history
Fixes #143

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon authored Aug 25, 2018
1 parent 068f0f9 commit ec85fd2
Show file tree
Hide file tree
Showing 6 changed files with 8,333 additions and 7,455 deletions.
12 changes: 9 additions & 3 deletions pkg/parser/asciidoc-grammar.peg
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,14 @@ PassthroughMacroCharacter <- (!"]" .)
// ------------------------------------------
// Cross References
// ------------------------------------------
CrossReference <- "<<" id:(ID) ">>" {
return types.NewCrossReference(id.(string))
CrossReference <- "<<" id:(ID) WS* "," label:(CrossReferenceLabel) ">>" {
return types.NewCrossReference(id.(string), label.(string))
} / "<<" id:(ID) ">>" {
return types.NewCrossReference(id.(string), nil)
}

CrossReferenceLabel <- (!">>" .)+ {
return string(c.text), nil
}

// ------------------------------------------
Expand Down Expand Up @@ -930,7 +936,7 @@ URL <- (!NEWLINE !WS !"[" !"]" .)+ {
return string(c.text), nil
}

ID <- (!NEWLINE !WS !"[" !"]" !"<<" !">>".)+ {
ID <- (!NEWLINE !WS !"[" !"]" !"<<" !">>" !"," .)+ {
return string(c.text), nil
}

Expand Down
Loading

0 comments on commit ec85fd2

Please sign in to comment.