super-quick-rb 0.0.1
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.
- checksums.yaml +7 -0
- data/rdoc-8.0.0/CONTRIBUTING.md +195 -0
- data/rdoc-8.0.0/CVE-2013-0256.rdoc +49 -0
- data/rdoc-8.0.0/History.rdoc +1668 -0
- data/rdoc-8.0.0/LEGAL.rdoc +56 -0
- data/rdoc-8.0.0/LICENSE.rdoc +63 -0
- data/rdoc-8.0.0/README.md +236 -0
- data/rdoc-8.0.0/RI.md +842 -0
- data/rdoc-8.0.0/TODO.rdoc +60 -0
- data/rdoc-8.0.0/doc/markup_reference/markdown.md +659 -0
- data/rdoc-8.0.0/doc/markup_reference/rdoc.rdoc +1169 -0
- data/rdoc-8.0.0/exe/rdoc +43 -0
- data/rdoc-8.0.0/exe/ri +12 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/alias.rb +98 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/any_method.rb +387 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/attr.rb +178 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/class_module.rb +969 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/constant.rb +221 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/context/section.rb +182 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/context.rb +1238 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/extend.rb +9 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/include.rb +9 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/method_attr.rb +417 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/mixin.rb +123 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/normal_class.rb +92 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/normal_module.rb +73 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/require.rb +51 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/single_class.rb +30 -0
- data/rdoc-8.0.0/lib/rdoc/code_object/top_level.rb +286 -0
- data/rdoc-8.0.0/lib/rdoc/code_object.rb +393 -0
- data/rdoc-8.0.0/lib/rdoc/code_objects.rb +5 -0
- data/rdoc-8.0.0/lib/rdoc/comment.rb +353 -0
- data/rdoc-8.0.0/lib/rdoc/cross_reference.rb +215 -0
- data/rdoc-8.0.0/lib/rdoc/encoding.rb +120 -0
- data/rdoc-8.0.0/lib/rdoc/erb_partial.rb +18 -0
- data/rdoc-8.0.0/lib/rdoc/erbio.rb +37 -0
- data/rdoc-8.0.0/lib/rdoc/generator/aliki.rb +200 -0
- data/rdoc-8.0.0/lib/rdoc/generator/darkfish.rb +824 -0
- data/rdoc-8.0.0/lib/rdoc/generator/json_index.rb +284 -0
- data/rdoc-8.0.0/lib/rdoc/generator/markup.rb +196 -0
- data/rdoc-8.0.0/lib/rdoc/generator/pot/message_extractor.rb +68 -0
- data/rdoc-8.0.0/lib/rdoc/generator/pot/po.rb +84 -0
- data/rdoc-8.0.0/lib/rdoc/generator/pot/po_entry.rb +141 -0
- data/rdoc-8.0.0/lib/rdoc/generator/pot.rb +94 -0
- data/rdoc-8.0.0/lib/rdoc/generator/ri.rb +30 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_head.rhtml +43 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +5 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +17 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +17 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +16 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +21 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +32 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +6 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +15 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +39 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/class.rhtml +220 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/rdoc.css +701 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/index.rhtml +24 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/darkfish.js +140 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/search.js +120 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/page.rhtml +19 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +21 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +65 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +72 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
- data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/searcher.js +271 -0
- data/rdoc-8.0.0/lib/rdoc/generator.rb +52 -0
- data/rdoc-8.0.0/lib/rdoc/i18n/locale.rb +102 -0
- data/rdoc-8.0.0/lib/rdoc/i18n/text.rb +126 -0
- data/rdoc-8.0.0/lib/rdoc/i18n.rb +10 -0
- data/rdoc-8.0.0/lib/rdoc/known_classes.rb +74 -0
- data/rdoc-8.0.0/lib/rdoc/markdown/entities.rb +2131 -0
- data/rdoc-8.0.0/lib/rdoc/markdown/literals.kpeg +21 -0
- data/rdoc-8.0.0/lib/rdoc/markdown/literals.rb +454 -0
- data/rdoc-8.0.0/lib/rdoc/markdown.kpeg +1315 -0
- data/rdoc-8.0.0/lib/rdoc/markdown.rb +16865 -0
- data/rdoc-8.0.0/lib/rdoc/markup/blank_line.rb +29 -0
- data/rdoc-8.0.0/lib/rdoc/markup/block_quote.rb +14 -0
- data/rdoc-8.0.0/lib/rdoc/markup/document.rb +164 -0
- data/rdoc-8.0.0/lib/rdoc/markup/element.rb +21 -0
- data/rdoc-8.0.0/lib/rdoc/markup/formatter.rb +285 -0
- data/rdoc-8.0.0/lib/rdoc/markup/hard_break.rb +34 -0
- data/rdoc-8.0.0/lib/rdoc/markup/heading.rb +170 -0
- data/rdoc-8.0.0/lib/rdoc/markup/include.rb +42 -0
- data/rdoc-8.0.0/lib/rdoc/markup/indented_paragraph.rb +47 -0
- data/rdoc-8.0.0/lib/rdoc/markup/inline_parser.rb +312 -0
- data/rdoc-8.0.0/lib/rdoc/markup/list.rb +101 -0
- data/rdoc-8.0.0/lib/rdoc/markup/list_item.rb +99 -0
- data/rdoc-8.0.0/lib/rdoc/markup/paragraph.rb +28 -0
- data/rdoc-8.0.0/lib/rdoc/markup/parser.rb +585 -0
- data/rdoc-8.0.0/lib/rdoc/markup/pre_process.rb +317 -0
- data/rdoc-8.0.0/lib/rdoc/markup/raw.rb +66 -0
- data/rdoc-8.0.0/lib/rdoc/markup/rule.rb +20 -0
- data/rdoc-8.0.0/lib/rdoc/markup/table.rb +64 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_ansi.rb +144 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_bs.rb +86 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_html.rb +682 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_html_crossref.rb +261 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_html_snippet.rb +287 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_joined_paragraph.rb +41 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_label.rb +84 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_markdown.rb +215 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_rdoc.rb +421 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_table_of_contents.rb +88 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_test.rb +77 -0
- data/rdoc-8.0.0/lib/rdoc/markup/to_tt_only.rb +107 -0
- data/rdoc-8.0.0/lib/rdoc/markup/verbatim.rb +83 -0
- data/rdoc-8.0.0/lib/rdoc/markup.rb +219 -0
- data/rdoc-8.0.0/lib/rdoc/options.rb +1412 -0
- data/rdoc-8.0.0/lib/rdoc/parser/c.rb +1227 -0
- data/rdoc-8.0.0/lib/rdoc/parser/changelog.rb +379 -0
- data/rdoc-8.0.0/lib/rdoc/parser/markdown.rb +22 -0
- data/rdoc-8.0.0/lib/rdoc/parser/rbs.rb +275 -0
- data/rdoc-8.0.0/lib/rdoc/parser/rd.rb +22 -0
- data/rdoc-8.0.0/lib/rdoc/parser/ruby.rb +1266 -0
- data/rdoc-8.0.0/lib/rdoc/parser/ruby_colorizer.rb +253 -0
- data/rdoc-8.0.0/lib/rdoc/parser/simple.rb +44 -0
- data/rdoc-8.0.0/lib/rdoc/parser/text.rb +11 -0
- data/rdoc-8.0.0/lib/rdoc/parser.rb +298 -0
- data/rdoc-8.0.0/lib/rdoc/rbs_helper.rb +186 -0
- data/rdoc-8.0.0/lib/rdoc/rd/block_parser.rb +1706 -0
- data/rdoc-8.0.0/lib/rdoc/rd/block_parser.ry +643 -0
- data/rdoc-8.0.0/lib/rdoc/rd/inline.rb +71 -0
- data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.rb +1854 -0
- data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.ry +593 -0
- data/rdoc-8.0.0/lib/rdoc/rd.rb +99 -0
- data/rdoc-8.0.0/lib/rdoc/rdoc.rb +724 -0
- data/rdoc-8.0.0/lib/rdoc/ri/driver.rb +1572 -0
- data/rdoc-8.0.0/lib/rdoc/ri/formatter.rb +6 -0
- data/rdoc-8.0.0/lib/rdoc/ri/paths.rb +171 -0
- data/rdoc-8.0.0/lib/rdoc/ri/servlet.rb +452 -0
- data/rdoc-8.0.0/lib/rdoc/ri/store.rb +6 -0
- data/rdoc-8.0.0/lib/rdoc/ri/task.rb +71 -0
- data/rdoc-8.0.0/lib/rdoc/ri.rb +21 -0
- data/rdoc-8.0.0/lib/rdoc/rubygems_hook.rb +327 -0
- data/rdoc-8.0.0/lib/rdoc/server.rb +460 -0
- data/rdoc-8.0.0/lib/rdoc/stats/normal.rb +58 -0
- data/rdoc-8.0.0/lib/rdoc/stats/quiet.rb +59 -0
- data/rdoc-8.0.0/lib/rdoc/stats/verbose.rb +44 -0
- data/rdoc-8.0.0/lib/rdoc/stats.rb +484 -0
- data/rdoc-8.0.0/lib/rdoc/store.rb +1205 -0
- data/rdoc-8.0.0/lib/rdoc/task.rb +355 -0
- data/rdoc-8.0.0/lib/rdoc/text.rb +244 -0
- data/rdoc-8.0.0/lib/rdoc/token_stream.rb +104 -0
- data/rdoc-8.0.0/lib/rdoc/tom_doc.rb +257 -0
- data/rdoc-8.0.0/lib/rdoc/version.rb +10 -0
- data/rdoc-8.0.0/lib/rdoc.rb +239 -0
- data/rdoc-8.0.0/lib/rubygems_plugin.rb +14 -0
- data/rdoc-8.0.0/man/ri.1 +249 -0
- data/rdoc-8.0.0/rdoc-logo.svg +43 -0
- data/rdoc-8.0.0/rdoc.gemspec +74 -0
- data/super-quick-rb.gemspec +12 -0
- metadata +257 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
##
|
|
3
|
+
# A file included at generation time. Objects of this class are created by
|
|
4
|
+
# RDoc::RD for an extension-less include.
|
|
5
|
+
#
|
|
6
|
+
# This implementation in incomplete.
|
|
7
|
+
|
|
8
|
+
class RDoc::Markup::Include
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
# The filename to be included, without extension
|
|
12
|
+
|
|
13
|
+
attr_reader :file
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Directories to search for #file
|
|
17
|
+
|
|
18
|
+
attr_reader :include_path
|
|
19
|
+
|
|
20
|
+
##
|
|
21
|
+
# Creates a new include that will import +file+ from +include_path+
|
|
22
|
+
|
|
23
|
+
def initialize(file, include_path)
|
|
24
|
+
@file = file
|
|
25
|
+
@include_path = include_path
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def ==(other) # :nodoc:
|
|
29
|
+
self.class === other and
|
|
30
|
+
@file == other.file and @include_path == other.include_path
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def pretty_print(q) # :nodoc:
|
|
34
|
+
q.group 2, '[incl ', ']' do
|
|
35
|
+
q.text file
|
|
36
|
+
q.breakable
|
|
37
|
+
q.text 'from '
|
|
38
|
+
q.pp include_path
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
##
|
|
3
|
+
# An Indented Paragraph of text
|
|
4
|
+
|
|
5
|
+
class RDoc::Markup::IndentedParagraph < RDoc::Markup::Raw
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# The indent in number of spaces
|
|
9
|
+
|
|
10
|
+
attr_reader :indent
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
# Creates a new IndentedParagraph containing +parts+ indented with +indent+
|
|
14
|
+
# spaces
|
|
15
|
+
|
|
16
|
+
def initialize(indent, *parts)
|
|
17
|
+
@indent = indent
|
|
18
|
+
|
|
19
|
+
super(*parts)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def ==(other) # :nodoc:
|
|
23
|
+
super and indent == other.indent
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
# Calls #accept_indented_paragraph on +visitor+
|
|
28
|
+
|
|
29
|
+
def accept(visitor)
|
|
30
|
+
visitor.accept_indented_paragraph self
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Joins the raw paragraph text and converts inline HardBreaks to the
|
|
35
|
+
# +hard_break+ text followed by the indent.
|
|
36
|
+
|
|
37
|
+
def text(hard_break = nil)
|
|
38
|
+
@parts.map do |part|
|
|
39
|
+
if RDoc::Markup::HardBreak === part then
|
|
40
|
+
'%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break
|
|
41
|
+
else
|
|
42
|
+
part
|
|
43
|
+
end
|
|
44
|
+
end.join
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'set'
|
|
4
|
+
require 'strscan'
|
|
5
|
+
|
|
6
|
+
# Parses inline markup in RDoc text.
|
|
7
|
+
# This parser handles em, bold, strike, tt, hard break, and tidylink.
|
|
8
|
+
# Block-level constructs are handled in RDoc::Markup::Parser.
|
|
9
|
+
|
|
10
|
+
class RDoc::Markup::InlineParser
|
|
11
|
+
|
|
12
|
+
# TT, BOLD_WORD, EM_WORD: regexp-handling(example: crossref) is disabled
|
|
13
|
+
WORD_PAIRS = {
|
|
14
|
+
'*' => :BOLD_WORD,
|
|
15
|
+
'**' => :BOLD_WORD,
|
|
16
|
+
'_' => :EM_WORD,
|
|
17
|
+
'__' => :EM_WORD,
|
|
18
|
+
'+' => :TT,
|
|
19
|
+
'++' => :TT,
|
|
20
|
+
'`' => :TT,
|
|
21
|
+
'``' => :TT
|
|
22
|
+
} # :nodoc:
|
|
23
|
+
|
|
24
|
+
# Other types: regexp-handling(example: crossref) is enabled
|
|
25
|
+
TAGS = {
|
|
26
|
+
'em' => :EM,
|
|
27
|
+
'i' => :EM,
|
|
28
|
+
'b' => :BOLD,
|
|
29
|
+
's' => :STRIKE,
|
|
30
|
+
'del' => :STRIKE,
|
|
31
|
+
} # :nodoc:
|
|
32
|
+
|
|
33
|
+
STANDALONE_TAGS = { 'br' => :HARD_BREAK } # :nodoc:
|
|
34
|
+
|
|
35
|
+
CODEBLOCK_TAGS = %w[tt code] # :nodoc:
|
|
36
|
+
|
|
37
|
+
TOKENS = {
|
|
38
|
+
**WORD_PAIRS.transform_values { [:word_pair, nil] },
|
|
39
|
+
**TAGS.keys.to_h {|tag| ["<#{tag}>", [:open_tag, tag]] },
|
|
40
|
+
**TAGS.keys.to_h {|tag| ["</#{tag}>", [:close_tag, tag]] },
|
|
41
|
+
**CODEBLOCK_TAGS.to_h {|tag| ["<#{tag}>", [:code_start, tag]] },
|
|
42
|
+
**STANDALONE_TAGS.keys.to_h {|tag| ["<#{tag}>", [:standalone_tag, tag]] },
|
|
43
|
+
'{' => [:tidylink_start, nil],
|
|
44
|
+
'}' => [:tidylink_mid, nil],
|
|
45
|
+
'\\' => [:escape, nil],
|
|
46
|
+
'[' => nil # To make `label[url]` scan as separate tokens
|
|
47
|
+
} # :nodoc:
|
|
48
|
+
|
|
49
|
+
multi_char_tokens_regexp = Regexp.union(TOKENS.keys.select {|s| s.size > 1 }).source
|
|
50
|
+
token_starts_regexp = TOKENS.keys.map {|s| s[0] }.uniq.map {|s| Regexp.escape(s) }.join
|
|
51
|
+
|
|
52
|
+
SCANNER_REGEXP =
|
|
53
|
+
/(?:
|
|
54
|
+
#{multi_char_tokens_regexp}
|
|
55
|
+
|[^#{token_starts_regexp}\sa-zA-Z0-9\.]+ # chunk of normal text
|
|
56
|
+
|\s+|[a-zA-Z0-9\.]+|.
|
|
57
|
+
)/x # :nodoc:
|
|
58
|
+
|
|
59
|
+
# Characters that can be escaped with backslash.
|
|
60
|
+
ESCAPING_CHARS = '\\*_+`{}[]<>' # :nodoc:
|
|
61
|
+
|
|
62
|
+
# Pattern to match code block content until <code></tt></code> or <tt></code></tt>.
|
|
63
|
+
CODEBLOCK_REGEXPS = CODEBLOCK_TAGS.to_h {|name| [name, /((?:\\.|[^\\])*?)<\/#{name}>/] } # :nodoc:
|
|
64
|
+
|
|
65
|
+
# Word contains alphanumeric and <tt>_./:[]-</tt> characters.
|
|
66
|
+
# Word may start with <tt>#</tt> and may end with any non-space character. (e.g. <tt>#eql?</tt>).
|
|
67
|
+
# Underscore delimiter have special rules.
|
|
68
|
+
WORD_REGEXPS = {
|
|
69
|
+
# Words including _, longest match.
|
|
70
|
+
# Example: `_::A_` `_-42_` `_A::B::C.foo_bar[baz]_` `_kwarg:_`
|
|
71
|
+
# Content must not include _ followed by non-alphanumeric character
|
|
72
|
+
# Example: `_host_:_port_` will be `_host_` + `:` + `_port_`
|
|
73
|
+
'_' => /#?([a-zA-Z0-9.\/:\[\]-]|_+[a-zA-Z0-9])+[^\s]?_(?=[^a-zA-Z0-9_]|\z)/,
|
|
74
|
+
# Words allowing _ but not allowing __
|
|
75
|
+
'__' => /#?[a-zA-Z0-9.\/:\[\]-]*(_[a-zA-Z0-9.\/:\[\]-]+)*[^\s]?__(?=[^a-zA-Z0-9]|\z)/,
|
|
76
|
+
**%w[* ** + ++ ` ``].to_h do |s|
|
|
77
|
+
# normal words that can be used within +word+ or *word*
|
|
78
|
+
[s, /#?[a-zA-Z0-9_.\/:\[\]-]+[^\s]?#{Regexp.escape(s)}(?=[^a-zA-Z0-9]|\z)/]
|
|
79
|
+
end
|
|
80
|
+
} # :nodoc:
|
|
81
|
+
|
|
82
|
+
def initialize(string)
|
|
83
|
+
@scanner = StringScanner.new(string)
|
|
84
|
+
@last_match = nil
|
|
85
|
+
@scanner_negative_cache = Set.new
|
|
86
|
+
@stack = []
|
|
87
|
+
@delimiters = {}
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Return the current parsing node on <tt>@stack</tt>.
|
|
91
|
+
|
|
92
|
+
def current
|
|
93
|
+
@stack.last
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Parse and return an array of nodes.
|
|
97
|
+
# Node format:
|
|
98
|
+
# {
|
|
99
|
+
# type: :EM | :BOLD | :BOLD_WORD | :EM_WORD | :TT | :STRIKE | :HARD_BREAK | :TIDYLINK,
|
|
100
|
+
# url: string # only for :TIDYLINK
|
|
101
|
+
# children: [string_or_node, ...]
|
|
102
|
+
# }
|
|
103
|
+
|
|
104
|
+
def parse
|
|
105
|
+
stack_push(:root, nil)
|
|
106
|
+
while true
|
|
107
|
+
type, token, value = scan_token
|
|
108
|
+
close = nil
|
|
109
|
+
tidylink_url = nil
|
|
110
|
+
case type
|
|
111
|
+
when :node
|
|
112
|
+
current[:children] << value
|
|
113
|
+
invalidate_open_tidylinks if value[:type] == :TIDYLINK
|
|
114
|
+
when :eof
|
|
115
|
+
close = :root
|
|
116
|
+
when :tidylink_open
|
|
117
|
+
stack_push(:tidylink, token)
|
|
118
|
+
when :tidylink_close
|
|
119
|
+
close = :tidylink
|
|
120
|
+
if value
|
|
121
|
+
tidylink_url = value
|
|
122
|
+
else
|
|
123
|
+
# Tidylink closing brace without URL part. Treat opening and closing braces as normal text
|
|
124
|
+
# `{labelnodes}...` case.
|
|
125
|
+
current[:children] << token
|
|
126
|
+
end
|
|
127
|
+
when :invalidated_tidylink_close
|
|
128
|
+
# `{...{label}[url]...}` case. Nested tidylink invalidates outer one. The last `}` closes the invalidated tidylink.
|
|
129
|
+
current[:children] << token
|
|
130
|
+
close = :invalidated_tidylink
|
|
131
|
+
when :text
|
|
132
|
+
current[:children] << token
|
|
133
|
+
when :open
|
|
134
|
+
stack_push(value, token)
|
|
135
|
+
when :close
|
|
136
|
+
if @delimiters[value]
|
|
137
|
+
close = value
|
|
138
|
+
else
|
|
139
|
+
# closing tag without matching opening tag. Treat as normal text.
|
|
140
|
+
current[:children] << token
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
next unless close
|
|
145
|
+
|
|
146
|
+
while current[:delimiter] != close
|
|
147
|
+
children = current[:children]
|
|
148
|
+
open_token = current[:token]
|
|
149
|
+
stack_pop
|
|
150
|
+
current[:children] << open_token if open_token
|
|
151
|
+
current[:children].concat(children)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
token = current[:token]
|
|
155
|
+
children = compact_string(current[:children])
|
|
156
|
+
stack_pop
|
|
157
|
+
|
|
158
|
+
return children if close == :root
|
|
159
|
+
|
|
160
|
+
if close == :tidylink || close == :invalidated_tidylink
|
|
161
|
+
if tidylink_url
|
|
162
|
+
current[:children] << { type: :TIDYLINK, children: children, url: tidylink_url }
|
|
163
|
+
invalidate_open_tidylinks
|
|
164
|
+
else
|
|
165
|
+
current[:children] << token
|
|
166
|
+
current[:children].concat(children)
|
|
167
|
+
end
|
|
168
|
+
else
|
|
169
|
+
current[:children] << { type: TAGS[close], children: children }
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
private
|
|
175
|
+
|
|
176
|
+
# When a valid tidylink node is encountered, invalidate all nested tidylinks.
|
|
177
|
+
|
|
178
|
+
def invalidate_open_tidylinks
|
|
179
|
+
return unless @delimiters[:tidylink]
|
|
180
|
+
|
|
181
|
+
@delimiters[:invalidated_tidylink] ||= []
|
|
182
|
+
@delimiters[:tidylink].each do |idx|
|
|
183
|
+
@delimiters[:invalidated_tidylink] << idx
|
|
184
|
+
@stack[idx][:delimiter] = :invalidated_tidylink
|
|
185
|
+
end
|
|
186
|
+
@delimiters.delete(:tidylink)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Pop the top node off the stack when node is closed by a closing delimiter or an error.
|
|
190
|
+
|
|
191
|
+
def stack_pop
|
|
192
|
+
delimiter = current[:delimiter]
|
|
193
|
+
@delimiters[delimiter].pop
|
|
194
|
+
@delimiters.delete(delimiter) if @delimiters[delimiter].empty?
|
|
195
|
+
@stack.pop
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Push a new node onto the stack when encountering an opening delimiter.
|
|
199
|
+
|
|
200
|
+
def stack_push(delimiter, token)
|
|
201
|
+
node = { delimiter: delimiter, token: token, children: [] }
|
|
202
|
+
(@delimiters[delimiter] ||= []) << @stack.size
|
|
203
|
+
@stack << node
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Compacts adjacent strings in +nodes+ into a single string.
|
|
207
|
+
|
|
208
|
+
def compact_string(nodes)
|
|
209
|
+
nodes.chunk {|e| String === e }.flat_map do |is_str, elems|
|
|
210
|
+
is_str ? elems.join : elems
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Scan from StringScanner with +pattern+
|
|
215
|
+
# If +negative_cache+ is true, caches scan failure result. <tt>scan(pattern, negative_cache: true)</tt> return nil when it is called again after a failure.
|
|
216
|
+
# Be careful to use +negative_cache+ with a pattern and position that does not match after previous failure.
|
|
217
|
+
|
|
218
|
+
def strscan(pattern, negative_cache: false)
|
|
219
|
+
return if negative_cache && @scanner_negative_cache.include?(pattern)
|
|
220
|
+
|
|
221
|
+
string = @scanner.scan(pattern)
|
|
222
|
+
@last_match = string if string
|
|
223
|
+
@scanner_negative_cache << pattern if !string && negative_cache
|
|
224
|
+
string
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Scan and return the next token for parsing.
|
|
228
|
+
# Returns <tt>[token_type, token_string_or_nil, extra_info]</tt>
|
|
229
|
+
|
|
230
|
+
def scan_token
|
|
231
|
+
last_match = @last_match
|
|
232
|
+
token = strscan(SCANNER_REGEXP)
|
|
233
|
+
type, name = TOKENS[token]
|
|
234
|
+
|
|
235
|
+
case type
|
|
236
|
+
when :word_pair
|
|
237
|
+
# If the character before word pair delimiter is alphanumeric, do not treat as word pair.
|
|
238
|
+
word_pair = strscan(WORD_REGEXPS[token]) unless /[a-zA-Z0-9]\z/.match?(last_match)
|
|
239
|
+
|
|
240
|
+
if word_pair.nil?
|
|
241
|
+
[:text, token, nil]
|
|
242
|
+
elsif token == '__' && word_pair.match?(/\A[a-zA-Z]+__\z/)
|
|
243
|
+
# Special exception: __FILE__, __LINE__, __send__ should be treated as normal text.
|
|
244
|
+
[:text, "#{token}#{word_pair}", nil]
|
|
245
|
+
else
|
|
246
|
+
[:node, nil, { type: WORD_PAIRS[token], children: [word_pair.delete_suffix(token)] }]
|
|
247
|
+
end
|
|
248
|
+
when :open_tag
|
|
249
|
+
[:open, token, name]
|
|
250
|
+
when :close_tag
|
|
251
|
+
[:close, token, name]
|
|
252
|
+
when :code_start
|
|
253
|
+
if (codeblock = strscan(CODEBLOCK_REGEXPS[name], negative_cache: true))
|
|
254
|
+
# Need to unescape `\\` and `\<`.
|
|
255
|
+
# RDoc also unescapes backslash + word separators, but this is not really necessary.
|
|
256
|
+
content = codeblock.delete_suffix("</#{name}>").gsub(/\\(.)/) { '\\<*+_`'.include?($1) ? $1 : $& }
|
|
257
|
+
[:node, nil, { type: :TT, children: content.empty? ? [] : [content] }]
|
|
258
|
+
else
|
|
259
|
+
[:text, token, nil]
|
|
260
|
+
end
|
|
261
|
+
when :standalone_tag
|
|
262
|
+
[:node, nil, { type: STANDALONE_TAGS[name], children: [] }]
|
|
263
|
+
when :tidylink_start
|
|
264
|
+
[:tidylink_open, token, nil]
|
|
265
|
+
when :tidylink_mid
|
|
266
|
+
if @delimiters[:tidylink]
|
|
267
|
+
if (url = read_tidylink_url)
|
|
268
|
+
[:tidylink_close, nil, url]
|
|
269
|
+
else
|
|
270
|
+
[:tidylink_close, token, nil]
|
|
271
|
+
end
|
|
272
|
+
elsif @delimiters[:invalidated_tidylink]
|
|
273
|
+
[:invalidated_tidylink_close, token, nil]
|
|
274
|
+
else
|
|
275
|
+
[:text, token, nil]
|
|
276
|
+
end
|
|
277
|
+
when :escape
|
|
278
|
+
next_char = strscan(/./)
|
|
279
|
+
if next_char.nil?
|
|
280
|
+
# backslash at end of string
|
|
281
|
+
[:text, '\\', nil]
|
|
282
|
+
elsif next_char && ESCAPING_CHARS.include?(next_char)
|
|
283
|
+
# escaped character
|
|
284
|
+
[:text, next_char, nil]
|
|
285
|
+
else
|
|
286
|
+
# If next_char not an escaping character, it is treated as text token with backslash + next_char
|
|
287
|
+
# For example, backslash of `\Ruby` (suppressed crossref) remains.
|
|
288
|
+
[:text, "\\#{next_char}", nil]
|
|
289
|
+
end
|
|
290
|
+
else
|
|
291
|
+
if token.nil?
|
|
292
|
+
[:eof, nil, nil]
|
|
293
|
+
elsif token.match?(/\A[A-Za-z0-9]*\z/) && (url = read_tidylink_url)
|
|
294
|
+
# Simplified tidylink: label[url]
|
|
295
|
+
[:node, nil, { type: :TIDYLINK, children: [token], url: url }]
|
|
296
|
+
else
|
|
297
|
+
[:text, token, nil]
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Read the URL part of a tidylink from the current position.
|
|
303
|
+
# Returns nil if no valid URL part is found.
|
|
304
|
+
# URL part is enclosed in square brackets and may contain escaped brackets.
|
|
305
|
+
# Example: <tt>[http://example.com/?q=\[\]]</tt> represents <tt>http://example.com/?q=[]</tt>.
|
|
306
|
+
# If we're accepting rdoc-style links in markdown, url may include <tt>*+<_</tt> with backslash escape.
|
|
307
|
+
|
|
308
|
+
def read_tidylink_url
|
|
309
|
+
bracketed_url = strscan(/\[([^\s\[\]\\]|\\[\[\]\\*+<_])+\]/)
|
|
310
|
+
bracketed_url[1...-1].gsub(/\\(.)/, '\1') if bracketed_url
|
|
311
|
+
end
|
|
312
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
##
|
|
3
|
+
# A List is a homogeneous set of ListItems.
|
|
4
|
+
#
|
|
5
|
+
# The supported list types include:
|
|
6
|
+
#
|
|
7
|
+
# :BULLET::
|
|
8
|
+
# An unordered list
|
|
9
|
+
# :LABEL::
|
|
10
|
+
# An unordered definition list, but using an alternate RDoc::Markup syntax
|
|
11
|
+
# :LALPHA::
|
|
12
|
+
# An ordered list using increasing lowercase English letters
|
|
13
|
+
# :NOTE::
|
|
14
|
+
# An unordered definition list
|
|
15
|
+
# :NUMBER::
|
|
16
|
+
# An ordered list using increasing Arabic numerals
|
|
17
|
+
# :UALPHA::
|
|
18
|
+
# An ordered list using increasing uppercase English letters
|
|
19
|
+
#
|
|
20
|
+
# Definition lists behave like HTML definition lists. Each list item can
|
|
21
|
+
# describe multiple terms. See RDoc::Markup::ListItem for how labels and
|
|
22
|
+
# definition are stored as list items.
|
|
23
|
+
|
|
24
|
+
class RDoc::Markup::List
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
# The list's type
|
|
28
|
+
|
|
29
|
+
attr_accessor :type
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Items in the list
|
|
33
|
+
|
|
34
|
+
attr_reader :items
|
|
35
|
+
|
|
36
|
+
##
|
|
37
|
+
# Creates a new list of +type+ with +items+. Valid list types are:
|
|
38
|
+
# +:BULLET+, +:LABEL+, +:LALPHA+, +:NOTE+, +:NUMBER+, +:UALPHA+
|
|
39
|
+
|
|
40
|
+
def initialize(type = nil, *items)
|
|
41
|
+
@type = type
|
|
42
|
+
@items = []
|
|
43
|
+
@items.concat items
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Appends +item+ to the list
|
|
48
|
+
|
|
49
|
+
def <<(item)
|
|
50
|
+
@items << item
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def ==(other) # :nodoc:
|
|
54
|
+
self.class == other.class and
|
|
55
|
+
@type == other.type and
|
|
56
|
+
@items == other.items
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
##
|
|
60
|
+
# Runs this list and all its #items through +visitor+
|
|
61
|
+
|
|
62
|
+
def accept(visitor)
|
|
63
|
+
visitor.accept_list_start self
|
|
64
|
+
|
|
65
|
+
@items.each do |item|
|
|
66
|
+
item.accept visitor
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
visitor.accept_list_end self
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
##
|
|
73
|
+
# Is the list empty?
|
|
74
|
+
|
|
75
|
+
def empty?
|
|
76
|
+
@items.empty?
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
##
|
|
80
|
+
# Returns the last item in the list
|
|
81
|
+
|
|
82
|
+
def last
|
|
83
|
+
@items.last
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def pretty_print(q) # :nodoc:
|
|
87
|
+
q.group 2, "[list: #{@type} ", ']' do
|
|
88
|
+
q.seplist @items do |item|
|
|
89
|
+
q.pp item
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
##
|
|
95
|
+
# Appends +items+ to the list
|
|
96
|
+
|
|
97
|
+
def push(*items)
|
|
98
|
+
@items.concat items
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
##
|
|
3
|
+
# An item within a List that contains paragraphs, headings, etc.
|
|
4
|
+
#
|
|
5
|
+
# For BULLET, NUMBER, LALPHA and UALPHA lists, the label will always be nil.
|
|
6
|
+
# For NOTE and LABEL lists, the list label may contain:
|
|
7
|
+
#
|
|
8
|
+
# * a single String for a single label
|
|
9
|
+
# * an Array of Strings for a list item with multiple terms
|
|
10
|
+
# * nil for an extra description attached to a previously labeled list item
|
|
11
|
+
|
|
12
|
+
class RDoc::Markup::ListItem
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# The label for the ListItem
|
|
16
|
+
|
|
17
|
+
attr_accessor :label
|
|
18
|
+
|
|
19
|
+
##
|
|
20
|
+
# Parts of the ListItem
|
|
21
|
+
|
|
22
|
+
attr_reader :parts
|
|
23
|
+
|
|
24
|
+
##
|
|
25
|
+
# Creates a new ListItem with an optional +label+ containing +parts+
|
|
26
|
+
|
|
27
|
+
def initialize(label = nil, *parts)
|
|
28
|
+
@label = label
|
|
29
|
+
@parts = []
|
|
30
|
+
@parts.concat parts
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# Appends +part+ to the ListItem
|
|
35
|
+
|
|
36
|
+
def <<(part)
|
|
37
|
+
@parts << part
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def ==(other) # :nodoc:
|
|
41
|
+
self.class == other.class and
|
|
42
|
+
@label == other.label and
|
|
43
|
+
@parts == other.parts
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Runs this list item and all its #parts through +visitor+
|
|
48
|
+
|
|
49
|
+
def accept(visitor)
|
|
50
|
+
visitor.accept_list_item_start self
|
|
51
|
+
|
|
52
|
+
@parts.each do |part|
|
|
53
|
+
part.accept visitor
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
visitor.accept_list_item_end self
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
##
|
|
60
|
+
# Is the ListItem empty?
|
|
61
|
+
|
|
62
|
+
def empty?
|
|
63
|
+
@parts.empty?
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
##
|
|
67
|
+
# Length of parts in the ListItem
|
|
68
|
+
|
|
69
|
+
def length
|
|
70
|
+
@parts.length
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def pretty_print(q) # :nodoc:
|
|
74
|
+
q.group 2, '[item: ', ']' do
|
|
75
|
+
case @label
|
|
76
|
+
when Array then
|
|
77
|
+
q.pp @label
|
|
78
|
+
q.text ';'
|
|
79
|
+
q.breakable
|
|
80
|
+
when String then
|
|
81
|
+
q.pp @label
|
|
82
|
+
q.text ';'
|
|
83
|
+
q.breakable
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
q.seplist @parts do |part|
|
|
87
|
+
q.pp part
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
##
|
|
93
|
+
# Adds +parts+ to the ListItem
|
|
94
|
+
|
|
95
|
+
def push(*parts)
|
|
96
|
+
@parts.concat parts
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
##
|
|
3
|
+
# A Paragraph of text
|
|
4
|
+
|
|
5
|
+
class RDoc::Markup::Paragraph < RDoc::Markup::Raw
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Calls #accept_paragraph on +visitor+
|
|
9
|
+
|
|
10
|
+
def accept(visitor)
|
|
11
|
+
visitor.accept_paragraph self
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# Joins the raw paragraph text and converts inline HardBreaks to the
|
|
16
|
+
# +hard_break+ text.
|
|
17
|
+
|
|
18
|
+
def text(hard_break = '')
|
|
19
|
+
@parts.map do |part|
|
|
20
|
+
if RDoc::Markup::HardBreak === part then
|
|
21
|
+
hard_break
|
|
22
|
+
else
|
|
23
|
+
part
|
|
24
|
+
end
|
|
25
|
+
end.join
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|