ronn-ng 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
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
data/ronn-ng.gemspec ADDED
@@ -0,0 +1,97 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'ronn-ng'
3
+ s.version = '0.7.4'
4
+ s.date = '2018-12-22'
5
+
6
+ s.summary = "Builds manuals"
7
+ s.description = "Ronn-NG builds manuals in HTML and Unix man page format from Markdown."
8
+ s.homepage = "https://github.com/apjanke/ronn-ng"
9
+ s.license = "MIT"
10
+
11
+ s.authors = ["Andrew Janke"]
12
+ s.email = "floss@apjanke.net"
13
+
14
+ # = MANIFEST =
15
+ s.files = %w[
16
+ AUTHORS
17
+ CHANGES
18
+ LICENSE.txt
19
+ INSTALLING
20
+ README.md
21
+ Rakefile
22
+ bin/ronn
23
+ config.ru
24
+ lib/ronn.rb
25
+ lib/ronn/document.rb
26
+ lib/ronn/index.rb
27
+ lib/ronn/roff.rb
28
+ lib/ronn/server.rb
29
+ lib/ronn/template.rb
30
+ lib/ronn/template/80c.css
31
+ lib/ronn/template/dark.css
32
+ lib/ronn/template/darktoc.css
33
+ lib/ronn/template/default.html
34
+ lib/ronn/template/man.css
35
+ lib/ronn/template/print.css
36
+ lib/ronn/template/screen.css
37
+ lib/ronn/template/toc.css
38
+ lib/ronn/utils.rb
39
+ man/index.html
40
+ man/index.txt
41
+ man/ronn-format.7
42
+ man/ronn-format.7.ronn
43
+ man/ronn.1
44
+ man/ronn.1.ronn
45
+ ronn-ng.gemspec
46
+ test/angle_bracket_syntax.html
47
+ test/angle_bracket_syntax.ronn
48
+ test/basic_document.html
49
+ test/basic_document.ronn
50
+ test/contest.rb
51
+ test/custom_title_document.html
52
+ test/custom_title_document.ronn
53
+ test/definition_list_syntax.html
54
+ test/definition_list_syntax.roff
55
+ test/definition_list_syntax.ronn
56
+ test/dots_at_line_start_test.roff
57
+ test/dots_at_line_start_test.ronn
58
+ test/entity_encoding_test.html
59
+ test/entity_encoding_test.roff
60
+ test/entity_encoding_test.ronn
61
+ test/index.txt
62
+ test/markdown_syntax.html
63
+ test/markdown_syntax.roff
64
+ test/markdown_syntax.ronn
65
+ test/middle_paragraph.html
66
+ test/middle_paragraph.roff
67
+ test/middle_paragraph.ronn
68
+ test/missing_spaces.roff
69
+ test/missing_spaces.ronn
70
+ test/pre_block_with_quotes.roff
71
+ test/pre_block_with_quotes.ronn
72
+ test/section_reference_links.html
73
+ test/section_reference_links.roff
74
+ test/section_reference_links.ronn
75
+ test/test_ronn.rb
76
+ test/test_ronn_document.rb
77
+ test/test_ronn_index.rb
78
+ test/titleless_document.html
79
+ test/titleless_document.ronn
80
+ test/underline_spacing_test.roff
81
+ test/underline_spacing_test.ronn
82
+ ]
83
+ # = MANIFEST =
84
+
85
+ s.executables = ['ronn']
86
+ s.test_files = s.files.select { |path| path =~ /^test\/.*_test.rb/ }
87
+
88
+ s.extra_rdoc_files = %w[LICENSE.txt AUTHORS]
89
+ s.add_dependency 'hpricot', '~> 0.8', '>= 0.8.2'
90
+ s.add_dependency 'rdiscount', '~> 1.5', '>= 1.5.8'
91
+ s.add_dependency 'mustache', '~> 0.7', '>= 0.7.0'
92
+
93
+ s.has_rdoc = true
94
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ronn"]
95
+ s.require_paths = %w[lib]
96
+ s.rubygems_version = '1.1.1'
97
+ end
@@ -0,0 +1,18 @@
1
+ <div class='mp'>
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>
6
+
7
+ <p>A <var>WORD</var> in angle brackets is converted to <var>WORD</var>,</p>
8
+
9
+ <pre><code>except when &lt;WORD> is
10
+ part of a preformatted
11
+ code block,
12
+ </code></pre>
13
+
14
+ <p>or when <code>&lt;WORD></code> is enclosed in backticks.</p>
15
+
16
+ <p>or when <var>WORD</var> has a &lt;dot.> or &lt;foo:colon>.</p>
17
+
18
+ </div>
@@ -0,0 +1,12 @@
1
+ angle_bracket_syntax(5) -- angle bracket syntax test
2
+ ====================================================
3
+
4
+ A <WORD> in angle brackets is converted to <var>WORD</var>,
5
+
6
+ except when <WORD> is
7
+ part of a preformatted
8
+ code block,
9
+
10
+ or when `<WORD>` is enclosed in backticks.
11
+
12
+ or when <WORD> has a <dot.> or <foo:colon>.
@@ -0,0 +1,9 @@
1
+ <div class='mp'>
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>
6
+
7
+ <p>This document created by ron.</p>
8
+
9
+ </div>
@@ -0,0 +1,4 @@
1
+ simple(7) -- a simple ron example
2
+ =================================
3
+
4
+ This document created by ron.
data/test/contest.rb ADDED
@@ -0,0 +1,68 @@
1
+ require "test/unit"
2
+
3
+ # Test::Unit loads a default test if the suite is empty, whose purpose is to
4
+ # fail. Since having empty contexts is a common practice, we decided to
5
+ # overwrite TestSuite#empty? in order to allow them. Having a failure when no
6
+ # tests have been defined seems counter-intuitive.
7
+ class Test::Unit::TestSuite
8
+ def empty?
9
+ false
10
+ end
11
+ end
12
+
13
+ # Contest adds +teardown+, +test+ and +context+ as class methods, and the
14
+ # instance methods +setup+ and +teardown+ now iterate on the corresponding
15
+ # blocks. Note that all setup and teardown blocks must be defined with the
16
+ # block syntax. Adding setup or teardown instance methods defeats the purpose
17
+ # of this library.
18
+ class Test::Unit::TestCase
19
+ def self.setup(&block)
20
+ define_method :setup do
21
+ super(&block)
22
+ instance_eval(&block)
23
+ end
24
+ end
25
+
26
+ def self.teardown(&block)
27
+ define_method :teardown do
28
+ instance_eval(&block)
29
+ super(&block)
30
+ end
31
+ end
32
+
33
+ def self.context(name, &block)
34
+ subclass = Class.new(self)
35
+ remove_tests(subclass)
36
+ subclass.class_eval(&block) if block_given?
37
+ const_set(context_name(name), subclass)
38
+ end
39
+
40
+ def self.test(name, &block)
41
+ define_method(test_name(name), &block)
42
+ end
43
+
44
+ class << self
45
+ alias_method :should, :test
46
+ alias_method :describe, :context
47
+ end
48
+
49
+ private
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
@@ -0,0 +1,6 @@
1
+ <div class='mp'>
2
+ <h1>This is a custom title</h1>
3
+ <p>It doesn't define the name or section of this manual page and is
4
+ output as a simple <code>&lt;h1&gt;</code> instead of a <code>NAME</code> section.</p>
5
+
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,21 @@
1
+ <div class='mp'>
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>
6
+
7
+ <p>Definition lists look like unordered lists:</p>
8
+
9
+ <dl>
10
+ <dt class="flush">term</dt><dd><p>definition</p></dd>
11
+ <dt>another one</dt><dd><p>The definition may span
12
+ multiple lines and even</p>
13
+
14
+ <p>start</p>
15
+
16
+ <p>new paragraphs</p></dd>
17
+ <dt><code>--somearg</code>=<var>VALUE</var></dt><dd><p>We can do that too.</p></dd>
18
+ </dl>
19
+
20
+
21
+ </div>
@@ -0,0 +1,26 @@
1
+ .TH "DEFITION_LIST_SYNTAX" "5" "January 1979" "" ""
2
+ .
3
+ .SH "NAME"
4
+ \fBdefition_list_syntax\fR \- hiya
5
+ .
6
+ .P
7
+ Definition lists look like unordered lists:
8
+ .
9
+ .TP
10
+ term
11
+ definition
12
+ .
13
+ .TP
14
+ another one
15
+ The definition may span multiple lines and even
16
+ .
17
+ .IP
18
+ start
19
+ .
20
+ .IP
21
+ new paragraphs
22
+ .
23
+ .TP
24
+ \fB\-\-somearg\fR=\fIVALUE\fR
25
+ We can do that too\.
26
+
@@ -0,0 +1,18 @@
1
+ defition_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,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.
@@ -0,0 +1,35 @@
1
+ <div class='mp'>
2
+ <h2 id="NAME">NAME</h2>
3
+ <p class="man-name">
4
+ <code>hello</code> - <span class="man-whatis">hello world</span>
5
+ </p>
6
+
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; &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
+
35
+ </div>
@@ -0,0 +1,61 @@
1
+ .TH "HELLO" "1" "January 1979" "" ""
2
+ .
3
+ .SH "NAME"
4
+ \fBhello\fR \- hello world
5
+ .
6
+ .P
7
+ Your output <i>might</i> look like this:
8
+ .
9
+ .IP "" 4
10
+ .
11
+ .nf
12
+
13
+ * Chris
14
+ *
15
+ * &lt;b&gt;GitHub&lt;/b&gt;
16
+ * <b>GitHub</b>
17
+ .
18
+ .fi
19
+ .
20
+ .IP "" 0
21
+ .
22
+ .P
23
+ Here\'s some special entities:
24
+ .
25
+ .IP "\[ci]" 4
26
+ &bull; \[ci]
27
+ .
28
+ .IP "\[ci]" 4
29
+ &nbsp; \~
30
+ .
31
+ .IP "\[ci]" 4
32
+ &copy; \(co
33
+ .
34
+ .IP "\[ci]" 4
35
+ &rdquo; \(rs
36
+ .
37
+ .IP "\[ci]" 4
38
+ &mdash; \(em
39
+ .
40
+ .IP "\[ci]" 4
41
+ &reg; \(rg
42
+ .
43
+ .IP "\[ci]" 4
44
+ &sec; \(sc
45
+ .
46
+ .IP "\[ci]" 4
47
+ &ge; \(>=
48
+ .
49
+ .IP "\[ci]" 4
50
+ &le; \(<=
51
+ .
52
+ .IP "\[ci]" 4
53
+ &ne; \(!=
54
+ .
55
+ .IP "\[ci]" 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\.
@@ -0,0 +1,25 @@
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;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.