Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output Consists of only Title and Search Bar #4

Open
kmiklas opened this issue Nov 27, 2012 · 2 comments
Open

Output Consists of only Title and Search Bar #4

kmiklas opened this issue Nov 27, 2012 · 2 comments

Comments

@kmiklas
Copy link

kmiklas commented Nov 27, 2012

Hi,

I ran Dox on dox.js, which generated the JSON object below.

I then applied dox-template. As I'm stuck in a Windows environment running PowerShell which does not support the "<" redirect, I had to modify the shell command a bit, as follows:
cat ./dox.json | ./node_modules/.bin/dox-template -r 0.1.1 > dox.1.html

The resulting HTML file--also below--contains only a horizontal line, followed by the title of "Dox Template v0.1.1," and a search input. the rest of the page is blank.

In addition, why is there not a set of tags created in the resulting documentation page? In other words, why does the documentation begin with ?

tyvm
~Keith :^)

/** 
 * JSON Object created when Dox is applied to dox.js 
*/


[
  {
    "tags": [],
    "description": {
      "full": "<p>Module dependencies.</p>",
      "summary": "<p>Module dependencies.</p>",
      "body": ""
    },
    "ignore": true,
    "code": "var markdown = require('github-flavored-markdown').parse\n  , escape = require('./utils').escape;",
    "ctx": {
      "type": "declaration",
      "name": "markdown",
      "value": "require('github-flavored-markdown').parse",
      "string": "markdown"
    }
  },
  {
    "tags": [],
    "description": {
      "full": "<p>Library version.</p>",
      "summary": "<p>Library version.</p>",
      "body": ""
    },
    "ignore": false,
    "code": "exports.version = '0.3.2';",
    "ctx": {
      "type": "property",
      "receiver": "exports",
      "name": "version",
      "value": "'0.3.2'",
      "string": "exports.version"
    }
  },
  {
    "tags": [],
    "description": {
      "full": "<p>Expose api.</p>",
      "summary": "<p>Expose api.</p>",
      "body": ""
    },
    "ignore": false,
    "code": "exports.api = require('./api');",
    "ctx": {
      "type": "property",
      "receiver": "exports",
      "name": "api",
      "value": "require('./api')",
      "string": "exports.api"
    }
  },
  {
    "tags": [
      {
        "type": "param",
        "types": [
          "String"
        ],
        "name": "js",
        "description": ""
      },
      {
        "type": "param",
        "types": [
          "Object"
        ],
        "name": "options",
        "description": ""
      },
      {
        "type": "return",
        "types": [
          "Array"
        ],
        "description": ""
      },
      {
        "type": "see",
        "local": "exports.parseComment",
        "visibility": "exports.parseComment"
      },
      {
        "type": "api",
        "visibility": "public"
      }
    ],
    "description": {
      "full": "<p>Parse comments in the given string of <code>js</code>.</p>",
      "summary": "<p>Parse comments in the given string of <code>js</code>.</p>",
      "body": ""
    },
    "isPrivate": false,
    "ignore": false,
    "code": "exports.parseComments = function(js, options){\n  options = options || {};\n  js = js.replace(/\\r\\n/gm, '\\n');\n\n  var comments = []\n    , raw = options.raw\n    , comment\n    , buf = ''\n    , ignore\n    , withinMultiline = false\n    , withinSingle = false\n    , code;\n\n  for (var i = 0, len = js.length; i < len; ++i) {\n    // start comment\n    if (!withinMultiline && !withinSingle && '/' == js[i] && '*' == js[i+1]) {\n      // code following previous comment\n      if (buf.trim().length) {\n        comment = comments[comments.length - 1];\n        if(comment) {\n          comment.code = code = buf.trim();\n          comment.ctx = exports.parseCodeContext(code);\n        }\n        buf = '';\n      }\n      i += 2;\n      withinMultiline = true;\n      ignore = '!' == js[i];\n    // end comment\n    } else if (withinMultiline && !withinSingle && '*' == js[i] && '/' == js[i+1]) {\n      i += 2;\n      buf = buf.replace(/^ *\\* ?/gm, '');\n      var comment = exports.parseComment(buf, options);\n      comment.ignore = ignore;\n      comments.push(comment);\n      withinMultiline = ignore = false;\n      buf = '';\n    } else if (!withinSingle && !withinMultiline && '/' == js[i] && '/' == js[i+1]) {\n      withinSingle = true;\n      buf += js[i];\n    } else if (withinSingle && !withinMultiline && '\\n' == js[i]) {\n      withinSingle = false;\n      buf += js[i];\n    // buffer comment or code\n    } else {\n      buf += js[i];\n    }\n  }\n\n  if (comments.length === 0) {\n    comments.push({\n      tags: [],\n      description: {full: '', summary: '', body: ''},\n      isPrivate: false\n    });\n  }\n\n  // trailing code\n  if (buf.trim().length) {\n    comment = comments[comments.length - 1];\n    code = buf.trim();\n    comment.code = code;\n    comment.ctx = exports.parseCodeContext(code);\n  }\n\n  return comments;\n};",
    "ctx": {
      "type": "method",
      "receiver": "exports",
      "name": "parseComments",
      "string": "exports.parseComments()"
    }
  },
  {
    "tags": [
      {
        "type": "param",
        "types": [
          "String"
        ],
        "name": "str",
        "description": ""
      },
      {
        "type": "param",
        "types": [
          "Object"
        ],
        "name": "options",
        "description": ""
      },
      {
        "type": "return",
        "types": [
          "Object"
        ],
        "description": ""
      },
      {
        "type": "see",
        "local": "exports.parseTag",
        "visibility": "exports.parseTag"
      },
      {
        "type": "api",
        "visibility": "public"
      }
    ],
    "description": {
      "full": "<p>Parse the given comment <code>str</code>.</p>\n\n<p>The comment object returned contains the following</p>\n\n<ul>\n<li><code>tags</code>  array of tag objects</li>\n<li><code>description</code> the first line of the comment</li>\n<li><code>body</code> lines following the description</li>\n<li><code>content</code> both the description and the body</li>\n<li><code>isPrivate</code> true when \"@api private\" is used</li>\n</ul>",
      "summary": "<p>Parse the given comment <code>str</code>.</p>",
      "body": "<p>The comment object returned contains the following</p>\n\n<ul>\n<li><code>tags</code>  array of tag objects</li>\n<li><code>description</code> the first line of the comment</li>\n<li><code>body</code> lines following the description</li>\n<li><code>content</code> both the description and the body</li>\n<li><code>isPrivate</code> true when \"@api private\" is used</li>\n</ul>"
    },
    "isPrivate": false,
    "ignore": false,
    "code": "exports.parseComment = function(str, options) {\n  str = str.trim();\n  options = options || {};\n\n  var comment = { tags: [] }\n    , raw = options.raw\n    , description = {};\n\n  // parse comment body\n  description.full = str.split('\\n@')[0];\n  description.summary = description.full.split('\\n\\n')[0];\n  description.body = description.full.split('\\n\\n').slice(1).join('\\n\\n');\n  comment.description = description;\n\n  // parse tags\n  if (~str.indexOf('\\n@')) {\n    var tags = '@' + str.split('\\n@').slice(1).join('\\n@');\n    comment.tags = tags.split('\\n').map(exports.parseTag);\n    comment.isPrivate = comment.tags.some(function(tag){\n      return 'api' == tag.type && 'private' == tag.visibility;\n    })\n  }\n\n  // markdown\n  if (!raw) {\n    description.full = markdown(description.full);\n    description.summary = markdown(description.summary);\n    description.body = markdown(description.body);\n  }\n\n  return comment;\n}",
    "ctx": {
      "type": "method",
      "receiver": "exports",
      "name": "parseComment",
      "string": "exports.parseComment()"
    }
  },
  {
    "tags": [
      {
        "type": "param",
        "types": [
          "String"
        ],
        "name": "",
        "description": ""
      },
      {
        "type": "return",
        "types": [
          "Object"
        ],
        "description": ""
      },
      {
        "type": "api",
        "visibility": "public"
      }
    ],
    "description": {
      "full": "<p>Parse tag string \"@param {Array} name description\" etc.</p>",
      "summary": "<p>Parse tag string \"@param {Array} name description\" etc.</p>",
      "body": ""
    },
    "isPrivate": false,
    "ignore": false,
    "code": "exports.parseTag = function(str) {\n  var tag = {} \n    , parts = str.split(/ +/)\n    , type = tag.type = parts.shift().replace('@', '');\n\n  switch (type) {\n    case 'param':\n      tag.types = exports.parseTagTypes(parts.shift());\n      tag.name = parts.shift() || '';\n      tag.description = parts.join(' ');\n      break;\n    case 'return':\n      tag.types = exports.parseTagTypes(parts.shift());\n      tag.description = parts.join(' ');\n      break;\n    case 'see':\n      if (~str.indexOf('http')) {\n        tag.title = parts.length > 1\n          ? parts.shift()\n          : '';\n        tag.url = parts.join(' ');\n      } else {\n        tag.local = parts.join(' ');\n      }\n    case 'api':\n      tag.visibility = parts.shift();\n      break;\n    case 'type':\n      tag.types = exports.parseTagTypes(parts.shift());\n      break;\n    case 'memberOf':\n      tag.parent = parts.shift();\n      break;\n    case 'augments':\n      tag.otherClass = parts.shift();\n      break;\n    case 'borrows':\n      tag.otherMemberName = parts.join(' ').split(' as ')[0];\n      tag.thisMemberName = parts.join(' ').split(' as ')[1];\n      break;\n    default:\n      tag.string = parts.join(' ');\n      break;\n  }\n\n  return tag;\n}",
    "ctx": {
      "type": "method",
      "receiver": "exports",
      "name": "parseTag",
      "string": "exports.parseTag()"
    }
  },
  {
    "tags": [
      {
        "type": "param",
        "types": [
          "String"
        ],
        "name": "str",
        "description": ""
      },
      {
        "type": "return",
        "types": [
          "Array"
        ],
        "description": ""
      },
      {
        "type": "api",
        "visibility": "public"
      }
    ],
    "description": {
      "full": "<p>Parse tag type string \"{Array|Object}\" etc.</p>",
      "summary": "<p>Parse tag type string \"{Array|Object}\" etc.</p>",
      "body": ""
    },
    "isPrivate": false,
    "ignore": false,
    "code": "exports.parseTagTypes = function(str) {\n  return str\n    .replace(/[{}]/g, '')\n    .split(/ *[|,\\/] */);\n};",
    "ctx": {
      "type": "method",
      "receiver": "exports",
      "name": "parseTagTypes",
      "string": "exports.parseTagTypes()"
    }
  },
  {
    "tags": [
      {
        "type": "param",
        "types": [
          "String"
        ],
        "name": "str",
        "description": ""
      },
      {
        "type": "return",
        "types": [
          "Object"
        ],
        "description": ""
      },
      {
        "type": "api",
        "visibility": "public"
      }
    ],
    "description": {
      "full": "<p>Parse the context from the given <code>str</code> of js.</p>\n\n<p>This method attempts to discover the context<br />for the comment based on it's code. Currently<br />supports:</p>\n\n<ul>\n<li>function statements</li>\n<li>function expressions</li>\n<li>prototype methods</li>\n<li>prototype properties</li>\n<li>methods</li>\n<li>properties</li>\n<li>declarations</li>\n</ul>",
      "summary": "<p>Parse the context from the given <code>str</code> of js.</p>",
      "body": "<p>This method attempts to discover the context<br />for the comment based on it's code. Currently<br />supports:</p>\n\n<ul>\n<li>function statements</li>\n<li>function expressions</li>\n<li>prototype methods</li>\n<li>prototype properties</li>\n<li>methods</li>\n<li>properties</li>\n<li>declarations</li>\n</ul>"
    },
    "isPrivate": false,
    "ignore": false,
    "code": "exports.parseCodeContext = function(str){\n  var str = str.split('\\n')[0];\n\n  // function statement\n  if (/^function (\\w+) *\\(/.exec(str)) {\n    return {\n        type: 'function'\n      , name: RegExp.$1\n      , string: RegExp.$1 + '()'\n    };\n  // function expression\n  } else if (/^var *(\\w+) *= *function/.exec(str)) {\n    return {\n        type: 'function'\n      , name: RegExp.$1\n      , string: RegExp.$1 + '()'\n    };\n  // prototype method\n  } else if (/^(\\w+)\\.prototype\\.(\\w+) *= *function/.exec(str)) {\n    return {\n        type: 'method'\n      , constructor: RegExp.$1\n      , cons: RegExp.$1\n      , name: RegExp.$2\n      , string: RegExp.$1 + '.prototype.' + RegExp.$2 + '()'\n    };\n  // prototype property\n  } else if (/^(\\w+)\\.prototype\\.(\\w+) *= *([^\\n;]+)/.exec(str)) {\n    return {\n        type: 'property'\n      , constructor: RegExp.$1\n      , cons: RegExp.$1\n      , name: RegExp.$2\n      , value: RegExp.$3\n      , string: RegExp.$1 + '.prototype' + RegExp.$2\n    };\n  // method\n  } else if (/^([\\w.]+)\\.(\\w+) *= *function/.exec(str)) {\n    return {\n        type: 'method'\n      , receiver: RegExp.$1\n      , name: RegExp.$2\n      , string: RegExp.$1 + '.' + RegExp.$2 + '()'\n    };\n  // property\n  } else if (/^(\\w+)\\.(\\w+) *= *([^\\n;]+)/.exec(str)) {\n    return {\n        type: 'property'\n      , receiver: RegExp.$1\n      , name: RegExp.$2\n      , value: RegExp.$3\n      , string: RegExp.$1 + '.' + RegExp.$2\n    };\n  // declaration\n  } else if (/^var +(\\w+) *= *([^\\n;]+)/.exec(str)) {\n    return {\n        type: 'declaration'\n      , name: RegExp.$1\n      , value: RegExp.$2\n      , string: RegExp.$1\n    };\n  }\n};",
    "ctx": {
      "type": "method",
      "receiver": "exports",
      "name": "parseCodeContext",
      "string": "exports.parseCodeContext()"
    }
  }
]
/**
 * dox-template HTML Created
 */ 

