ronn 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/CHANGES +34 -0
  2. data/INSTALLING +18 -0
  3. data/README.md +43 -69
  4. data/Rakefile +9 -10
  5. data/bin/ronn +66 -49
  6. data/config.ru +1 -1
  7. data/lib/ronn.rb +35 -9
  8. data/lib/ronn/document.rb +239 -135
  9. data/lib/ronn/index.rb +183 -0
  10. data/lib/ronn/roff.rb +48 -28
  11. data/lib/ronn/template.rb +22 -8
  12. data/lib/ronn/template/dark.css +1 -4
  13. data/lib/ronn/template/default.html +0 -2
  14. data/lib/ronn/template/man.css +12 -12
  15. data/lib/ronn/utils.rb +8 -0
  16. data/man/index.html +78 -0
  17. data/man/index.txt +15 -0
  18. data/man/{ronn.5 → ronn-format.7} +26 -30
  19. data/man/{ronn.5.ronn → ronn-format.7.ronn} +39 -39
  20. data/man/ronn.1 +47 -15
  21. data/man/ronn.1.ronn +53 -23
  22. data/ronn.gemspec +14 -8
  23. data/test/angle_bracket_syntax.html +4 -2
  24. data/test/basic_document.html +4 -2
  25. data/test/custom_title_document.html +1 -2
  26. data/test/definition_list_syntax.html +4 -2
  27. data/test/dots_at_line_start_test.roff +10 -0
  28. data/test/dots_at_line_start_test.ronn +4 -0
  29. data/test/entity_encoding_test.html +24 -2
  30. data/test/entity_encoding_test.roff +41 -1
  31. data/test/entity_encoding_test.ronn +17 -0
  32. data/test/index.txt +8 -0
  33. data/test/markdown_syntax.html +5 -3
  34. data/test/markdown_syntax.roff +4 -4
  35. data/test/middle_paragraph.html +4 -2
  36. data/test/missing_spaces.roff +3 -0
  37. data/test/section_reference_links.html +4 -2
  38. data/test/{ronn_test.rb → test_ronn.rb} +18 -5
  39. data/test/{document_test.rb → test_ronn_document.rb} +59 -8
  40. data/test/test_ronn_index.rb +73 -0
  41. data/test/titleless_document.html +7 -2
  42. data/test/titleless_document.ronn +3 -2
  43. data/test/underline_spacing_test.roff +5 -0
  44. metadata +30 -14
  45. data/man/ronn.7 +0 -168
  46. data/man/ronn.7.ronn +0 -120
@@ -3,7 +3,7 @@ ronn(1) -- convert markdown files to manpages
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `ronn` [<options>] <file>...<br>
6
+ `ronn` [<format>...] <file>...<br>
7
7
  `ronn` `-m`|`--man` <file>...<br>
8
8
  `ronn` `-S`|`--server` <file>...<br>
9
9
  `ronn` `--pipe` <file><br>
@@ -11,31 +11,29 @@ ronn(1) -- convert markdown files to manpages
11
11
 
12
12
  ## DESCRIPTION
13
13
 
14
- **Ronn** converts Markdown input to standard roff-formatted UNIX manpages or
15
- manpage styled HTML. The ronn(5) source format is based on markdown(7) but
16
- includes additional rules and syntax geared toward authoring manuals.
14
+ **Ronn** converts textfiles to standard roff-formatted UNIX manpages or HTML.
15
+ ronn-format(7) is based on markdown(7) but includes additional rules and syntax
16
+ geared toward authoring manuals.
17
17
 
18
- In its default mode, `ronn` converts one or more input <file>s to HTML or UNIX
19
- roff output files. The `--roff`, `--html`, and `--fragment` options dictate
20
- which output files are generated. Multiple format arguments may be specified to
18
+ In its default mode, `ronn` converts one or more input <file>s to HTML or roff
19
+ output files. The `--roff`, `--html`, and `--fragment` options dictate which
20
+ output files are generated. Multiple format arguments may be specified to
21
21
  generate multiple output files. Output files are named after and written to the
22
22
  same directory as input <file>s.
23
23
 
24
- The `--server` and `--man` options change the output behavior from output file
24
+ The `--server` and `--man` options change the output behavior from file
25
25
  generation to serving dynamically generated HTML manpages or viewing <file> as
26
26
  with man(1).
27
27
 
28
28
  With no <file> arguments, `ronn` acts as simple filter. Ronn source text is read
