Skip to content

Commit

Permalink
Easier references
Browse files Browse the repository at this point in the history
Signed-off-by: Miek Gieben <[email protected]>
  • Loading branch information
miekg committed Sep 3, 2018
1 parent 59b50e3 commit 48534cb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
13 changes: 0 additions & 13 deletions rfc/8341.md
Original file line number Diff line number Diff line change
Expand Up @@ -1757,19 +1757,6 @@ different access levels are needed, separate protocol operations should be defin
<format type='HTML' target='https://trac.ietf.org/trac/ops/wiki/yang-security-guidelines'/>
</reference>

<reference anchor='W3C.REC-xml-20081126'
target='http://www.w3.org/TR/2008/REC-xml-20081126'> <front>
<title> Extensible Markup Language (XML) 1.0 (Fifth Edition) </title>
<author initials='T.' surname='Bray' fullname='Tim Bray'> <organization /> </author>
<author initials='J.' surname='Paoli' fullname='Jean Paoli'> <organization /> </author>
<author initials='M.' surname='Sperberg-McQueen' fullname='Michael Sperberg-McQueen'> <organization /> </author>
<author initials='E.' surname='Maler' fullname='Eve Maler'> <organization /> </author>
<author initials='F.' surname='Yergeau' fullname='François Yergeau'> <organization /> </author>
<date month='November' day='26' year='2008' /> </front>
<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xml-20081126' />
<format type='HTML' target='http://www.w3.org/TR/2008/REC-xml-20081126' />
</reference>

# Usage Examples

The following XML [@!W3C.REC-xml-20081126] snippets are provided as examples only, to demonstrate
Expand Down
8 changes: 4 additions & 4 deletions xml/bibliography.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (r *Renderer) bibliographyItem(w io.Writer, node *mast.BibliographyItem) {
tag = makeXiInclude(ToolsRFC, fmt.Sprintf("reference.RFC.%s.xml", node.Anchor[3:]))

case bytes.HasPrefix(node.Anchor, []byte("W3C.")):
tag = makeXiInclude(ToolsW3C, fmt.Sprintf("reference.RFC.%s.xml", node.Anchor[3:]))
tag = makeXiInclude(ToolsW3C, fmt.Sprintf("reference.W3C.%s.xml", node.Anchor[4:]))

case bytes.HasPrefix(node.Anchor, []byte("I-D.")):
hash := bytes.Index(node.Anchor, []byte("#"))
Expand All @@ -63,7 +63,7 @@ func makeXiInclude(url, reference string) string {
}

var (
ToolsRFC = "https://xml2rfc.ietf.org/public/rfc/bibxml/"
ToolsID = "https://xml2rfc.ietf.org/public/rfc/bibxml-ids/"
ToolsW3C = "https://xml2rfc.ietf.org/public/rfc/bibxml-w3c/"
ToolsRFC = "https://xml2rfc.ietf.org/public/rfc/bibxml"
ToolsID = "https://xml2rfc.ietf.org/public/rfc/bibxml-ids"
ToolsW3C = "https://xml2rfc.ietf.org/public/rfc/bibxml-w3c"
)
2 changes: 1 addition & 1 deletion xml2/bibliography.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (r *Renderer) bibliographyItem(w io.Writer, node *mast.BibliographyItem) {
tag = makeRFCInclude(xml.ToolsRFC, fmt.Sprintf("reference.RFC.%s.xml", node.Anchor[3:]))

case bytes.HasPrefix(node.Anchor, []byte("W3C.")):
tag = makeRFCInclude(xml.ToolsW3C, fmt.Sprintf("reference.RFC.%s.xml", node.Anchor[3:]))
tag = makeRFCInclude(xml.ToolsW3C, fmt.Sprintf("reference.W3C.%s.xml", node.Anchor[4:]))

case bytes.HasPrefix(node.Anchor, []byte("I-D.")):
hash := bytes.Index(node.Anchor, []byte("#"))
Expand Down
2 changes: 2 additions & 0 deletions xml2/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ func (r *Renderer) codeBlock(w io.Writer, codeBlock *ast.CodeBlock) {
r.cr(w)
_, inFigure := codeBlock.Parent.(*ast.CaptionFigure)
if inFigure {
// Drop anchor for now, but need to figure out what to allow here.
mast.DeleteAttribute(codeBlock, "id")
r.outTag(w, "<artwork", html.BlockAttrs(codeBlock))
} else {
r.outTag(w, "<figure", html.BlockAttrs(codeBlock))
Expand Down

0 comments on commit 48534cb

Please sign in to comment.