rdoc 5.0.0 → 6.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (158) hide show
  1. checksums.yaml +5 -5
  2. data/CONTRIBUTING.rdoc +4 -4
  3. data/Gemfile +9 -0
  4. data/History.rdoc +12 -2
  5. data/README.rdoc +5 -6
  6. data/Rakefile +35 -65
  7. data/lib/rdoc/alias.rb +1 -1
  8. data/lib/rdoc/anon_class.rb +1 -1
  9. data/lib/rdoc/any_method.rb +59 -15
  10. data/lib/rdoc/attr.rb +1 -1
  11. data/lib/rdoc/class_module.rb +5 -3
  12. data/lib/rdoc/code_object.rb +2 -9
  13. data/lib/rdoc/code_objects.rb +1 -1
  14. data/lib/rdoc/comment.rb +32 -11
  15. data/lib/rdoc/constant.rb +3 -3
  16. data/lib/rdoc/context/section.rb +1 -14
  17. data/lib/rdoc/context.rb +74 -21
  18. data/lib/rdoc/cross_reference.rb +33 -15
  19. data/lib/rdoc/encoding.rb +58 -30
  20. data/lib/rdoc/erb_partial.rb +2 -2
  21. data/lib/rdoc/erbio.rb +8 -4
  22. data/lib/rdoc/extend.rb +1 -1
  23. data/lib/rdoc/generator/darkfish.rb +60 -29
  24. data/lib/rdoc/generator/json_index.rb +7 -4
  25. data/lib/rdoc/generator/markup.rb +3 -13
  26. data/lib/rdoc/generator/pot/message_extractor.rb +1 -1
  27. data/lib/rdoc/generator/pot/po.rb +3 -3
  28. data/lib/rdoc/generator/pot/po_entry.rb +11 -11
  29. data/lib/rdoc/generator/pot.rb +4 -4
  30. data/lib/rdoc/generator/ri.rb +1 -1
  31. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
  32. data/lib/rdoc/generator/template/darkfish/_head.rhtml +9 -7
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
  40. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  41. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
  42. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
  43. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
  44. data/lib/rdoc/generator/template/darkfish/class.rhtml +45 -47
  45. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +55 -6
  46. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
  47. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +22 -99
  48. data/lib/rdoc/generator/template/darkfish/js/search.js +32 -31
  49. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
  50. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
  51. data/lib/rdoc/generator/template/json_index/js/navigation.js +4 -41
  52. data/lib/rdoc/generator/template/json_index/js/searcher.js +6 -6
  53. data/lib/rdoc/generator.rb +1 -1
  54. data/lib/rdoc/ghost_method.rb +1 -1
  55. data/lib/rdoc/i18n/locale.rb +2 -2
  56. data/lib/rdoc/i18n/text.rb +5 -5
  57. data/lib/rdoc/i18n.rb +3 -3
  58. data/lib/rdoc/include.rb +1 -1
  59. data/lib/rdoc/known_classes.rb +1 -1
  60. data/lib/rdoc/markdown/entities.rb +1 -1
  61. data/lib/rdoc/markdown/literals.kpeg +1 -0
  62. data/lib/rdoc/markdown/literals.rb +19 -7
  63. data/lib/rdoc/markdown.kpeg +92 -44
  64. data/lib/rdoc/markdown.rb +1171 -610
  65. data/lib/rdoc/markup/attr_changer.rb +1 -1
  66. data/lib/rdoc/markup/attr_span.rb +9 -3
  67. data/lib/rdoc/markup/attribute_manager.rb +115 -50
  68. data/lib/rdoc/markup/attributes.rb +7 -7
  69. data/lib/rdoc/markup/blank_line.rb +1 -1
  70. data/lib/rdoc/markup/block_quote.rb +1 -1
  71. data/lib/rdoc/markup/document.rb +1 -1
  72. data/lib/rdoc/markup/formatter.rb +25 -24
  73. data/lib/rdoc/markup/hard_break.rb +1 -1
  74. data/lib/rdoc/markup/heading.rb +4 -4
  75. data/lib/rdoc/markup/include.rb +1 -1
  76. data/lib/rdoc/markup/indented_paragraph.rb +1 -1
  77. data/lib/rdoc/markup/list.rb +1 -1
  78. data/lib/rdoc/markup/list_item.rb +1 -1
  79. data/lib/rdoc/markup/paragraph.rb +1 -1
  80. data/lib/rdoc/markup/parser.rb +79 -47
  81. data/lib/rdoc/markup/pre_process.rb +11 -6
  82. data/lib/rdoc/markup/raw.rb +1 -1
  83. data/lib/rdoc/markup/regexp_handling.rb +41 -0
  84. data/lib/rdoc/markup/rule.rb +1 -1
  85. data/lib/rdoc/markup/to_ansi.rb +1 -1
  86. data/lib/rdoc/markup/to_bs.rb +4 -4
  87. data/lib/rdoc/markup/to_html.rb +71 -26
  88. data/lib/rdoc/markup/to_html_crossref.rb +41 -26
  89. data/lib/rdoc/markup/to_html_snippet.rb +10 -10
  90. data/lib/rdoc/markup/to_joined_paragraph.rb +7 -32
  91. data/lib/rdoc/markup/to_label.rb +10 -10
  92. data/lib/rdoc/markup/to_markdown.rb +9 -9
  93. data/lib/rdoc/markup/to_rdoc.rb +35 -7
  94. data/lib/rdoc/markup/to_table_of_contents.rb +2 -1
  95. data/lib/rdoc/markup/to_test.rb +1 -1
  96. data/lib/rdoc/markup/to_tt_only.rb +3 -3
  97. data/lib/rdoc/markup/verbatim.rb +1 -1
  98. data/lib/rdoc/markup.rb +14 -17
  99. data/lib/rdoc/meta_method.rb +1 -1
  100. data/lib/rdoc/method_attr.rb +2 -2
  101. data/lib/rdoc/mixin.rb +1 -1
  102. data/lib/rdoc/normal_class.rb +3 -3
  103. data/lib/rdoc/normal_module.rb +1 -1
  104. data/lib/rdoc/options.rb +79 -21
  105. data/lib/rdoc/parser/c.rb +147 -194
  106. data/lib/rdoc/parser/changelog.rb +150 -19
  107. data/lib/rdoc/parser/markdown.rb +1 -1
  108. data/lib/rdoc/parser/rd.rb +1 -1
  109. data/lib/rdoc/parser/ripper_state_lex.rb +590 -0
  110. data/lib/rdoc/parser/ruby.rb +634 -465
  111. data/lib/rdoc/parser/ruby_tools.rb +33 -34
  112. data/lib/rdoc/parser/simple.rb +3 -3
  113. data/lib/rdoc/parser/text.rb +1 -1
  114. data/lib/rdoc/parser.rb +12 -35
  115. data/lib/rdoc/rd/block_parser.rb +109 -108
  116. data/lib/rdoc/rd/block_parser.ry +3 -3
  117. data/lib/rdoc/rd/inline.rb +5 -5
  118. data/lib/rdoc/rd/inline_parser.rb +186 -185
  119. data/lib/rdoc/rd/inline_parser.ry +1 -1
  120. data/lib/rdoc/rd.rb +1 -1
  121. data/lib/rdoc/rdoc.rb +54 -41
  122. data/lib/rdoc/require.rb +1 -1
  123. data/lib/rdoc/ri/driver.rb +132 -42
  124. data/lib/rdoc/ri/formatter.rb +1 -1
  125. data/lib/rdoc/ri/paths.rb +4 -18
  126. data/lib/rdoc/ri/store.rb +1 -1
  127. data/lib/rdoc/ri/task.rb +2 -2
  128. data/lib/rdoc/ri.rb +1 -1
  129. data/lib/rdoc/rubygems_hook.rb +3 -3
  130. data/lib/rdoc/servlet.rb +21 -12
  131. data/lib/rdoc/single_class.rb +1 -1
  132. data/lib/rdoc/stats/normal.rb +24 -18
  133. data/lib/rdoc/stats/quiet.rb +1 -1
  134. data/lib/rdoc/stats/verbose.rb +1 -1
  135. data/lib/rdoc/stats.rb +1 -1
  136. data/lib/rdoc/store.rb +38 -27
  137. data/lib/rdoc/task.rb +2 -2
  138. data/lib/rdoc/text.rb +16 -21
  139. data/lib/rdoc/token_stream.rb +56 -33
  140. data/lib/rdoc/tom_doc.rb +17 -12
  141. data/lib/rdoc/top_level.rb +9 -3
  142. data/lib/rdoc/version.rb +8 -0
  143. data/lib/rdoc.rb +24 -10
  144. data/man/ri.1 +247 -0
  145. data/rdoc.gemspec +206 -15
  146. metadata +15 -64
  147. data/.document +0 -5
  148. data/.gitignore +0 -13
  149. data/.travis.yml +0 -23
  150. data/lib/gauntlet_rdoc.rb +0 -82
  151. data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -4
  152. data/lib/rdoc/markup/formatter_test_case.rb +0 -764
  153. data/lib/rdoc/markup/inline.rb +0 -2
  154. data/lib/rdoc/markup/special.rb +0 -41
  155. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -115
  156. data/lib/rdoc/ruby_lex.rb +0 -1367
  157. data/lib/rdoc/ruby_token.rb +0 -461
  158. data/lib/rdoc/test_case.rb +0 -204
