diff options
Diffstat (limited to 'packages/gitbook-asciidoc/lib/toAsciidoc.js')
-rw-r--r-- | packages/gitbook-asciidoc/lib/toAsciidoc.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/lib/toAsciidoc.js b/packages/gitbook-asciidoc/lib/toAsciidoc.js new file mode 100644 index 0000000..5b4e93c --- /dev/null +++ b/packages/gitbook-asciidoc/lib/toAsciidoc.js @@ -0,0 +1,47 @@ + +// Return N time a string +function ns(s, n) { + return Array(n + 1).join(s); +} + +module.exports = { + onTitleStart: function(level) { + return ns('=', level) + ' '; + }, + onTitleEnd: function(level) { + return this.onBL(); + }, + + onParagraphStart: function() { + return this.onSection(); + }, + onParagraphEnd: function() { + return this.onSection(); + }, + + onLinkStart: function(href) { + return 'link:' + href + '['; + }, + onLinkEnd: function() { + return ']'; + }, + + onListStart: function(level) { + return ''; + }, + onListEnd: function() { + return ''; + }, + + onListItemStart: function(level) { + return ns('.', level + 1) + ' '; + }, + onListItemEnd: function() { + return ''; + }, + + onHR: function() { + return "'''"; + } +}; + |