ronn-ng 0.7.4 → 0.8.0.SNAPSHOT

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +12 -3
  3. data/Gemfile +2 -0
  4. data/INSTALLING.md +100 -0
  5. data/README.md +19 -1
  6. data/Rakefile +39 -49
  7. data/bin/ronn +93 -75
  8. data/completion/bash/ronn +32 -0
  9. data/completion/zsh/_ronn +24 -0
  10. data/config.ru +3 -3
  11. data/lib/ronn/document.rb +127 -106
  12. data/lib/ronn/index.rb +8 -9
  13. data/lib/ronn/roff.rb +153 -76
  14. data/lib/ronn/server.rb +19 -22
  15. data/lib/ronn/template.rb +27 -26
  16. data/lib/ronn/utils.rb +9 -7
  17. data/lib/ronn.rb +5 -3
  18. data/man/ronn-format.7 +6 -62
  19. data/man/ronn.1 +21 -123
  20. data/man/ronn.1.ronn +8 -0
  21. data/ronn-ng.gemspec +38 -13
  22. data/test/angle_bracket_syntax.html +4 -5
  23. data/test/backticks.html +14 -0
  24. data/test/backticks.ronn +10 -0
  25. data/test/basic_document.html +3 -4
  26. data/test/basic_document.ronn +2 -2
  27. data/test/circumflexes.ronn +1 -0
  28. data/test/code_blocks.7.ronn +41 -0
  29. data/test/contest.rb +56 -54
  30. data/test/custom_title_document.html +2 -2
  31. data/test/definition_list_syntax.html +13 -9
  32. data/test/definition_list_syntax.roff +2 -9
  33. data/test/definition_list_syntax.ronn +2 -2
  34. data/test/dots_at_line_start_test.roff +12 -3
  35. data/test/dots_at_line_start_test.ronn +8 -0
  36. data/test/ellipses.roff +7 -0
  37. data/test/ellipses.ronn +7 -0
  38. data/test/entity_encoding_test.html +13 -14
  39. data/test/entity_encoding_test.roff +1 -22
  40. data/test/entity_encoding_test.ronn +1 -1
  41. data/test/markdown_syntax.html +4 -5
  42. data/test/markdown_syntax.roff +1 -561
  43. data/test/middle_paragraph.html +2 -3
  44. data/test/middle_paragraph.roff +1 -5
  45. data/test/middle_paragraph.ronn +1 -1
  46. data/test/missing_spaces.roff +0 -2
  47. data/test/nested_list.ronn +19 -0
  48. data/test/nested_list_with_code.html +15 -0
  49. data/test/nested_list_with_code.roff +11 -0
  50. data/test/nested_list_with_code.ronn +6 -0
  51. data/test/page.with.periods.in.name.5.ronn +4 -0
  52. data/test/pre_block_with_quotes.roff +0 -5
  53. data/test/section_reference_links.html +2 -3
  54. data/test/section_reference_links.roff +1 -4
  55. data/test/section_reference_links.ronn +1 -1
  56. data/test/tables.ronn +24 -0
  57. data/test/test_ronn.rb +49 -35
  58. data/test/test_ronn_document.rb +81 -81
  59. data/test/test_ronn_index.rb +11 -11
  60. data/test/titleless_document.html +0 -1
  61. data/test/underline_spacing_test.roff +0 -8
  62. metadata +140 -22
  63. data/INSTALLING +0 -20
@@ -0,0 +1,10 @@
1
+ backticks(7) -- testing the link index with backticks
2
+ =====================================================
3
+
4
+ grep(1)
5
+
6
+ `grep`(1)
7
+
8
+ man(1)
9
+
10
+ `man`(1)
@@ -1,9 +1,8 @@
1
1
  <div class='mp'>
2
+
2
3
  <h2 id="NAME">NAME</h2>
3
4
  <p class="man-name">
4
- <code>simple</code> - <span class="man-whatis">a simple ron example</span>
5
+ <code>simple</code> - <span class="man-whatis">a simple ronn example</span>
5
6
  </p>
6
-
7
- <p>This document created by ron.</p>
8
-
7
+ <p>This document created by ronn.</p>
9
8
  </div>
@@ -1,4 +1,4 @@
1
- simple(7) -- a simple ron example
1
+ simple(7) -- a simple ronn example
2
2
  =================================
3
3
 
4
- This document created by ron.
4
+ This document created by ronn.
@@ -0,0 +1 @@
1
+ y = 2^x
@@ -0,0 +1,41 @@
1
+ Example Code Blocks
2
+ ===================
3
+
4
+ ## Basic code block
5
+
6
+ ```
7
+ Hello, world!
8
+ ```
9
+
10
+ ## Language-identified code blocks
11
+
12
+ ```html
13
+ <html>
14
+ <head>
15
+ <title>Hello, world!</title>
16
+ </head>
17
+ <body>
18
+ Hello, world!
19
+ </body>
20
+ </html>
21
+ ```
22
+
23
+ ## Interspersed code blocks and text
24
+
25
+ Some text.
26
+
27
+ ```
28
+ Some code.
29
+ ```
30
+
31
+ Here's some &lt;pre> text.
32
+
33
+ <pre>
34
+ This is pre text.
35
+ </pre>
36
+
37
+ Some more text.
38
+
39
+ ```
40
+ Some more code.
41
+ ```
data/test/contest.rb CHANGED
@@ -1,68 +1,70 @@
1
- require "test/unit"
1
+ require 'test/unit'
2
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)
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
23
13
  end