29
- from standard input and roff output is written to standard output. The `--html`
30
- and `--fragment` options can be used to generate that format output instead of
31
- roff.
29
+ from standard input and roff output is written to standard output. Use the
30
+ `--html`, `--roff`, and/or `--fragment` options to select the output format.
32
31
 
33
32
  ## FILES
34
33
 
35
- The `ronn` command expects input to be formatted as ronn(5) text. Source
36
- files are typically named '<name>.<section>.ronn' (e.g., `example.1.ronn`).
37
- The <name> and <section> should match the name and section defined in the
38
- <file>'s heading.
34
+ The `ronn` command expects input to be valid ronn-format(7) text. Source files
35
+ are typically named <name>.<section>.ronn (e.g., `example.1.ronn`). The <name>
36
+ and <section> should match the name and section defined in the <file>'s heading.
39
37
 
40
38
  When building roff or HTML output files, destination filenames are determined by
41
39
  taking the basename of the input <file> and adding the appropriate file
@@ -45,7 +43,7 @@ and `example.1.html` with HTML output.
45
43
 
46
44
  ## OPTIONS
47
45
 
48
- These options control whether output is written to files, standard output, or
46
+ These options control whether output is written to file(s), standard output, or
49
47
  directly to a man pager.
50
48
 
51
49
  * `-m`, `--man`:
@@ -105,7 +103,7 @@ the [ENVIRONMENT][].)
105
103
  displayed in the bottom-center footer area. The <file> mtime is used when no
106
104
  <date> is given, or the current time when no <file> is available.
107
105
 
108
- HTML output can be customized variously:
106
+ HTML output can be customized through the use of CSS stylesheets:
109
107
 
110
108
  * `--style`=<module>[,<module>]...:
111
109
  The list of CSS stylesheets to apply to the document. Multiple <module>
@@ -132,13 +130,45 @@ Miscellaneous options:
132
130
  Disable troff warnings. Warnings are disabled by default. This option can be
133
131
  used to revert the effect of a previous `-w` argument.
134
132
 
133
+ * `-v`, `--version`:
134
+ Show ronn version and exit.
135
+
136
+ ## LINK INDEXES
137
+
138
+ When generating HTML output, `ronn` hyperlinks manual references (like
139
+ `grep(1)`, `ls(1)`, `markdown(7)`) in source text based on reference name to URL
140
+ mappings defined in an `index.txt` file. Each line of the index file describes a
141
+ single reference link, with whitespace separating the reference's <id> from its
142
+ <location>. Blank lines are allowed; lines beginning with a `#` character are
143
+ ignored:
144
+
145
+ # manuals included in this project:
146
+ whisky(1) whisky.1.ronn
147
+ tango(5) tango.5.ronn
148
+
149
+ # external manuals
150
+ grep(1) http://man.cx/grep(1)
151
+ ls(1) http://man.cx/ls(1)
152
+
153
+ # other URLs for use with markdown reference links
154
+ src http://github.com/
155
+
156
+ The <location> is an absolute or relative URL that usually points at an HTML
157
+ version of manpage. It's possible to define references for things that aren't
158
+ manpages.
159
+
160
+ All manuals in an individual directory share the references defined in that
161
+ directory's `index.txt` file. Index references may be used explicitly in
162
+ Markdown reference style links using the syntax: `[`<text>`][`<id>`]`, where
163
+ <text> is the link text and <id> is a reference name defined in the index.
164
+
135
165
  ## STYLES
136
166
 
137
167
  The `--style` option selects a list of CSS stylesheets to include in the
138
168
  generated HTML. Styles are applied in the order defined, so each can use the
139
169
  cascade to override previously defined styles.
140
170
 
141
- ### Internal Stylesheets
171
+ ### Builtin Stylesheets
142
172
 
143
173
  These styles are included with the distribution:
144
174
 
@@ -188,10 +218,10 @@ allow targeting all generated elements:
188
218
  The main `<h1>` element. Hidden by default unless the manual has no <name>
189
219
  or <section> attributes.
190
220
 
191
- See the [internal style sources][internal] for examples.
221
+ See the [builtin style sources][builtin] for examples.
192
222
 
193
- [internal]: http://github.com/rtomayko/ronn/tree/master/lib/ronn/template
194
- "internal stylesheet sources"
223
+ [builtin]: http://github.com/rtomayko/ronn/tree/master/lib/ronn/template
224
+ "Builtin Stylesheet .css files"
195
225
 
