- Commit
- 009fe0141445275c495d0825a1d5c0a374fc9d90
- Parent
- b811dd8facd3fe26da32b93d70ab92d3693fab5c
- Author
- John MacFarlane <fiddlosopher@gmail.com>
- Date
XML writer - implemented list attributes.
My personal build of CMark ✏️
XML writer - implemented list attributes.
1 file changed, 24 insertions, 0 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | js/lib/xml.js | 24 | 24 | 0 |
diff --git a/js/lib/xml.js b/js/lib/xml.js @@ -71,6 +71,29 @@ var renderNodes = function(block) { tagname = node.t.toLowerCase(); attrs = []; + + if (node.list_data) { + var data = node.list_data; + if (data.type) { + attrs.push(['type', data.type.toLowerCase()]); + } + if (data.start) { + attrs.push(['start', String(data.start)]); + } + if (data.tight) { + attrs.push(['tight', (data.tight ? 'true' : 'false')]); + } + if (data.delimiter) { + var delimword = ''; + if (data.delimiter === '.') { + delimword = 'period'; + } else { + delimword = 'paren'; + } + attrs.push(['delimiter', delimword]); + } + } + if (options.sourcepos) { var pos = node.sourcepos; if (pos) { @@ -100,6 +123,7 @@ var renderNodes = function(block) { } if (options.time) { console.timeEnd("rendering"); } + buffer += '\n'; return buffer; };