ronn-ng 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +8 -0
  3. data/CHANGES +184 -0
  4. data/INSTALLING +20 -0
  5. data/LICENSE.txt +11 -0
  6. data/README.md +113 -0
  7. data/Rakefile +163 -0
  8. data/bin/ronn +223 -0
  9. data/config.ru +15 -0
  10. data/lib/ronn.rb +50 -0
  11. data/lib/ronn/document.rb +495 -0
  12. data/lib/ronn/index.rb +183 -0
  13. data/lib/ronn/roff.rb +302 -0
  14. data/lib/ronn/server.rb +70 -0
  15. data/lib/ronn/template.rb +171 -0
  16. data/lib/ronn/template/80c.css +6 -0
  17. data/lib/ronn/template/dark.css +18 -0
  18. data/lib/ronn/template/darktoc.css +17 -0
  19. data/lib/ronn/template/default.html +41 -0
  20. data/lib/ronn/template/man.css +100 -0
  21. data/lib/ronn/template/print.css +5 -0
  22. data/lib/ronn/template/screen.css +105 -0
  23. data/lib/ronn/template/toc.css +27 -0
  24. data/lib/ronn/utils.rb +55 -0
  25. data/man/index.html +78 -0
  26. data/man/index.txt +15 -0
  27. data/man/ronn-format.7 +201 -0
  28. data/man/ronn-format.7.ronn +157 -0
  29. data/man/ronn.1 +325 -0
  30. data/man/ronn.1.ronn +306 -0
  31. data/ronn-ng.gemspec +97 -0
  32. data/test/angle_bracket_syntax.html +18 -0
  33. data/test/angle_bracket_syntax.ronn +12 -0
  34. data/test/basic_document.html +9 -0
  35. data/test/basic_document.ronn +4 -0
  36. data/test/contest.rb +68 -0
  37. data/test/custom_title_document.html +6 -0
  38. data/test/custom_title_document.ronn +5 -0
  39. data/test/definition_list_syntax.html +21 -0
  40. data/test/definition_list_syntax.roff +26 -0
  41. data/test/definition_list_syntax.ronn +18 -0
  42. data/test/dots_at_line_start_test.roff +10 -0
  43. data/test/dots_at_line_start_test.ronn +4 -0
  44. data/test/entity_encoding_test.html +35 -0
  45. data/test/entity_encoding_test.roff +61 -0
  46. data/test/entity_encoding_test.ronn +25 -0
  47. data/test/index.txt +8 -0
  48. data/test/markdown_syntax.html +957 -0
  49. data/test/markdown_syntax.roff +1467 -0
  50. data/test/markdown_syntax.ronn +881 -0
  51. data/test/middle_paragraph.html +15 -0
  52. data/test/middle_paragraph.roff +13 -0
  53. data/test/middle_paragraph.ronn +10 -0
  54. data/test/missing_spaces.roff +9 -0
  55. data/test/missing_spaces.ronn +2 -0
  56. data/test/pre_block_with_quotes.roff +13 -0
  57. data/test/pre_block_with_quotes.ronn +6 -0
  58. data/test/section_reference_links.html +17 -0
  59. data/test/section_reference_links.roff +10 -0
  60. data/test/section_reference_links.ronn +12 -0
  61. data/test/test_ronn.rb +110 -0
  62. data/test/test_ronn_document.rb +186 -0
  63. data/test/test_ronn_index.rb +73 -0
  64. data/test/titleless_document.html +10 -0
  65. data/test/titleless_document.ronn +3 -0
  66. data/test/underline_spacing_test.roff +21 -0
  67. data/test/underline_spacing_test.ronn +11 -0
  68. metadata +176 -0
