commit
1dfc2afbbd
|
@ -77,4 +77,4 @@ xcuserdata
|
||||||
*.env
|
*.env
|
||||||
|
|
||||||
# built docs
|
# built docs
|
||||||
public
|
/public
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
</div><!-- end #content -->
|
|
||||||
|
|
||||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
|
|
||||||
<script type="text/javascript" src="media/js/script.js"></script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,47 +0,0 @@
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
var headerHeight = $("#header").height();
|
|
||||||
var offsets = [];
|
|
||||||
var current = -1;
|
|
||||||
|
|
||||||
function endpoint(scrollDistance) {
|
|
||||||
if (scrollDistance < offsets[0]) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
for (var id = offsets.length; id > 0; id--) {
|
|
||||||
if (scrollDistance > offsets[id - 1]) {
|
|
||||||
return id - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$("h2").each(function(i) {
|
|
||||||
offsets.push($(this).offset().top - headerHeight)
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#content").append('<h2 class="fixed" style="display: none"><span> </span></h2>');
|
|
||||||
var fixed_h2 = $("h2.fixed");
|
|
||||||
var fixed_span = $("h2.fixed span");
|
|
||||||
|
|
||||||
$("#content").scroll(function() {
|
|
||||||
var scrollDistance = $("#content").attr('scrollTop');
|
|
||||||
var now = endpoint(scrollDistance);
|
|
||||||
|
|
||||||
if (now !== current) {
|
|
||||||
$("#sidebar li").removeClass("current");
|
|
||||||
current = now;
|
|
||||||
if (current < 0) {
|
|
||||||
fixed_h2.hide();
|
|
||||||
} else if (current >= 0) {
|
|
||||||
var heading = $($("h2 span")[current]).text();
|
|
||||||
$("#sidebar a[href|=#" + heading.replace(' ', '-') + "]").parent().addClass("current");
|
|
||||||
fixed_span.text(heading);
|
|
||||||
fixed_h2.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -7,7 +7,7 @@ body {
|
||||||
color: #4a3f2d;
|
color: #4a3f2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
:focus {
|
:focus:not(:focus-visible) {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,22 +83,6 @@ h4 {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---- custom classes */
|
|
||||||
|
|
||||||
pre.shell,
|
|
||||||
pre.shell code {
|
|
||||||
background:#444;
|
|
||||||
color:#fff;
|
|
||||||
border-width:0px;
|
|
||||||
}
|
|
||||||
pre.shell code::before {
|
|
||||||
content: '$ ';
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ---- header and sidebar */
|
/* ---- header and sidebar */
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
|
@ -150,15 +134,6 @@ pre.shell code::before {
|
||||||
z-index:0;
|
z-index:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar .vertical_divider {
|
|
||||||
background-color:#FFFFFF;
|
|
||||||
bottom:0px;
|
|
||||||
position:absolute;
|
|
||||||
top:0px;
|
|
||||||
right:0px;
|
|
||||||
width:1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar h1 {
|
#sidebar h1 {
|
||||||
font-size:1.2em;
|
font-size:1.2em;
|
||||||
padding:0px;
|
padding:0px;
|
||||||
|
@ -187,25 +162,6 @@ pre.shell code::before {
|
||||||
padding:1px 0px 1px 2px;
|
padding:1px 0px 1px 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar li span.verb {
|
|
||||||
color:#aaa;
|
|
||||||
padding:2px 3px 0px;
|
|
||||||
width:30px;
|
|
||||||
display:block;
|
|
||||||
float:left;
|
|
||||||
font-size:9px;
|
|
||||||
font-family:verdana;
|
|
||||||
-moz-border-radius:3px;
|
|
||||||
-webkit-border-radius:3px;
|
|
||||||
margin-left:0px;
|
|
||||||
margin-right:5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar li.current {
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position:right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* ---- intro */
|
/* ---- intro */
|
||||||
|
|
||||||
|
@ -219,13 +175,6 @@ pre.shell code::before {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin-bottom:40px;
|
margin-bottom:40px;
|
||||||
}
|
}
|
||||||
.intro pre.base {
|
|
||||||
background:#444;
|
|
||||||
color:#29231A;
|
|
||||||
color:#fff;
|
|
||||||
border-color:#fff;
|
|
||||||
font-size:1.5em;
|
|
||||||
}
|
|
||||||
.intro h1 {
|
.intro h1 {
|
||||||
color: #1C313C;
|
color: #1C313C;
|
||||||
}
|
}
|
||||||
|
@ -259,14 +208,6 @@ h1 + h2 {
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2.fixed {
|
|
||||||
position:fixed;
|
|
||||||
margin-top: 0;
|
|
||||||
border-top:none;
|
|
||||||
right:45px;
|
|
||||||
top:66px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 span {
|
h2 span {
|
||||||
background: #979592;
|
background: #979592;
|
||||||
float:right;
|
float:right;
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -32,3 +32,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
%(content)s
|
||||||
|
</div><!-- end #content -->
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -79,9 +79,7 @@ API documentation is:
|
||||||
# More information
|
# More information
|
||||||
|
|
||||||
- License:[MIT](http://opensource.org/licenses/mit-license.php)
|
- License:[MIT](http://opensource.org/licenses/mit-license.php)
|
||||||
- Code: [mcavage/node-ldapjs](https://github.com/mcavage/node-ldapjs)
|
- Code: [ldapjs/node-ldapjs](https://github.com/ldapjs/node-ldapjs)
|
||||||
- node.js version: >=0.8
|
|
||||||
- Twitter: [@pfmooney](http://twitter.com/pfmooney)
|
|
||||||
|
|
||||||
# What's not in the box?
|
# What's not in the box?
|
||||||
|
|
||||||
|
|
|
@ -66,56 +66,60 @@ function markdownTOC (markdown) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createHTML (header, footer, text) {
|
function createHTML (template, text) {
|
||||||
const { attributes, body } = fm(text)
|
const { attributes, body } = fm(text)
|
||||||
for (const prop in attributes) {
|
|
||||||
header = header.replace(new RegExp(`%\\(${prop}\\)s`, 'ig'), attributes[prop])
|
|
||||||
footer = footer.replace(new RegExp(`%\\(${prop}\\)s`, 'ig'), attributes[prop])
|
|
||||||
}
|
|
||||||
|
|
||||||
const { toc, html } = markdownTOC(body)
|
const { toc, html } = markdownTOC(body)
|
||||||
|
attributes.toc_html = toc
|
||||||
|
attributes.content = html
|
||||||
|
|
||||||
header = header.replace(/%\(toc_html\)s/ig, toc)
|
for (const prop in attributes) {
|
||||||
|
template = template.replace(new RegExp(`%\\(${prop}\\)s`, 'ig'), attributes[prop])
|
||||||
|
}
|
||||||
|
|
||||||
return header + html + footer
|
return template
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyRecursive (src, dest) {
|
||||||
|
const stats = await fs.stat(src)
|
||||||
|
const isDirectory = stats.isDirectory()
|
||||||
|
if (isDirectory) {
|
||||||
|
await fs.mkdir(dest)
|
||||||
|
const files = await fs.readdir(src)
|
||||||
|
for (const file of files) {
|
||||||
|
await copyRecursive(path.join(src, file), path.join(dest, file))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await fs.copyFile(src, dest)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createDocs () {
|
async function createDocs () {
|
||||||
const docs = path.resolve(__dirname, '..', 'docs')
|
const docs = path.resolve(__dirname, '..', 'docs')
|
||||||
const dist = path.resolve(__dirname, '..', 'public')
|
const dist = path.resolve(__dirname, '..', 'public')
|
||||||
const branding = path.join(docs, 'branding')
|
const branding = path.join(docs, 'branding')
|
||||||
|
const src = path.join(branding, 'public')
|
||||||
|
|
||||||
await fs.rmdir(dist, { recursive: true })
|
await fs.rmdir(dist, { recursive: true })
|
||||||
await fs.mkdir(dist)
|
await copyRecursive(src, dist)
|
||||||
|
|
||||||
const header = await fs.readFile(path.join(branding, 'header.html.in'), { encoding: 'utf8' })
|
const highlightjsStyles = path.resolve(__dirname, '..', 'node_modules', 'highlight.js', 'styles')
|
||||||
const footer = await fs.readFile(path.join(branding, 'footer.html.in'), { encoding: 'utf8' })
|
await fs.copyFile(path.join(highlightjsStyles, 'default.css'), path.join(dist, 'media', 'css', 'highlight.css'))
|
||||||
|
|
||||||
|
const template = await fs.readFile(path.join(branding, 'template.html'), { encoding: 'utf8' })
|
||||||
const files = await fs.readdir(docs)
|
const files = await fs.readdir(docs)
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (!file.endsWith('.md')) {
|
if (!file.endsWith('.md')) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const text = await fs.readFile(path.join(docs, file), { encoding: 'utf8' })
|
const text = await fs.readFile(path.join(docs, file), { encoding: 'utf8' })
|
||||||
const html = createHTML(header, footer, text)
|
const html = createHTML(template, text)
|
||||||
|
|
||||||
await fs.writeFile(path.join(dist, file.replace(/md$/, 'html')), html)
|
await fs.writeFile(path.join(dist, file.replace(/md$/, 'html')), html)
|
||||||
}
|
}
|
||||||
|
|
||||||
const dest = path.join(dist, 'media')
|
|
||||||
const src = path.join(branding, 'media')
|
|
||||||
const highlightjsStyles = path.resolve(__dirname, '..', 'node_modules', 'highlight.js', 'styles')
|
|
||||||
await fs.mkdir(dest)
|
|
||||||
await fs.mkdir(path.join(dest, 'css'))
|
|
||||||
await fs.mkdir(path.join(dest, 'js'))
|
|
||||||
await fs.mkdir(path.join(dest, 'img'))
|
|
||||||
await fs.copyFile(path.join(src, 'css', 'style.css'), path.join(dest, 'css', 'style.css'))
|
|
||||||
await fs.copyFile(path.join(highlightjsStyles, 'default.css'), path.join(dest, 'css', 'highlight.css'))
|
|
||||||
await fs.copyFile(path.join(src, 'js', 'script.js'), path.join(dest, 'js', 'script.js'))
|
|
||||||
await fs.copyFile(path.join(src, 'img', 'logo.svg'), path.join(dest, 'img', 'logo.svg'))
|
|
||||||
await fs.copyFile(path.join(branding, 'CNAME'), path.join(dist, 'CNAME'))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createDocs().catch(ex => {
|
createDocs().catch(ex => {
|
||||||
console.error(ex)
|
console.error(ex)
|
||||||
process.exit(1)
|
process.exitCode = 1
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue