forked from limedocs/limedocs-wiki-converter
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathtoc.js.map
1 lines (1 loc) · 2.82 KB
/
toc.js.map
1
{"version":3,"sources":["../src/toc.js"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;AAEZ,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IACtB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IACxB,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IACtB,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;;IAExB,GAAG;;;;;;;AAMI,WANP,GAAG,CAMK,SAAS,EAAE;0BANnB,GAAG;;AAOL,QAAI,CAAC,SAAS,GAAG,SAAS,CAAA;AAC1B,QAAI,CAAC,eAAe,EAAE,CAAA;GACvB;;eATG,GAAG;;WAWI,uBAAG;AACZ,aAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAA;KACtB;;;WAEM,mBAAG;AACR,aAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAA;KACxB;;;WAEO,oBAAG;AACT,aAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAA;KACzB;;;;;;;WAKc,2BAAG;AAChB,UAAI,CAAC,GAAG,GAAG,EAAE,CAAA;AACb,UAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;;AAE1C,UAAI,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACjG,UAAI,CAAC,GAAG,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAA;AACvC,UAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAA;KAC1C;;;;;;;;WAMiB,8BAAG;AACnB,UAAI,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAA;AACzC,UAAI,OAAO,EAAE;AACX,eAAO,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAA;OACpD;;AAED,aAAO,IAAI,CAAC,kBAAkB,EAAE,CAAA;KACjC;;;;;;;;WAMiB,8BAAG;AACnB,aAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,CAAC,UAAA,QAAQ,EAAI;AACpE,YAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AACtC,eAAO,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;OACrD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KACd;;;SAzDG,GAAG;;;AA4DT,MAAM,CAAC,OAAO,GAAG,GAAG,CAAA","file":"toc.js","sourcesContent":["\"use strict\"\n\nvar path = require('path')\n , fs = require('fs-extra')\n , util = require('util')\n , marked = require('marked')\n\nclass Toc {\n\n /**\n *\n * @param {GWC} gwc\n */\n constructor(converter) {\n this.converter = converter\n this.computeTocParts()\n }\n\n getMarkdown() {\n return this.toc.tocMd\n }\n\n getHtml() {\n return this.toc.tocHtml\n }\n\n getItems() {\n return this.toc.tocItems\n }\n\n /**\n * @private\n */\n computeTocParts() {\n this.toc = {}\n this.toc.tocMd = this.getTocFileContents()\n\n let convertedToc = this.converter.getMarkdownConverter().convertTocMarkdownString(this.toc.tocMd)\n this.toc.tocHtml = convertedToc.tocHtml\n this.toc.tocItems = convertedToc.tocItems\n }\n\n /**\n * @private\n * @returns {String}\n */\n getTocFileContents() {\n var tocFile = this.converter.getTocFile()\n if (tocFile) {\n return fs.readFileSync(tocFile, {encoding: 'utf8'})\n }\n // if no toc file, generate contents from files\n return this.genTocFileContents()\n }\n\n /**\n * @private\n * @returns {string}\n */\n genTocFileContents() {\n return Object.keys(this.converter.getMarkdownFiles()).map(filename => {\n var basename = path.basename(filename)\n return util.format('- [%s](%s)', basename, basename)\n }).join('\\n')\n }\n}\n\nmodule.exports = Toc\n"]}