Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Prototype of Sphinx docs with JavaScript extensions
- Loading branch information
1 parent
0b3f5a0
commit eb9a809
Showing
7 changed files
with
139 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Generates CLI docs for Dredd. | ||
# | ||
# Purpose: | ||
# Thanks to this we can be sure the CLI docs are always up-to-date. | ||
# | ||
# Usage: | ||
# | ||
# $ cat document-template.md | coffee generate-cli-docs.coffee > document.md | ||
|
||
|
||
fs = require('fs') | ||
path = require('path') | ||
ect = require('ect') | ||
clone = require('clone') | ||
|
||
options = require('../../src/options') | ||
|
||
|
||
# Turn options into a sorted array | ||
data = {options: []} | ||
|
||
for own name, attributes of options | ||
option = clone(attributes) | ||
option.description = option.description.trim() | ||
option.name = name | ||
data.options.push(option) | ||
|
||
data.options.sort((o1, o2) -> | ||
switch | ||
when o1.name < o2.name then -1 | ||
when o1.name > o2.name then 1 | ||
else 0 | ||
) | ||
|
||
|
||
# Process stdin | ||
source = '' | ||
process.stdin.on('data', (buffer) -> | ||
source += buffer.toString() | ||
) | ||
process.stdin.on('end', -> | ||
renderer = ect({root: {source}}) | ||
processedLine = renderer.render('source', data) | ||
process.stdout.write(processedLine) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.