196
226
  ## EXAMPLES
197
227
 
@@ -268,8 +298,8 @@ version of this program would be welcome.
268
298
 
269
299
  ## COPYRIGHT
270
300
 
271
- Ronn is Copyright (C) 2009 Ryan Tomayko <tomayko.com/about>
301
+ Ronn is Copyright (C) 2009 Ryan Tomayko <http://tomayko.com/about>
272
302
 
273
303
  ## SEE ALSO
274
304
 
275
- ronn(5), (7), manpages(5), man(1), roff(7), groff(1), markdown(7)
305
+ ronn-format(7), manpages(5), man(1), roff(7), groff(1), markdown(7)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ronn'
3
- s.version = '0.6.6'
4
- s.date = '2010-06-13'
3
+ s.version = '0.7.0'
4
+ s.date = '2010-06-21'
5
5
 
6
6
  s.description = "The opposite of roff"
7
7
  s.summary = "The opposite of roff"
@@ -14,12 +14,14 @@ Gem::Specification.new do |s|
14
14
  AUTHORS
15
15
  CHANGES
16
16
  COPYING
17
+ INSTALLING
17
18
  README.md
18
19
  Rakefile
19
20
  bin/ronn
20
21
  config.ru
21
22
  lib/ronn.rb
22
23
  lib/ronn/document.rb
24
+ lib/ronn/index.rb
23
25
  lib/ronn/roff.rb
24
26
  lib/ronn/server.rb
25
27
  lib/ronn/template.rb
@@ -32,12 +34,12 @@ Gem::Specification.new do |s|
32
34
  lib/ronn/template/screen.css
33
35
  lib/ronn/template/toc.css
34
36
  lib/ronn/utils.rb
37
+ man/index.html
38
+ man/index.txt
39
+ man/ronn-format.7
40
+ man/ronn-format.7.ronn
35
41
  man/ronn.1
36
42
  man/ronn.1.ronn
37
- man/ronn.5
38
- man/ronn.5.ronn
39
- man/ronn.7
40
- man/ronn.7.ronn
41
43
  ronn.gemspec
42
44
  test/angle_bracket_syntax.html
43
45
  test/angle_bracket_syntax.ronn
@@ -49,10 +51,12 @@ Gem::Specification.new do |s|
49
51
  test/definition_list_syntax.html
50
52
  test/definition_list_syntax.roff
51
53
  test/definition_list_syntax.ronn
52
- test/document_test.rb
54
+ test/dots_at_line_start_test.roff
55
+ test/dots_at_line_start_test.ronn
53
56
  test/entity_encoding_test.html
54
57
  test/entity_encoding_test.roff
55
58
  test/entity_encoding_test.ronn
59
+ test/index.txt
56
60
  test/markdown_syntax.html
57
61
  test/markdown_syntax.roff
58
62
  test/markdown_syntax.ronn
@@ -61,10 +65,12 @@ Gem::Specification.new do |s|
61
65
  test/middle_paragraph.ronn
62
66
  test/missing_spaces.roff
63
67
  test/missing_spaces.ronn
64
- test/ronn_test.rb
65
68
  test/section_reference_links.html
66
69
  test/section_reference_links.roff
67
70
  test/section_reference_links.ronn
71
+ test/test_ronn.rb
72
+ test/test_ronn_document.rb
73
+ test/test_ronn_index.rb
68
74
  test/titleless_document.html
69
75
  test/titleless_document.ronn
70
76
  test/underline_spacing_test.roff
@@ -1,6 +1,8 @@
1
1
  <div class='mp'>
2
- <h2 id='NAME'>NAME</h2>
3
- <p><code>angle_bracket_syntax</code> - angle bracket syntax test</p>
2
+ <h2 id="NAME">NAME</h2>
3
+ <p class="man-name">
4
+ <code>angle_bracket_syntax</code> - <span class="man-whatis">angle bracket syntax test</span>
5
+ </p>
4
6
 
5
7
  <p>A <var>WORD</var> in angle brackets is converted to <var>WORD</var>,</p>
6
8
 
@@ -1,6 +1,8 @@
1
1
  <div class='mp'>
2
- <h2 id='NAME'>NAME</h2>
3
- <p><code>simple</code> - a simple ron example</p>
2
+ <h2 id="NAME">NAME</h2>
3
+ <p class="man-name">
4
+ <code>simple</code> - <span class="man-whatis">a simple ron example</span>
5
+ </p>
4
6
 
