Add documentation and homepage

develop
Sven Slootweg 11 years ago
parent 96338fc1d5
commit b8bbefd754

File diff suppressed because one or more lines are too long

@ -0,0 +1,333 @@
# ZippyDoc format documentation
{<documentation.zpy}(Download the ZippyDoc source of this page.)
ZippyDoc is a compact, light-weight and code-oriented documentation markup language.
It allows you to easily write documentation for your code or APIs, and batch-convert it to HTML.
{TOC}
## Format overview
ZippyDoc is a paragraph-oriented format, much like Markdown. Each paragraph represents a "block" of something, and no linebreaks are used anywhere - to start on a new line,
you simply start out with a new paragraph. A block is indicated by a specific prefix. Tabs (not spaces!) are used to indent blocks and indicate children of previous blocks.
A new "paragraph" is started by having two or more successive line-endings - this basically comes down to at least one empty line inbetween paragraphs.
There is also some inline markup available, including emphasis, strong text, and hyperlinks to both other ZippyDoc documents and external locations.
## Blocks
Several block types exist. Some of them have "continuation characters" that indicate the continuation of the previous block in a new paragraph, as opposed to
starting a new block.
^ Definition block
A definition block is prefixed with a caret, and contains something along the lines of a function definition or type.
In this particular document, it is used to denote the types of blocks and markup elements. Inline markup (such as the emphasis for arguments in the below example) is applied.
These blocks are used for a table of contents if you choose to use one.
@ Using a definition block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
You can also have an alternative notation for a definition. This can be useful if you have aliased functions, or multiple input forms.
The alternative notation should be put on the same indentation as the original definition, but without a caret in front. The alternative
notations (there is no limit) are shown separately in the table of contents if you choose to use one. You may indent the alternative
notations with spaces to make the definition easier to read.
@ Using a definition block
$ ^ my_function(**argument**, **another_argument**)
alt_func(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
^ Argument block
An argument block shows a particular argument or parameter, and its explanation. The argument name is suffixed with a double colon (::), and the explanation
follows on the next line. If so desired, the explanation can be indented with a tab - the tabs in front of the explanation will be eaten by the parser. The
explanation can also consist of multiple lines - the newlines are preserved in the HTML version. Inline markup is applied only in the explanation.
@ Using an argument block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
^ Example block
An example block shows an example of the function you are documenting, with code and output. The example block itself is prefixed with an @, and only specifies a title;
you will use indented children of the Code and Output block variety to show respectively the code and the output for the example. These blocks will be explained later on.
The title of your example block will be prefixed with "Example:" in the output automatically.
@ Using an example block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
$$ @ Using this function
$$ $ Some code goes here.
$$ > Some output goes here.
^ Code block
! This block cannot have child elements!
The code block is used in an example to show example code. It is prefixed with a dollar sign ($), and all text following it will be show on the HTML page verbatim, without
any further markup processing being done. It even allows you to display ZippyDoc formatting characters without having them interpreted, as is done on this page!
@ Using a code block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
$$ @ Using this function
$$ $ my_function(42, "The answer to everything")
$$ > Some output goes here.
It is also possible to have a code block spanning multiple paragraphs, without each paragraph being broken up into a separate code block (as would normally happen if you
just used the dollar sign). To do this, you can use two dollar signs at the start of the block. Note that after these two dollar signs, whitespace (except for spaces) is
**not** eaten, meaning you can use tabs to indent further blocks of your code!
@ Using a multi-paragraph code block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
$$ @ Using this function
$$ $ if some_variable == True:
$$ $$ my_function(42, "The answer to everything")
$$ > Some output goes here.
^ Output block
! This block cannot have child elements!
The output block is used to display sample output in an example. Just like the code block, it is shown exactly as it originally was, without any further formatting applied.
It is prefixed by a >, and like the code block it has a continuation character - in this case, that is >>.
@ Using an output block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
$$ @ Using this function
$$ $ my_function(42, "The answer to everything")
$$ > The answer to everything is 42!
@ Using a multi-paragraph output block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
$$ @ Using this function
$$ $ my_function(42, "The answer to everything")
$$ > The answer to everything is 42!
$$ >> Did you know The answer to everything is 42?
^ Exclamation block
The exclamation block allows you to mark a block of text as "important". In the standard HTML layout, it will have a yellow-ish background, and will be prefixed
with "__Important!__". It is prefixed with an exclamation mark (!). Inline markup is applied.
@ Using an exclamation block
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ ! Only ever use this function with the number '42'!
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
$$ @ Using this function
$$ $ my_function(42, "The answer to everything")
$$ > The answer to everything is 42!
^ Header block
! This block cannot have child elements!
A header block is a generic header to indicate the start of a new section. It is treated as a separate element, not as a "container". The header blocks in ZippyDoc
work similarly to those in Markdown: they are prefixed by a hash (#), and the amount of hash characters defines what level of header it is.
@ Using header blocks
$ # This is a level 1 (largest) header.
$$ ## This is a level 2 header.
$$ ...
$$ ####### This is a level 7 (smallest) header.
^ Text block
! This block cannot have child elements!
A text block is any block that is not prefixed by a special character. It is shown as defined, with inline markup applied.
## Inline markup
There are also various forms of inline markup that you can use in your documentation.
^ Emphasized text
Emphasized text is typically displayed as italic. You can emphasize text by enclosing it in two asterisks on each side.
@ Emphasizing text
$ This is just some text, and **this part is emphasized**.
^ Strong text
Strong text is typically displayed as bold. You can make text strong by enclosing it in two underscores on each side.
@ Making text strong
$ This is just some text, __and this part is strong__.
^ Internal references (hyperlinks)
Internal references are hyperlinks that point to other documents in the same documentation set. Depending on the export format (currently only HTML is supported),
the appropriate extension is automatically appended. The paths should resemble the directory structure you are storing the ZippyDoc source files in. The target
of the reference is enclosed in curly braces and prefixed with a >. If you wish to give the reference a friendly description, you can do so by appending it,
enclosed in parentheses.
@ Referencing another documentation page
$ You can also view the API documentation at {>api/index}.
@ Referencing another documentation page with a friendly description
$ You can also view the {>api/index}(API documentation).
^ External references (hyperlinks)
External references are hyperlinks just like the internal references, but they refer to an external resources. The syntax is identical to that of internal references,
except for the > disappearing. Note that external references are only picked up when the text enclosed in the braces is an actual URI of some sort.
You can also force an external reference to be created by prefixing the URI with <. This is useful when you want to for example link to a download relative to the current
page.
@ Referencing Google
$ You could also search {http://www.google.com/}.
@ Referencing another documentation page with a friendly description
$ You could also search {http://www.google.com/}(Google).
@ Referencing a relative file that is not a ZippyDoc document
$ You can download it by {<file.zip}(clicking here).
^ Fixed-width text
Fixed-width text can be useful to indicate code elements or other things that would benefit from being displayed in a terminal-like font. You can make text fixed-width
by enclosing it in backticks.
@ Fixed-width text
$ Now enter `./run.sh` into your terminal.
## Special tags
Currently there is only one special tag. Special tags can be inserted anywhere in the document to insert a generated element.
^ Table of contents
To insert a table of contents that is automatically generated from all definition blocks on the page, simply insert {TOC} on the page where you want it to appear (it has
to be in its own paragraph). Typically you will want to place it just below the main page header.
Every item in a table of contents will be followed by a snippet of text, that is grabbed from the first Text block for that definition. Alternative notations are shown
after this description.
@ Including a table of contents
$ # Sample documentation
$$ {TOC}
$$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here.
$$ ...
## Full example
You can {>example}(view a full example here) of a ZippyDoc source file and its result.

@ -0,0 +1,187 @@
<!doctype html>
<html>
<head>
<style>
body {
background-color: #F5F5F5;
font-family: sans-serif;
margin-right: 40px;
}
h2, h3, h4, h5, h6, h7
{
margin-top: 16px;
margin-bottom: 4px;
}
.children { padding-left: 40px; }
.definition
{
font-weight: bold;
margin-bottom: 32px;
}
.example
{
padding: 5px 6px;
font-weight: bold;
font-size: 15px;
background-color: #E6E6E6;
margin-top: 11px;
}
.example > .children
{
padding-top: 11px;
padding-left: 10px;
}
.example > .children > h7
{
font-size: 13px;
}
h7
{
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}
pre
{
margin-top: 0px;
padding: 6px 7px;
background-color: #D9D9D9;
font-weight: normal;
font-size: 13px;
}
dl
{
margin: 5px 0px;
}
dt
{
font-weight: bold;
}
dd
{
font-size: 14px;
font-weight: normal;
margin-left: 8px;
}
dd > .children
{
font-size: 95%;
}
dd > .children > dl > dd
{
margin-left: 13px;
}
.exclamation
{
padding: 7px 8px;
margin: 11px 0px;
background-color: #FFE9AA;
border: 1px solid yellow;
font-size: 15px;
font-weight: normal;
}
.text
{
font-size: 15px;
font-weight: normal;
margin-bottom: 14px;
margin-top: 10px;
}
.toc
{
border: 1px solid gray;
background-color: #E6E6E6;
padding: 8px 9px;
font-size: 15px;
margin-bottom: 12px;
}
.toc h2
{
margin: 0px 0px 3px 0px;
font-size: 19px;
}
.toc ul
{
margin-top: 0px;
margin-bottom: 0px;
padding-left: 25px;
}
.toc li
{
margin-bottom: 2px;
}
.toc .alternatives
{
font-size: 12px;
}
.toc a
{
color: #292722;
}
.toc a:hover
{
color: black;
}
.fixed
{
font-family: monospace;
background-color: white;
padding: 1px 4px;
border: 1px solid silver;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="children"><h1>A complete example</h1><h7>Code:</h7><pre class="code">^ my_function(**argument**, **another_argument**)
Some kind of text describing the function goes here. `Also some mono-spaced text.`
! Only ever use this function with the number '42'!
argument::
This is the first argument to this example function.
another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
We can also add an {&gt;documentation}(internal link) and an {http://google.com/}(external link).
@ Using this function
$ if some_variable == True:
$$ my_function(42, "The answer to everything")
&gt; The answer to everything is 42!
&gt;&gt; Did you know The answer to everything is 42?</pre><h2>Result</h2><div class="definition"><a name="my_functionargumentanother_argument">my_function(<em>argument</em>, <em>another_argument</em>) <div class="children"><div class="text">Some kind of text describing the function goes here. <span class="fixed">Also some mono-spaced text.</span></div><div class="exclamation"><strong>Important:</strong> Only ever use this function with the number '42'! <div class="children"></div></div><dl><dt>argument</dt><dd>This is the first argument to this example function.<div class="children"></div></dd></dl><dl><dt>another_argument</dt><dd>This is the second argument to this example function. As you can see, it's possible to split the explanation over multiple lines as well. We can also add an <a href="documentation.html">internal link</a> and an <a href="http://google.com/">external link</a>.<div class="children"></div></dd></dl><div class="example">Example: Using this function <div class="children"><h7>Code:</h7><pre class="code">if some_variable == True:
my_function(42, "The answer to everything")</pre><h7>Output:</h7><pre class="output">The answer to everything is 42!
Did you know The answer to everything is 42?</pre></div></div></div></a></div></div>
</body>
</html>

@ -0,0 +1,51 @@
# A complete example
$ ^ my_function(**argument**, **another_argument**)
$$ Some kind of text describing the function goes here. `Also some mono-spaced text.`
$$ ! Only ever use this function with the number '42'!
$$ argument::
This is the first argument to this example function.
$$ another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
We can also add an {>documentation}(internal link) and an {http://google.com/}(external link).
$$ @ Using this function
$$ $ if some_variable == True:
$$ $$ my_function(42, "The answer to everything")
$$ > The answer to everything is 42!
$$ >> Did you know The answer to everything is 42?
## Result
^ my_function(**argument**, **another_argument**)
Some kind of text describing the function goes here. `Also some mono-spaced text.`
! Only ever use this function with the number '42'!
argument::
This is the first argument to this example function.
another_argument::
This is the second argument to this example function.
As you can see, it's possible to split the explanation over multiple lines as well.
We can also add an {>documentation}(internal link) and an {http://google.com/}(external link).
@ Using this function
$ if some_variable == True:
$$ my_function(42, "The answer to everything")
> The answer to everything is 42!
>> Did you know The answer to everything is 42?

@ -0,0 +1,177 @@
<!doctype html>
<html>
<head>
<style>
body {
background-color: #F5F5F5;
font-family: sans-serif;
margin-right: 40px;
}
h2, h3, h4, h5, h6, h7
{
margin-top: 16px;
margin-bottom: 4px;
}
.children { padding-left: 40px; }
.definition
{
font-weight: bold;
margin-bottom: 32px;
}
.example
{
padding: 5px 6px;
font-weight: bold;
font-size: 15px;
background-color: #E6E6E6;
margin-top: 11px;
}
.example > .children
{
padding-top: 11px;
padding-left: 10px;
}
.example > .children > h7
{
font-size: 13px;
}
h7
{
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}
pre
{
margin-top: 0px;
padding: 6px 7px;
background-color: #D9D9D9;
font-weight: normal;
font-size: 13px;
}
dl
{
margin: 5px 0px;
}
dt
{
font-weight: bold;
}
dd
{
font-size: 14px;
font-weight: normal;
margin-left: 8px;
}
dd > .children
{
font-size: 95%;
}
dd > .children > dl > dd
{
margin-left: 13px;
}
.exclamation
{
padding: 7px 8px;
margin: 11px 0px;
background-color: #FFE9AA;
border: 1px solid yellow;
font-size: 15px;
font-weight: normal;
}
.text
{
font-size: 15px;
font-weight: normal;
margin-bottom: 14px;
margin-top: 10px;
}
.toc
{
border: 1px solid gray;
background-color: #E6E6E6;
padding: 8px 9px;
font-size: 15px;
margin-bottom: 12px;
}
.toc h2
{
margin: 0px 0px 3px 0px;
font-size: 19px;
}
.toc ul
{
margin-top: 0px;
margin-bottom: 0px;
padding-left: 25px;
}
.toc li
{
margin-bottom: 2px;
}
.toc .alternatives
{
font-size: 12px;
}
.toc a
{
color: #292722;
}
.toc a:hover
{
color: black;
}
.fixed
{
font-family: monospace;
background-color: white;
padding: 1px 4px;
border: 1px solid silver;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="children"><h1>ZippyDoc</h1><div class="text">Hi, this is the website of ZippyDoc, a compact, light-weight and human-readable format for documenting code, APIs, and other things, that can be easily converted to HTML.</div><div class="text">It is designed primarily to be simple to use (unlike complex markup languages like reStructuredText), and very code-oriented (unlike other simple markup languages like Markdown). You will probably learn the entire syntax in about 10 minutes.</div><div class="text">ZippyDoc (both the format and the parser) are licensed under the <a href="http://www.wtfpl.net/">WTFPL</a>, meaning you can basically do with it whatever you want, and reuse it in any fashion you see fit. I hope it will help you write nicer, easier, and more complete documentation!</div><div class="text">While ZippyDoc is technically intended for documentation, I decided to whip up a simple index page in ZippyDoc as well - you're looking at it! :)</div><h2>What does the ZippyDoc format look like?</h2><h7>Code:</h7><pre class="code">^ my_function(argument1, argument2)
! This is just an example!
This is a function.
argument1::
This is the first argument.
argument2::
This is the second argument.
@ How to call my_function
$ my_function("ZippyDoc", "awesome")
&gt; "ZippyDoc is awesome!"</pre><h7>Result:</h7><div class="definition"><a name="my_functionargument1argument2">my_function(argument1, argument2) <div class="children"><div class="exclamation"><strong>Important:</strong> This is just an example! <div class="children"></div></div><div class="text">This is a function.</div><dl><dt>argument1</dt><dd>This is the first argument.<div class="children"></div></dd></dl><dl><dt>argument2</dt><dd>This is the second argument.<div class="children"></div></dd></dl><div class="example">Example: How to call my_function <div class="children"><h7>Code:</h7><pre class="code">my_function("ZippyDoc", "awesome")</pre><h7>Output:</h7><pre class="output">"ZippyDoc is awesome!"</pre></div></div></div></a></div><h2>Documentation</h2><div class="text">The documentation for ZippyDoc can be found <a href="documentation.html">here</a>.</div><h2>Downloading ZippyDoc</h2><div class="text">ZippyDoc is still in a pretty messy stage, but it should already work reliably according to the current documentation. GitHub repository is coming soon, until that time you can <a href="zpy2html.py">download the conversion script here</a>. It's a Python script, so you'll need a Python interpreter of some sort. No dependencies are necessary, it only uses standard library functionality. Simply run it with all files you wish to convert as arguments, and it will convert each of them into a file with the same name, but a <em>.html</em> extension instead of the original extension. It's strongly recommended to name your ZippyDoc source files with the <em>.zpy</em> extension.</div></div>
</body>
</html>

@ -0,0 +1,62 @@
# ZippyDoc
Hi, this is the website of ZippyDoc, a compact, light-weight and human-readable format for documenting code, APIs, and other things, that can be easily converted to HTML.
It is designed primarily to be simple to use (unlike complex markup languages like reStructuredText), and very code-oriented (unlike other simple markup languages like Markdown).
You will probably learn the entire syntax in about 10 minutes.
ZippyDoc (both the format and the parser) are licensed under the {http://www.wtfpl.net/}(WTFPL), meaning you can basically do with it whatever you want, and reuse it in any
fashion you see fit. I hope it will help you write nicer, easier, and more complete documentation!
While ZippyDoc is technically intended for documentation, I decided to whip up a simple index page in ZippyDoc as well - you're looking at it! :)
## What does the ZippyDoc format look like?
$ ^ my_function(argument1, argument2)
$$ ! This is just an example!
$$ This is a function.
$$ argument1::
This is the first argument.
$$ argument2::
This is the second argument.
$$ @ How to call my_function
$$ $ my_function("ZippyDoc", "awesome")
$$ > "ZippyDoc is awesome!"
####### Result:
^ my_function(argument1, argument2)
! This is just an example!
This is a function.
argument1::
This is the first argument.
argument2::
This is the second argument.
@ How to call my_function
$ my_function("ZippyDoc", "awesome")
> "ZippyDoc is awesome!"
## Documentation
The documentation for ZippyDoc can be found {>documentation}(here).
## Downloading ZippyDoc
ZippyDoc is still in a pretty messy stage, but it should already work reliably according to the current documentation. GitHub repository is coming soon, until that time you can
{<zpy2html.py}(download the conversion script here). It's a Python script, so you'll need a Python interpreter of some sort. No dependencies are necessary, it only uses standard
library functionality. Simply run it with all files you wish to convert as arguments, and it will convert each of them into a file with the same name, but a **.html** extension
instead of the original extension. It's strongly recommended to name your ZippyDoc source files with the **.zpy** extension.
Loading…
Cancel
Save