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:
-rw-r--r--html/docfoot-script.html31
-rw-r--r--html/docfoot.html32
-rw-r--r--html/dochead.html2
-rwxr-xr-xscripts/doc-build.sh24
4 files changed, 45 insertions, 44 deletions
diff --git a/html/docfoot-script.html b/html/docfoot-script.html
new file mode 100644
index 000000000..c0fea672a
--- /dev/null
+++ b/html/docfoot-script.html
@@ -0,0 +1,31 @@
+<script>
+;(function () {
+var wrapper = document.getElementById("wrapper")
+var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
+ .filter(function (el) {
+ return el.parentNode === wrapper
+ && el.tagName.match(/H[1-6]/)
+ && el.id
+ })
+var l = 2
+ , toc = document.createElement("ul")
+toc.innerHTML = els.map(function (el) {
+ var i = el.tagName.charAt(1)
+ , out = ""
+ while (i > l) {
+ out += "<ul>"
+ l ++
+ }
+ while (i < l) {
+ out += "</ul>"
+ l --
+ }
+ out += "<li><a href='#" + el.id + "'>" +
+ ( el.innerText || el.text || el.innerHTML)
+ + "</a>"
+ return out
+}).join("\n")
+toc.id = "toc"
+document.body.appendChild(toc)
+})()
+</script>
diff --git a/html/docfoot.html b/html/docfoot.html
index 3e35341cc..237b89718 100644
--- a/html/docfoot.html
+++ b/html/docfoot.html
@@ -1,34 +1,2 @@
</div>
<p id="footer">@NAME@ &mdash; npm@@VERSION@</p>
-<script>
-;(function () {
-var wrapper = document.getElementById("wrapper")
-var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
- .filter(function (el) {
- return el.parentNode === wrapper
- && el.tagName.match(/H[1-6]/)
- && el.id
- })
-var l = 2
- , toc = document.createElement("ul")
-toc.innerHTML = els.map(function (el) {
- var i = el.tagName.charAt(1)
- , out = ""
- while (i > l) {
- out += "<ul>"
- l ++
- }
- while (i < l) {
- out += "</ul>"
- l --
- }
- out += "<li><a href='#" + el.id + "'>" +
- ( el.innerText || el.text || el.innerHTML)
- + "</a>"
- return out
-}).join("\n")
-toc.id = "toc"
-document.body.appendChild(toc)
-})()
-</script>
-</body></html>
diff --git a/html/dochead.html b/html/dochead.html
index 1526e1b7b..01f4d2f05 100644
--- a/html/dochead.html
+++ b/html/dochead.html
@@ -2,7 +2,7 @@
<html>
<title>@NAME@</title>
<meta http-equiv="content-type" value="text/html;utf-8">
- <link rel="stylesheet" type="text/css" href="../static/style.css">
+ <link rel="stylesheet" type="text/css" href="../../static/style.css">
<body>
<div id="wrapper">
diff --git a/scripts/doc-build.sh b/scripts/doc-build.sh
index c32557055..de4c9d22b 100755
--- a/scripts/doc-build.sh
+++ b/scripts/doc-build.sh
@@ -44,8 +44,9 @@ case $dest in
*.[1357])
./node_modules/.bin/ronn --roff $src \
| sed "s|@VERSION@|$version|g" \
- | perl -pi -e 's/npm\\-([^\(]*)\(1\)/npm help \1/g' \
- | perl -pi -e 's/npm\\-([^\(]*)\(3\)/npm apihelp \1/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\(1\)/npm help npm/g' \
| perl -pi -e 's/npm\(3\)/npm apihelp npm/g' \
> $dest
@@ -53,21 +54,22 @@ case $dest in
;;
*.html)
(cat html/dochead.html && \
- ./node_modules/.bin/ronn -f $src && \
- cat html/docfoot.html )\
+ ./node_modules/.bin/ronn -f $src &&
+ cat html/docfoot.html)\
| sed "s|@NAME@|$name|g" \
| sed "s|@DATE@|$date|g" \
| 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/<h1>([^\(]*\([0-9]\)) -- (.*?)<\/h1>/<h1>\1<\/h1> <p>\2<\/p>/g' \
| perl -pi -e 's/npm-npm/npm/g' \
| perl -pi -e 's/([^"-])(npm-)?README(\(1\))?/\1<a href="..\/doc\/README.html">README<\/a>/g' \
- | perl -pi -e 's/<title><a href="..\/doc\/README.html">README<\/a><\/title>/<title>README<\/title>/g' \
- | perl -pi -e 's/([^"-])npm-([^\(]+)(\(1\))/\1<a href="..\/doc\/\2.html">\2\3<\/a>/g' \
- | perl -pi -e 's/([^"-])npm-([^\(]+)(\(3\))/\1<a href="..\/api\/\2.html">\2\3<\/a>/g' \
- | perl -pi -e 's/([^"-])npm\(1\)/\1<a href="..\/doc\/npm.html">npm(1)<\/a>/g' \
- | perl -pi -e 's/([^"-])npm\(3\)/\1<a href="..\/api\/npm.html">npm(3)<\/a>/g' \
- | perl -pi -e 's/\([13]\)<\/a><\/h1>/<\/a><\/h1>/g' \
+ | perl -pi -e 's/<title><a href="[^"]+README.html">README<\/a><\/title>/<title>README<\/title>/g' \
+ | perl -pi -e 's/([^"-])([^\(> ]+)(\(1\))/\1<a href="..\/cli\/\2.html">\2\3<\/a>/g' \
+ | perl -pi -e 's/([^"-])([^\(> ]+)(\(3\))/\1<a href="..\/api\/\2.html">\2\3<\/a>/g' \
+ | perl -pi -e 's/([^"-])([^\(> ]+)(\(5\))/\1<a href="..\/files\/\2.html">\2\3<\/a>/g' \
+ | perl -pi -e 's/([^"-])([^\(> ]+)(\(7\))/\1<a href="..\/misc\/\2.html">\2\3<\/a>/g' \
+ | perl -pi -e 's/\([1357]\)<\/a><\/h1>/<\/a><\/h1>/g' \
> $dest
+ cat html/docfoot-script.html >> $dest
exit $?
;;
*)