Skip to content

Commit

Permalink
remove novecento, add roboto (sad)
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Feb 3, 2015
1 parent c95b417 commit 4ee17ca
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Cakefile
Expand Up @@ -26,7 +26,7 @@ task 'doc', 'rebuild the Docco documentation', (options) ->
layout = options.layout or 'linear'
exec([
"bin/docco --layout #{layout} docco.litcoffee"
"sed \"s/docco.css/resources\\/#{layout}\\/docco.css/\" < docs/docco.html > index.html"
"sed \"s/docco.css/resources\\/#{layout}\\/docco.css/\" < docs/docco.litcoffee.html > index.html"
'rm -r docs'
].join(' && '), (err) ->
throw err if err
Expand Down
2 changes: 1 addition & 1 deletion docco.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 41 additions & 16 deletions index.html
Expand Up @@ -109,12 +109,13 @@ <h2 id="main-documentation-generation-functions">Main Documentation Generation F

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
<span class="hljs-function"><span class="hljs-title">copyAsset</span> = <span class="hljs-params">(file, callback)</span> -&gt;</span>
<span class="hljs-keyword">return</span> callback() <span class="hljs-keyword">unless</span> fs.existsSync file
fs.copy file, path.join(config.output, path.basename(file)), callback
<span class="hljs-function"><span class="hljs-title">complete</span> = -&gt;</span>
copyAsset config.css, <span class="hljs-function"><span class="hljs-params">(error)</span> -&gt;</span>
<span class="hljs-keyword">if</span> error <span class="hljs-keyword">then</span> callback error
<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
<span class="hljs-keyword">else</span> callback()
<span class="hljs-keyword">return</span> callback error <span class="hljs-keyword">if</span> error
<span class="hljs-keyword">return</span> copyAsset config.public, callback <span class="hljs-keyword">if</span> fs.existsSync config.public
callback()

files = config.sources.slice()

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



<p>Pass any user defined options to Marked if specified via command line option</p>


<div class='highlight'><pre> markedOptions =
<span class="hljs-attribute">smartypants</span>: <span class="hljs-literal">true</span>

<span class="hljs-keyword">if</span> config.marked
markedOptions = config.marked

marked.setOptions markedOptions</pre></div>



<p>Tell Marked how to highlight code blocks within comments, treating that code
as either the language specified in the code block or the language of the file
if not specified.</p>
Expand Down Expand Up @@ -224,15 +238,17 @@ <h2 id="main-documentation-generation-functions">Main Documentation Generation F
<div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">write</span> = <span class="hljs-params">(source, sections, config)</span> -&gt;</span>

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



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


<div class='highlight'><pre> first = marked.lexer(sections[<span class="hljs-number">0</span>].docsText)[<span class="hljs-number">0</span>]
<div class='highlight'><pre> firstSection = _.find sections, <span class="hljs-function"><span class="hljs-params">(section)</span> -&gt;</span>
section.docsText.length &gt; <span class="hljs-number">0</span>
first = marked.lexer(firstSection.docsText)[<span class="hljs-number">0</span>] <span class="hljs-keyword">if</span> firstSection
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>
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

Expand All @@ -259,7 +275,8 @@ <h2 id="configuration">Configuration</h2>
<span class="hljs-attribute">template</span>: <span class="hljs-literal">null</span>
<span class="hljs-attribute">css</span>: <span class="hljs-literal">null</span>
<span class="hljs-attribute">extension</span>: <span class="hljs-literal">null</span>
<span class="hljs-attribute">languages</span>: {}</pre></div>
<span class="hljs-attribute">languages</span>: {}
<span class="hljs-attribute">marked</span>: <span class="hljs-literal">null</span></pre></div>



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

config.languages = buildMatchers config.languages
<span class="hljs-keyword">if</span> options.template
config.languages = buildMatchers config.languages</pre></div>



<p>The user is able to override the layout file used with the <code>--template</code> parameter.
In this case, it is also neccessary to explicitly specify a stylesheet file.
These custom templates are compiled exactly like the predefined ones, but the <code>public</code> folder
is only copied for the latter.</p>


<div class='highlight'><pre> <span class="hljs-keyword">if</span> options.template
<span class="hljs-keyword">unless</span> options.css
<span class="hljs-built_in">console</span>.warn <span class="hljs-string">"docco: no stylesheet file specified"</span>
config.layout = <span class="hljs-literal">null</span>
<span class="hljs-keyword">else</span>
dir = config.layout = path.join __dirname, <span class="hljs-string">'resources'</span>, config.layout
Expand All @@ -281,6 +309,9 @@ <h2 id="configuration">Configuration</h2>
config.css = options.css <span class="hljs-keyword">or</span> path.join dir, <span class="hljs-string">'resources/linear/docco.css'</span>
config.template = _.template fs.readFileSync(config.template).toString()

<span class="hljs-keyword">if</span> options.marked
config.marked = JSON.parse fs.readFileSync(options.marked)

config.sources = options.args.filter<span class="hljs-function"><span class="hljs-params">((source) -&gt;
lang = getLanguage source, config
<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
Expand Down Expand Up @@ -311,13 +342,6 @@ <h2 id="helpers-initial-setup">Helpers &amp; Initial Setup</h2>



<p>Enable nicer typography with marked.</p>


<div class='highlight'><pre>marked.setOptions <span class="hljs-attribute">smartypants</span>: <span class="hljs-literal">yes</span></pre></div>



<p>Languages are stored in JSON in the file <code>resources/languages.json</code>.
Each item maps the file extension to the name of the language and the
<code>symbol</code> that indicates a line comment. To add support for a new programming
Expand Down Expand Up @@ -358,7 +382,7 @@ <h2 id="helpers-initial-setup">Helpers &amp; Initial Setup</h2>

<div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">getLanguage</span> = <span class="hljs-params">(source, config)</span> -&gt;</span>
ext = config.extension <span class="hljs-keyword">or</span> path.extname(source) <span class="hljs-keyword">or</span> path.basename(source)
lang = config.languages[ext] <span class="hljs-keyword">or</span> languages[ext]
lang = config.languages?[ext] <span class="hljs-keyword">or</span> languages[ext]
<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>
codeExt = path.extname(path.basename(source, ext))
<span class="hljs-keyword">if</span> codeExt <span class="hljs-keyword">and</span> codeLang = languages[codeExt]
Expand Down Expand Up @@ -393,6 +417,7 @@ <h2 id="command-line-interface">Command Line Interface</h2>
.option(<span class="hljs-string">'-c, --css [file]'</span>, <span class="hljs-string">'use a custom css file'</span>, c.css)
.option(<span class="hljs-string">'-t, --template [file]'</span>, <span class="hljs-string">'use a custom .jst template'</span>, c.template)
.option(<span class="hljs-string">'-e, --extension [ext]'</span>, <span class="hljs-string">'assume a file extension for all inputs'</span>, c.extension)
.option(<span class="hljs-string">'-m, --marked [file]'</span>, <span class="hljs-string">'use custom marked options'</span>, c.marked)
.parse(args)
.name = <span class="hljs-string">"docco"</span>
<span class="hljs-keyword">if</span> commander.args.length
Expand Down
Binary file removed resources/classic/public/fonts/novecento-bold.eot
Binary file not shown.
Binary file removed resources/classic/public/fonts/novecento-bold.ttf
Binary file not shown.
Binary file removed resources/classic/public/fonts/novecento-bold.woff
Binary file not shown.
Binary file added resources/classic/public/fonts/roboto-black.eot
Binary file not shown.
Binary file added resources/classic/public/fonts/roboto-black.ttf
Binary file not shown.
Binary file not shown.
16 changes: 8 additions & 8 deletions resources/linear/docco.css
Expand Up @@ -21,11 +21,11 @@
}

@font-face {
font-family: 'novecento-bold';
src: url('public/fonts/novecento-bold.eot');
src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'),
url('public/fonts/novecento-bold.woff') format('woff'),
url('public/fonts/novecento-bold.ttf') format('truetype');
font-family: 'roboto-black';
src: url('public/fonts/roboto-black.eot');
src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'),
url('public/fonts/roboto-black.woff') format('woff'),
url('public/fonts/roboto-black.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Expand Down Expand Up @@ -58,7 +58,7 @@ hr {
h1, h2, h3, h4, h5, h6 {
color: #112233;
font-weight: normal;
font-family: "novecento-bold";
font-family: "roboto-black";
text-transform: uppercase;
line-height: 1em;
margin-top: 50px;
Expand All @@ -68,7 +68,7 @@ h1, h2, h3, h4, h5, h6 {
text-align: center;
}
h2 {
font-size: 1.3em;
font-size: 1.26em;
}
h1:after {
content: "8";
Expand Down Expand Up @@ -190,7 +190,7 @@ ul.sections {
list-style-type: upper-roman;
}
.toc li {
font-family: 'novecento-bold';
font-family: 'roboto-black';
}
.toc li a {
font-family: 'aller-light';
Expand Down
Binary file removed resources/linear/public/fonts/novecento-bold.eot
Binary file not shown.
Binary file removed resources/linear/public/fonts/novecento-bold.ttf
Binary file not shown.
Binary file removed resources/linear/public/fonts/novecento-bold.woff
Binary file not shown.
Binary file added resources/linear/public/fonts/roboto-black.eot
Binary file not shown.
Binary file added resources/linear/public/fonts/roboto-black.ttf
Binary file not shown.
Binary file not shown.
15 changes: 9 additions & 6 deletions resources/parallel/docco.css
Expand Up @@ -21,11 +21,11 @@
}

@font-face {
font-family: 'novecento-bold';
src: url('public/fonts/novecento-bold.eot');
src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'),
url('public/fonts/novecento-bold.woff') format('woff'),
url('public/fonts/novecento-bold.ttf') format('truetype');
font-family: 'roboto-black';
src: url('public/fonts/roboto-black.eot');
src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'),
url('public/fonts/roboto-black.woff') format('woff'),
url('public/fonts/roboto-black.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Expand Down Expand Up @@ -67,14 +67,17 @@ h1, h2, h3, h4, h5, h6 {
color: #112233;
line-height: 1em;
font-weight: normal;
font-family: "novecento-bold";
font-family: "roboto-black";
text-transform: uppercase;
margin: 30px 0 15px 0;
}

h1 {
margin-top: 40px;
}
h2 {
font-size: 1.26em;
}

hr {
border: 0;
Expand Down
Binary file removed resources/parallel/public/fonts/novecento-bold.eot
Binary file not shown.
Binary file not shown.
Binary file removed resources/parallel/public/fonts/novecento-bold.woff
Binary file not shown.
Binary file added resources/parallel/public/fonts/roboto-black.eot
Binary file not shown.
Binary file added resources/parallel/public/fonts/roboto-black.ttf
Binary file not shown.
Binary file not shown.

0 comments on commit 4ee17ca

Please sign in to comment.