24
- end
25
14
 
26
- def self.teardown(&block)
27
- define_method :teardown do
28
- instance_eval(&block)
29
- super(&block)
30
- end
31
- end
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
32
27
 
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
28
+ def self.teardown(&block)
29
+ define_method :teardown do
30
+ instance_eval(&block)
31
+ super(&block)
32
+ end
33
+ end
39
34
 
40
- def self.test(name, &block)
41
- define_method(test_name(name), &block)
42
- end
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
43
41
 
44
- class << self
45
- alias_method :should, :test
46
- alias_method :describe, :context
47
- end
42
+ def self.test(name, &block)
43
+ define_method(test_name(name), &block)
44
+ end
48
45
 
49
- private
46
+ class << self
47
+ alias should test
48
+ alias describe context
49
+ end
50
50
 
51
- def self.context_name(name)
52
- "Test#{sanitize_name(name).gsub(/(^| )(\w)/) { $2.upcase }}".to_sym
53
- end
51
+ def self.context_name(name)
52
+ "Test#{sanitize_name(name).gsub(/(^| )(\w)/) { $2.upcase }}".to_sym
53
+ end
54
54
 
55
- def self.test_name(name)
56
- "test_#{sanitize_name(name).gsub(/\s+/,'_')}".to_sym
57
- end
55
+ def self.test_name(name)
56
+ "test_#{sanitize_name(name).gsub(/\s+/, '_')}".to_sym
57
+ end
58
58
 
59
- def self.sanitize_name(name)
60
- name.gsub(/\W+/, ' ').strip
61
- end
59
+ def self.sanitize_name(name)
60
+ name.gsub(/\W+/, ' ').strip
61
+ end
62
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)
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
66
68
  end
67
69
  end
68
70
  end
@@ -1,6 +1,6 @@
1
1
  <div class='mp'>
2
- <h1>This is a custom title</h1>
2
+
3
+ <h1 id="This-is-a-custom-title">This is a custom title</h1>
3
4
  <p>It doesn't define the name or section of this manual page and is
4
5
  output as a simple <code>&lt;h1&gt;</code> instead of a <code>NAME</code> section.</p>
5
-
6
6
  </div>
@@ -1,21 +1,25 @@
1
1
  <div class='mp'>
2
+
2
3
  <h2 id="NAME">NAME</h2>
3
4
  <p class="man-name">
4
- <code>defition_list_syntax</code> - <span class="man-whatis">hiya</span>
5
+ <code>definition_list_syntax</code> - <span class="man-whatis">hiya</span>
5
6
  </p>
6
-
7
7
  <p>Definition lists look like unordered lists:</p>
8
8
 
9
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>
10
+ <dt>term</dt>
11
+ <dd>definition</dd>
12
+ <dt>another one</dt>
13
+ <dd>The definition may span
14
+ multiple lines and even
13
15
 
14
16
  <p>start</p>
15
17
 
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
+ <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>
18
24
  </dl>
19
-
20
-
21
25
  </div>
@@ -1,25 +1,18 @@
1
- .TH "DEFITION_LIST_SYNTAX" "5" "January 1979" "" ""
2
- .
1
+ .TH "DEFINITION_LIST_SYNTAX" "5" "January 1979" "" ""
3
2
  .SH "NAME"
4
- \fBdefition_list_syntax\fR \- hiya
5
- .
3
+ \fBdefinition_list_syntax\fR \- hiya
6
4
  .P
7
5
  Definition lists look like unordered lists:
8
- .
9
6
  .TP
10
7
  term
11
8
  definition
12
- .
13
9
  .TP
14
10
  another one
15
11
  The definition may span multiple lines and even
16
- .
17
12
  .IP
18
13
  start
19
- .
20
14
  .IP
21
15
  new paragraphs
22
- .
23
16
  .TP
24
17
  \fB\-\-somearg\fR=\fIVALUE\fR
25
18
  We can do that too\.
@@ -1,5 +1,5 @@
1
- defition_list_syntax(5) -- hiya
2
- ===============================
1
+ definition_list_syntax(5) -- hiya
2
+ =================================
3
3
 
4
4
  Definition lists look like unordered lists:
5
5
 
@@ -1,10 +1,19 @@
1
1
  .TH "DOTS_AT_LINE_START_TEST" "" "January 1979" "" ""
2
- .
3
2
  .SH "NAME"
4
3
  \fBdots_at_line_start_test\fR
5
- .
6
4
  .P
7
5
  There\'s a weird issue where dots at the beginning of a line generate troff warnings due to escaping\.
8
- .
9
6
  .P
10
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
+
@@ -2,3 +2,11 @@ There's a weird issue where dots at the beginning of a line
2
2
  generate troff warnings due to escaping.
3
3
 
