Skip to content

Commit

Permalink
Dont add newline after CDATA
Browse files Browse the repository at this point in the history
Fixes: #220

Signed-off-by: Miek Gieben <[email protected]>
  • Loading branch information
miekg committed Aug 1, 2024
1 parent 83be7d5 commit e2edb33
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion render/xml/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ func (r *Renderer) codeBlock(w io.Writer, codeBlock *ast.CodeBlock) {
} else {
r.outs(w, "<![CDATA[")
r.out(w, codeBlock.Literal)
r.outs(w, "]]>\n")
r.outs(w, "]]>")
}
r.outs(w, "</"+name+">")
r.cr(w)
Expand Down
3 changes: 1 addition & 2 deletions testdata/artwork.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<artwork><![CDATA[println("hello")
]]>
</artwork>
]]></artwork>
3 changes: 1 addition & 2 deletions testdata/code-caption-id.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<figure anchor="golang"><name>This is a proper caption. </name>
<artwork><![CDATA[println("GO")
]]>
</artwork>
]]></artwork>
</figure>
3 changes: 1 addition & 2 deletions testdata/figure-anchor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SRO Param | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]>
</artwork>
]]></artwork>
</figure>
3 changes: 1 addition & 2 deletions testdata/include-block-caption.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<sourcecode type="c"><![CDATA[main() int {
return 0
}
]]>
</sourcecode>
]]></sourcecode>
</figure>
<t>And some other text.</t>
3 changes: 1 addition & 2 deletions testdata/include-block.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<sourcecode type="c"><![CDATA[main() int {
return 0
}
]]>
</sourcecode>
]]></sourcecode>
<t>And some other text.</t>
3 changes: 1 addition & 2 deletions testdata/sourcecode.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<sourcecode type="go"><![CDATA[println("hello")
]]>
</sourcecode>
]]></sourcecode>
3 changes: 1 addition & 2 deletions testdata/table-codeblock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
</tbody>
</table>
<sourcecode type="sh"><![CDATA[% cat /dev/zero
]]>
</sourcecode>
]]></sourcecode>

0 comments on commit e2edb33

Please sign in to comment.