Skip to content

Commit 4ee17ca

Browse files
committed
remove novecento, add roboto (sad)
1 parent c95b417 commit 4ee17ca

23 files changed

+60
-32
lines changed

Cakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ task 'doc', 'rebuild the Docco documentation', (options) ->
2626
layout = options.layout or 'linear'
2727
exec([
2828
"bin/docco --layout #{layout} docco.litcoffee"
29-
"sed \"s/docco.css/resources\\/#{layout}\\/docco.css/\" < docs/docco.html > index.html"
29+
"sed \"s/docco.css/resources\\/#{layout}\\/docco.css/\" < docs/docco.litcoffee.html > index.html"
3030
'rm -r docs'
3131
].join(' && '), (err) ->
3232
throw err if err

docco.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+41-16
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ <h2 id="main-documentation-generation-functions">Main Documentation Generation F
109109

110110
callback <span class="hljs-function"><span class="hljs-title">or</span>= <span class="hljs-params">(error)</span> -&gt;</span> <span class="hljs-keyword">throw</span> error <span class="hljs-keyword">if</span> error
111111
<span class="hljs-function"><span class="hljs-title">copyAsset</span> = <span class="hljs-params">(file, callback)</span> -&gt;</span>
112+
<span class="hljs-keyword">return</span> callback() <span class="hljs-keyword">unless</span> fs.existsSync file
112113
fs.copy file, path.join(config.output, path.basename(file)), callback
113114
<span class="hljs-function"><span class="hljs-title">complete</span> = -&gt;</span>
114115
copyAsset config.css, <span class="hljs-function"><span class="hljs-params">(error)</span> -&gt;</span>
115-
<span class="hljs-keyword">if</span> error <span class="hljs-keyword">then</span> callback error
116-
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> fs.existsSync config.public <span class="hljs-keyword">then</span> copyAsset config.public, callback
117-
<span class="hljs-keyword">else</span> callback()
116+
<span class="hljs-keyword">return</span> callback error <span class="hljs-keyword">if</span> error
117+
<span class="hljs-keyword">return</span> copyAsset config.public, callback <span class="hljs-keyword">if</span> fs.existsSync config.public
118+
callback()
118119

119120
files = config.sources.slice()
120121

@@ -192,6 +193,19 @@ <h2 id="main-documentation-generation-functions">Main Documentation Generation F
192193

193194

194195

196+
<p>Pass any user defined options to Marked if specified via command line option</p>
197+
198+
199+
<div class='highlight'><pre> markedOptions =
200+
<span class="hljs-attribute">smartypants</span>: <span class="hljs-literal">true</span>
201+
202+
<span class="hljs-keyword">if</span> config.marked
203+
markedOptions = config.marked
204+
205+
marked.setOptions markedOptions</pre></div>
206+
207+
208+
195209
<p>Tell Marked how to highlight code blocks within comments, treating that code
196210
as either the language specified in the code block or the language of the file
197211
if not specified.</p>
@@ -224,15 +238,17 @@ <h2 id="main-documentation-generation-functions">Main Documentation Generation F
224238
<div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">write</span> = <span class="hljs-params">(source, sections, config)</span> -&gt;</span>
225239

226240
<span class="hljs-function"><span class="hljs-title">destination</span> = <span class="hljs-params">(file)</span> -&gt;</span>
227-
path.join(config.output, path.basename(file, path.extname(file)) + <span class="hljs-string">'.html'</span>)</pre></div>
241+
path.join(config.output, file + <span class="hljs-string">'.html'</span>)</pre></div>
228242

229243

230244

231245
<p>The <strong>title</strong> of the file is either the first heading in the prose, or the
232246
name of the source file.</p>
233247

234248

235-
<div class='highlight'><pre> first = marked.lexer(sections[<span class="hljs-number">0</span>].docsText)[<span class="hljs-number">0</span>]
249+
<div class='highlight'><pre> firstSection = _.find sections, <span class="hljs-function"><span class="hljs-params">(section)</span> -&gt;</span>
250+
section.docsText.length &gt; <span class="hljs-number">0</span>
251+
first = marked.lexer(firstSection.docsText)[<span class="hljs-number">0</span>] <span class="hljs-keyword">if</span> firstSection
236252
hasTitle = first <span class="hljs-keyword">and</span> first.type <span class="hljs-keyword">is</span> <span class="hljs-string">'heading'</span> <span class="hljs-keyword">and</span> first.depth <span class="hljs-keyword">is</span> <span class="hljs-number">1</span>
237253
title = <span class="hljs-keyword">if</span> hasTitle <span class="hljs-keyword">then</span> first.text <span class="hljs-keyword">else</span> path.basename source
238254

@@ -259,7 +275,8 @@ <h2 id="configuration">Configuration</h2>
259275
<span class="hljs-attribute">template</span>: <span class="hljs-literal">null</span>
260276
<span class="hljs-attribute">css</span>: <span class="hljs-literal">null</span>
261277
<span class="hljs-attribute">extension</span>: <span class="hljs-literal">null</span>
262-
<span class="hljs-attribute">languages</span>: {}</pre></div>
278+
<span class="hljs-attribute">languages</span>: {}
279+
<span class="hljs-attribute">marked</span>: <span class="hljs-literal">null</span></pre></div>
263280

264281

265282

@@ -271,8 +288,19 @@ <h2 id="configuration">Configuration</h2>
271288
<div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">configure</span> = <span class="hljs-params">(options)</span> -&gt;</span>
272289
config = _.extend {}, defaults, _.pick(options, _.keys(defaults)...)
273290

274-
config.languages = buildMatchers config.languages
275-
<span class="hljs-keyword">if</span> options.template
291+
config.languages = buildMatchers config.languages</pre></div>
292+
293+
294+
295+
<p>The user is able to override the layout file used with the <code>--template</code> parameter.
296+
In this case, it is also neccessary to explicitly specify a stylesheet file.
297+
These custom templates are compiled exactly like the predefined ones, but the <code>public</code> folder
298+
is only copied for the latter.</p>
299+
300+
301+
<div class='highlight'><pre> <span class="hljs-keyword">if</span> options.template
302+
<span class="hljs-keyword">unless</span> options.css
303+
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"docco: no stylesheet file specified"</span>
276304
config.layout = <span class="hljs-literal">null</span>
277305
<span class="hljs-keyword">else</span>
278306
dir = config.layout = path.join __dirname, <span class="hljs-string">'resources'</span>, config.layout
@@ -281,6 +309,9 @@ <h2 id="configuration">Configuration</h2>
281309
config.css = options.css <span class="hljs-keyword">or</span> path.join dir, <span class="hljs-string">'resources/linear/docco.css'</span>
282310
config.template = _.template fs.readFileSync(config.template).toString()
283311

312+
<span class="hljs-keyword">if</span> options.marked
313+
config.marked = JSON.parse fs.readFileSync(options.marked)
314+
284315
config.sources = options.args.filter<span class="hljs-function"><span class="hljs-params">((source) -&gt;
285316
lang = getLanguage source, config
286317
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"docco: skipped unknown type (<span class="hljs-subst">#{path.basename source}</span>)"</span> <span class="hljs-keyword">unless</span> lang
@@ -311,13 +342,6 @@ <h2 id="helpers-initial-setup">Helpers &amp; Initial Setup</h2>
311342

312343

313344

314-
<p>Enable nicer typography with marked.</p>
315-
316-
317-
<div class='highlight'><pre>marked.setOptions <span class="hljs-attribute">smartypants</span>: <span class="hljs-literal">yes</span></pre></div>
318-
319-
320-
321345
<p>Languages are stored in JSON in the file <code>resources/languages.json</code>.
322346
Each item maps the file extension to the name of the language and the
323347
<code>symbol</code> that indicates a line comment. To add support for a new programming
@@ -358,7 +382,7 @@ <h2 id="helpers-initial-setup">Helpers &amp; Initial Setup</h2>
358382

359383
<div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">getLanguage</span> = <span class="hljs-params">(source, config)</span> -&gt;</span>
360384
ext = config.extension <span class="hljs-keyword">or</span> path.extname(source) <span class="hljs-keyword">or</span> path.basename(source)
361-
lang = config.languages[ext] <span class="hljs-keyword">or</span> languages[ext]
385+
lang = config.languages?[ext] <span class="hljs-keyword">or</span> languages[ext]
362386
<span class="hljs-keyword">if</span> lang <span class="hljs-keyword">and</span> lang.name <span class="hljs-keyword">is</span> <span class="hljs-string">'markdown'</span>
363387
codeExt = path.extname(path.basename(source, ext))
364388
<span class="hljs-keyword">if</span> codeExt <span class="hljs-keyword">and</span> codeLang = languages[codeExt]
@@ -393,6 +417,7 @@ <h2 id="command-line-interface">Command Line Interface</h2>
393417
.option(<span class="hljs-string">'-c, --css [file]'</span>, <span class="hljs-string">'use a custom css file'</span>, c.css)
394418
.option(<span class="hljs-string">'-t, --template [file]'</span>, <span class="hljs-string">'use a custom .jst template'</span>, c.template)
395419
.option(<span class="hljs-string">'-e, --extension [ext]'</span>, <span class="hljs-string">'assume a file extension for all inputs'</span>, c.extension)
420+
.option(<span class="hljs-string">'-m, --marked [file]'</span>, <span class="hljs-string">'use custom marked options'</span>, c.marked)
396421
.parse(args)
397422
.name = <span class="hljs-string">"docco"</span>
398423
<span class="hljs-keyword">if</span> commander.args.length
-17.8 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
20.2 KB
Binary file not shown.
43.8 KB
Binary file not shown.
Binary file not shown.

resources/linear/docco.css

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
}
2222

2323
@font-face {
24-
font-family: 'novecento-bold';
25-
src: url('public/fonts/novecento-bold.eot');
26-
src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'),
27-
url('public/fonts/novecento-bold.woff') format('woff'),
28-
url('public/fonts/novecento-bold.ttf') format('truetype');
24+
font-family: 'roboto-black';
25+
src: url('public/fonts/roboto-black.eot');
26+
src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'),
27+
url('public/fonts/roboto-black.woff') format('woff'),
28+
url('public/fonts/roboto-black.ttf') format('truetype');
2929
font-weight: normal;
3030
font-style: normal;
3131
}
@@ -58,7 +58,7 @@ hr {
5858
h1, h2, h3, h4, h5, h6 {
5959
color: #112233;
6060
font-weight: normal;
61-
font-family: "novecento-bold";
61+
font-family: "roboto-black";
6262
text-transform: uppercase;
6363
line-height: 1em;
6464
margin-top: 50px;
@@ -68,7 +68,7 @@ h1, h2, h3, h4, h5, h6 {
6868
text-align: center;
6969
}
7070
h2 {
71-
font-size: 1.3em;
71+
font-size: 1.26em;
7272
}
7373
h1:after {
7474
content: "8";
@@ -190,7 +190,7 @@ ul.sections {
190190
list-style-type: upper-roman;
191191
}
192192
.toc li {
193-
font-family: 'novecento-bold';
193+
font-family: 'roboto-black';
194194
}
195195
.toc li a {
196196
font-family: 'aller-light';
-17.8 KB
Binary file not shown.
Binary file not shown.
-20.1 KB
Binary file not shown.
20.2 KB
Binary file not shown.
43.8 KB
Binary file not shown.
Binary file not shown.

resources/parallel/docco.css

+9-6
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
}
2222

2323
@font-face {
24-
font-family: 'novecento-bold';
25-
src: url('public/fonts/novecento-bold.eot');
26-
src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'),
27-
url('public/fonts/novecento-bold.woff') format('woff'),
28-
url('public/fonts/novecento-bold.ttf') format('truetype');
24+
font-family: 'roboto-black';
25+
src: url('public/fonts/roboto-black.eot');
26+
src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'),
27+
url('public/fonts/roboto-black.woff') format('woff'),
28+
url('public/fonts/roboto-black.ttf') format('truetype');
2929
font-weight: normal;
3030
font-style: normal;
3131
}
@@ -67,14 +67,17 @@ h1, h2, h3, h4, h5, h6 {
6767
color: #112233;
6868
line-height: 1em;
6969
font-weight: normal;
70-
font-family: "novecento-bold";
70+
font-family: "roboto-black";
7171
text-transform: uppercase;
7272
margin: 30px 0 15px 0;
7373
}
7474

7575
h1 {
7676
margin-top: 40px;
7777
}
78+
h2 {
79+
font-size: 1.26em;
80+
}
7881

7982
hr {
8083
border: 0;
Binary file not shown.
Binary file not shown.
Binary file not shown.
20.2 KB
Binary file not shown.
43.8 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)