ronn 0.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/AUTHORS +7 -0
  2. data/CHANGES +128 -0
  3. data/README.md +64 -79
  4. data/Rakefile +81 -28
  5. data/bin/ronn +124 -65
  6. data/config.ru +15 -0
  7. data/lib/ronn.rb +13 -5
  8. data/lib/ronn/document.rb +87 -13
  9. data/lib/ronn/roff.rb +43 -18
  10. data/lib/ronn/server.rb +70 -0
  11. data/lib/ronn/template.rb +157 -0
  12. data/lib/ronn/template/80c.css +6 -0
  13. data/lib/ronn/template/dark.css +21 -0
  14. data/lib/ronn/template/darktoc.css +17 -0
  15. data/lib/ronn/template/default.html +43 -0
  16. data/lib/ronn/template/man.css +100 -0
  17. data/lib/ronn/template/print.css +5 -0
  18. data/lib/ronn/template/screen.css +105 -0
  19. data/lib/ronn/template/toc.css +27 -0
  20. data/man/ronn.1 +160 -93
  21. data/man/ronn.1.ronn +206 -89
  22. data/man/ronn.5 +94 -96
  23. data/man/ronn.5.ronn +96 -91
  24. data/man/ronn.7 +50 -84
  25. data/man/ronn.7.ronn +64 -79
  26. data/ronn.gemspec +26 -11
  27. data/test/angle_bracket_syntax.html +4 -1
  28. data/test/basic_document.html +4 -1
  29. data/test/contest.rb +68 -0
  30. data/test/custom_title_document.html +4 -1
  31. data/test/definition_list_syntax.html +4 -1
  32. data/test/definition_list_syntax.roff +26 -0
  33. data/test/document_test.rb +51 -4
  34. data/test/entity_encoding_test.html +4 -1
  35. data/test/entity_encoding_test.roff +1 -1
  36. data/test/markdown_syntax.html +955 -0
  37. data/test/markdown_syntax.roff +1467 -0
  38. data/{man/markdown.5.ronn → test/markdown_syntax.ronn} +0 -0
  39. data/test/middle_paragraph.html +5 -2
  40. data/test/middle_paragraph.roff +2 -2
  41. data/test/ronn_test.rb +19 -4
  42. data/test/section_reference_links.html +15 -0
  43. data/test/section_reference_links.roff +10 -0
  44. data/test/section_reference_links.ronn +12 -0
  45. data/test/titleless_document.html +3 -0
  46. metadata +34 -13
  47. data/lib/ronn/layout.html +0 -75
  48. data/man/markdown.5 +0 -1639
@@ -1,152 +1,157 @@
1
- ronn(5) -- humane manual page authoring format
2
- ==============================================
1
+ ronn(5) -- markdown-based text format for authoring manpages
2
+ ============================================================
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- name(1) -- one sentence description
7
- ===================================
6
+ name(1) -- short, single-sentence description
7
+ =============================================
8
+
9
+ ## SYNOPSIS
8
10
 
9
- ## SECTION HEADING
11
+ `name` [<optional>...] <flags>
10
12
 
11
- A normal paragraph. This can span multiple lines and is
12
- terminated with two or more line endings -- just like
13
- Markdown.
13
+ ## DESCRIPTION
14
14
 
15
- ## INLINE MARKUP
15
+ A normal paragraph. This can span multiple lines and is terminated with two
16
+ or more line endings -- just like Markdown.
16
17
 
17
- Inline markup is used for `code` and `user input` (displayed
18
- in boldface), and also <variables> or _emphasis_.
18
+ Inline markup for `code`, `user input`, and **strong** are displayed
19
+ boldface; <variable>, _emphasis_, *emphasis*, are displayed in italics or
20
+ underline.
19
21
 
20
- Manual page references like sh(1), markdown(5), roff(7), etc.
21
- are displayed in boldface and hyperlinked in HTML output.
22
+ Manual references like sh(1), markdown(7), roff(7), etc. are displayed in
23
+ boldface and hyperlinked in HTML output.
22
24
 