<head>
  <script>
    var raw = []
  </script>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>

  <script type="text/javascript" charset="utf-8">
    // lunr.js version: 0.0.4
    // (c) 2011 Oliver Nightingale
    //
    //  Released under MIT license.
    //
    var Lunr=function(c,f){var b=new Lunr.Index(c);f.call(b,b);return b};
    Lunr.utils={uniq:function(c){if(!c)return[];return c.reduce(function(c,b){c.indexOf(b)===-1&&c.push(b);return c},[])},intersect:function(c){var f=[].slice.call(arguments,1);return this.uniq(c).filter(function(b){return f.every(function(a){return a.indexOf(b)>=0})})},detect:function(c,f,b){for(var a=c.length,g=null,d=0;d<a;d++)if(f.call(b,c[d],d,c)){g=c[d];break}return g},copy:function(c){return Object.keys(c).reduce(function(f,b){f[b]=c[b];return f},{})}};
    Lunr.Trie=function(){var c=function(){this.children={};this.values=[]};c.prototype={childForKey:function(b){var a=this.children[b];a||(a=new c,this.children[b]=a);return a}};var f=function(){this.root=new c};f.prototype={get:function(b){var a=this;return this.keys(b).reduce(function(c,d){a.getNode(d).values.forEach(function(a){a=Lunr.utils.copy(a);if(b===d)a.exact=!0;c.push(a)});return c},[])},getNode:function(b){var a=function(b,d){if(!d.length)return b;return a(b.childForKey(d.charAt(0)),d.slice(1))};
    return a(this.root,b)},keys:function(b){var a=[];b=b||"";var c=function(b,e){b.values.length&&a.push(e);Object.keys(b.children).forEach(function(a){c(b.children[a],e+a)})};c(this.getNode(b),b);return a},set:function(b,a){var c=function(b,e){if(!e.length)return b.values.push(a);c(b.childForKey(e.charAt(0)),e.slice(1))};return c(this.root,b)}};return f}();Lunr.Index=function(c){this.name=c;this.refName="id";this.fields={};this.trie=new Lunr.Trie};
    Lunr.Index.prototype={add:function(c){(new Lunr.Document(c,this.refName,this.fields)).words().forEach(function(c){this.trie.set(c.id,c.docs[0])},this)},field:function(c,f){this.fields[c]=f||{multiplier:1}},ref:function(c){this.refName=c},search:function(c){if(!c)return[];c=c.split(" ").map(function(c){c=new Lunr.Word(c);if(!c.isStopWord())return c.toString()}).filter(function(c){return c}).map(function(c){return this.trie.get(c).sort(function(b,a){if(b.exact&&a.exact===void 0)return-1;if(a.exact&&
    b.exact===void 0)return 1;if(b.score<a.score)return 1;if(b.score>a.score)return-1;return 0}).map(function(b){return b.documentId})},this);return Lunr.utils.intersect.apply(Lunr.utils,c)}};Lunr.Document=function(c,f,b){this.original=c;this.fields=b;this.ref=c[f]};
    Lunr.Document.prototype={asJSON:function(){return{id:this.ref,words:this.words().map(function(c){return c.id}),original:this.original}},words:function(){var c=this,f={};Object.keys(this.fields).forEach(function(b){c.original[b].split(/\b/g).filter(function(a){return!!a.match(/\w/)}).map(function(a){a=new Lunr.Word(a);if(!a.isStopWord())return a.toString()}).filter(function(a){return a}).forEach(function(a){f[a]||(f[a]={score:0,ref:c.ref});f[a].score+=c.fields[b].multiplier})});return Object.keys(f).map(function(b){return{id:b,
    docs:[{score:f[b].score,documentId:c.ref}]}})}};Lunr.Word=function(c){this.raw=c;this.out=this.raw.replace(/^\W+/,"").replace(/\W+$/,"").toLowerCase()};Lunr.Word.stopWords=["the","of","to","and","a","in","is","it","you","that","this"];
    Lunr.Word.prototype={isStopWord:function(){return Lunr.Word.stopWords.indexOf(this.raw.toLowerCase())!==-1},toString:function(){if(!this.isStopWord())return this.stem(),this.out},stem:function(){var c={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},f={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",
    ful:"",ness:""};return function(){var b,a,g,d=g=this.out;if(g.length<3)return g;var e,h;g=g.substr(0,1);g=="y"&&(d=g.toUpperCase()+d.substr(1));e=/^(.+?)(ss|i)es$/;a=/^(.+?)([^s])s$/;e.test(d)?d=d.replace(e,"$1$2"):a.test(d)&&(d=d.replace(a,"$1$2"));e=/^(.+?)eed$/;a=/^(.+?)(ed|ing)$/;e.test(d)?(a=e.exec(d),e=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,e.test(a[1])&&(e=/.$/,d=d.replace(e,""))):a.test(d)&&(a=a.exec(d),b=a[1],a=/^([^aeiou][^aeiouy]*)?[aeiouy]/,a.test(b)&&(d=b,a=/(at|bl|iz)$/,
    h=/([^aeiouylsz])\1$/,b=/^[^aeiou][^aeiouy]*[aeiouy][^aeiouwxy]$/,a.test(d)?d+="e":h.test(d)?(e=/.$/,d=d.replace(e,"")):b.test(d)&&(d+="e")));e=/^(.+?)y$/;e.test(d)&&(a=e.exec(d),b=a[1],e=/^([^aeiou][^aeiouy]*)?[aeiouy]/,e.test(b)&&(d=b+"i"));e=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;e.test(d)&&(a=e.exec(d),b=a[1],a=a[2],e=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,e.test(b)&&(d=b+c[a]));
    e=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;e.test(d)&&(a=e.exec(d),b=a[1],a=a[2],e=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,e.test(b)&&(d=b+f[a]));e=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;a=/^(.+?)(s|t)(ion)$/;e.test(d)?(a=e.exec(d),b=a[1],e=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,e.test(b)&&(d=b)):a.test(d)&&(a=a.exec(d),b=a[1]+a[2],a=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,
    a.test(b)&&(d=b));e=/^(.+?)e$/;if(e.test(d)&&(a=e.exec(d),b=a[1],e=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,a=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$/,h=/^[^aeiou][^aeiouy]*[aeiouy][^aeiouwxy]$/,e.test(b)||a.test(b)&&!h.test(b)))d=b;e=/ll$/;a=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*/;e.test(d)&&a.test(d)&&(e=/.$/,d=d.replace(e,""));g=="y"&&(d=g.toLowerCase()+
    d.substr(1));this.out=d}}()};
  </script>

  <script type="text/javascript" charset="utf-8">
    var idx = Lunr('methods', function () {
      this.ref('id')
      this.field('name', { multiplier: 10 })
      this.field('parent', { multiplier: 5 })
      this.field('full_description')
    })

    var methods = raw.reduce(function (memo, module) {
      return memo.concat(module.methods)
    }, [])

    methods.forEach(function (method) {
      idx.add(method)
    })

    $(document).ready(function () {

      var search = function (term) {
        return idx.search(term).map(function (id) {
          return methods.filter(function (method) {
            return method.id === id
          })[0]
        })
      }

      var searchResults = $('#search-results')

      $('#search-input').keyup(function () {
        var query = $(this).val(),
            results = search(query)

        if (!results.length) {
          searchResults.empty()
          return
        };

        var resultsList = results.reduce(function (ul, result) {
          var li = $('<li>').append($('<a>', {
            href: '#' + result.name,
            text: result.name
          }))

          ul.append(li)

          return ul
        }, $('<ul>'))

        searchResults.html(resultsList)
      })
    })
  </script>

  <style type="text/css" media="screen">
    body {
  font-family: 'Helvetica Neue';
  color: #333;
}