5
7
  <p>This document created by ron.</p>
6
8
 
@@ -1,6 +1,5 @@
1
1
  <div class='mp'>
2
- <h1>custom_title_document - This is a custom title</h1>
3
-
2
+ <h1>This is a custom title</h1>
4
3
  <p>It doesn't define the name or section of this manual page and is
5
4
  output as a simple <code>&lt;h1&gt;</code> instead of a <code>NAME</code> section.</p>
6
5
 
@@ -1,6 +1,8 @@
1
1
  <div class='mp'>
2
- <h2 id='NAME'>NAME</h2>
3
- <p><code>defition_list_syntax</code> - hiya</p>
2
+ <h2 id="NAME">NAME</h2>
3
+ <p class="man-name">
4
+ <code>defition_list_syntax</code> - <span class="man-whatis">hiya</span>
5
+ </p>
4
6
 
5
7
  <p>Definition lists look like unordered lists:</p>
6
8
 
@@ -0,0 +1,10 @@
1
+ .TH "DOTS_AT_LINE_START_TEST" "" "January 1979" "" ""
2
+ .
3
+ .SH "NAME"
4
+ \fBdots_at_line_start_test\fR
5
+ .
6
+ .P
7
+ There\'s a weird issue where dots at the beginning of a line generate troff warnings due to escaping\.
8
+ .
9
+ .P
10
+ \&\.\.\. let\'s see what happens\.
@@ -0,0 +1,4 @@
1
+ There's a weird issue where dots at the beginning of a line
2
+ generate troff warnings due to escaping.
3
+
4
+ ... let's see what happens.
@@ -1,6 +1,8 @@
1
1
  <div class='mp'>
2
- <h2 id='NAME'>NAME</h2>
3
- <p><code>hello</code> - hello world</p>
2
+ <h2 id="NAME">NAME</h2>
3
+ <p class="man-name">
4
+ <code>hello</code> - <span class="man-whatis">hello world</span>
5
+ </p>
4
6
 
5
7
  <p>Your output &lt;i&gt;might&lt;/i&gt; look like this:</p>
6
8
 
@@ -10,4 +12,24 @@
10
12
  * &lt;b&gt;GitHub&lt;/b&gt;
11
13
  </code></pre>
12
14
 
15
+ <p>Here's some special entities:</p>
16
+
17
+ <ul>
18
+ <li>&amp;bull; &bull;</li>
19
+ <li>&amp;nbsp; &nbsp;</li>
20
+ <li>&amp;copy; &copy;</li>
21
+ <li>&amp;rdquo; &rdquo;</li>
22
+ <li>&amp;mdash; &mdash;</li>
23
+ <li>&amp;reg; &reg;</li>
24
+ <li>&amp;sec; &sec;</li>
25
+ <li>&amp;ge; &ge;</li>
26
+ <li>&amp;le; &le;</li>
27
+ <li>&amp;ne; &ne;</li>
28
+ <li>&amp;equiv; &equiv;</li>
29
+ </ul>
30
+
31
+
32
+ <p>Here's a line that uses non-breaking spaces to force the
33
+ last&nbsp;few&nbsp;words&nbsp;to&nbsp;wrap&nbsp;together.</p>
34
+
13
35
  </div>
@@ -18,4 +18,44 @@ Your output <i>might</i> look like this:
18
18
  .fi
19
19
  .
20
20
  .IP "" 0
