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>2014-08-22 22:45:21 +0400
committerisaacs <i@izs.me>2014-08-22 22:47:20 +0400
commit7b55f44420252baeb3f30da437d22956315c31c9 (patch)
treebd963f654a9fdd1afa926b485771edf1a5a3193e /scripts
parent13cbe4d17b930f0838fbb82fa8d57be0791a9e6d (diff)
doc: Fix 'npm help index'
This fixes the doc builder script so that the appropriate numbers get printed into the links, and so that 'npm help index' isn't all wonky in its formatting.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/doc-build.sh6
-rwxr-xr-xscripts/index-build.js17
2 files changed, 12 insertions, 11 deletions
diff --git a/scripts/doc-build.sh b/scripts/doc-build.sh
index 18f4e6ca8..9afab0782 100755
--- a/scripts/doc-build.sh
+++ b/scripts/doc-build.sh
@@ -70,9 +70,9 @@ case $dest in
*.[1357])
./node_modules/.bin/ronn --roff $src \
| sed "s|@VERSION@|$version|g" \
- | perl -pi -e 's/(npm\\-)?([^\(]*)\(1\)/npm help \2/g' \
- | perl -pi -e 's/(npm\\-)?([^\(]*)\([57]\)/npm help \3 \2/g' \
- | perl -pi -e 's/(npm\\-)?([^\(]*)\(3\)/npm apihelp \2/g' \
+ | perl -pi -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(1\)/npm help \2/g' \
+ | perl -pi -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(([57])\)/npm help \3 \2/g' \
+ | perl -pi -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(3\)/npm apihelp \2/g' \
| perl -pi -e 's/npm\(1\)/npm help npm/g' \
| perl -pi -e 's/npm\(3\)/npm apihelp npm/g' \
> $dest
diff --git a/scripts/index-build.js b/scripts/index-build.js
index 8031fe727..21297cc93 100755
--- a/scripts/index-build.js
+++ b/scripts/index-build.js
@@ -35,15 +35,16 @@ function output (files) {
"==============================================\n")
writeLines(files, 0)
- writeLines(files, 1, "Command Line Documentation")
- writeLines(files, 3, "API Documentation")
- writeLines(files, 5, "Files")
- writeLines(files, 7, "Misc")
+ writeLines(files, 1, "Command Line Documentation", "Using npm on the command line")
+ writeLines(files, 3, "API Documentation", "Using npm in your Node programs")
+ writeLines(files, 5, "Files", "File system structures npm uses")
+ writeLines(files, 7, "Misc", "Various other bits and bobs")
}
-function writeLines (files, sxn, heading) {
- if (heading)
- console.log("# %s\n", heading)
+function writeLines (files, sxn, heading, desc) {
+ if (heading) {
+ console.log("## %s\n\n%s\n", heading, desc)
+ }
files.filter(function (f) {
return f[0] === sxn
}).forEach(writeLine)
@@ -57,6 +58,6 @@ function writeLine (sd) {
var content = fs.readFileSync(doc, "utf8").split("\n")[0].split("-- ")[1]
- console.log("## %s(%d)\n", d, sxn)
+ console.log("### %s(%d)\n", d, sxn)
console.log(content + "\n")
}