a {
  color: #0f4bf0;
}

header h1 {
  border-top: 4px solid #333;
  font-size: 2.6em;
}

header .version {
  font-size: 0.6em;
}

.main > header {
  margin-bottom: 40px;
}

article {
  margin-bottom: 10px;
  padding-bottom: 30px;
}

article header h2 {
  border-top: 3px solid #333;
  font-size: 2em;
  padding-top: 5px;
}

article > section {
  margin-bottom: 30px;
}

article section h3 {
  font-size: 1em;
}

article section header h3 {
  padding-top: 2px;
  font-size: 1.2em;
  margin-bottom: 5px;
  border-top: 2px solid #333;
}

article section header h4 {
  font-size: 0.9em;
  font-family: courier;
  margin: 2px 0 5px 0;
}

@-webkit-keyframes highlight {
  from {
    background-color: #Ffff66;
  }

  to {
    background-color: white;
  }
}

section.method:target {
  -webkit-animation-duration: 1s;
  -webkit-animation-name: highlight;
}

section header .type, section header .related {
  margin-top: 0px;
  font-size: 0.8em;
}

section.params h4, section.source h4 {
  margin-top: 5px;
  margin-bottom: 2px;
  font-size: 0.9em;
}

section.params ul {
  margin-top: 2px;
}

