Skip to content

Commit

Permalink
renamed project to Morocco
Browse files Browse the repository at this point in the history
  • Loading branch information
dtao committed Oct 5, 2013
1 parent b069741 commit d5c2a1b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 77 deletions.
2 changes: 1 addition & 1 deletion bin/docco → bin/morocco
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
var path = require('path');
var fs = require('fs');
var dir = path.join(path.dirname(fs.realpathSync(__filename)), '../');
require(dir + 'docco.js').run();
require(dir + 'morocco.js').run();
12 changes: 6 additions & 6 deletions docco.js → morocco.js

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

81 changes: 18 additions & 63 deletions docco.litcoffee → morocco.litcoffee
Original file line number Diff line number Diff line change
@@ -1,72 +1,27 @@
Docco
=====
Morocco
=======

**Docco** is a quick-and-dirty documentation generator, written in
**Morocco** is a fork of [Docco](http://jashkenas.github.io/docco/), written in
[Literate CoffeeScript](http://coffeescript.org/#literate).
It produces an HTML document that displays your comments intermingled with your
code. All prose is passed through
[Markdown](http://daringfireball.net/projects/markdown/syntax), and code is
passed through [Highlight.js](http://highlightjs.org/) syntax highlighting.
This page is the result of running Docco against its own
[source file](https://github.com/jashkenas/docco/blob/master/docco.litcoffee).

1. Install Docco with **npm**: `sudo npm install -g docco`
1. Install Morocco with **npm**: `sudo npm install -g morocco`
2. Run it against your code: `docco src/*.coffee`
2. Run it against your code: `morocco src/*.coffee`
There is no "Step 3". This will generate an HTML page for each of the named
source files, with a menu linking to the other pages, saving the whole mess
into a `docs` folder (configurable).

The [Docco source](http://github.com/jashkenas/docco) is available on GitHub,
The [Morocco source](http://github.com/dtao/morocco) is available on GitHub,
and is released under the [MIT license](http://opensource.org/licenses/MIT).

Docco can be used to process code written in any programming language. If it
doesn't handle your favorite yet, feel free to
[add it to the list](https://github.com/jashkenas/docco/blob/master/resources/languages.json).
Finally, the ["literate" style](http://coffeescript.org/#literate) of *any*
language is also supported — just tack an `.md` extension on the end:
`.coffee.md`, `.py.md`, and so on.


Partners in Crime:
------------------

* If Node.js doesn't run on your platform, or you'd prefer a more
convenient package, get [Ryan Tomayko](http://github.com/rtomayko)'s
[Rocco](http://rtomayko.github.io/rocco/rocco.html), the **Ruby** port that's
available as a gem.
* If you're writing shell scripts, try
[Shocco](http://rtomayko.github.io/shocco/), a port for the **POSIX shell**,
also by Mr. Tomayko.
* If **Python** is more your speed, take a look at
[Nick Fitzgerald](http://github.com/fitzgen)'s [Pycco](http://fitzgen.github.io/pycco/).
* For **Clojure** fans, [Fogus](http://blog.fogus.me/)'s
[Marginalia](http://fogus.me/fun/marginalia/) is a bit of a departure from
"quick-and-dirty", but it'll get the job done.
* There's a **Go** port called [Gocco](http://nikhilm.github.io/gocco/),
written by [Nikhil Marathe](https://github.com/nikhilm).
* For all you **PHP** buffs out there, Fredi Bach's
[sourceMakeup](http://jquery-jkit.com/sourcemakeup/) (we'll let the faux pas
with respect to our naming scheme slide), should do the trick nicely.
* **Lua** enthusiasts can get their fix with
[Robert Gieseke](https://github.com/rgieseke)'s [Locco](http://rgieseke.github.io/locco/).
* And if you happen to be a **.NET**
aficionado, check out [Don Wilson](https://github.com/dontangg)'s
[Nocco](http://dontangg.github.io/nocco/).
* Going further afield from the quick-and-dirty, [Groc](http://nevir.github.io/groc/)
is a **CoffeeScript** fork of Docco that adds a searchable table of contents,
and aims to gracefully handle large projects with complex hierarchies of code.
Note that not all ports will support all Docco features ... yet.
Morocco is basically Docco plus some special logic to handle the `@examples` tag
in comments. These are parsed to generate specs that may accompany the generated
documentation.


Main Documentation Generation Functions
Expand Down Expand Up @@ -200,7 +155,7 @@ if not specified.
if highlightjs.LANGUAGES[lang]
highlightjs.highlight(lang, code).value
else
console.warn "docco: couldn't highlight code block with unknown language '#{lang}' in #{source}"
console.warn "morocco: couldn't highlight code block with unknown language '#{lang}' in #{source}"
code
}
Expand Down Expand Up @@ -229,7 +184,7 @@ name of the source file.
html = config.template {sources: config.sources, css: path.basename(config.css),
title, hasTitle, sections, path, destination,}
console.log "docco: #{source} -> #{destination source}"
console.log "morocco: #{source} -> #{destination source}"
fs.writeFileSync destination(source), html

Expand All @@ -247,7 +202,7 @@ user-specified options.
extension: null
languages: {}
**Configure** this particular run of Docco. We might use a passed-in external
**Configure** this particular run of Morocco. We might use a passed-in external
template, or one of the built-in **layouts**. We only attempt to process
source files for languages for which we have definitions.

Expand All @@ -266,7 +221,7 @@ source files for languages for which we have definitions.
config.sources = options.args.filter((source) ->
lang = getLanguage source, config
console.warn "docco: skipped unknown type (#{path.basename source})" unless lang
console.warn "morocco: skipped unknown type (#{path.basename source})" unless lang
lang
).sort()
Expand All @@ -292,7 +247,7 @@ Enable nicer typography with marked.
Languages are stored in JSON in the file `resources/languages.json`.
Each item maps the file extension to the name of the language and the
`symbol` that indicates a line comment. To add support for a new programming
language to Docco, just add it to the file.
language to Morocco, just add it to the file.

languages = JSON.parse fs.readFileSync(path.join(__dirname, 'resources', 'languages.json'))
Expand Down Expand Up @@ -323,15 +278,15 @@ file extension. Detect and tag "literate" `.ext.md` variants.
lang = _.extend {}, codeLang, {literate: yes}
lang
Keep it DRY. Extract the docco **version** from `package.json`
Keep it DRY. Extract the Morocco **version** from `package.json`

version = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'))).version

Command Line Interface
----------------------

Finally, let's define the interface to run Docco from the command line.
Finally, let's define the interface to run Morocco from the command line.
Parse options using [Commander](https://github.com/visionmedia/commander.js).

run = (args = process.argv) ->
Expand All @@ -345,7 +300,7 @@ Parse options using [Commander](https://github.com/visionmedia/commander.js).
.option('-t, --template [file]', 'use a custom .jst template', c.template)
.option('-e, --extension [ext]', 'assume a file extension for all inputs', c.extension)
.parse(args)
.name = "docco"
.name = "morocco"
if commander.args.length
document commander
else
Expand All @@ -355,4 +310,4 @@ Parse options using [Commander](https://github.com/visionmedia/commander.js).
Public API
----------

Docco = module.exports = {run, document, parse, format, version}
Morocco = module.exports = {run, document, parse, format, version}
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{
"name": "docco",
"name": "morocco",
"description": "The Quick and Dirty Literate Programming Documentation Generator",
"keywords": ["documentation", "docs", "generator", "literate", "coffeescript"],
"author": "Jeremy Ashkenas",
"contributors": ["Dan Tao <daniel.tao@gmail.com> (http://danieltao.com)"],
"version": "0.6.2",
"licenses": [{
"type": "MIT",
"url": "http://opensource.org/licenses/mit-license.php"
}],
"repository": {
"type": "git",
"url": "https://github.com/jashkenas/docco.git"
},
"engines": {
"node": ">=0.2.0"
"url": "https://github.com/dtao/morocco.git"
},
"dependencies": {
"commander": ">= 0.5.2",
Expand All @@ -22,8 +20,8 @@
"underscore": ">= 1.0.0",
"highlight.js": ">= 7.3.0"
},
"main" : "./docco",
"main" : "./morocco",
"bin": {
"docco": "./bin/docco"
"morocco": "./bin/morocco"
}
}

0 comments on commit d5c2a1b

Please sign in to comment.