diff options
author | codepiano <codepiano.li@gmail.com> | 2014-11-02 01:34:28 +0800 |
---|---|---|
committer | codepiano <codepiano.li@gmail.com> | 2014-11-02 01:34:28 +0800 |
commit | 1502d65286eb36a76b8d0016f7bad64b9bf9f39f (patch) | |
tree | f954a62a351413faef03818b49d92a6312d5e4df /lib/parse/renderer.js | |
parent | 9da10e2b25cb8ad919bb8563cfdc81d9e0612341 (diff) | |
parent | 0feb672d708e2d73ee159d5a94b614f90c85e9e2 (diff) | |
download | gitbook-1502d65286eb36a76b8d0016f7bad64b9bf9f39f.zip gitbook-1502d65286eb36a76b8d0016f7bad64b9bf9f39f.tar.gz gitbook-1502d65286eb36a76b8d0016f7bad64b9bf9f39f.tar.bz2 |
Merge branch 'master' of github.com:GitbookIO/gitbook into fork
Conflicts:
lib/parse/page.js
Diffstat (limited to 'lib/parse/renderer.js')
-rw-r--r-- | lib/parse/renderer.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/parse/renderer.js b/lib/parse/renderer.js index 61b3d9b..0f6640b 100644 --- a/lib/parse/renderer.js +++ b/lib/parse/renderer.js @@ -1,9 +1,7 @@ var url = require('url'); +var _ = require('lodash'); var inherits = require('util').inherits; var links = require('../utils').links; - -var path = require('path'); - var kramed = require('kramed'); var rendererId = 0; @@ -50,11 +48,11 @@ GitBookRenderer.prototype.link = function(href, title, text) { // Parsed version of the url var parsed = url.parse(href); - var o = this._extra_options; + var extname = _.last(parsed.path.split(".")); // Relative link, rewrite it to point to github repo - if(links.isRelative(_href) && path.extname(parsed.path) == ".md") { + if(links.isRelative(_href) && extname == "md") { _href = links.toAbsolute(_href, o.dir || "./", o.outdir || "./"); _href = _href.replace(".md", ".html"); } |