diff options
Diffstat (limited to 'bower_components/bootstrap/grunt/bs-lessdoc-parser.js')
| -rw-r--r-- | bower_components/bootstrap/grunt/bs-lessdoc-parser.js | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/bower_components/bootstrap/grunt/bs-lessdoc-parser.js b/bower_components/bootstrap/grunt/bs-lessdoc-parser.js index c1821de..5a9ed2b 100644 --- a/bower_components/bootstrap/grunt/bs-lessdoc-parser.js +++ b/bower_components/bootstrap/grunt/bs-lessdoc-parser.js @@ -1,16 +1,19 @@ /*! * Bootstrap Grunt task for parsing Less docstrings * http://getbootstrap.com - * Copyright 2014 Twitter, Inc. + * Copyright 2014-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ + 'use strict'; -var markdown = require('markdown').markdown; +var Markdown = require('markdown-it'); function markdown2html(markdownString) { + var md = new Markdown(); + // the slice removes the <p>...</p> wrapper output by Markdown processor - return markdown.toHTML(markdownString.trim()).slice(3, -4); + return md.render(markdownString.trim()).slice(3, -5); } @@ -33,9 +36,9 @@ Mini-language: var CUSTOMIZABLE_HEADING = /^[/]{2}={2}(.*)$/; var UNCUSTOMIZABLE_HEADING = /^[/]{2}-{2}(.*)$/; var SUBSECTION_HEADING = /^[/]{2}={3}(.*)$/; -var SECTION_DOCSTRING = /^[/]{2}#{2}(.*)$/; -var VAR_ASSIGNMENT = /^(@[a-zA-Z0-9_-]+):[ ]*([^ ;][^;]+);[ ]*$/; -var VAR_DOCSTRING = /^[/]{2}[*]{2}(.*)$/; +var SECTION_DOCSTRING = /^[/]{2}#{2}(.+)$/; +var VAR_ASSIGNMENT = /^(@[a-zA-Z0-9_-]+):[ ]*([^ ;][^;]*);[ ]*$/; +var VAR_DOCSTRING = /^[/]{2}[*]{2}(.+)$/; function Section(heading, customizable) { this.heading = heading.trim(); @@ -119,7 +122,7 @@ Tokenizer.prototype._shift = function () { return new VarDocstring(match[1]); } var commentStart = line.lastIndexOf('//'); - var varLine = (commentStart === -1) ? line : line.slice(0, commentStart); + var varLine = commentStart === -1 ? line : line.slice(0, commentStart); match = VAR_ASSIGNMENT.exec(varLine); if (match !== null) { return new Variable(match[1], match[2]); @@ -166,8 +169,7 @@ Parser.prototype.parseSection = function () { var docstring = this._tokenizer.shift(); if (docstring instanceof SectionDocstring) { section.docstring = docstring; - } - else { + } else { this._tokenizer.unshift(docstring); } this.parseSubSections(section); @@ -183,15 +185,14 @@ Parser.prototype.parseSubSections = function (section) { // Presume an implicit initial subsection subsection = new SubSection(''); this.parseVars(subsection); - } - else { + } else { break; } } section.addSubSection(subsection); } - if (section.subsections.length === 1 && !(section.subsections[0].heading) && section.subsections[0].variables.length === 0) { + if (section.subsections.length === 1 && !section.subsections[0].heading && section.subsections[0].variables.length === 0) { // Ignore lone empty implicit subsection section.subsections = []; } |
