From 207dea91dac71e6fb73d8c971001d462be791954 Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Tue, 28 Mar 2017 11:37:07 -0700 Subject: [PATCH] docs: merge 7ba74ad and friends --- docs/components.md | 6 ++-- docs/generate.js | 14 ++++---- docs/index.md | 4 +-- docs/layout.html | 6 ++-- docs/lib/prism/prism.css | 6 ---- docs/lib/prism/prism.js | 7 ---- docs/{guides.md => nav-guides.md} | 0 docs/{methods.md => nav-methods.md} | 0 docs/releasing.md | 55 ++++++++++++++++++----------- docs/style.css | 33 ++++++++++++----- 10 files changed, 72 insertions(+), 59 deletions(-) delete mode 100644 docs/lib/prism/prism.css delete mode 100644 docs/lib/prism/prism.js rename docs/{guides.md => nav-guides.md} (100%) rename docs/{methods.md => nav-methods.md} (100%) diff --git a/docs/components.md b/docs/components.md index 3d958aad..229f1293 100644 --- a/docs/components.md +++ b/docs/components.md @@ -2,9 +2,9 @@ - [Structure](#structure) - [Lifecycle methods](#lifecycle-methods) +- [Syntactic variants](#syntactic-variants) - [State](#state) -- [ES6 classes](#es6-classes) -- [Avoid-anti-patterns](#avoid-anti-patterns) +- [Avoid anti-patterns](#avoid-anti-patterns) ### Structure @@ -101,7 +101,7 @@ To learn more about lifecycle methods, [see the lifecycle methods page](lifecycl --- -### Alternate component syntaxes +### Syntactic variants #### ES6 classes diff --git a/docs/generate.js b/docs/generate.js index 438b8343..52bc3e70 100644 --- a/docs/generate.js +++ b/docs/generate.js @@ -8,13 +8,9 @@ var version = JSON.parse(fs.readFileSync("./package.json", "utf-8")).version try {fs.mkdirSync("./dist")} catch (e) {/* ignore */} try {fs.mkdirSync("./dist/archive")} catch (e) {/* ignore */} try {fs.mkdirSync("./dist/archive/v" + version)} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/archive/v" + version + "/lib")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/archive/v" + version + "/lib/prism")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/lib")} catch (e) {/* ignore */} -try {fs.mkdirSync("./dist/lib/prism")} catch (e) {/* ignore */} -var guides = fs.readFileSync("docs/guides.md", "utf-8") -var methods = fs.readFileSync("docs/methods.md", "utf-8") +var guides = fs.readFileSync("docs/nav-guides.md", "utf-8") +var methods = fs.readFileSync("docs/nav-methods.md", "utf-8") var index = fs.readFileSync("docs/index.md", "utf-8") fs.writeFileSync("README.md", index.replace(/(\]\()(.+?)\.md(\))/g, "$1http://mithril.js.org/$2.html$3"), "utf-8") @@ -27,7 +23,7 @@ function generate(pathname) { generate(pathname + "/" + filename) }) } - else if (!pathname.match(/tutorials|archive|guides|methods/)) { + else if (!pathname.match(/tutorials|archive|nav-/)) { if (pathname.match(/\.md$/)) { var outputFilename = pathname.replace(/\.md$/, ".html") var markdown = fs.readFileSync(pathname, "utf-8") @@ -55,7 +51,9 @@ function generate(pathname) { .replace(/\[version\]/, version) // update version .replace(/\[body\]/, markedHtml) .replace(/(.+?)<\/h.>/gim, function(match, n, id, text) { // fix anchors - return ".+?<\/a>/g, "").replace(/\.|\[|\]|"|\/|\(|\)/g, "").replace(/\s/g, "-") + '">' + text + "" + var anchor = text.toLowerCase().replace(/<(\/?)code>/g, "").replace(/.+?<\/a>/g, "").replace(/\.|\[|\]|"|\/|\(|\)/g, "").replace(/\s/g, "-"); + + return `${text}`; }) fs.writeFileSync("./dist/archive/v" + version + "/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") fs.writeFileSync("./dist/" + outputFilename.replace(/^docs\//, ""), html, "utf-8") diff --git a/docs/index.md b/docs/index.md index 1481b21e..86aca2cc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,7 +12,7 @@ ### What is Mithril? -Mithril is a modern client-side Javascript framework for building Single Page Applications. +Mithril is a modern client-side Javascript framework for building Single Page Applications. It's small (< 8kb gzip), fast and provides routing and XHR utilities out of the box.
@@ -69,7 +69,7 @@ Let's create an HTML file to follow along: ### Hello world -Let's start as small as well can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) +Let's start as small as we can: render some text on screen. Copy the code below into your file (and by copy, I mean type it out - you'll learn better) ```javascript var root = document.body diff --git a/docs/layout.html b/docs/layout.html index 9dac0d2d..f5ce0231 100644 --- a/docs/layout.html +++ b/docs/layout.html @@ -2,8 +2,7 @@ Mithril.js - - + @@ -27,7 +26,8 @@ License: MIT. © Leo Horie. - + +