@@ -0,0 +1,27 @@
1
+ /* toc.css - enable table of contents */
2
+
3
+ .man-navigation {
4
+ display:block !important;
5
+ position:fixed;
6
+ top:0;
7
+ left:113ex; /* .mp width + padding */
8
+ height:100%;
9
+ width:100%;
10
+ padding:48px 0 0 0;
11
+ border-left:1px solid #dbdbdb;
12
+ background:#eee;
13
+ }
14
+ .man-navigation a,
15
+ .man-navigation a:hover,
16
+ .man-navigation a:link,
17
+ .man-navigation a:visited {
18
+ display:block;
19
+ margin:0;
20
+ padding:5px 2px 5px 30px;
21
+ color:#999;
22
+ text-decoration:none;
23
+ }
24
+ .man-navigation a:hover {
25
+ color:#111;
26
+ text-decoration:underline;
27
+ }
data/lib/ronn/utils.rb ADDED
@@ -0,0 +1,55 @@
1
+ require 'set'
2
+ require 'cgi'
3
+
4
+ module Ronn
5
+ module Utils
6
+
7
+ # All HTML 4 elements and some that are in common use.
8
+ HTML = %w[
9
+ a abbr acronym address applet area b base basefont bdo big blockquote body br
10
+ button caption center cite code col colgroup dd del dfn dir div dl dt em
11
+ fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img
12
+ input ins isindex kbd label legend li link map menu meta noframes noscript
13
+ object ol optgroup option p param pre q s samp script select small span strike
14
+ strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var
15
+ ].to_set
16
+
17
+ # Block elements.
18
+ HTML_BLOCK = %w[
19
+ blockquote body colgroup dd div dl dt fieldset form frame frameset
20
+ h1 h2 h3 h4 h5 h6 hr head html iframe li noframes noscript
21
+ object ol optgroup option p param pre script select
22
+ style table tbody td textarea tfoot th thead title tr tt ul
23
+ ].to_set
24
+
25
+ # Inline elements
26
+ HTML_INLINE = HTML - HTML_BLOCK
27
+
28
+ # Elements that don't have a closing tag.
29
+ HTML_EMPTY = %w[area base basefont br col hr input link meta].to_set
30
+
31
+ def block_element?(name)
32
+ HTML_BLOCK.include?(name)
33
+ end
34
+
35
+ def inline_element?(name)
36
+ HTML_INLINE.include?(name)
37
+ end
38
+
39
+ def empty_element?(name)
40
+ HTML_EMPTY.include?(name)
41
+ end
42
+
43
+ def html_element?(name)
44
+ HTML.include?(name)
45
+ end
46
+
47
+ def child_of?(node, tag)
48
+ while node
49
+ return true if node.name && node.name.downcase == tag
50
+ node = node.parent
51
+ end
52
+ false
53
+ end
54
+ end
55
+ end
data/man/index.html ADDED
@@ -0,0 +1,78 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Ronn</title>
5
+ <style>
6
+ body {
7
+ font-size:24px;
8
+ line-height:1.5;
9
+ font-family:georgia,serif;
10
+ color:#555;
11
+ }
12
+ div#index {
13
+ width:28em;
14
+ margin:0 auto;
15
+ }
16
+ h1 {
17
+ text-align:center;
18
+ font-weight:normal;
19
+ color:#000;
20
+ margin-bottom:0;
21
+ letter-spacing:-3px;
22
+ }
23
+ h3 {
24
+ text-align:center;
25
+ font-weight:normal;
26
+ color:#444;
27
+ margin-top:-20px;
28
+ margin-bottom:40px;
29
+ }
30
+ h4 {
31
+ font-weight:normal;
32
+ font-size:26px;
33
+ color:#111;
34
+ }
35
+ p, dl { margin-left:40px }
36
+ .aux { font-family:monospace;font-size:20px;letter-spacing:1px; }
37
+ .also { font-size:18px }
38
+ .copy { font-size:16px;text-align:center;color:#111 }
39
+ .man-ref { font-family:monospace;letter-spacing:-2px; }
40
+ </style>
41
+ </head>
42
+ <body>
43
+ <div id='index'>
44
+ <h1>Ronn</h1>
45
+ <h3>Builds manuals</h3>
46
+
47
+ <h4>Auxiliary</h4>
48
+ <p class='aux'>
49
+ <a href='http://github.com/apjanke/ronn-ng#readme'>README</a>,
50
+ <a href='http://github.com/apjanke/ronn-ng/blob/master/INSTALLING#files'>INSTALLING</a>,
51
+ <a href='http://github.com/apjanke/ronn-ng/blob/master/CHANGES#files'>CHANGES</a>,
52
+ <a href='http://github.com/apjanke/ronn-ng/blob/master/COPYING#files'>COPYING</a>,
53
+ <a href='http://github.com/apjanke/ronn-ng/blob/master/AUTHORS#files'>AUTHORS</a>
54
+ </p>
55
+
56
+ <h4>Manuals</h4>
57
+ <dl>
58
+ <dt><a class='man-ref' href='ronn.1.html'>ronn(1)</a></dt>
59
+ <dd>manual authoring tool</dd>
60
+
61
+ <dt><a class='man-ref' href='ronn-format.7.html'>ronn-format(7)</a></dt>
62
+ <dd>markdown-based text format for authoring manpages</dd>
63
+ </dl>
64
+
65
+ <h4>See Also</h4>
66
+ <p class='also'>
67
+ <a class='man-ref' href="http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/manpages.5.html">manpages(5)</a>,
68
+ <a class='man-ref' href="http://daringfireball.net/projects/markdown/syntax">markdown(7)</a>,
69
+ <a class='man-ref' href="http://man.cx/man(1)">man(1)</a>,
70
+ <a class='man-ref' href="http://man.cx/roff(7)">roff(7)</a>,
71
+ <a class='man-ref' href="http://man.cx/groff(1)">groff(1)</a>,
72
+ <a class='man-ref' href="http://mustache.github.com/mustache.5.html">mustache(5)</a>
73
+ </p>
74
+
75
+ <p class='copy'>Copyright &copy; 2010 Ryan Tomayko, &copy; 2018 Andrew Janke</p>
76
+ </div>
77
+ </body>
78
+ </html>
data/man/index.txt ADDED
@@ -0,0 +1,15 @@
1
+ # manuals
2
+ ronn(1) ronn.1.ronn
3
+ ronn(5) ronn.5.ronn
4
+ ronn(7) ronn.7.ronn
5
+
6
+ # external manuals
7
+ roff(7) http://man.cx/roff(7)
8
+ grep(1) http://man.cx/grep(1)
9
+ groff(1) http://man.cx/groff(1)
10
+ sh(1) http://man.cx/sh(1posix)
11
+ test(1) http://man.cx/test(1)
12
+ fork(2) http://man.cx/fork(2)
13
+ man(1) http://man.cx/man(1)
14
+ markdown(7) http://daringfireball.net/projects/markdown/syntax
15
+ manpages(5) http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/manpages.5.html
data/man/ronn-format.7 ADDED
@@ -0,0 +1,201 @@
1
+ .\" generated with Ronn/v0.7.0
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.0
3
+ .
4
+ .TH "RONN\-FORMAT" "7" "June 2010" "Ronn 0.7.0" "Ronn Manual"
5
+ .
6
+ .SH "NAME"
7
+ \fBronn\-format\fR \- manual authoring format based on Markdown
8
+ .
9
+ .SH "SYNOPSIS"
10
+ .
11
+ .nf
12
+
13
+ name(1) \-\- short, single\-sentence description
14
+ =============================================
15
+
16
+ ## SYNOPSIS
17
+
18
+ `name` [<optional>\.\.\.] <flags>
19
+
20
+ ## DESCRIPTION
21
+
22
+ A normal paragraph\. This can span multiple lines and is terminated with two
23
+ or more line endings \-\- just like Markdown\.
24
+
25
+ Inline markup for `code`, `user input`, and **strong** are displayed
26
+ boldface; <variable>, _emphasis_, *emphasis*, are displayed in italics
27
+ (HTML) or underline (roff)\.
28
+
29
+ Manual references like sh(1), markdown(7), roff(7), etc\. are hyperlinked in
30
+ HTML output\.
31
+
32
+ Link to sections like [STANDARDS][], [SEE ALSO][], or [WITH A DIFFERENT LINK
33
+ TEXT][#SEE\-ALSO]\.
34
+
35
+ Definition lists:
36
+
37
+ * `\-a`, `\-\-argument`=[<value>]:
38
+ One or more paragraphs describing the argument\.
39
+
40
+ * You can put whatever you *want* here, really:
41
+ Nesting and paragraph spacing are respected\.
42
+
43
+ Frequently used sections:
44
+
45
+ ## OPTIONS
46
+ ## SYNTAX
47
+ ## ENVIRONMENT
48
+ ## RETURN VALUES
49
+ ## STANDARDS
50
+ ## SECURITY CONSIDERATIONS
51
+ ## BUGS
52
+ ## HISTORY
53
+ ## AUTHOR
54
+ ## COPYRIGHT
55
+ ## SEE ALSO
56
+ .
57
+ .fi
58
+ .
59
+ .SH "DESCRIPTION"
60
+ The ronn(1) command converts text in a simple markup to Unix manual pages\. The syntax includes all Markdown formatting features, plus conventions for expressing the structure and various notations present in standard Unix manpages\.
61
+ .
62
+ .P
63
+ Not all roff(7) typesetting features can be expressed using ronn syntax\.
64
+ .
65
+ .SH "MANPAGE TITLE"
66
+ Manpages have a \fIname\fR, \fIsection\fR, and a one\-line \fIdescription\fR\. Files must start with a level one heading defining these attributes:
67
+ .
68
+ .IP "" 4
69
+ .
70
+ .nf
71
+
72
+ ls(1) \-\- list directory contents
73
+ ================================
74
+ .
75
+ .fi
76
+ .
77
+ .IP "" 0
78
+ .
79
+ .P
80
+ Indicates that the manpage is named \fBls\fR in manual section \fB1\fR (\"user commands\")\.
81
+ .
82
+ .SH "SECTION HEADINGS"
83
+ Man section headings are expressed with markdown level two headings\. There are two syntaxes for level two headings\.
84
+ .
85
+ .P
86
+ Hash prefix syntax:
87
+ .
88
+ .IP "" 4
89
+ .
90
+ .nf
91
+
92
+ ## HEADING TEXT
93
+ .
94
+ .fi
95
+ .
96
+ .IP "" 0
97
+ .
98
+ .P
99
+ Dash underline syntax:
100
+ .
101
+ .IP "" 4
102
+ .
103
+ .nf
104
+
105
+ HEADING TEXT
106
+ \-\-\-\-\-\-\-\-\-\-\-\-
107
+ .
108
+ .fi
109
+ .
110
+ .IP "" 0
111
+ .
112
+ .P
113
+ Section headings should be all uppercase and may not contain inline markup\.
114
+ .
115
+ .SH "INLINE MARKUP"
116
+ Manpages have a limited set of text formatting capabilities\. There\'s basically \fBboldface\fR and \fIitalics\fR (often displayed using \fIunderline\fR)\. Ronn uses the following bits of markdown(7) to accomplish this:
117
+ .
118
+ .TP
119
+ \fB`backticks`\fR (markdown compatible)
120
+ Code, flags, commands, and noun\-like things; typically displayed in in \fBboldface\fR\. All text included within \fBbackticks\fR is displayed literally; other inline markup is not processed\. HTML output: \fB<code>\fR\.
121
+ .
122
+ .TP
123
+ \fB**double\-stars**\fR (markdown compatible)
124
+ Also displayed in boldface\. Unlike backticks, inline markup is processed\. HTML output: \fB<strong>\fR\.
125
+ .
126
+ .TP
127
+ \fB<anglequotes>\fR (non\-compatible markdown extension)
128
+ User\-specified arguments, variables, or user input\. Typically displayed with \fIunderline\fR in roff output\. HTML output: \fB<var/>\fR\.
129
+ .
130
+ .TP
131
+ \fB_\fR\fIunderbars\fR\fB_\fR (markdown compatible)
132
+ Emphasis\. May be used for literal option values\. Typically displayed with \fIunderline\fR in roff output\. HTML output: \fB<em>\fR\.
133
+ .
134
+ .P
135
+ Here is grep(1)\'s DESCRIPTION section represented in \fBronn\fR:
136
+ .
137
+ .IP "" 4
138
+ .
139
+ .nf
140
+
141
+ `Grep` searches the named input <FILE> (or standard input if
142
+ no files are named, or the file name `\-` is given) for lines
143
+ containing a match to the given <PATTERN>\. By default, `grep`
144
+ prints the matching lines\.
145
+ .
146
+ .fi
147
+ .
148
+ .IP "" 0
149
+ .
150
+ .SH "DEFINITION LISTS"
151
+ The definition list syntax is compatible with markdown\'s unordered list syntax but requires that the first line of each list item be terminated with a colon \"\fB:\fR\" character\. The contents of the first line is the \fIterm\fR; subsequent lines may be comprised of multiple paragraphs, code blocks, standard lists, and nested definition lists\.
152
+ .
153
+ .P
154
+ An example definition list, taken from BSD test(1)\'s \fIDESCRIPTION\fR section:
155
+ .
156
+ .IP "" 4
157
+ .
158
+ .nf
159
+
160
+ The following primaries are used to construct expressions:
161
+
162
+ * `\-b` <file>:
163
+ True if <file> exists and is a block special file\.
164
+
165
+ * `\-c` <file>:
166
+ True if _file_ exists and is a character special file\.
167
+
168
+ * `\-d` <file>:
169
+ True if file exists and is a directory\.
170
+ .
171
+ .fi
172
+ .
173
+ .IP "" 0
174
+ .
175
+ .SH "LINKS"
176
+ All markdown(7) linking features are supported\.
177
+ .
178
+ .P
179
+ Markdown reference\-style links can be used to link to specific sections by name:
180
+ .
181
+ .IP "" 4
182
+ .
183
+ .nf
184
+
185
+ ## SECTION 1
186
+
187
+ See the following section\.
188
+
189
+ ## SECTION 2
190
+
191
+ See [SECTION 1][] or [to put it another way][SECTION 1]\.
192
+ .
193
+ .fi
194
+ .
195
+ .IP "" 0
196
+ .
197
+ .P
198
+ The anchor name would be \fB#SECTION\-1\fR and \fB#SECTION\-2\fR\. All non\-word characters are removed and spaces are replaced by dashes\.
199
+ .
200
+ .SH "SEE ALSO"
201
+ ronn(1), markdown(7), roff(7)
@@ -0,0 +1,157 @@
1
+ ronn-format(7) -- manual authoring format based on Markdown
2
+ ===========================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ name(1) -- short, single-sentence description
7
+ =============================================
8
+
9
+ ## SYNOPSIS
10
+
11
+ `name` [<optional>...] <flags>
12
+
13
+ ## DESCRIPTION
14
+
15
+ A normal paragraph. This can span multiple lines and is terminated with two
16
+ or more line endings -- just like Markdown.
17
+
18
+ Inline markup for `code`, `user input`, and **strong** are displayed
19
+ boldface; <variable>, _emphasis_, *emphasis*, are displayed in italics
20
+ (HTML) or underline (roff).
21
+
22
+ Manual references like sh(1), markdown(7), roff(7), etc. are hyperlinked in
23
+ HTML output.
24
+
25
+ Link to sections like [STANDARDS][], [SEE ALSO][], or [WITH A DIFFERENT LINK
26
+ TEXT][#SEE-ALSO].
27
+
28
+ Definition lists:
29
+
30
+ * `-a`, `--argument`=[<value>]:
31
+ One or more paragraphs describing the argument.
32
+
33
+ * You can put whatever you *want* here, really:
34
+ Nesting and paragraph spacing are respected.
35
+
36
+ Frequently used sections:
37
+
38
+ ## OPTIONS
39
+ ## SYNTAX
40
+ ## ENVIRONMENT
41
+ ## RETURN VALUES
42
+ ## STANDARDS
43
+ ## SECURITY CONSIDERATIONS
44
+ ## BUGS
45
+ ## HISTORY
46
+ ## AUTHOR
47
+ ## COPYRIGHT
48
+ ## SEE ALSO
49
+
50
+ ## DESCRIPTION
51
+
52
+ The ronn(1) command converts text in a simple markup to Unix manual pages. The
53
+ syntax includes all Markdown formatting features, plus conventions for
54
+ expressing the structure and various notations present in standard Unix
55
+ manpages.
56
+
57
+ Not all roff(7) typesetting features can be expressed using ronn syntax.
58
+
59
+ ## MANPAGE TITLE
60
+
61
+ Manpages have a <name>, <section>, and a one-line <description>. Files must
62
+ start with a level one heading defining these attributes:
63
+
64
+ ls(1) -- list directory contents
65
+ ================================
66
+
67
+ Indicates that the manpage is named `ls` in manual section `1` ("user
68
+ commands").
69
+
70
+ ## SECTION HEADINGS
71
+
72
+ Man section headings are expressed with markdown level two headings. There
73
+ are two syntaxes for level two headings.
74
+
75
+ Hash prefix syntax:
76
+
77
+ ## HEADING TEXT
78
+
79
+ Dash underline syntax:
80
+
81
+ HEADING TEXT
82
+ ------------
83
+
84
+ Section headings should be all uppercase and may not contain inline markup.
85
+
86
+ ## INLINE MARKUP
87
+
88
+ Manpages have a limited set of text formatting capabilities. There's basically
89
+ <b>boldface</b> and <i>italics</i> (often displayed using <u>underline</u>).
90
+ Ronn uses the following bits of markdown(7) to accomplish this:
91
+
92
+ * <code>\`backticks\`</code> (markdown compatible):
93
+ Code, flags, commands, and noun-like things; typically displayed in in
94
+ <b>boldface</b>. All text included within `backticks` is displayed
95
+ literally; other inline markup is not processed. HTML output:
96
+ `<code>`.
97
+
98
+ * `**double-stars**` (markdown compatible):
99
+ Also displayed in boldface. Unlike backticks, inline markup is processed.
100
+ HTML output: `<strong>`.
101
+
102
+ * `<anglequotes>` (non-compatible markdown extension):
103
+ User-specified arguments, variables, or user input. Typically displayed with
104
+ <u>underline</u> in roff output. HTML output: `<var/>`.
105
+
106
+ * `_`_underbars_`_` (markdown compatible):
107
+ Emphasis. May be used for literal option values. Typically displayed with
108
+ <u>underline</u> in roff output. HTML output: `<em>`.
109
+
110
+ Here is grep(1)'s DESCRIPTION section represented in `ronn`:
111
+
112
+ `Grep` searches the named input <FILE> (or standard input if
113
+ no files are named, or the file name `-` is given) for lines
114
+ containing a match to the given <PATTERN>. By default, `grep`
115
+ prints the matching lines.
116
+
117
+ ## DEFINITION LISTS
118
+
119
+ The definition list syntax is compatible with markdown's unordered list syntax
120
+ but requires that the first line of each list item be terminated with a colon
121
+ "`:`" character. The contents of the first line is the <term>; subsequent lines
122
+ may be comprised of multiple paragraphs, code blocks, standard lists, and nested
123
+ definition lists.
124
+
125
+ An example definition list, taken from BSD test(1)'s *DESCRIPTION* section:
126
+
127
+ The following primaries are used to construct expressions:
128
+
129
+ * `-b` <file>:
130
+ True if <file> exists and is a block special file.
131
+
132
+ * `-c` <file>:
133
+ True if _file_ exists and is a character special file.
134
+
135
+ * `-d` <file>:
136
+ True if file exists and is a directory.
137
+
138
+ ## LINKS
139
+
140
+ All markdown(7) linking features are supported.
141
+
142
+ Markdown reference-style links can be used to link to specific sections by name:
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.
154
+
155
+ ## SEE ALSO
156
+
157
+ ronn(1), markdown(7), roff(7)