@@ -51,20 +51,20 @@ Searcher.prototype = new function() {
51
51
 
52
52
  /* ----- Utilities ------ */
53
53
  function splitQuery(query) {
54
- return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) {
54
+ return query.split(/(\s+|::?|\(\)?)/).filter(function(string) {
55
55
  return string.match(/\S/);
56
56
  });
57
57
  }
58
58
 
59
59
  function buildRegexps(queries) {
60
- return jQuery.map(queries, function(query) {
60
+ return queries.map(function(query) {
61
61
  return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i');
62
62
  });
63
63
  }
64
64
 
65
65
  function buildHilighters(queries) {
66
- return jQuery.map(queries, function(query) {
67
- return jQuery.map(query.split(''), function(l, i) {
66
+ return queries.map(function(query) {
67
+ return query.split('').map(function(l, i) {
68
68
  return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
69
69
  }).join('');
70
70
  });
@@ -221,9 +221,9 @@ Searcher.prototype = new function() {
221
221
  }
222
222
 
223
223
  function triggerResults(results, isLast) {
224
- jQuery.each(this.handlers, function(i, fn) {
224
+ this.handlers.forEach(function(fn) {
225
225
  fn.call(this, results, isLast)
226
- })
226
+ });
227
227
  }
228
228
  }
229
229
 
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
3
  # RDoc uses generators to turn parsed source code in the form of an
4
4
  # RDoc::CodeObject tree into some form of output. RDoc comes with the HTML
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
3
  # GhostMethod represents a method referenced only by a comment
4
4
 
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
3
  # A message container for a locale.
4
4
  #
@@ -92,7 +92,7 @@ class RDoc::I18n::Locale
92
92
  end
93
93
 
94
94
  ##
95
- # Translates the +message+ into locale. If there is no tranlsation
95
+ # Translates the +message+ into locale. If there is no translation
96
96
  # messages for +message+ in locale, +message+ itself is returned.
97
97
 
98
98
  def translate(message)
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
3
  # An i18n supported text.
4
4
  #
@@ -46,9 +46,9 @@ class RDoc::I18n::Text
46
46
  parse do |part|
47
47
  case part[:type]
48
48
  when :paragraph
49
- translated_text << locale.translate(part[:paragraph])
49
+ translated_text += locale.translate(part[:paragraph])
50
50
  when :empty_line
51
- translated_text << part[:line]
51
+ translated_text += part[:line]
52
52
  else
53
53
  raise "should not reach here: unexpected type: #{type}"
54
54
  end
@@ -69,14 +69,14 @@ class RDoc::I18n::Text
69
69
  if paragraph.empty?
70
70
  emit_empty_line_event(line, line_no, &block)
71
71
  else
72
- paragraph << line
72
+ paragraph += line
73
73
  emit_paragraph_event(paragraph, paragraph_start_line, line_no,
74
74
  &block)
75
75
  paragraph = ''
76
76
  end
77
77
  else
78
78
  paragraph_start_line = line_no if paragraph.empty?
79
- paragraph << line
79
+ paragraph += line
80
80
  end
81
81
  end
82
82
 
data/lib/rdoc/i18n.rb CHANGED
@@ -1,10 +1,10 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
- # This module provides i18n realated features.
3
+ # This module provides i18n related features.
4
4
 
5
5
  module RDoc::I18n
6
6
 
7
7
  autoload :Locale, 'rdoc/i18n/locale'
8
- autoload :Text, 'rdoc/i18n/text'
8
+ require_relative 'i18n/text'
9
9
 
10
10
  end
data/lib/rdoc/include.rb CHANGED
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
3
  # A Module included in a class with \#include
4
4
  #
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  module RDoc
3
3
 
4
4
  ##
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: false
1
+ # frozen_string_literal: true
2
2
  ##
3
3
  # HTML entity name map for RDoc::Markdown
4
4
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  %% header {
4
4
  # coding: UTF-8
5
+ # frozen_string_literal: true
5
6
  # :markup: markdown
6
7
 
7
8
  ##
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
- # frozen_string_literal: false
2
+ # frozen_string_literal: true
3
3
  # :markup: markdown
4
4
 
5
5
  ##
@@ -183,14 +183,26 @@ class RDoc::Markdown::Literals
183
183
  return nil
184
184
  end
185
185
 
186
- def get_byte
187
- if @pos >= @string_size
188
- return nil
186
+ if "".respond_to? :ord
187
+ def get_byte
188
+ if @pos >= @string_size
189
+ return nil
190
+ end
191
+
192
+ s = @string[@pos].ord
193
+ @pos += 1
194
+ s
189
195
  end
196
+ else
197
+ def get_byte
198
+ if @pos >= @string_size
199
+ return nil
200
+ end
190
201
 
191
- s = @string[@pos].ord
192
- @pos += 1
193
- s
202
+ s = @string[@pos]
203
+ @pos += 1
204
+ s
205
+ end
194
206
  end
195
207
 
196
208
  def parse(rule=nil)
@@ -2,6 +2,7 @@
2
2
 
3
3
  %% header {
4
4
  # coding: UTF-8
5
+ # frozen_string_literal: true
5
6
  # :markup: markdown
6
7
 
7
8
  ##
@@ -84,6 +85,18 @@
84
85
  # : A little insect that is known
85
86
  # to enjoy picnics
86
87
  #
88
+ # ### Strike
89
+ #
90
+ # Example:
91
+ #
92
+ # ```
93
+ # This is ~~striked~~.
94
+ # ```
95
+ #
96
+ # Produces:
97
+ #
98
+ # This is ~~striked~~.
99
+ #
87
100
  # ### Github
88
101
  #
89
102
  # The #github extension enables a partial set of [Github Flavored Markdown]
@@ -163,7 +176,7 @@
163
176
  # The port to kpeg was performed by Eric Hodel and Evan Phoenix
164
177
  #
165
178
  # [dingus]: http://daringfireball.net/projects/markdown/dingus
166
- # [GFM]: http://github.github.com/github-flavored-markdown/
179
+ # [GFM]: https://github.github.com/gfm/
167
180
  # [pegmarkdown]: https://github.com/jgm/peg-markdown
168
181
  # [PHPE]: http://michelf.com/projects/php-markdown/extra/#def-list
169
182
  # [syntax]: http://daringfireball.net/projects/markdown/syntax
@@ -193,6 +206,7 @@
193
206
  :github,
194
207
  :html,
195
208
  :notes,
209
+ :strike,
196
210
  ]
197
211
 
198
212
  # :section: Extensions
@@ -243,6 +257,11 @@
243
257
 
244
258
  extension :notes
245
259
 
260
+ ##
261
+ # Enables the strike extension
262
+
263
+ extension :strike
264
+
246
265
  # :section:
247
266
 
248
267
  ##
@@ -331,7 +350,7 @@
331
350
  # with the linking `text` (usually whitespace).
332
351
 
333
352
  def link_to content, label = content, text = nil
334
- raise 'enable notes extension' if
353
+ raise ParseError, 'enable notes extension' if
335
354
  content.start_with? '^' and label.equal? content
336
355
 
337
356
  if ref = @references[label] then
@@ -466,6 +485,17 @@
466
485
  "<b>#{text}</b>"
467
486
  end
468
487
  end
488
+
489
+ ##
490
+ # Wraps `text` in strike markup for rdoc inline formatting
491
+
492
+ def strike text
493
+ if text =~ /\A[a-z\d.\/-]+\z/i then
494
+ "~#{text}~"
495
+ else
496
+ "<s>#{text}</s>"
497
+ end
498
+ end
469
499
  }
470
500
 
471
501
  root = Doc
@@ -476,6 +506,7 @@ Block = @BlankLine*
476
506
  ( BlockQuote
477
507
  | Verbatim
478
508
  | CodeFence
509
+ | Table
479
510
  | Note
480
511
  | Reference
481
512
  | HorizontalRule
@@ -494,27 +525,27 @@ Para = @NonindentSpace Inlines:a @BlankLine+
494
525
  Plain = Inlines:a
495
526
  { paragraph a }
496
527
 
497
- AtxInline = !@Newline !(@Sp? /#*/ @Sp @Newline) Inline
528
+ AtxInline = !@Newline !(@Sp /#*/ @Sp @Newline) Inline
498
529
 
499
530
  AtxStart = < /\#{1,6}/ >
500
531
  { text.length }
501
532
 
502
- AtxHeading = AtxStart:s @Sp? AtxInline+:a (@Sp? /#*/ @Sp)? @Newline
533
+ AtxHeading = AtxStart:s @Sp AtxInline+:a (@Sp /#*/ @Sp)? @Newline
503
534
  { RDoc::Markup::Heading.new(s, a.join) }
504
535
 
505
536
  SetextHeading = SetextHeading1 | SetextHeading2
506
537
 
507
- SetextBottom1 = /={3,}/ @Newline
538
+ SetextBottom1 = /={1,}/ @Newline
508
539
 
509
- SetextBottom2 = /-{3,}/ @Newline
540
+ SetextBottom2 = /-{1,}/ @Newline
510
541
 
511
542
  SetextHeading1 = &(@RawLine SetextBottom1)
512
- @StartList:a ( !@Endline Inline:b { a << b } )+ @Sp? @Newline
543
+ @StartList:a ( !@Endline Inline:b { a << b } )+ @Sp @Newline
513
544
  SetextBottom1
514
545
  { RDoc::Markup::Heading.new(1, a.join) }
515
546
 
516
547
  SetextHeading2 = &(@RawLine SetextBottom2)
517
- @StartList:a ( !@Endline Inline:b { a << b })+ @Sp? @Newline
548
+ @StartList:a ( !@Endline Inline:b { a << b })+ @Sp @Newline
518
549
  SetextBottom2
519
550
  { RDoc::Markup::Heading.new(2, a.join) }
520
551
 
@@ -733,6 +764,9 @@ HtmlBlockOpenScript = "<" Spnl ("script" | "SCRIPT") Spnl HtmlAttribute* ">"
733
764
  HtmlBlockCloseScript = "<" Spnl "/" ("script" | "SCRIPT") Spnl ">"
734
765
  HtmlBlockScript = HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript
735
766
 
767
+ HtmlBlockOpenHead = "<" Spnl ("head" | "HEAD") Spnl HtmlAttribute* ">"
768
+ HtmlBlockCloseHead = "<" Spnl "/" ("head" | "HEAD") Spnl ">"
769
+ HtmlBlockHead = HtmlBlockOpenHead (!HtmlBlockCloseHead .)* HtmlBlockCloseHead
736
770
 
737
771
  HtmlBlockInTags = HtmlAnchor
738
772
  | HtmlBlockAddress
@@ -768,6 +802,7 @@ HtmlBlockInTags = HtmlAnchor
768
802
  | HtmlBlockThead
769
803
  | HtmlBlockTr
770
804
  | HtmlBlockScript
805
+ | HtmlBlockHead
771
806
 
772
807
  HtmlBlock = < ( HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) >
773
808
  @BlankLine+
@@ -862,7 +897,8 @@ StyleBlock = < InStyleTags >
862
897
  end }
863
898
 
864
899
  Inlines = ( !@Endline Inline:i { i }
865
- | @Endline:c &Inline { c } )+:chunks @Endline?
900
+ | @Endline:c !( &{ github? } Ticks3 /[^`\n]*$/ )
901
+ &Inline { c } )+:chunks @Endline?
866
902
  { chunks }
867
903
 
868
904
  Inline = Str
@@ -871,6 +907,7 @@ Inline = Str
871
907
  | @Space
872
908
  | Strong
873
909
  | Emph
910
+ | Strike
874
911
  | Image
875
912
  | Link
876
913
  | NoteReference
@@ -896,7 +933,7 @@ Entity = ( HexEntity | DecEntity | CharEntity ):a { a }
896
933
  Endline = @LineBreak | @TerminalEndline | @NormalEndline
897
934
 
898
935
  NormalEndline = @Sp @Newline !@BlankLine !">" !AtxStart
899
- !(Line /={3,}|-{3,}=/ @Newline)
936
+ !(Line /={1,}|-{1,}/ @Newline)
900
937
  { "\n" }
901
938
 
902
939
  TerminalEndline = @Sp @Newline @Eof
@@ -916,46 +953,44 @@ UlLine = < /_{4,}/ > { text } |
916
953
 
917
954
  Emph = EmphStar | EmphUl
918
955
 
919
- OneStarOpen = !StarLine "*" !@Spacechar !@Newline
920
- OneStarClose = !@Spacechar !@Newline Inline:a "*"
921
- { a }
956
+ Whitespace = @Spacechar | @Newline
922
957
 
923
- EmphStar = OneStarOpen
958
+ EmphStar = "*" !@Whitespace
924
959
  @StartList:a
925
- ( !OneStarClose Inline:l { a << l } )*
926
- OneStarClose:l { a << l }
960
+ ( !"*" Inline:b { a << b }
961
+ | StrongStar:b { a << b }
962
+ )+
963
+ "*"
927
964
  { emphasis a.join }
928
965
 
929
- OneUlOpen = !UlLine "_" !@Spacechar !@Newline
930
- OneUlClose = !@Spacechar !@Newline Inline:a "_" # !Alphanumeric # TODO check
931
- { a }
932
-
933
- EmphUl = OneUlOpen
966
+ EmphUl = "_" !@Whitespace
934
967
  @StartList:a
935
- ( !OneUlClose Inline:l { a << l } )*
936
- OneUlClose:l { a << l }
968
+ ( !"_" Inline:b { a << b }
969
+ | StrongUl:b { a << b }
970
+ )+
971
+ "_"
937
972
  { emphasis a.join }
938
973
 
939
974
  Strong = StrongStar | StrongUl
940
975
 
941
- TwoStarOpen = !StarLine "**" !@Spacechar !@Newline
942
- TwoStarClose = !@Spacechar !@Newline Inline:a "**" { a }
943
-
944
- StrongStar = TwoStarOpen
976
+ StrongStar = "**" !@Whitespace
945
977
  @StartList:a
946
- ( !TwoStarClose Inline:l { a << l } )*
947
- TwoStarClose:l { a << l }
978
+ ( !"**" Inline:b { a << b } )+
979
+ "**"
948
980
  { strong a.join }
949
981
 
950
- TwoUlOpen = !UlLine "__" !@Spacechar !@Newline
951
- TwoUlClose = !@Spacechar !@Newline Inline:a "__" # !Alphanumeric # TODO check
952
- { a }
982
+ StrongUl = "__" !@Whitespace
983
+ @StartList:a
984
+ ( !"__" Inline:b { a << b } )+
985
+ "__"
986
+ { strong a.join }
953
987
 
954
- StrongUl = TwoUlOpen
955
- @StartList:a
956
- ( !TwoUlClose Inline:i { a << i } )*
957
- TwoUlClose:l { a << l }
958
- { strong a.join }
988
+ Strike = &{ strike? }
989
+ "~~" !@Whitespace
990
+ @StartList:a
991
+ ( !"~~" Inline:b { a << b } )+
992
+ "~~"
993
+ { strike a.join }
959
994
 
960
995
  # TODO alt text support
961
996
  Image = "!" ( ExplicitLink | ReferenceLink ):a
@@ -971,14 +1006,13 @@ ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label
971
1006
  ReferenceLinkSingle = Label:content < (Spnl "[]")? >
972
1007
  { link_to content, content, text }
973
1008
 
974
- ExplicitLink = Label:l Spnl "(" @Sp Source:s Spnl Title @Sp ")"
1009
+ ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")"
975
1010
  { "{#{l}}[#{s}]" }
976
1011
 
977
1012
  Source = ( "<" < SourceContents > ">" | < SourceContents > )
978
1013
  { text }
979
1014
 
980
1015
  SourceContents = ( ( !"(" !")" !">" Nonspacechar )+ | "(" SourceContents ")")*
981
- | ""
982
1016
 
983
1017
  Title = ( TitleSingle | TitleDouble | "" ):a
984
1018
  { a }
@@ -1068,7 +1102,7 @@ Eof = !.
1068
1102
  Nonspacechar = !@Spacechar !@Newline .
1069
1103
  Sp = @Spacechar*
1070
1104
  Spnl = @Sp (@Newline @Sp)?
1071
- SpecialChar = /[*_`&\[\]()<!#\\'"]/ | @ExtendedSpecialChar
1105
+ SpecialChar = /[~*_`&\[\]()<!#\\'"]/ | @ExtendedSpecialChar
1072
1106
  NormalChar = !( @SpecialChar | @Spacechar | @Newline ) .
1073
1107
  Digit = [0-9]
1074
1108
 
@@ -1077,7 +1111,6 @@ Alphanumeric = %literals.Alphanumeric
1077
1111
  AlphanumericAscii = %literals.AlphanumericAscii
1078
1112
  BOM = %literals.BOM
1079
1113
  Newline = %literals.Newline
1080
- NonAlphanumeric = %literals.NonAlphanumeric
1081
1114
  Spacechar = %literals.Spacechar
1082
1115
 
1083
1116
  HexEntity = /&#x/i < /[0-9a-fA-F]+/ > ";"
@@ -1137,8 +1170,7 @@ InlineNote = &{ notes? }
1137
1170
  @StartList:a
1138
1171
  ( !"]" Inline:l { a << l } )+
1139
1172
  "]"
1140
- {
1141
- ref = [:inline, @note_order.length]
1173
+ { ref = [:inline, @note_order.length]
1142
1174
  @footnotes[ref] = paragraph a
1143
1175
 
1144
1176
  note_for ref
@@ -1161,10 +1193,26 @@ CodeFence = &{ github? }
1161
1193
  @Newline
1162
1194
  )+ > Ticks3 @Sp @Newline*
1163
1195
  { verbatim = RDoc::Markup::Verbatim.new text
1164
- verbatim.format = format.intern if format
1196
+ verbatim.format = format.intern if format.instance_of?(String)
1165
1197
  verbatim
1166
1198
  }
1167
1199
 
1200
+ Table = &{ github? }
1201
+ TableRow:header TableLine:line TableRow+:body
1202
+ { table = RDoc::Markup::Table.new(header, line, body) }
1203
+
1204
+ TableRow = TableItem+:row "|" @Newline
1205
+ { row }
1206
+ TableItem = "|" < (!"|" !@Newline .)+ >
1207
+ { text.strip }
1208
+
1209
+ TableLine = TableColumn+:line "|" @Newline
1210
+ { line }
1211
+ TableColumn = "|" < ( "-"+ ":"? | ":" "-"* ) >
1212
+ { text.start_with?(":") ? :left :
1213
+ text.end_with?(":") ? :right : nil
1214
+ }
1215
+
1168
1216
  DefinitionList = &{ definition_lists? }
1169
1217
  ( DefinitionListItem+:list )
1170
1218
  { RDoc::Markup::List.new :NOTE, *list.flatten }