Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-09-09 00:26:13 +0400
committerisaacs <i@izs.me>2011-09-09 00:26:13 +0400
commit69c87edce797d100fb774f7c96ec95276aabd6ec (patch)
tree734d8906e9adba269d2e554d719ce6707cbcdfc4 /scripts
parentd5a920f7988e5091de1b87aba3ead7bd8e591f8a (diff)
Add README into index build
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/doc-build.sh2
-rw-r--r--scripts/index-build.js10
2 files changed, 6 insertions, 6 deletions
diff --git a/scripts/doc-build.sh b/scripts/doc-build.sh
index 2f0fc6a28..acdbb4ccb 100755
--- a/scripts/doc-build.sh
+++ b/scripts/doc-build.sh
@@ -26,9 +26,9 @@ case $dest in
| sed "s|@VERSION@|$version|g" \
| perl -pi -e 's/<h1>npm(-?[^\(]*\([0-9]\)) -- (.*?)<\/h1>/<h1>npm\1<\/h1> <p>\2<\/p>/g' \
| perl -pi -e 's/npm-npm/npm/g' \
+ | perl -pi -e 's/([^"-])(npm-)?README(\(1\))?/\1<a href="README.html">README<\/a>/g' \
| perl -pi -e 's/([^"-])npm-([^\(]+)\(1\)/\1<a href="\2.html">\2<\/a>/g' \
| perl -pi -e 's/([^"-])npm\(1\)/\1<a href="npm.html">npm<\/a>/g' \
- | perl -pi -e 's/README/<a href="README.html">README<\/a>/g' \
> $dest
exit $?
;;
diff --git a/scripts/index-build.js b/scripts/index-build.js
index 7d60a1775..f78532531 100644
--- a/scripts/index-build.js
+++ b/scripts/index-build.js
@@ -4,15 +4,15 @@ var fs = require("fs")
, docdir = path.resolve(__dirname, "..", "doc")
console.log(
- "npm-index(1) -- Index of all npm documentation files\n" +
- "====================================================\n\n")
+ "npm-index(1) -- Index of all npm documentation\n" +
+ "==============================================\n")
fs.readdir(docdir, function (er, docs) {
if (er) throw er
- docs.filter(function (d) {
+ ;["../README.md"].concat(docs.filter(function (d) {
return d !== "index.md"
&& d.charAt(0) !== "."
&& d.match(/\.md$/)
- }).forEach(function (d) {
+ })).forEach(function (d) {
var doc = path.resolve(docdir, d)
, s = fs.lstatSync(doc)
, content = fs.readFileSync(doc, "utf8").split("\n\n")
@@ -27,7 +27,7 @@ fs.readdir(docdir, function (er, docs) {
if (c === "## SYNOPSIS") syn = content[i + 1]
if (c === "## DESCRIPTION") syn = content[i + 1]
})
- console.log(d.replace(/^(.*)\.md$/, "## npm-$1(1)") + "\n")
+ console.log(d.replace(/^.*?([^\/]*)\.md$/, "## npm-$1(1)") + "\n")
if (desc) console.log(desc + "\n")
else if (syn) console.log(syn + "\n")
})