23
- ## DEFINITION LISTS
25
+ Link to other sections like [STANDARDS][], [SEE ALSO][], or
26
+ [WITH A DIFFERENT LINK TEXT][#SEE-ALSO].
24
27
 
25
- Definition lists are used to define options, arguments,
26
- variables, and other type of terms:
28
+ Definition lists:
27
29
 
28
- * `-a`, `--arg1`=[_OPTION_]:
30
+ * `-a`, `--argument`=[<value>]:
29
31
  One or more paragraphs describing the argument.
30
- * `-b`, `--arg2`:
31
- Any number of these may be specified and may
32
- be nested.
32
+ * You can put whatever you *want* here, really:
33
+ Nesting and paragraph spacing are respected.
34
+
35
+ Markdown ordered and unordered lists too.
36
+
37
+ Frequently used sections:
38
+
39
+ ## OPTIONS
40
+ ## SYNTAX
41
+ ## ENVIRONMENT
42
+ ## RETURN VALUES
43
+ ## STANDARDS
44
+ ## SECURITY CONSIDERATIONS
45
+ ## BUGS
46
+ ## HISTORY
47
+ ## AUTHOR
48
+ ## COPYRIGHT
49
+ ## SEE ALSO
33
50
 
34
51
  ## DESCRIPTION
35
52
 
36
- Ronn files are simple ascii texts that document things in the
37
- style of UNIX man pages but with a syntax and feature-set less
38
- insane than that of roff(7). Ronn files are piped through ronn(1)
39
- to build and install traditional roff(7) man pages or to generate
40
- hyperlinked HTML documentation.
53
+ Ronn is a source format for authoring UNIX manpages. The syntax includes all
54
+ Markdown formatting features, plus conventions for expressing the structure and
55
+ various notations present in standard UNIX manpages.
41
56
 
42
- All ronn formatted files must conform to a simple subset of
43
- markdown(5), a humane text markup designed for writing on the
44
- web. It is neither possible nor desirable to express many of
45
- roff(7)'s complex typesetting features in ronn.
57
+ Ronn files can be converted to traditional roff-formatted manpages or to HTML
58
+ using the ronn(1) command.
46
59
 
47
- ## MANPAGE TITLE
60
+ Not all roff(7) typesetting features can be expressed using ronn syntax.
48
61
 
49
- All man pages have a <name>, belong to a <section>, and have a
50
- single sentence <tagline> (useless but witty, preferably). Ronn
51
- files must begin with a first-level heading that includes all of
52
- this information. For example, this very man page begins:
62
+ ## MANPAGE TITLE
53
63
 
54
- ronn(5) -- humane manual page authoring format
55
- =============================================
64
+ Manpages have a <name>, <section> number, and one-line <description>. Ronn files
65
+ must start with a level one heading defining these attributes:
56
66
 
57
- Here, we're saying that the man page documents a thing named
58
- `ronn` in manual section `5` (the "file formats" section; see
59
- manpages(5) for full section list) and that's quickly described
60
- as a "humane manual page authoring format".
67
+ ls(1) -- list directory contents
68
+ ================================
61
69
 
62
- These bits of information are used to fill in the document
63
- header, to create the `NAME` section, and also to establish
64
- output filenames when processed with ronn(1).
70
+ Indicates that the manpage is named `ls` in manual section `1` ("user
71
+ commands").
65
72
 
66
73
  ## SECTION HEADINGS
67
74
 
68
- Man section headings are expressed with markdown level two
69
- headings. markdown(5) provides two syntaxes for level two
70
- headings. A hash prefix syntax:
75
+ Man section headings are expressed with markdown level two headings. There
76
+ are two syntaxes for level two headings.
77
+
78
+ Hash prefix syntax:
71
79
 
72
80
  ## HEADING TEXT
73
81
 
74
- Or, a dash underline syntax:
82
+ Dash underline syntax:
75
83
 
76
84
  HEADING TEXT
77
85
  ------------
78
86
 
79
- Section headings should be in all uppercase and may not contain
80
- other inline markup.
81
-
82
- Most manual pages include at least one of the `SYNOPSIS`,
83
- `DESCRIPTION`, and/or `OPTIONS` sections. Additional sections
84
- commonly included are `SYNTAX`, `ENVIRONMENT`, `HISTORY`, `RETURN
85
- VALUES`, `BUGS`, `SECURITY CONSIDERATIONS`, `STANDARDS` /
86
- `CONFORMING TO`, `AUTHOR`, and `COPYRIGHT`. Finally, most man
87
- pages end with a `SEE ALSO` section that references other manual
88
- pages and external documents.
87
+ Section headings should be all uppercase and may not contain inline markup.
89
88
 
90
89
  ## INLINE MARKUP
91
90
 
92
- Man pages have a limited set of text formatting capabilities at
93
- their disposal. There's basically <b>boldface</b> and
94
- <i>italics</i> (often displayed using <u>underline</u>). Ronn uses
95
- the following bits of markdown(5) to accomplish this:
91
+ Manpages have a limited set of text formatting capabilities. There's basically
92
+ <b>boldface</b> and <i>italics</i> (often displayed using <u>underline</u>).
93
+ Ronn uses the following bits of markdown(7) to accomplish this:
96
94
 
97
95
  * <code>\`backticks\`</code>:
98
- Code, flags, commands, and noun-like things; typically
99
- displayed in in <b>boldface</b>. Note that all text included
100
- within `backticks` is displayed literally; other inline markup
101
- is not processed.
96
+ Code, flags, commands, and noun-like things; typically displayed in in
97
+ <b>boldface</b>. Note that all text included within `backticks` is displayed
98
+ literally; other inline markup is not processed.
102
99
  * `**double-stars**`:
103
100
  Like `backticks` but inline markup is processed.
104
101
  * `_`_underbars_`_`:
105
- User-specified arguments, variables, or user input; typically
106
- displayed with <u>underline</u>.
102
+ User-specified arguments, variables, or user input; typically displayed with
103
+ <u>underline</u>.
107
104
  * `<angle-quotes>`:
108
105
  Same as _underbars_. This is not compatible with Markdown.
109
106
 
110
107
  Here is grep(1)'s DESCRIPTION section represented in `ronn`:
111
108
 
112
- `Grep` searches the named input _FILE_ (or standard input if
109
+ `Grep` searches the named input <FILE> (or standard input if
113
110
  no files are named, or the file name `-` is given) for lines
114
- containing a match to the given _PATTERN_. By default, `grep`
111
+ containing a match to the given <PATTERN>. By default, `grep`
115
112
  prints the matching lines.
116
113
 
117
114
  ## DEFINITION LISTS
118
115
 
119
- Because definition lists are so often used in manual pages to
120
- describe arguments, options, and variables, the basic markdown(5)
121
- list syntax has been extended to support a definition list
122
- syntax.
123
-
124
- Definition list syntax is exactly the same as markdown(5)'s
125
- unordered list syntax but requires that the first line of each
126
- list item be terminated with a colon "`:`". The first line (minus
127
- the colon) is the <term>; subsequent lines may be comprised of
128
- multiple paragraphs, code blocks, standard lists, and nested
129
- definition lists.
116
+ The definition list syntax is exactly the same as markdown's unordered list
117
+ syntax but requires that the first line of each list item be terminated with a
118
+ colon "`:`" character. The contents of the first line (without the colon) is
119
+ the <term>; subsequent lines may be comprised of multiple paragraphs, code
120
+ blocks, standard lists, and nested definition lists.
130
121
 
131
- An example definition list, taken from BSD test(1)'s
132
- `DESCRIPTION` section:
122
+ An example definition list, taken from BSD test(1)'s *DESCRIPTION* section:
133
123
 
134
124
  The following primaries are used to construct expressions:
135
125
 
136
- * `-b` _file_:
137
- True if _file_ exists and is a block special file.
126
+ * `-b` <file>:
127
+ True if <file> exists and is a block special file.
138
128
 
139
- * `-c` _file_:
129
+ * `-c` <file>:
140
130
  True if _file_ exists and is a character special file.
141
131
 
142
- * `-d` _file_:
132
+ * `-d` <file>:
143
133
  True if file exists and is a directory.
144
134
 
145
- The definition list syntax is intentionally backward compatible
146
- with markdown(5)'s list syntax. This allows `ronn` documents to be
147
- piped through normal markdown processors with minor degradation
148
- in output formatting.
135
+ The definition list syntax is intentionally backward compatible with
136
+ markdown(7)'s list syntax. This allows `ronn` documents to be piped through
137
+ normal markdown processors with minor degradation in output formatting.
138
+
139
+ ## LINKS
140
+
141
+ Ronn supports all markdown(7) linking features. Additionally, section headings
142
+ can be linked using reference-style links:
143
+
144
+ ## SECTION 1
145
+
146
+ See the following section.
147
+
148
+ ## SECTION 2
149
+
150
+ See [SECTION 1][] or [to put it another way][SECTION 1].
151
+
152
+ The anchor name would be `#SECTION-1` and `#SECTION-2`. All non-word characters
153
+ are removed and spaces are replaced by dashes.
149
154
 
150
155
  ## SEE ALSO
151
156
 
152
- ronn(1), markdown(5), manpages(5)
157
+ ronn(1), markdown(7), roff(7)
data/man/ronn.7 CHANGED
@@ -1,51 +1,31 @@
1
- .\" generated with Ronn/v0.4.2
1
+ .\" generated with Ronn/v0.6.0
2
2
  .\" http://github.com/rtomayko/ronn/
3
3
  .
4
- .TH "RONN" "7" "March 2010" "Ryan Tomayko" "Ronn Manual"
4
+ .TH "RONN" "7" "June 2010" "0.6.0" "Ronn 0.6.0"
5
5
  .
6
6
  .SH "NAME"
7
- \fBronn\fR \-\- the opposite of roff
7
+ \fBronn\fR \- the opposite of roff
8
8
  .
9
9
  .SH "DESCRIPTION"
10
- Ronn is a humane text format and toolchain for creating UNIX man
11
- pages, and things that appear as man pages from a distance. Use it
12
- to build and install standard UNIX roff man pages or to generate
13
- nicely formatted HTML manual pages for the web.
10
+ Ronn is a text format and toolchain for creating UNIX manpages\. It converts markdown to standard UNIX roff manpages and formatted HTML manuals for the web\.
14
11
  .
15
12
  .P
16
- The Ronn file format is based on Markdown. In fact, Ronn files are a
17
- compatible subset of Markdown syntax but have a more rigid structure and
18
- extend Markdown in some ways to provide features commonly found in man
19
- pages (e.g., definition lists). The ronn(5) manual page defines the
20
- format in more detail.
13
+ The source format includes all of Markdown but has a more rigid structure and includes extensions that provide features commonly found in manpages (definition lists, link notation, etc\.)\. The ronn(5) manual page defines the format in detail\.
21
14
  .
22
15
  .SH "DOCUMENTATION"
23
- The \fB.ronn\fR files located under the \fBman/\fR directory show off a wide
24
- range of ronn capabilities and are the source of Ronn's own documentation.
25
- The source files and generated HTML / roff output files are available
26
- at:
16
+ The \fB\.ronn\fR files located under the \fBman/\fR directory show off a wide range of ronn capabilities and are the source of Ronn\'s own documentation\. The source files and generated HTML / roff output files are available at:
27
17
  .
28
18
  .IP "\(bu" 4
29
- \fIronn(1)\fR \-
30
- build markdown based manual pages at the command line.
19
+ ronn(1) \fIhttp://rtomayko\.github\.com/ronn/ronn\.1\fR \- convert markdown files to manpages\.
31
20
  .
32
21
  .br
33
- \fIsource file\fR, \fIroff output\fR
22
+ source file \fIhttp://github\.com/rtomayko/ronn/blob/master/man/ronn\.1\.ronn\fR, roff output \fIhttp://github\.com/rtomayko/ronn/blob/master/man/ronn\.1\fR
34
23
  .
35
24
  .IP "\(bu" 4
36
- \fIronn(5)\fR \-
37
- humane manual page authoring format syntax reference.
25
+ ronn(5) \fIhttp://rtomayko\.github\.com/ronn/ronn\.5\fR \- markdown\-based text format for authoring manpages
38
26
  .
39
27
  .br
40
- \fIsource file\fR, \fIroff output\fR
41
- .
42
- .IP "\(bu" 4
43
- \fImarkdown(5)\fR \-
44
- humane text markup syntax (taken from \fIMarkdown Syntax\fR,
45
- John Gruber)
46
- .
47
- .br
48
- \fIsource file\fR, \fIroff output\fR
28
+ source file \fIhttp://github\.com/rtomayko/ronn/blob/master/man/ronn\.5\.ronn\fR, roff output \fIhttp://github\.com/rtomayko/ronn/blob/master/man/ronn\.5\fR
49
29
  .
50
30
  .IP "" 0
51
31
  .
@@ -70,7 +50,7 @@ Or, clone the git repository:
70
50
  .
71
51
  .nf
72
52
 
73
- $ git clone git://github.com/rtomayko/ronn.git
53
+ $ git clone git://github\.com/rtomayko/ronn\.git
74
54
  $ PATH=ronn/bin:$PATH
75
55
  $ ronn \-\-help
76
56
  .
@@ -79,124 +59,110 @@ $ ronn \-\-help
79
59
  .IP "" 0
80
60
  .
81
61
  .SH "BASIC USAGE"
82
- To generate a roff man page from the included \fBmarkdown.5.ronn\fR file and
83
- open it with man(1):
62
+ Build roff and HTML output files for one or more input files:
84
63
  .
85
64
  .IP "" 4
86
65
  .
87
66
  .nf
88
67
 
89
- $ ronn \-b man/markdown.5.ronn
90
- building: man/markdown.5
91
- $ man man/markdown.5
68
+ $ ronn man/ronn\.5\.ronn
69
+ roff: man/ronn\.5
70
+ html: man/ronn\.5\.html
92
71
  .
93
72
  .fi
94
73
  .
95
74
  .IP "" 0
96
75
  .
97
76
  .P
98
- To generate a standalone HTML version:
77
+ View a roff manpage with man(1):
99
78
  .
100
79
  .IP "" 4
101
80
  .
102
81
  .nf
103
82
 
104
- $ ronn \-b \-\-html man/markdown.5.ronn
105
- building: man/markdown.5.html
106
- $ open man/markdown.5.html
83
+ $ man man/ronn\.5
107
84
  .
108
85
  .fi
109
86
  .
110
87
  .IP "" 0
111
88
  .
112
89
  .P
113
- To build roff and HTML versions of all ronn files:
90
+ Generate only a standalone HTML version of one or more files:
114
91
  .
115
92
  .IP "" 4
116
93
  .
117
94
  .nf
118
95
 
119
- $ ronn \-b \-\-roff \-\-html man/*.ronn
96
+ $ ronn \-\-html man/markdown\.5\.ronn
97
+ html: man/markdown\.5\.html
120
98
  .
121
99
  .fi
122
100
  .
123
101
  .IP "" 0
124
102
  .
125
103
  .P
126
- If you just want to view a ronn file as if it were a man page without
127
- building intermediate files:
104
+ Build roff versions of all ronn files in a directory:
128
105
  .
129
106
  .IP "" 4
130
107
  .
131
108
  .nf
132
109
 
133
- $ ronn \-m man/markdown.5.ronn
110
+ $ ronn \-\-roff man/*\.ronn
134
111
  .
135
112
  .fi
136
113
  .
137
114
  .IP "" 0
138
115
  .
139
116
  .P
140
- The \fIronn(1)\fR manual page
141
- includes comprehensive documentation on \fBronn\fR command line options.
117
+ View a ronn file as if it were a manpage without building intermediate files:
118
+ .
119
+ .IP "" 4
120
+ .
121
+ .nf
122
+
123
+ $ ronn \-\-man man/markdown\.5\.ronn
124
+ .
125
+ .fi
126
+ .
127
+ .IP "" 0
128
+ .
129
+ .P
130
+ The ronn(1) \fIhttp://rtomayko\.github\.com/ronn/ronn\.1\fR manual page includes comprehensive documentation on \fBronn\fR command line options\.
142
131
  .
143
132
  .SH "ABOUT"
144
- Some people think UNIX manual pages are a poor and outdated style of
145
- documentation. I disagree:
133
+ Some people say UNIX manual pages are a poor and outdated style of documentation\. I disagree:
146
134
  .
147
135
  .IP "\(bu" 4
148
- Man pages follow a well defined structure that's immediately
149
- familiar and provides a useful starting point for developers
150
- documenting new tools, libraries, and formats.
136
+ Man pages follow a well defined structure that\'s immediately familiar\. This provides developers with a useful starting point when documenting new tools, libraries, and formats\.
151
137
  .
152
138
  .IP "\(bu" 4
153
- Man pages get to the point. Because they're written in an inverted
154
- style, with a SYNOPSIS section followed by additional detail,
155
- prose and references to other sources of information, man pages
156
- provide the best of both cheat sheet and reference style
157
- documentation.
139
+ Man pages get to the point\. Because they\'re written in an inverted style, with a SYNOPSIS section followed by additional detail, prose and references to other sources of information, man pages provide the best of both cheat sheet and reference style documentation\.
158
140
  .
159
141
  .IP "\(bu" 4
160
- Man pages have extremely \-\- unbelievably \-\- limited text
161
- formatting capabilities. You get a couple of headings, lists, bold,
162
- underline and no more. This is a feature.
142
+ Man pages have extremely \-\- unbelievably \-\- limited text formatting capabilities\. You get a couple of headings, lists, bold, underline and no more\. This is a feature\.
163
143
  .
164
144
  .IP "\(bu" 4
165
- Although two levels of section hierarchy are technically
166
- supported, most man pages use only a single level. Unwieldy
167
- document hierarchies complicate otherwise good documentation.
168
- Feynman covered all of physics \-\- heavenly bodies through QED \-\-
169
- with only two levels of document hierarchy (\fIThe Feynman Lectures
170
- on Physics\fR, 1970).
145
+ Although two levels of section hierarchy are technically supported, most man pages use only a single level\. Unwieldy document hierarchies complicate otherwise good documentation\. Feynman covered all of physics \-\- heavenly bodies through QED \-\- with only two levels of document hierarchy (\fIThe Feynman Lectures on Physics\fR, 1970)\.
171
146
  .
172
147
  .IP "\(bu" 4
173
- Man pages have a simple referencing syntax; e.g., sh(1), fork(2),
174
- markdown(5). HTML versions can use this to generate links between
175
- pages.
148
+ Man pages have a simple referencing syntax; e\.g\., sh(1), fork(2), markdown(7)\. HTML versions can use this to generate links between pages\.
176
149
  .
177
150
  .IP "\(bu" 4
178
- The classical terminal man page display is typographically well
179
- thought out. Big bold section headings, justified monospace text,
180
- nicely indented paragraphs, intelligently aligned definition
181
- lists, and an informational header and footer.
151
+ The classical terminal man page display is typographically well thought out\. Big bold section headings, justified monospace text, nicely indented paragraphs, intelligently aligned definition lists, and an informational header and footer\.
182
152
  .
183
153
  .IP "" 0
184
154
  .
185
155
  .P
186
- Unfortunately, trying to figure out how to create a man page is a
187
- fairly tedious process. The roff/man macro languages are highly
188
- extensible, fractured between multiple dialects, and include a bunch
189
- of device specific stuff that's entirely irrelevant to modern
190
- publishing tools.
156
+ Unfortunately, figuring out how to create a manpage is a fairly tedious process\. The roff/man macro languages are highly extensible, fractured between multiple dialects, and include a bunch of device specific stuff irrelevant to modern publishing tools\.
191
157
  .
192
158
  .P
193
- Ronn aims to address many of the issues with man page creation while
194
- preserving the things that makes man pages a great form of
195
- documentation.
159
+ Ronn aims to address many of the issues with manpage creation while preserving the things that makes manpages a great form of documentation\.
196
160
  .
197
161
  .SH "COPYING"
198
- Ronn is Copyright (C) 2009 \fIRyan Tomayko\fR
199
- See the file COPYING for information of licensing and distribution.
162
+ Ronn is Copyright (C) 2009 Ryan Tomayko \fIhttp://tomayko\.com/about\fR
163
+ .
164
+ .br
165
+ See the file COPYING for information of licensing and distribution\.
200
166
  .
201
167
  .SH "SEE ALSO"
202
- \fIronn(1)\fR, \fIronn(5)\fR, \fImarkdown(5)\fR
168
+ ronn(1) \fIhttp://rtomayko\.github\.com/ronn/ronn\.1\fR, ronn(5) \fIhttp://rtomayko\.github\.com/ronn/ronn\.5\fR, markdown(5)