21
-
21
+ .
22
+ .P
23
+ Here\'s some special entities:
24
+ .
25
+ .IP "\(bu" 4
26
+ &bull; \(bu
27
+ .
28
+ .IP "\(bu" 4
29
+ &nbsp; \~
30
+ .
31
+ .IP "\(bu" 4
32
+ &copy; \(co
33
+ .
34
+ .IP "\(bu" 4
35
+ &rdquo; \(rs
36
+ .
37
+ .IP "\(bu" 4
38
+ &mdash; \(em
39
+ .
40
+ .IP "\(bu" 4
41
+ &reg; \(rg
42
+ .
43
+ .IP "\(bu" 4
44
+ &sec; \(sc
45
+ .
46
+ .IP "\(bu" 4
47
+ &ge; \(>=
48
+ .
49
+ .IP "\(bu" 4
50
+ &le; \(<=
51
+ .
52
+ .IP "\(bu" 4
53
+ &ne; \(!=
54
+ .
55
+ .IP "\(bu" 4
56
+ &equiv; \(==
57
+ .
58
+ .IP "" 0
59
+ .
60
+ .P
61
+ Here\'s a line that uses non\-breaking spaces to force the last\~few\~words\~to\~wrap\~together\.
@@ -6,3 +6,20 @@ Your output &lt;i&gt;might&lt;/i&gt; look like this:
6
6
  *
7
7
  * &lt;b&gt;GitHub&lt;/b&gt;
8
8
  * <b>GitHub</b>
9
+
10
+ Here's some special entities:
11
+
12
+ * &amp;bull; &bull;
13
+ * &amp;nbsp; &nbsp;
14
+ * &amp;copy; &copy;
15
+ * &amp;rdquo; &rdquo;
16
+ * &amp;mdash; &mdash;
17
+ * &amp;reg; &reg;
18
+ * &amp;sec; &sec;
19
+ * &amp;ge; &ge;
20
+ * &amp;le; &le;
21
+ * &amp;ne; &ne;
22
+ * &amp;equiv; &equiv;
23
+
24
+ Here's a line that uses non-breaking spaces to force the
25
+ last&nbsp;few&nbsp;words&nbsp;to&nbsp;wrap&nbsp;together.
@@ -0,0 +1,8 @@
1
+ # test ronn index
2
+
3
+ # local manuals
4
+ basic_document(7) basic_document.ronn
5
+ definition_list_syntax(5) definition_list_syntax.ronn
6
+
7
+ # see also
8
+ grep(1) http://man.cx/grep(1)
@@ -1,6 +1,8 @@
1
1
  <div class='mp'>
2
- <h2 id='NAME'>NAME</h2>
3
- <p><code>markdown</code> - humane markup syntax</p>
2
+ <h2 id="NAME">NAME</h2>
3
+ <p class="man-name">
4
+ <code>markdown</code> - <span class="man-whatis">humane markup syntax</span>
5
+ </p>
4
6
 
5
7
  <h2 id="SYNOPSIS">SYNOPSIS</h2>
6
8
 
@@ -949,7 +951,7 @@ also by John Gruber.</p>
949
951
 
950
952
  <h2 id="SEE-ALSO">SEE ALSO</h2>
951
953
 
952
- <p>ronn(5)<br />
954
+ <p><span class="man-ref">ronn<span class="s">(5)</span></span><br />
953
955
  <a href="http://daringfireball.net/projects/markdown/" data-bare-link="true">http://daringfireball.net/projects/markdown/</a></p>
954
956
 
955
957
  </div>
@@ -647,7 +647,7 @@ In other words, a \fInumber\-period\-space\fR sequence at the beginning of a lin
647
647
  .
648
648
  .nf
649
649
 
650
- 1986\\\. What a great season\.
650
+ 1986\e\. What a great season\.
651
651
  .
652
652
  .fi
653
653
  .
@@ -1149,7 +1149,7 @@ To produce a literal asterisk or underscore at a position where it would otherwi
1149
1149
  .
1150
1150
  .nf
1151
1151
 
1152
- \\*this text is surrounded by literal asterisks\\*
1152
+ \e*this text is surrounded by literal asterisks\e*
1153
1153
  .
1154
1154
  .fi
1155
1155
  .
@@ -1424,7 +1424,7 @@ Markdown allows you to use backslash escapes to generate literal characters whic
1424
1424
  .
1425
1425
  .nf
1426
1426
 
1427
- \\*literal asterisks\\*
1427
+ \e*literal asterisks\e*
1428
1428
  .
1429
1429
  .fi
1430
1430
  .
@@ -1437,7 +1437,7 @@ Markdown provides backslash escapes for the following characters:
1437
1437
  .
1438
1438
  .nf
1439
1439
 
1440
- \\ backslash
1440
+ \e backslash
1441
1441
  ` backtick
1442
1442
  * asterisk
1443
1443
  _ underscore
@@ -1,6 +1,8 @@
1
1
  <div class='mp'>
2
- <h2 id='NAME'>NAME</h2>
3
- <p><code>test</code> - just a ron test</p>
2
+ <h2 id="NAME">NAME</h2>
3
+ <p class="man-name">
4
+ <code>test</code> - <span class="man-whatis">just a ron test</span>
5
+ </p>
4
6
 
5
7
  <h2 id="TEST">TEST</h2>
6
8