nronn 0.10.1.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +8 -0
  3. data/CHANGES +230 -0
  4. data/Gemfile +2 -0
  5. data/Gemfile.lock +72 -0
  6. data/INSTALLING.md +92 -0
  7. data/LICENSE.txt +12 -0
  8. data/README.md +131 -0
  9. data/Rakefile +153 -0
  10. data/bin/ronn +253 -0
  11. data/completion/bash/ronn +32 -0
  12. data/completion/zsh/_ronn +24 -0
  13. data/config.ru +15 -0
  14. data/lib/ronn/document.rb +530 -0
  15. data/lib/ronn/index.rb +180 -0
  16. data/lib/ronn/roff.rb +393 -0
  17. data/lib/ronn/server.rb +67 -0
  18. data/lib/ronn/template/80c.css +6 -0
  19. data/lib/ronn/template/dark.css +18 -0
  20. data/lib/ronn/template/darktoc.css +17 -0
  21. data/lib/ronn/template/default.html +41 -0
  22. data/lib/ronn/template/man.css +100 -0
  23. data/lib/ronn/template/print.css +5 -0
  24. data/lib/ronn/template/screen.css +105 -0
  25. data/lib/ronn/template/toc.css +27 -0
  26. data/lib/ronn/template.rb +173 -0
  27. data/lib/ronn/utils.rb +57 -0
  28. data/lib/ronn.rb +47 -0
  29. data/man/index.html +78 -0
  30. data/man/index.txt +15 -0
  31. data/man/ronn-format.7 +145 -0
  32. data/man/ronn-format.7.ronn +157 -0
  33. data/man/ronn.1 +227 -0
  34. data/man/ronn.1.ronn +316 -0
  35. data/nronn.gemspec +136 -0
  36. data/test/angle_bracket_syntax.html +27 -0
  37. data/test/angle_bracket_syntax.roff +24 -0
  38. data/test/angle_bracket_syntax.ronn +22 -0
  39. data/test/backticks.html +14 -0
  40. data/test/backticks.ronn +10 -0
  41. data/test/basic_document.html +8 -0
  42. data/test/basic_document.ronn +4 -0
  43. data/test/circumflexes.ronn +1 -0
  44. data/test/code_blocks.html +38 -0
  45. data/test/code_blocks.roff +38 -0
  46. data/test/code_blocks.ronn +41 -0
  47. data/test/code_blocks_regression +19 -0
  48. data/test/code_blocks_regression.html +38 -0
  49. data/test/code_blocks_regression.ronn +40 -0
  50. data/test/contest.rb +70 -0
  51. data/test/custom_title_document.html +6 -0
  52. data/test/custom_title_document.ronn +5 -0
  53. data/test/definition_list_syntax.html +25 -0
  54. data/test/definition_list_syntax.roff +19 -0
  55. data/test/definition_list_syntax.ronn +18 -0
  56. data/test/dots_at_line_start_test.roff +19 -0
  57. data/test/dots_at_line_start_test.ronn +12 -0
  58. data/test/ellipses.roff +7 -0
  59. data/test/ellipses.ronn +7 -0
  60. data/test/entity_encoding_test.html +42 -0
  61. data/test/entity_encoding_test.roff +51 -0
  62. data/test/entity_encoding_test.ronn +34 -0
  63. data/test/index.txt +8 -0
  64. data/test/markdown_syntax.html +954 -0
  65. data/test/markdown_syntax.roff +907 -0
  66. data/test/markdown_syntax.ronn +881 -0
  67. data/test/middle_paragraph.html +14 -0
  68. data/test/middle_paragraph.roff +9 -0
  69. data/test/middle_paragraph.ronn +10 -0
  70. data/test/missing_spaces.roff +7 -0
  71. data/test/missing_spaces.ronn +2 -0
  72. data/test/nested_list.ronn +19 -0
  73. data/test/nested_list_with_code.html +14 -0
  74. data/test/nested_list_with_code.roff +11 -0
  75. data/test/nested_list_with_code.ronn +6 -0
  76. data/test/ordered_list.html +28 -0
  77. data/test/ordered_list.roff +25 -0
  78. data/test/ordered_list.ronn +21 -0
  79. data/test/page.with.periods.in.name.5.ronn +4 -0
  80. data/test/pre_block_with_quotes.roff +8 -0
  81. data/test/pre_block_with_quotes.ronn +6 -0
  82. data/test/section_reference_links.html +16 -0
  83. data/test/section_reference_links.roff +7 -0
  84. data/test/section_reference_links.ronn +12 -0
  85. data/test/single_quotes.html +11 -0
  86. data/test/single_quotes.roff +5 -0
  87. data/test/single_quotes.ronn +9 -0
  88. data/test/tables.ronn +24 -0
  89. data/test/test_ronn.rb +124 -0
  90. data/test/test_ronn_document.rb +186 -0
  91. data/test/test_ronn_index.rb +73 -0
  92. data/test/titleless_document.html +9 -0
  93. data/test/titleless_document.ronn +3 -0
  94. data/test/underline_spacing_test.roff +13 -0
  95. data/test/underline_spacing_test.ronn +11 -0
  96. metadata +309 -0
