diff --git a/build/jsdoc-toolkit/templates/jsdoc/class.tmpl b/build/jsdoc-toolkit/templates/jsdoc/class.tmpl index b3bc4350..60536d30 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/class.tmpl +++ b/build/jsdoc-toolkit/templates/jsdoc/class.tmpl @@ -59,7 +59,7 @@

Extends {+ inheritedClassLinks.join(', ') +}

-

{+processInlineTags(data.classDesc)+}

+{+processInlineTags(data.classDesc)+} @@ -78,7 +78,7 @@
-

{+processInlineTags(data.desc)+}

+
{+processInlineTags(data.desc)+}
{+example+}
@@ -89,7 +89,7 @@
    Returns:
  • -
    {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+processInlineTags(item.desc)+}
    +
    {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+processInlineTags(item.desc, { stripParagraphs: true })+}
diff --git a/build/jsdoc-toolkit/templates/jsdoc/method.tmpl b/build/jsdoc-toolkit/templates/jsdoc/method.tmpl index e013e239..80b0aa6b 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/method.tmpl +++ b/build/jsdoc-toolkit/templates/jsdoc/method.tmpl @@ -22,14 +22,14 @@
-

{+processInlineTags(data.desc)+}

+
{+processInlineTags(data.desc)+} {+ new JSDOC.JsPlate(publish.conf.templatesDir+"examples.tmpl").process(data) +} {+ new JSDOC.JsPlate(publish.conf.templatesDir+"parameters.tmpl").process(data) +}
    Returns:
  • - {+ new Link().toSymbol(item.type) +} — {+processInlineTags(item.desc)+} + {+ new Link().toSymbol(item.type) +} — {+processInlineTags(item.desc, { stripParagraphs: true })+}
diff --git a/build/jsdoc-toolkit/templates/jsdoc/operators.tmpl b/build/jsdoc-toolkit/templates/jsdoc/operators.tmpl index 2b3b136c..639dc7f8 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/operators.tmpl +++ b/build/jsdoc-toolkit/templates/jsdoc/operators.tmpl @@ -34,12 +34,12 @@
-

{+processInlineTags(operator.desc)+}

+
{+processInlineTags(operator.desc)+} {+ new JSDOC.JsPlate(publish.conf.templatesDir+"examples.tmpl").process(operator) +}
    Returns:
  • - {+ new Link().toSymbol(item.type) +} — {+processInlineTags(item.desc)+} + {+ new Link().toSymbol(item.type) +} — {+processInlineTags(item.desc, { stripParagraphs: true })+}
diff --git a/build/jsdoc-toolkit/templates/jsdoc/property.tmpl b/build/jsdoc-toolkit/templates/jsdoc/property.tmpl index 29b684ed..1178b082 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/property.tmpl +++ b/build/jsdoc-toolkit/templates/jsdoc/property.tmpl @@ -25,8 +25,9 @@
-

- {+processInlineTags(data.desc)+} Read only.

+
+ {+processInlineTags(data.desc)+} + Read only. {+ new JSDOC.JsPlate(publish.conf.templatesDir+"examples.tmpl").process(data) +}
    Default: diff --git a/build/jsdoc-toolkit/templates/jsdoc/publish.js b/build/jsdoc-toolkit/templates/jsdoc/publish.js index 44f7d4bd..338650cc 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/publish.js +++ b/build/jsdoc-toolkit/templates/jsdoc/publish.js @@ -1,5 +1,3 @@ -var templates; - var Operator = new function() { var operators = { add: '+', subtract: '-', multiply: '*', divide: '/', equals: '==', @@ -51,6 +49,7 @@ var Helpers = { } }; +var templates; /** Called automatically by JsDoc Toolkit. */ function publish(symbolSet) { publish.conf = { // trailing slash expected for dirs @@ -276,7 +275,9 @@ function processGroupTitle(str, symbol) { return str; } -function processInlineTags(str) { +function processInlineTags(str, param) { + if (!param) + param = {}; // .. ->
    ..
    str = str.replace(/<(\/)*(code)>/g, '<$1pre>'); @@ -292,9 +293,59 @@ function processInlineTags(str) { return '' + code + ''; } ); + + var lineBreak = java.lang.System.getProperty('line.separator'); + + // Convert any type of lineBreak to the one we're using now: + str = str.replace(/(\r\n|\n|\r)/g, function(match, lineBreak) { + return lineBreak; + }); + + // Replace inline with + str = str.replace(/[ \t]*([^\n\r]*?)[ \t]*<\/code>/g, function(match, content) { + return '' + content + ''; + }); + + // Put code and pre tags on the same line as the content, as white-space: pre is set: + str = str.replace(/(<(?:code|pre)>)\s*([\u0000-\uffff]*?)\s*(<\/(?:code|pre)>)/g, function(match, open, content, close) { + // Filter out the first white space at the beginning of each line, since + // that stems from the space after the * in the comment and replace + // with
    , to fix a IE problem where lighter.js does not receive
    +		// linebreaks from code tags weven when white-space: pre is set.
    +		return '
    ' + content.replace(/(\r\n|\n|\r) /mg, function(match, lineBreak) {
    +			return lineBreak;
    +		}) + '
    '; + }); + // Empty lines -> Paragraphs + if (!param.stripParagraphs) { + if (param.wrapInParagraphs === undefined || param.wrapInParagraphs) + str = '

    ' + str.trim() + '

    '; + str = str.trim().replace(/(\r\n|\n|\r)\s*(\r\n|\n|\r)/g, function(match, lineBreak) { + return '

    ' + lineBreak + '

    '; + }); + // Automatically put

    at the end of sentences with line breaks. + // Match following

    and

    tags and swallow them. This happens when + // the original content contains these. + str = str.trim().replace(/([.:?!;])\s*(\r\n|\n|\r)(\s*)(<\/p>|

    |)/g, function(match, before, lineBreak, whiteSpace, after) { + // Include following whiteSpace as well, since for code blocks they are relevant (e.g. indentation on new line) + return before + '

    ' + lineBreak + whiteSpace + '

    '; + }); + // Filter out

    tags within and around and

     blocks again
    +		str = str.replace(/((?:

    \s*|)<(?:code|pre)[^>]*>[\u0000-\uffff]*<\/(?:code|pre)>(?:\s*<\/p>|))/g, function(match, code) { + return stripTags(code, 'p'); + }); + // Filter out empty paragraphs + str = str.replace(/

    <\/p>/g, ''); + } + return str; } +function stripTags(str, tag) { + var tag = tag || '.*?'; // Default: all tags + return str.replace(new RegExp('<' + tag + '>|', 'g'), ''); +} + function copyStatic(dir) { var dir = publish.conf.templatesDir + 'resources/';