4
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.
@@ -1,9 +1,9 @@
1
1
  <div class='mp'>
2
+
2
3
  <h2 id="NAME">NAME</h2>
3
4
  <p class="man-name">
4
5
  <code>hello</code> - <span class="man-whatis">hello world</span>
5
6
  </p>
6
-
7
7
  <p>Your output &lt;i&gt;might&lt;/i&gt; look like this:</p>
8
8
 
9
9
  <pre><code>* Chris
@@ -15,21 +15,20 @@
15
15
  <p>Here's some special entities:</p>
16
16
 
17
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>
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
29
  </ul>
30
30
 
31
31
 
32
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
-
33
+ last few words to wrap together.</p>
35
34
  </div>
@@ -1,61 +1,40 @@
1
1
  .TH "HELLO" "1" "January 1979" "" ""
2
- .
3
2
  .SH "NAME"
4
3
  \fBhello\fR \- hello world
5
- .
6
4
  .P
7
5
  Your output <i>might</i> look like this:
8
- .
9
6
  .IP "" 4
10
- .
11
7
  .nf
12
-
13
8
  * Chris
14
9
  *
15
10
  * &lt;b&gt;GitHub&lt;/b&gt;
16
11
  * <b>GitHub</b>
17
- .
18
12
  .fi
19
- .
20
13
  .IP "" 0
21
- .
22
14
  .P
23
15
  Here\'s some special entities:
24
- .
25
16
  .IP "\[ci]" 4
26
17
  &bull; \[ci]
27
- .
28
18
  .IP "\[ci]" 4
29
19
  &nbsp; \~
30
- .
31
20
  .IP "\[ci]" 4
32
21
  &copy; \(co
33
- .
34
22
  .IP "\[ci]" 4
35
23
  &rdquo; \(rs
36
- .
37
24
  .IP "\[ci]" 4
38
25
  &mdash; \(em
39
- .
40
26
  .IP "\[ci]" 4
41
27
  &reg; \(rg
42
- .
43
28
  .IP "\[ci]" 4
44
- &sec; \(sc
45
- .
29
+ &sect; \(sc
46
30
  .IP "\[ci]" 4
47
31
  &ge; \(>=
48
- .
49
32
  .IP "\[ci]" 4
50
33
  &le; \(<=
51
- .
52
34
  .IP "\[ci]" 4
53
35
  &ne; \(!=
54
- .
55
36
  .IP "\[ci]" 4
56
37
  &equiv; \(==
57
- .
58
38
  .IP "" 0
59
- .
60
39
  .P
61
40
  Here\'s a line that uses non\-breaking spaces to force the last\~few\~words\~to\~wrap\~together\.
@@ -15,7 +15,7 @@ Here's some special entities:
15
15
  * &amp;rdquo; &rdquo;
16
16
  * &amp;mdash; &mdash;
17
17
  * &amp;reg; &reg;
18
- * &amp;sec; &sec;
18
+ * &amp;sect; &sect;
19
19
  * &amp;ge; &ge;
20
20
  * &amp;le; &le;
21
21
  * &amp;ne; &ne;
@@ -1,9 +1,9 @@
1
1
  <div class='mp'>
2
+
2
3
  <h2 id="NAME">NAME</h2>
3
4
  <p class="man-name">
4
5
  <code>markdown</code> - <span class="man-whatis">humane markup syntax</span>
5
6
  </p>
6
-
7
7
  <h2 id="SYNOPSIS">SYNOPSIS</h2>
8
8
 
9
9
  <pre><code># Header 1 #
@@ -508,7 +508,7 @@ end tell
508
508
  <p>A code block continues until it reaches a line that is not indented
509
509
  (or the end of the article).</p>
510
510
 
511
- <p>Within a code block, ampersands (<code>&amp;</code>) and angle brackets (<code>&lt;</code> and <code>></code>)
511
+ <p>Within a code block, ampersands (<code>&amp;</code>) and angle brackets (<code>&lt;</code> and <code>&gt;</code>)
512
512
  are automatically converted into HTML entities. This makes it very
513
513
  easy to include example HTML source code using Markdown -- just paste
514
514
  it and indent it, and Markdown will handle the hassle of encoding the
@@ -816,7 +816,7 @@ A backtick-delimited string in a code span: `` `foo` ``
816
816
  entities automatically, which makes it easy to include example HTML
817
817
  tags. Markdown will turn this:</p>
818
818
 
819
- <pre><code>Please don't use any `&lt;blink>` tags.
819
+ <pre><code>Please don't use any `&lt;blink&gt;` tags.
820
820
  </code></pre>
821
821
 
822
822
  <p>into:</p>
@@ -951,7 +951,6 @@ also by John Gruber.</p>
951
951
 
952
952
  <h2 id="SEE-ALSO">SEE ALSO</h2>
953
953
 
954
- <p><span class="man-ref">ronn<span class="s">(5)</span></span><br />
954
+ <p><span class="man-ref">ronn<span class="s">(5)</span></span><br>
955
955
  <a href="http://daringfireball.net/projects/markdown/" data-bare-link="true">http://daringfireball.net/projects/markdown/</a></p>
956
-
957
956
  </div>