@@ -0,0 +1,19 @@
1
+ .\" generated with nRonn/v0.9.1
2
+ .\" https://github.com/n-ronn/nronn/tree/0.9.1
3
+ .TH "CODE_BLOCKS_REGRESSION" "" "July 2020" ""
4
+ .SH "In the text:"
5
+ This is Renzo\'s code\.
6
+ .P
7
+ Debian\'s lintian returns the following warning: acute\-accent\-in\-manual\-page
8
+ .P
9
+ This manual page uses the \' groff sequence\. Usually, the intent to generate an apostrophe, but that sequence actually renders as a an acute accent\.
10
+ .P
11
+ For an apostrophe or a single closing quote, use plain \'\. For single opening quote, i\.e\. a straight downward line \' like the one used in shell commands, use \e(aq\.
12
+ .SH "Basic code block"
13
+ The situation is even worse when there are code blocks, mainly code chunks or commands\. E\.g\., copy\-paste fails\.
14
+ .P
15
+ Type the following command \fBecho \'Hello World\'\fR\.
16
+ .P
17
+ \fBbash $ echo \'hello world\'\fR
18
+ .P
19
+ The following code cannot be compiled: \fBC int main() { int example = 42; switch (example) { case \'a\': return 10; default: return 42; } }\fR
@@ -0,0 +1,38 @@
1
+ <div class='mp'>
2
+
3
+ <h1 id="Example-Quote-Error">Example Quote Error</h1>
4
+ <h2 id="In-the-text-">In the text:</h2>
5
+
6
+ <p>This is Renzo's code.</p>
7
+
8
+ <p>Debian's lintian returns the following warning:
9
+ acute-accent-in-manual-page</p>
10
+
11
+ <p>This manual page uses the ' groff sequence. Usually, the intent to
12
+ generate an apostrophe, but that sequence actually renders as a an acute
13
+ accent.</p>
14
+
15
+ <p>For an apostrophe or a single closing quote, use plain '. For single
16
+ opening quote, i.e. a straight downward line ' like the one used in
17
+ shell commands, use \(aq.</p>
18
+
19
+ <h2 id="Basic-code-block">Basic code block</h2>
20
+
21
+ <p>The situation is even worse when there are code blocks, mainly code
22
+ chunks or commands. E.g., copy-paste fails.</p>
23
+
24
+ <p>Type the following command <code>echo 'Hello World'</code>.</p>
25
+
26
+ <pre><code class="language-bash">$ echo 'hello world'
27
+ </code></pre>
28
+
29
+ <p>The following code cannot be compiled:</p>
30
+ <pre><code class="language-C">int main() {
31
+ int example = 42;
32
+ switch (example) {
33
+ case 'a': return 10;
34
+ default: return 42;
35
+ }
36
+ }
37
+ </code></pre>
38
+ </div>
@@ -0,0 +1,40 @@
1
+ Example Quote Error
2
+ ===================
3
+
4
+ ## In the text:
5
+
6
+ This is Renzo's code.
7
+
8
+ Debian's lintian returns the following warning:
9
+ acute-accent-in-manual-page
10
+
11
+ This manual page uses the \' groff sequence. Usually, the intent to
12
+ generate an apostrophe, but that sequence actually renders as a an acute
13
+ accent.
14
+
15
+ For an apostrophe or a single closing quote, use plain '. For single
16
+ opening quote, i.e. a straight downward line ' like the one used in
17
+ shell commands, use &#92;(aq.
18
+
19
+ ## Basic code block
20
+
21
+ The situation is even worse when there are code blocks, mainly code
22
+ chunks or commands. E.g., copy-paste fails.
23
+
24
+ Type the following command `echo 'Hello World'`.
25
+
26
+ ``` bash
27
+ $ echo 'hello world'
28
+ ```
29
+
30
+ The following code cannot be compiled:
31
+ ``` C
32
+ int main() {
33
+ int example = 42;
34
+ switch (example) {
35
+ case 'a': return 10;
36
+ default: return 42;
37
+ }
38
+ }
39
+ ```
40
+
data/test/contest.rb ADDED
@@ -0,0 +1,70 @@
1
+ require 'test/unit'
2
+
3
+ module Test
4
+ module Unit
5
+ # TestSuite loads a default test if the suite is empty, whose purpose is to
6
+ # fail. Since having empty contexts is a common practice, we decided to
7
+ # overwrite TestSuite#empty? in order to allow them. Having a failure when no
8
+ # tests have been defined seems counter-intuitive.
9
+ class TestSuite
10
+ def empty?
11
+ false
12
+ end
13
+ end
14
+
15
+ # Contest adds +teardown+, +test+ and +context+ as class methods, and the
16
+ # instance methods +setup+ and +teardown+ now iterate on the corresponding
17
+ # blocks. Note that all setup and teardown blocks must be defined with the
18
+ # block syntax. Adding setup or teardown instance methods defeats the purpose
19
+ # of this library.
20
+ class TestCase
21
+ def self.setup(&block)
22
+ define_method :setup do
23
+ super(&block)
24
+ instance_eval(&block)
25
+ end
26
+ end
27
+
28
+ def self.teardown(&block)
29
+ define_method :teardown do
30
+ instance_eval(&block)
31
+ super(&block)
32
+ end
33
+ end
34
+
35
+ def self.context(name, &block)
36
+ subclass = Class.new(self)
37
+ remove_tests(subclass)
38
+ subclass.class_eval(&block) if block_given?
39
+ const_set(context_name(name), subclass)
40
+ end
41
+
42
+ def self.test(name, &block)
43
+ define_method(test_name(name), &block)
44
+ end
45
+
46
+ class << self
47
+ alias should test
48
+ alias describe context
49
+ end
50
+
51
+ def self.context_name(name)
52
+ "Test#{sanitize_name(name).gsub(/(^| )(\w)/) { $2.upcase }}".to_sym
53
+ end
54
+
55
+ def self.test_name(name)
56
+ "test_#{sanitize_name(name).gsub(/\s+/, '_')}".to_sym
57
+ end
58
+
59
+ def self.sanitize_name(name)
60
+ name.gsub(/\W+/, ' ').strip
61
+ end
62
+
63
+ def self.remove_tests(subclass)
64
+ subclass.public_instance_methods.grep(/^test_/).each do |meth|
65
+ subclass.send(:undef_method, meth.to_sym)
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,6 @@
1
+ <div class='mp'>
2
+
3
+ <h1 id="This-is-a-custom-title">This is a custom title</h1>
4
+ <p>It doesn't define the name or section of this manual page and is
5
+ output as a simple <code>&lt;h1&gt;</code> instead of a <code>NAME</code> section.</p>
6
+ </div>
@@ -0,0 +1,5 @@
1
+ This is a custom title
2
+ ======================
3
+
4
+ It doesn't define the name or section of this manual page and is
5
+ output as a simple `<h1>` instead of a `NAME` section.
@@ -0,0 +1,25 @@
1
+ <div class='mp'>
2
+
3
+ <h2 id="NAME">NAME</h2>
4
+ <p class="man-name">
5
+ <code>definition_list_syntax</code> - <span class="man-whatis">hiya</span>
6
+ </p>
7
+ <p>Definition lists look like unordered lists:</p>
8
+
9
+ <dl>
10
+ <dt>term</dt>
11
+ <dd>definition</dd>
12
+ <dt>another one</dt>
13
+ <dd>The definition may span
14
+ multiple lines and even
15
+
16
+ <p>start</p>
17
+
18
+ <p>new paragraphs</p>
19
+ </dd>
20
+ <dt>
21
+ <code>--somearg</code>=<var>VALUE</var>
22
+ </dt>
23
+ <dd>We can do that too.</dd>
24
+ </dl>
25
+ </div>
@@ -0,0 +1,19 @@
1
+ .TH "DEFINITION_LIST_SYNTAX" "5" "January 1979" ""
2
+ .SH "NAME"
3
+ \fBdefinition_list_syntax\fR \- hiya
4
+ .P
5
+ Definition lists look like unordered lists:
6
+ .TP
7
+ term
8
+ definition
9
+ .TP
10
+ another one
11
+ The definition may span multiple lines and even
12
+ .IP
13
+ start
14
+ .IP
15
+ new paragraphs
16
+ .TP
17
+ \fB\-\-somearg\fR=\fIVALUE\fR
18
+ We can do that too\.
19
+
@@ -0,0 +1,18 @@
1
+ definition_list_syntax(5) -- hiya
2
+ =================================
3
+
4
+ Definition lists look like unordered lists:
5
+
6
+ * term:
7
+ definition
8
+
9
+ * another one:
10
+ The definition may span
11
+ multiple lines and even
12
+
13
+ start
14
+
15
+ new paragraphs
16
+
17
+ * `--somearg`=<VALUE>:
18
+ We can do that too.
@@ -0,0 +1,19 @@
1
+ .TH "DOTS_AT_LINE_START_TEST" "" "January 1979" ""
2
+ .SH "NAME"
3
+ \fBdots_at_line_start_test\fR
4
+ .P
5
+ There's a weird issue where dots at the beginning of a line generate troff warnings due to escaping\.
6
+ .P
7
+ \&\.\. let's see what happens\.
8
+ .IP "" 4
9
+ .nf
10
+ \&\. A dot on an indented line
11
+
12
+ \&\. Another dot on an indented line
13
+
14
+ some text
15
+ some more text
16
+ \&\. A dot on an indented line as part of a paragraph
17
+ .fi
18
+ .IP "" 0
19
+
@@ -0,0 +1,12 @@
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.
5
+
6
+ . A dot on an indented line
7
+
8
+ . Another dot on an indented line
9
+
10
+ some text
11
+ some more text
12
+ . A dot on an indented line as part of a paragraph
@@ -0,0 +1,7 @@
1
+ .TH "ELLIPSES" "7" "January 1979" ""
2
+ .SH "NAME"
3
+ \fBellipses\fR \- testing ellipses
4
+ .P
5
+ Ellipses should be replaced\|\.\|\.\|\.
6
+ .P
7
+ \|\.\|\.\|\.also, they shouldn't interfere with regular dots at the beginning of a line\.
@@ -0,0 +1,7 @@
1
+ ellipses(7) -- testing ellipses
2
+ ===============================
3
+
4
+ Ellipses should be replaced...
5
+
6
+ ...also, they shouldn't interfere with regular dots at the beginning
7
+ of a line.
@@ -0,0 +1,42 @@
1
+ <div class='mp'>
2
+
3
+ <h2 id="NAME">NAME</h2>
4
+ <p class="man-name">
5
+ <code>hello</code> - <span class="man-whatis">hello world</span>
6
+ </p>
7
+ <p>Your output &lt;i&gt;might&lt;/i&gt; look like this:</p>
8
+
9
+ <pre><code>* Chris
10
+ *
11
+ * &amp;lt;b&amp;gt;GitHub&amp;lt;/b&amp;gt;
12
+ * &lt;b&gt;GitHub&lt;/b&gt;
13
+ </code></pre>
14
+
15
+ <p>Here's some special entities:</p>
16
+
17
+ <ul>
18
+ <li>&amp;bull; •</li>
19
+ <li>&amp;nbsp;  </li>
20
+ <li>&amp;copy; ©</li>
21
+ <li>&amp;rdquo; ”</li>
22
+ <li>&amp;mdash; —</li>
23
+ <li>&amp;reg; ®</li>
24
+ <li>&amp;sect; §</li>
25
+ <li>&amp;ge; ≥</li>
26
+ <li>&amp;le; ≤</li>
27
+ <li>&amp;ne; ≠</li>
28
+ <li>&amp;equiv; ≡</li>
29
+ </ul>
30
+
31
+ <p>Here's a line that uses non-breaking spaces to force the
32
+ last few words to wrap together.</p>
33
+
34
+ <p>And stuff like this:</p>
35
+
36
+ <p>git bulk [-g] ([-a]|[-w <ws-name>]) <git command> </git></ws-name><br>
37
+ git bulk --addworkspace <ws-name> <ws-root-directory> (--from <url or file>) </url></ws-root-directory></ws-name><br>
38
+ git bulk --removeworkspace &lt;ws-name&gt; <br></p>
39
+
40
+ <p>Should have the <code>&amp;lt;</code>/<code>&amp;gt;</code> entities stay as <code>&amp;lt;</code>/<code>&amp;gt;</code> in HTML, but be
41
+ turned into literal brackets in the ROFF.</p>
42
+ </div>
@@ -0,0 +1,51 @@
1
+ .TH "HELLO" "1" "January 1979" ""
2
+ .SH "NAME"
3
+ \fBhello\fR \- hello world
4
+ .P
5
+ Your output <i>might</i> look like this:
6
+ .IP "" 4
7
+ .nf
8
+ * Chris
9
+ *
10
+ * &lt;b&gt;GitHub&lt;/b&gt;
11
+ * <b>GitHub</b>
12
+ .fi
13
+ .IP "" 0
14
+ .P
15
+ Here's some special entities:
16
+ .IP "\(bu" 4
17
+ &bull; \(bu
18
+ .IP "\(bu" 4
19
+ &nbsp; \~
20
+ .IP "\(bu" 4
21
+ &copy; \(co
22
+ .IP "\(bu" 4
23
+ &rdquo; \(rs
24
+ .IP "\(bu" 4
25
+ &mdash; \(em
26
+ .IP "\(bu" 4
27
+ &reg; \(rg
28
+ .IP "\(bu" 4
29
+ &sect; \(sc
30
+ .IP "\(bu" 4
31
+ &ge; \(>=
32
+ .IP "\(bu" 4
33
+ &le; \(<=
34
+ .IP "\(bu" 4
35
+ &ne; \(!=
36
+ .IP "\(bu" 4
37
+ &equiv; \(==
38
+ .IP "" 0
39
+ .P
40
+ Here's a line that uses non\-breaking spaces to force the last\~few\~words\~to\~wrap\~together\.
41
+ .P
42
+ And stuff like this:
43
+ .P
44
+ git bulk [\-g] ([\-a]|[\-w
45
+ .br
46
+ git bulk \-\-addworkspace
47
+ .br
48
+ git bulk \-\-removeworkspace <ws\-name>
49
+ .br
50
+ .P
51
+ Should have the \fB&lt;\fR/\fB&gt;\fR entities stay as \fB&lt;\fR/\fB&gt;\fR in HTML, but be turned into literal brackets in the ROFF\.
@@ -0,0 +1,34 @@
1
+ # hello(1) -- hello world
2
+
3
+ Your output &lt;i&gt;might&lt;/i&gt; look like this:
4
+
5
+ * Chris
6
+ *
7
+ * &lt;b&gt;GitHub&lt;/b&gt;
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;sect; &sect;
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.
26
+
27
+ And stuff like this:
28
+
29
+ git bulk [-g] ([-a]|[-w &lt;ws-name&gt;]) &lt;git command&gt; <br/>
30
+ git bulk --addworkspace &lt;ws-name&gt; &lt;ws-root-directory&gt; (--from &lt;URL or file&gt;) <br/>
31
+ git bulk --removeworkspace &lt;ws-name&gt; <br/>
32
+
33
+ Should have the `&lt;`/`&gt;` entities stay as `&lt;`/`&gt;` in HTML, but be
34
+ turned into literal brackets in the ROFF.
data/test/index.txt ADDED
@@ -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)