a.show-source {
  font-size: 0.8em;
}

.wrap {
  width: 960px;
  margin: 0 auto;
}

.main {
  width: 760px;
  float: left;
}

.search {
  margin-top: 10px;
  float: right;
}

#search-input {
  width: 200px;
}

#search-results {
  position: relative;
}

#search-results ul {
  width: 200px;
  position: absolute;
  top: 0px;
  left: 0px;
  background-color: white;
  border: 1px solid #ccc;
  list-style: none;
  padding: 0;
  margin-top: 0;
  font-size: 0.9em;
}

#search-results li {
  padding: 5px;
}

#search-results li:hover {
  background-color: #eee;
  cursor: pointer;
}

#search-results li a {
  text-decoration: none;
  width: 200px;
  display: block;
}

p {
  line-height: 1.4em;
}

nav {
  padding-top: 15px;
  float: left;
  width: 165px;
  margin-right: 30px;
  text-align: right;
  font-size: 0.8em;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav ul h3 {
  margin-bottom: 5px;
  border-top: 2px solid #CCC;
  padding-top: 2px;
}

nav ul ul li {
  padding: 2px 0;
}

pre {
  background-color: rgba(0,0,0,0.1);
  padding: 8px;
}

code .keyword, code .special {
  font-weight: bold;
  color: black;
}

code .string, code .regexp {
  color: green
}

code .class { 
  color: blue
}

code .number {
  color: red
}

code .comment {
  color: grey;
  font-style: italic;
}
  </style>
</head>
<body>
  <div class='wrap'>


    <nav>
      <ul>

      </ul>
    </nav>

    <div class='main'>
      <header>
        <div class='search'>
          <input type="search" id="search-input" placeholder="Search"></input>
          <div id="search-results"></div>
        </div>
        <h1>dox-template <span class='version'>0.1.1</span></h1>
      </header>


    </div>
  </div>
  <script>
    (function (hijs) {
    //
    // hijs - JavaScript Syntax Highlighter
    //
    // Copyright (c) 2010 Alexis Sellier
    //

    // All elements which match this will be syntax highlighted.
    var selector = hijs || 'code';

    var keywords = ('var function if else for while break switch case do new null in with void '
                   +'continue delete return this true false throw catch typeof with instanceof').split(' '),
        special  = ('eval window document undefined NaN Infinity parseInt parseFloat '
                   +'encodeURI decodeURI encodeURIComponent decodeURIComponent').split(' ');

    // Syntax definition
    // The key becomes the class name of the <span>
    // around the matched block of code.
    var syntax = [
      ['comment', /(\/\*(?:[^*\n]|\*+[^\/*])*\*+\/)/g],
      ['comment', /(\/\/[^\n]*)/g],
      ['string' , /("(?:(?!")[^\\\n]|\\.)*"|'(?:(?!')[^\\\n]|\\.)*')/g],
      ['regexp' , /(\/.+\/[mgi]*)(?!\s*\w)/g],
      ['class'  , /\b([A-Z][a-zA-Z]+)\b/g],
      ['number' , /\b([0-9]+(?:\.[0-9]+)?)\b/g],
      ['keyword', new(RegExp)('\\b(' + keywords.join('|') + ')\\b', 'g')],
      ['special', new(RegExp)('\\b(' + special.join('|') + ')\\b', 'g')]
    ];
    var nodes, table = {};

    if (/^[a-z]+$/.test(selector)) {
        nodes = document.getElementsByTagName(selector);
    } else if (/^\.[\w-]+$/.test(selector)) {
        nodes = document.getElementsByClassName(selector.slice(1));
    } else if (document.querySelectorAll) {
        nodes = document.querySelectorAll(selector);
    } else {
        nodes = [];
    }

    for (var i = 0, children; i < nodes.length; i++) {
        children = nodes[i].childNodes;

        for (var j = 0, str; j < children.length; j++) {
            code = children[j];

            if (code.length >= 0) { // It's a text node
                // Don't highlight command-line snippets
                if (! /^\$/.test(code.nodeValue.trim())) {
                    syntax.forEach(function (s) {
                        var k = s[0], v = s[1];
                        code.nodeValue = code.nodeValue.replace(v, function (_, m) {
                            return '\u00ab' + encode(k) + '\u00b7'
                                            + encode(m) +
                                   '\u00b7' + encode(k) + '\u00bb';
                        });
                    });
                }
            }
        }
    }
    for (var i = 0; i < nodes.length; i++) {
        nodes[i].innerHTML =
            nodes[i].innerHTML.replace(/\u00ab(.+?)\u00b7(.+?)\u00b7\1\u00bb/g, function (_, name, value) {
                value = value.replace(/\u00ab[^\u00b7]+\u00b7/g, '').replace(/\u00b7[^\u00bb]+\u00bb/g, '');
                return '<span class="' + decode(name) + '">' + escape(decode(value)) + '</span>';
        });
    }

    function escape(str) {
        return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
    }

    // Encode ASCII characters to, and from Braille
    function encode (str, encoded) {
        table[encoded = str.split('').map(function (s) {
            if (s.charCodeAt(0) > 127) { return s }
            return String.fromCharCode(s.charCodeAt(0) + 0x2800);
        }).join('')] = str;
        return encoded;
    }
    function decode (str) {
        if (str in table) {
            return table[str];
        } else {
            return str.trim().split('').map(function (s) {
                if (s.charCodeAt(0) - 0x2800 > 127) { return s }
                return String.fromCharCode(s.charCodeAt(0) - 0x2800);
            }).join('');
        }
    }

    })(window.hijs);
  </script>
</body>
@xmajox
Copy link

xmajox commented Dec 10, 2012

I was just trying dox-template and got the exact same situation (with my own lib though). Original dox output seems correct but template comes up empty (only header line and search box).

Any ideas?

@xmajox
Copy link

xmajox commented Dec 10, 2012

Just noticed this was already raised (and closed) on previous tickets. Check #1 for the solution that worked for me.

Quoting @olivernn :

The reason that you aren't seeing anything in the html is because dox template is fairly opinionated about the input it is expecting. It expects your code to be grouped into modules, which are defined with a custom tag of @module. An example, from Davis.js, is https://github.com/olivernn/davis.js/blob/master/lib/davis.logger.js. This is a module that is similar to your example in that it is really just a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants