From 5faa9968050d7d944b6e0090bbae4d6178b16e07 Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 2 Feb 2017 08:30:41 -0500 Subject: [PATCH] fix some links --- docs/generate.js | 4 ++-- docs/lint.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/generate.js b/docs/generate.js index 691a1040..9d694b87 100644 --- a/docs/generate.js +++ b/docs/generate.js @@ -52,8 +52,8 @@ function generate(pathname) { .replace(/Mithril\.js<\/title>/, "<title>" + title[1] + " - Mithril.js") .replace(/\[version\]/, version) // update version .replace(/\[body\]/, markedHtml) - .replace(/
([^<]+?)<\/h5>/gim, function(match, id, text) { // fix anchors - return "
" + text + "
" + .replace(/(.+?)<\/h.>/gim, function(match, n, id, text) { // fix anchors + return "/g, "").replace(/.+?<\/a>/g, "").replace(/\.|\[|\]|"|\/|\(|\)/g, "").replace(/\s/g, "-") + "\">" + text + "" }) fs.writeFileSync("../mithril/archive/v" + version + "/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") fs.writeFileSync("../mithril/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") diff --git a/docs/lint.js b/docs/lint.js index 6ed537b2..3ab0d559 100644 --- a/docs/lint.js +++ b/docs/lint.js @@ -88,7 +88,7 @@ function ensureLinkIsValid(file, data) { var links = data.match(/\]\(([^\)]+?)\)/gim) || [] links.forEach(function(match) { var link = match.slice(2, -1) - var path = link.match(/[\w-]+\.md/) + var path = (link.match(/[\w-#]+\.md/) || [])[0] if (link.match(/http/)) { var u = url.parse(link) http.request({method: "HEAD", host: u.host, path: u.pathname, port: 80}).on("error", function() {