diff options
Diffstat (limited to 'packages/gitbook-asciidoc/lib/toasciidoc.js')
-rw-r--r-- | packages/gitbook-asciidoc/lib/toasciidoc.js | 43 |
1 files changed, 43 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..cb32921 --- /dev/null +++ b/packages/gitbook-asciidoc/lib/toasciidoc.js @@ -0,0 +1,43 @@ + +// 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 ''; + }, +}; + |