danger-packwerk 0.14.0 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/danger_package_todo_yml_changes.rb +21 -118
  3. data/lib/danger-packwerk/danger_packwerk.rb +12 -7
  4. data/lib/danger-packwerk/private/git.rb +65 -0
  5. data/lib/danger-packwerk/private/todo_yml_changes.rb +135 -0
  6. data/lib/danger-packwerk/private.rb +1 -0
  7. data/lib/danger-packwerk/version.rb +1 -1
  8. metadata +4 -88
  9. data/sorbet/config +0 -4
  10. data/sorbet/rbi/gems/actionview@7.0.4.rbi +0 -11543
  11. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +0 -12959
  12. data/sorbet/rbi/gems/addressable@2.8.1.rbi +0 -1505
  13. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -522
  14. data/sorbet/rbi/gems/better_html@2.0.1.rbi +0 -286
  15. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -8
  16. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +0 -791
  17. data/sorbet/rbi/gems/claide@1.1.0.rbi +0 -1132
  18. data/sorbet/rbi/gems/code_ownership@1.29.2.rbi +0 -525
  19. data/sorbet/rbi/gems/code_teams@1.0.0.rbi +0 -120
  20. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -2256
  21. data/sorbet/rbi/gems/colored2@3.1.2.rbi +0 -130
  22. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +0 -8695
  23. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +0 -30
  24. data/sorbet/rbi/gems/cork@0.3.0.rbi +0 -248
  25. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -436
  26. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +0 -8
  27. data/sorbet/rbi/gems/danger@9.0.0.rbi +0 -4722
  28. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -862
  29. data/sorbet/rbi/gems/erubi@1.11.0.rbi +0 -102
  30. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +0 -266
  31. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +0 -209
  32. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +0 -212
  33. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +0 -805
  34. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +0 -221
  35. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +0 -266
  36. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +0 -216
  37. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +0 -206
  38. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +0 -212
  39. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +0 -225
  40. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +0 -222
  41. data/sorbet/rbi/gems/faraday@1.10.2.rbi +0 -1862
  42. data/sorbet/rbi/gems/git@1.12.0.rbi +0 -1936
  43. data/sorbet/rbi/gems/i18n@1.12.0.rbi +0 -1643
  44. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +0 -8
  45. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +0 -2168
  46. data/sorbet/rbi/gems/loofah@2.19.0.rbi +0 -646
  47. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -199
  48. data/sorbet/rbi/gems/minitest@5.16.3.rbi +0 -997
  49. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +0 -165
  50. data/sorbet/rbi/gems/nap@1.1.0.rbi +0 -351
  51. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +0 -8
  52. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +0 -4916
  53. data/sorbet/rbi/gems/octokit@5.6.1.rbi +0 -8939
  54. data/sorbet/rbi/gems/open4@1.3.4.rbi +0 -8
  55. data/sorbet/rbi/gems/packs@0.0.5.rbi +0 -111
  56. data/sorbet/rbi/gems/packwerk@2.2.1-e998ef65194de398f0baaf03a0ba33390b30351e.rbi +0 -2161
  57. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -163
  58. data/sorbet/rbi/gems/parse_packwerk@0.18.0.rbi +0 -225
  59. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +0 -5988
  60. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -6969
  61. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +0 -779
  62. data/sorbet/rbi/gems/racc@1.6.0.rbi +0 -92
  63. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +0 -8
  64. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +0 -493
  65. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -227
  66. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -1865
  67. data/sorbet/rbi/gems/rbi@0.0.14.rbi +0 -2337
  68. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +0 -587
  69. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +0 -1851
  70. data/sorbet/rbi/gems/rexml@3.2.5.rbi +0 -3852
  71. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +0 -7725
  72. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +0 -6201
  73. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +0 -3625
  74. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +0 -1176
  75. data/sorbet/rbi/gems/rspec@3.11.0.rbi +0 -40
  76. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +0 -4193
  77. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +0 -677
  78. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +0 -37914
  79. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -732
  80. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +0 -8
  81. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +0 -513
  82. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +0 -326
  83. data/sorbet/rbi/gems/spoom@1.1.11.rbi +0 -1600
  84. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +0 -1959
  85. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +0 -438
  86. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -2921
  87. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +0 -4879
  88. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +0 -27
  89. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -2789
  90. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -1802
  91. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +0 -288
  92. data/sorbet/rbi/gems/yard@0.9.27.rbi +0 -12668
  93. data/sorbet/rbi/todo.rbi +0 -125
  94. data/sorbet/tapioca/require.rb +0 -4
@@ -1,2168 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `kramdown` gem.
5
- # Please instead update this file by running `bin/tapioca gem kramdown`.
6
-
7
- module Kramdown
8
- class << self
9
- # Return the data directory for kramdown.
10
- def data_dir; end
11
- end
12
- end
13
-
14
- # This module contains all available converters, i.e. classes that take a root Element and convert
15
- # it to a specific output format. The result is normally a string. For example, the
16
- # Converter::Html module converts an element tree into valid HTML.
17
- #
18
- # Converters use the Base class for common functionality (like applying a template to the output)
19
- # \- see its API documentation for how to create a custom converter class.
20
- module Kramdown::Converter
21
- extend ::Kramdown::Utils::Configurable
22
-
23
- class << self
24
- def add_math_engine(data, *args, &block); end
25
- def add_syntax_highlighter(data, *args, &block); end
26
- def configurables; end
27
- def math_engine(data); end
28
- def syntax_highlighter(data); end
29
- end
30
- end
31
-
32
- # == \Base class for converters
33
- #
34
- # This class serves as base class for all converters. It provides methods that can/should be
35
- # used by all converters (like #generate_id) as well as common functionality that is
36
- # automatically applied to the result (for example, embedding the output into a template).
37
- #
38
- # A converter object is used as a throw-away object, i.e. it is only used for storing the needed
39
- # state information during conversion. Therefore one can't instantiate a converter object
40
- # directly but only use the Base::convert method.
41
- #
42
- # == Implementing a converter
43
- #
44
- # Implementing a new converter is rather easy: just derive a new class from this class and put
45
- # it in the Kramdown::Converter module (the latter is only needed if auto-detection should work
46
- # properly). Then you need to implement the #convert method which has to contain the conversion
47
- # code for converting an element and has to return the conversion result.
48
- #
49
- # The actual transformation of the document tree can be done in any way. However, writing one
50
- # method per element type is a straight forward way to do it - this is how the Html and Latex
51
- # converters do the transformation.
52
- #
53
- # Have a look at the Base::convert method for additional information!
54
- class Kramdown::Converter::Base
55
- # Initialize the converter with the given +root+ element and +options+ hash.
56
- #
57
- # @return [Base] a new instance of Base
58
- def initialize(root, options); end
59
-
60
- # Returns whether the template should be applied after the conversion of the tree.
61
- #
62
- # Defaults to true.
63
- #
64
- # @return [Boolean]
65
- def apply_template_after?; end
66
-
67
- # Returns whether the template should be applied before the conversion of the tree.
68
- #
69
- # Defaults to false.
70
- #
71
- # @return [Boolean]
72
- def apply_template_before?; end
73
-
74
- # The basic version of the ID generator, without any special provisions for empty or unique
75
- # IDs.
76
- def basic_generate_id(str); end
77
-
78
- # Convert the element +el+ and return the resulting object.
79
- #
80
- # This is the only method that has to be implemented by sub-classes!
81
- #
82
- # @raise [NotImplementedError]
83
- def convert(_el); end
84
-
85
- # Can be used by a converter for storing arbitrary information during the conversion process.
86
- def data; end
87
-
88
- # Extract the code block/span language from the attributes.
89
- def extract_code_language(attr); end
90
-
91
- # See #extract_code_language
92
- #
93
- # *Warning*: This version will modify the given attributes if a language is present.
94
- def extract_code_language!(attr); end
95
-
96
- # Format the given math element with the math engine configured through the option
97
- # 'math_engine'.
98
- def format_math(el, opts = T.unsafe(nil)); end
99
-
100
- # Generate an unique alpha-numeric ID from the the string +str+ for use as a header ID.
101
- #
102
- # Uses the option +auto_id_prefix+: the value of this option is prepended to every generated
103
- # ID.
104
- def generate_id(str); end
105
-
106
- # Highlight the given +text+ in the language +lang+ with the syntax highlighter configured
107
- # through the option 'syntax_highlighter'.
108
- def highlight_code(text, lang, type, opts = T.unsafe(nil)); end
109
-
110
- # Return +true+ if the header element +el+ should be used for the table of contents (as
111
- # specified by the +toc_levels+ option).
112
- #
113
- # @return [Boolean]
114
- def in_toc?(el); end
115
-
116
- # The hash with the conversion options.
117
- def options; end
118
-
119
- # Return the output header level given a level.
120
- #
121
- # Uses the +header_offset+ option for adjusting the header level.
122
- def output_header_level(level); end
123
-
124
- # The root element that is converted.
125
- def root; end
126
-
127
- # Return the entity that represents the given smart_quote element.
128
- def smart_quote_entity(el); end
129
-
130
- # Add the given warning +text+ to the warning array.
131
- def warning(text); end
132
-
133
- # The warnings array.
134
- def warnings; end
135
-
136
- class << self
137
- # Apply the +template+ using +body+ as the body string.
138
- #
139
- # The template is evaluated using ERB and the body is available in the @body instance variable
140
- # and the converter object in the @converter instance variable.
141
- def apply_template(converter, body); end
142
-
143
- # Convert the element tree +tree+ and return the resulting conversion object (normally a
144
- # string) and an array with warning messages. The parameter +options+ specifies the conversion
145
- # options that should be used.
146
- #
147
- # Initializes a new instance of the calling class and then calls the #convert method with
148
- # +tree+ as parameter.
149
- #
150
- # If the +template+ option is specified and non-empty, the template is evaluate with ERB
151
- # before and/or after the tree conversion depending on the result of #apply_template_before?
152
- # and #apply_template_after?. If the template is evaluated before, an empty string is used for
153
- # the body; if evaluated after, the result is used as body. See ::apply_template.
154
- #
155
- # The template resolution is done in the following way (for the converter ConverterName):
156
- #
157
- # 1. Look in the current working directory for the template.
158
- #
159
- # 2. Append +.converter_name+ (e.g. +.html+) to the template name and look for the resulting
160
- # file in the current working directory (the form +.convertername+ is deprecated).
161
- #
162
- # 3. Append +.converter_name+ to the template name and look for it in the kramdown data
163
- # directory (the form +.convertername+ is deprecated).
164
- #
165
- # 4. Check if the template name starts with 'string://' and if so, strip this prefix away and
166
- # use the rest as template.
167
- def convert(tree, options = T.unsafe(nil)); end
168
-
169
- # Return the template specified by +template+.
170
- def get_template(template); end
171
- end
172
- end
173
-
174
- Kramdown::Converter::Base::SMART_QUOTE_INDICES = T.let(T.unsafe(nil), Hash)
175
-
176
- # Converts a Kramdown::Document to a nested hash for further processing or debug output.
177
- class Kramdown::Converter::HashAST < ::Kramdown::Converter::Base
178
- def convert(el); end
179
- end
180
-
181
- Kramdown::Converter::HashAst = Kramdown::Converter::HashAST
182
-
183
- # Converts a Kramdown::Document to HTML.
184
- #
185
- # You can customize the HTML converter by sub-classing it and overriding the +convert_NAME+
186
- # methods. Each such method takes the following parameters:
187
- #
188
- # [+el+] The element of type +NAME+ to be converted.
189
- #
190
- # [+indent+] A number representing the current amount of spaces for indent (only used for
191
- # block-level elements).
192
- #
193
- # The return value of such a method has to be a string containing the element +el+ formatted as
194
- # HTML element.
195
- class Kramdown::Converter::Html < ::Kramdown::Converter::Base
196
- include ::Kramdown::Utils::Html
197
- include ::Kramdown::Parser::Html::Constants
198
-
199
- # Initialize the HTML converter with the given Kramdown document +doc+.
200
- #
201
- # @return [Html] a new instance of Html
202
- def initialize(root, options); end
203
-
204
- # Add the syntax highlighter name to the 'class' attribute of the given attribute hash. And
205
- # overwrites or add a "language-LANG" part using the +lang+ parameter if +lang+ is not nil.
206
- def add_syntax_highlighter_to_class_attr(attr, lang = T.unsafe(nil)); end
207
-
208
- # Dispatch the conversion of the element +el+ to a +convert_TYPE+ method using the +type+ of
209
- # the element.
210
- def convert(el, indent = T.unsafe(nil)); end
211
-
212
- def convert_a(el, indent); end
213
- def convert_abbreviation(el, _indent); end
214
- def convert_blank(_el, _indent); end
215
- def convert_blockquote(el, indent); end
216
- def convert_br(_el, _indent); end
217
- def convert_codeblock(el, indent); end
218
- def convert_codespan(el, _indent); end
219
- def convert_comment(el, indent); end
220
- def convert_dd(el, indent); end
221
- def convert_dl(el, indent); end
222
- def convert_dt(el, indent); end
223
- def convert_em(el, indent); end
224
- def convert_entity(el, _indent); end
225
- def convert_footnote(el, _indent); end
226
- def convert_header(el, indent); end
227
- def convert_hr(el, indent); end
228
- def convert_html_element(el, indent); end
229
- def convert_img(el, _indent); end
230
- def convert_li(el, indent); end
231
- def convert_math(el, indent); end
232
- def convert_ol(el, indent); end
233
- def convert_p(el, indent); end
234
- def convert_raw(el, _indent); end
235
- def convert_root(el, indent); end
236
- def convert_smart_quote(el, _indent); end
237
-
238
- # Helper method used by +convert_p+ to convert a paragraph that only contains a single :img
239
- # element.
240
- def convert_standalone_image(el, indent); end
241
-
242
- def convert_strong(el, indent); end
243
- def convert_table(el, indent); end
244
- def convert_tbody(el, indent); end
245
- def convert_td(el, indent); end
246
- def convert_text(el, _indent); end
247
- def convert_tfoot(el, indent); end
248
- def convert_thead(el, indent); end
249
- def convert_tr(el, indent); end
250
- def convert_typographic_sym(el, _indent); end
251
- def convert_ul(el, indent); end
252
- def convert_xml_comment(el, indent); end
253
- def convert_xml_pi(el, indent); end
254
-
255
- # Fixes the elements for use in a TOC entry.
256
- def fix_for_toc_entry(elements); end
257
-
258
- # Return an HTML ordered list with the footnote content for the used footnotes.
259
- def footnote_content; end
260
-
261
- # Format the given element as block HTML.
262
- def format_as_block_html(name, attr, body, indent); end
263
-
264
- # Format the given element as block HTML with a newline after the start tag and indentation
265
- # before the end tag.
266
- def format_as_indented_block_html(name, attr, body, indent); end
267
-
268
- # Format the given element as span HTML.
269
- def format_as_span_html(name, attr, body); end
270
-
271
- # Generate and return an element tree for the table of contents.
272
- def generate_toc_tree(toc, type, attr); end
273
-
274
- # The amount of indentation used when nesting HTML tags.
275
- def indent; end
276
-
277
- # The amount of indentation used when nesting HTML tags.
278
- def indent=(_arg0); end
279
-
280
- # Return the converted content of the children of +el+ as a string. The parameter +indent+ has
281
- # to be the amount of indentation used for the element +el+.
282
- #
283
- # Pushes +el+ onto the @stack before converting the child elements and pops it from the stack
284
- # afterwards.
285
- def inner(el, indent); end
286
-
287
- # Obfuscate the +text+ by using HTML entities.
288
- def obfuscate(text); end
289
-
290
- # Remove all footnotes from the given elements.
291
- def remove_footnotes(elements); end
292
-
293
- # Remove all link elements by unwrapping them.
294
- def unwrap_links(elements); end
295
- end
296
-
297
- Kramdown::Converter::Html::ENTITY_NBSP = T.let(T.unsafe(nil), Kramdown::Utils::Entities::Entity)
298
- Kramdown::Converter::Html::FOOTNOTE_BACKLINK_FMT = T.let(T.unsafe(nil), String)
299
- Kramdown::Converter::Html::TYPOGRAPHIC_SYMS = T.let(T.unsafe(nil), Hash)
300
- Kramdown::Converter::Html::ZERO_TO_ONETWENTYEIGHT = T.let(T.unsafe(nil), Array)
301
-
302
- # Converts an element tree to the kramdown format.
303
- class Kramdown::Converter::Kramdown < ::Kramdown::Converter::Base
304
- include ::Kramdown::Utils::Html
305
-
306
- # @return [Kramdown] a new instance of Kramdown
307
- def initialize(root, options); end
308
-
309
- def convert(el, opts = T.unsafe(nil)); end
310
- def convert_a(el, opts); end
311
- def convert_abbreviation(el, _opts); end
312
- def convert_blank(_el, _opts); end
313
- def convert_blockquote(el, opts); end
314
- def convert_br(_el, _opts); end
315
- def convert_codeblock(el, _opts); end
316
- def convert_codespan(el, _opts); end
317
- def convert_comment(el, _opts); end
318
- def convert_dd(el, opts); end
319
- def convert_dl(el, opts); end
320
- def convert_dt(el, opts); end
321
- def convert_em(el, opts); end
322
- def convert_entity(el, _opts); end
323
- def convert_footnote(el, _opts); end
324
- def convert_header(el, opts); end
325
- def convert_hr(_el, _opts); end
326
- def convert_html_element(el, opts); end
327
- def convert_img(el, _opts); end
328
- def convert_li(el, opts); end
329
- def convert_math(el, _opts); end
330
- def convert_ol(el, opts); end
331
- def convert_p(el, opts); end
332
- def convert_raw(el, _opts); end
333
- def convert_root(el, opts); end
334
- def convert_smart_quote(el, _opts); end
335
- def convert_strong(el, opts); end
336
- def convert_table(el, opts); end
337
- def convert_tbody(el, opts); end
338
- def convert_td(el, opts); end
339
- def convert_text(el, opts); end
340
- def convert_tfoot(el, opts); end
341
- def convert_thead(el, opts); end
342
- def convert_tr(el, opts); end
343
- def convert_typographic_sym(el, _opts); end
344
- def convert_ul(el, opts); end
345
- def convert_xml_comment(el, _opts); end
346
- def convert_xml_pi(el, _opts); end
347
- def create_abbrev_defs; end
348
- def create_footnote_defs; end
349
- def create_link_defs; end
350
-
351
- # Return the IAL containing the attributes of the element +el+.
352
- def ial_for_element(el); end
353
-
354
- def inner(el, opts = T.unsafe(nil)); end
355
- def parse_title(attr); end
356
- end
357
-
358
- Kramdown::Converter::Kramdown::ESCAPED_CHAR_RE = T.let(T.unsafe(nil), Regexp)
359
- Kramdown::Converter::Kramdown::HTML_ELEMENT_TYPES = T.let(T.unsafe(nil), Array)
360
- Kramdown::Converter::Kramdown::HTML_TAGS_WITH_BODY = T.let(T.unsafe(nil), Array)
361
- Kramdown::Converter::Kramdown::TYPOGRAPHIC_SYMS = T.let(T.unsafe(nil), Hash)
362
-
363
- # Converts an element tree to LaTeX.
364
- #
365
- # This converter uses ideas from other Markdown-to-LaTeX converters like Pandoc and Maruku.
366
- #
367
- # You can customize this converter by sub-classing it and overriding the +convert_NAME+ methods.
368
- # Each such method takes the following parameters:
369
- #
370
- # [+el+] The element of type +NAME+ to be converted.
371
- #
372
- # [+opts+] A hash containing processing options that are passed down from parent elements. The
373
- # key :parent is always set and contains the parent element as value.
374
- #
375
- # The return value of such a method has to be a string containing the element +el+ formatted
376
- # correctly as LaTeX markup.
377
- class Kramdown::Converter::Latex < ::Kramdown::Converter::Base
378
- # Initialize the LaTeX converter with the +root+ element and the conversion +options+.
379
- #
380
- # @return [Latex] a new instance of Latex
381
- def initialize(root, options); end
382
-
383
- # Return a LaTeX comment containing all attributes as 'key="value"' pairs.
384
- def attribute_list(el); end
385
-
386
- # Dispatch the conversion of the element +el+ to a +convert_TYPE+ method using the +type+ of
387
- # the element.
388
- def convert(el, opts = T.unsafe(nil)); end
389
-
390
- def convert_a(el, opts); end
391
- def convert_abbreviation(el, _opts); end
392
- def convert_blank(_el, opts); end
393
- def convert_blockquote(el, opts); end
394
- def convert_br(_el, opts); end
395
- def convert_codeblock(el, _opts); end
396
- def convert_codespan(el, _opts); end
397
- def convert_comment(el, _opts); end
398
- def convert_dd(el, opts); end
399
- def convert_dl(el, opts); end
400
- def convert_dt(el, opts); end
401
- def convert_em(el, opts); end
402
- def convert_entity(el, _opts); end
403
- def convert_footnote(el, opts); end
404
- def convert_header(el, opts); end
405
- def convert_hr(el, _opts); end
406
- def convert_html_element(el, opts); end
407
- def convert_img(el, _opts); end
408
- def convert_li(el, opts); end
409
- def convert_math(el, _opts); end
410
- def convert_ol(el, opts); end
411
- def convert_p(el, opts); end
412
- def convert_raw(el, _opts); end
413
- def convert_root(el, opts); end
414
- def convert_smart_quote(el, opts); end
415
-
416
- # Helper method used by +convert_p+ to convert a paragraph that only contains a single :img
417
- # element.
418
- def convert_standalone_image(el, _opts, img); end
419
-
420
- def convert_strong(el, opts); end
421
- def convert_table(el, opts); end
422
- def convert_tbody(el, opts); end
423
- def convert_td(el, opts); end
424
- def convert_text(el, _opts); end
425
- def convert_tfoot(el, opts); end
426
- def convert_thead(el, opts); end
427
- def convert_tr(el, opts); end
428
- def convert_typographic_sym(el, _opts); end
429
- def convert_ul(el, opts); end
430
- def convert_xml_comment(el, _opts); end
431
- def convert_xml_pi(_el, _opts); end
432
- def entity_to_latex(entity); end
433
-
434
- # Escape the special LaTeX characters in the string +str+.
435
- def escape(str); end
436
-
437
- # Return the converted content of the children of +el+ as a string.
438
- def inner(el, opts); end
439
-
440
- # Wrap the +text+ inside a LaTeX environment of type +type+. The element +el+ is passed on to
441
- # the method #attribute_list -- the resulting string is appended to both the \\begin and the
442
- # \\end lines of the LaTeX environment for easier post-processing of LaTeX environments.
443
- def latex_environment(type, el, text); end
444
-
445
- # Return a string containing a valid \hypertarget command if the element has an ID defined, or
446
- # +nil+ otherwise. If the parameter +add_label+ is +true+, a \label command will also be used
447
- # additionally to the \hypertarget command.
448
- def latex_link_target(el, add_label = T.unsafe(nil)); end
449
-
450
- # Normalize the abbreviation key so that it only contains allowed ASCII character
451
- def normalize_abbreviation_key(key); end
452
- end
453
-
454
- # Inspired by Maruku: entity conversion table based on the one from htmltolatex
455
- # (http://sourceforge.net/projects/htmltolatex/), with some small adjustments/additions
456
- Kramdown::Converter::Latex::ENTITY_CONV_TABLE = T.let(T.unsafe(nil), Hash)
457
-
458
- Kramdown::Converter::Latex::ESCAPE_MAP = T.let(T.unsafe(nil), Hash)
459
- Kramdown::Converter::Latex::ESCAPE_RE = T.let(T.unsafe(nil), Regexp)
460
- Kramdown::Converter::Latex::TABLE_ALIGNMENT_CHAR = T.let(T.unsafe(nil), Hash)
461
- Kramdown::Converter::Latex::TYPOGRAPHIC_SYMS = T.let(T.unsafe(nil), Hash)
462
-
463
- # Converts a Kramdown::Document to a manpage in groff format. See man(7), groff_man(7) and
464
- # man-pages(7) for information regarding the output.
465
- class Kramdown::Converter::Man < ::Kramdown::Converter::Base
466
- def convert(el, opts = T.unsafe(nil)); end
467
-
468
- private
469
-
470
- def convert_a(el, opts); end
471
- def convert_abbreviation(el, opts); end
472
- def convert_blank(*_arg0); end
473
- def convert_blockquote(el, opts); end
474
- def convert_br(_el, opts); end
475
- def convert_codeblock(el, opts); end
476
- def convert_codespan(el, opts); end
477
- def convert_comment(el, opts); end
478
- def convert_dd(el, opts); end
479
- def convert_dl(el, opts); end
480
- def convert_dt(el, opts); end
481
- def convert_em(el, opts); end
482
- def convert_entity(el, opts); end
483
- def convert_footnote(*_arg0); end
484
- def convert_header(el, opts); end
485
- def convert_hr(*_arg0); end
486
- def convert_html_element(*_arg0); end
487
- def convert_img(_el, _opts); end
488
- def convert_li(el, opts); end
489
- def convert_math(el, opts); end
490
- def convert_ol(el, opts); end
491
- def convert_p(el, opts); end
492
- def convert_raw(*_arg0); end
493
- def convert_root(el, opts); end
494
- def convert_smart_quote(el, opts); end
495
- def convert_strong(el, opts); end
496
- def convert_table(el, opts); end
497
- def convert_tbody(el, opts); end
498
- def convert_td(el, opts); end
499
- def convert_text(el, opts); end
500
- def convert_tfoot(el, opts); end
501
- def convert_thead(el, opts); end
502
- def convert_tr(el, opts); end
503
- def convert_typographic_sym(el, opts); end
504
- def convert_ul(el, opts); end
505
- def convert_xml_comment(el, opts); end
506
- def convert_xml_pi(*_arg0); end
507
- def escape(text, preserve_whitespace = T.unsafe(nil)); end
508
- def inner(el, opts, use = T.unsafe(nil)); end
509
- def macro(name, *args); end
510
- def newline(text); end
511
- def quote(text); end
512
- def unicode_char(codepoint); end
513
- end
514
-
515
- Kramdown::Converter::Man::TABLE_CELL_ALIGNMENT = T.let(T.unsafe(nil), Hash)
516
- Kramdown::Converter::Man::TYPOGRAPHIC_SYMS_MAP = T.let(T.unsafe(nil), Hash)
517
-
518
- # Removes all block (and optionally span) level HTML tags from the element tree.
519
- #
520
- # This converter can be used on parsed HTML documents to get an element tree that will only
521
- # contain native kramdown elements.
522
- #
523
- # *Note* that the returned element tree may not be fully conformant (i.e. the content models of
524
- # *some elements may be violated)!
525
- #
526
- # This converter modifies the given tree in-place and returns it.
527
- class Kramdown::Converter::RemoveHtmlTags < ::Kramdown::Converter::Base
528
- # @return [RemoveHtmlTags] a new instance of RemoveHtmlTags
529
- def initialize(root, options); end
530
-
531
- def convert(el); end
532
- end
533
-
534
- # Converts a Kramdown::Document to an element tree that represents the table of contents.
535
- #
536
- # The returned tree consists of Element objects of type :toc where the root element is just used
537
- # as container object. Each :toc element contains as value the wrapped :header element and under
538
- # the attribute key :id the header ID that should be used (note that this ID may not exist in
539
- # the wrapped element).
540
- #
541
- # Since the TOC tree consists of special :toc elements, one cannot directly feed this tree to
542
- # other converters!
543
- class Kramdown::Converter::Toc < ::Kramdown::Converter::Base
544
- # @return [Toc] a new instance of Toc
545
- def initialize(root, options); end
546
-
547
- def convert(el); end
548
-
549
- private
550
-
551
- def add_to_toc(el, id); end
552
- end
553
-
554
- # The main interface to kramdown.
555
- #
556
- # This class provides a one-stop-shop for using kramdown to convert text into various output
557
- # formats. Use it like this:
558
- #
559
- # require 'kramdown'
560
- # doc = Kramdown::Document.new('This *is* some kramdown text')
561
- # puts doc.to_html
562
- #
563
- # The #to_html method is a shortcut for using the Converter::Html class. See #method_missing for
564
- # more information.
565
- #
566
- # The second argument to the ::new method is an options hash for customizing the behaviour of the
567
- # used parser and the converter. See ::new for more information!
568
- class Kramdown::Document
569
- # Create a new Kramdown document from the string +source+ and use the provided +options+. The
570
- # options that can be used are defined in the Options module.
571
- #
572
- # The special options key :input can be used to select the parser that should parse the
573
- # +source+. It has to be the name of a class in the Kramdown::Parser module. For example, to
574
- # select the kramdown parser, one would set the :input key to +Kramdown+. If this key is not
575
- # set, it defaults to +Kramdown+.
576
- #
577
- # The +source+ is immediately parsed by the selected parser so that the root element is
578
- # immediately available and the output can be generated.
579
- #
580
- # @return [Document] a new instance of Document
581
- def initialize(source, options = T.unsafe(nil)); end
582
-
583
- def inspect; end
584
-
585
- # Check if a method is invoked that begins with +to_+ and if so, try to instantiate a converter
586
- # class (i.e. a class in the Kramdown::Converter module) and use it for converting the document.
587
- #
588
- # For example, +to_html+ would instantiate the Kramdown::Converter::Html class.
589
- def method_missing(id, *attr, &block); end
590
-
591
- # The options hash which holds the options for parsing/converting the Kramdown document.
592
- def options; end
593
-
594
- # The root Element of the element tree. It is immediately available after the ::new method has
595
- # been called.
596
- def root; end
597
-
598
- # The root Element of the element tree. It is immediately available after the ::new method has
599
- # been called.
600
- def root=(_arg0); end
601
-
602
- # An array of warning messages. It is filled with warnings during the parsing phase (i.e. in
603
- # ::new) and the conversion phase.
604
- def warnings; end
605
-
606
- protected
607
-
608
- # Try requiring a parser or converter class and don't raise an error if the file is not found.
609
- def try_require(type, name); end
610
- end
611
-
612
- # Represents all elements in the element tree.
613
- #
614
- # kramdown only uses this one class for representing all available elements in an element tree
615
- # (paragraphs, headers, emphasis, ...). The type of element can be set via the #type accessor.
616
- #
617
- # The root of a kramdown element tree has to be an element of type :root. It needs to have certain
618
- # option keys set so that conversions work correctly. If only a part of a tree should be
619
- # converted, duplicate the root node and assign the #children appropriately, e.g:
620
- #
621
- # root = doc.root
622
- # new_root = root.dup
623
- # new_root.children = [root.children[0]] # assign new array with elements to convert
624
- #
625
- # Following is a description of all supported element types.
626
- #
627
- # Note that the option :location may contain the start line number of an element in the source
628
- # document.
629
- #
630
- # == Structural Elements
631
- #
632
- # === :root
633
- #
634
- # [Category] None
635
- # [Usage context] As the root element of a document
636
- # [Content model] Block-level elements
637
- #
638
- # Represents the root of a kramdown document.
639
- #
640
- # The root element contains the following option keys:
641
- #
642
- # parts of the kramdown document.
643
- #
644
- # :abbrev_defs:: This key may be used to store the mapping of abbreviation to abbreviation
645
- # definition.
646
- #
647
- # :abbrev_attr:: This key may be used to store the mapping of abbreviation to abbreviation
648
- # attributes.
649
- #
650
- # :options:: This key may be used to store options that were set during parsing of the document.
651
- #
652
- # :footnote_count:: This key stores the number of actually referenced footnotes of the document.
653
- #
654
- # === :blank
655
- #
656
- # [Category] Block-level element
657
- # [Usage context] Where block-level elements are expected
658
- # [Content model] Empty
659
- #
660
- # Represents one or more blank lines. It is not allowed to have two or more consecutive blank
661
- # elements.
662
- #
663
- # The +value+ field may contain the original content of the blank lines.
664
- #
665
- #
666
- # === :p
667
- #
668
- # [Category] Block-level element
669
- # [Usage context] Where block-level elements are expected
670
- # [Content model] Span-level elements
671
- #
672
- # Represents a paragraph.
673
- #
674
- # If the option :transparent is +true+, this element just represents a block of text. I.e. this
675
- # element just functions as a container for span-level elements.
676
- #
677
- #
678
- # === :header
679
- #
680
- # [Category] Block-level element
681
- # [Usage context] Where block-level elements are expected
682
- # [Content model] Span-level elements
683
- #
684
- # Represents a header.
685
- #
686
- # The option :level specifies the header level and has to contain a number between 1 and \6. The
687
- # option :raw_text has to contain the raw header text.
688
- #
689
- #
690
- # === :blockquote
691
- #
692
- # [Category] Block-level element
693
- # [Usage context] Where block-level elements are expected
694
- # [Content model] Block-level elements
695
- #
696
- # Represents a blockquote.
697
- #
698
- #
699
- # === :codeblock
700
- #
701
- # [Category] Block-level element
702
- # [Usage context] Where block-level elements are expected
703
- # [Content model] Empty
704
- #
705
- # Represents a code block, i.e. a block of text that should be used as-is.
706
- #
707
- # The +value+ field has to contain the content of the code block.
708
- #
709
- # The option :lang specifies a highlighting language with possible HTML style options (e.g.
710
- # php?start_inline=1) and should be used instead of a possibly also available language embedded in
711
- # a class name of the form 'language-LANG'.
712
- #
713
- #
714
- # === :ul
715
- #
716
- # [Category] Block-level element
717
- # [Usage context] Where block-level elements are expected
718
- # [Content model] One or more :li elements
719
- #
720
- # Represents an unordered list.
721
- #
722
- #
723
- # === :ol
724
- #
725
- # [Category] Block-level element
726
- # [Usage context] Where block-level elements are expected
727
- # [Content model] One or more :li elements
728
- #
729
- # Represents an ordered list.
730
- #
731
- #
732
- # === :li
733
- #
734
- # [Category] Block-level element
735
- # [Usage context] Inside :ol and :ul elements
736
- # [Content model] Block-level elements
737
- #
738
- # Represents a list item of an ordered or unordered list.
739
- #
740
- # Note that the first child of a list item must not be a :blank element!
741
- #
742
- #
743
- # === :dl
744
- #
745
- # [Category] Block-level element
746
- # [Usage context] Where block-level elements are expected
747
- # [Content model] One or more groups each consisting of one or more :dt elements followed by one
748
- # or more :dd elements.
749
- #
750
- # Represents a definition list which contains groups consisting of terms and definitions for them.
751
- #
752
- #
753
- # === :dt
754
- #
755
- # [Category] Block-level element
756
- # [Usage context] Before :dt or :dd elements inside a :dl elment
757
- # [Content model] Span-level elements
758
- #
759
- # Represents the term part of a term-definition group in a definition list.
760
- #
761
- #
762
- # === :dd
763
- #
764
- # [Category] Block-level element
765
- # [Usage context] After :dt or :dd elements inside a :dl elment
766
- # [Content model] Block-level elements
767
- #
768
- # Represents the definition part of a term-definition group in a definition list.
769
- #
770
- #
771
- # === :hr
772
- #
773
- # [Category] Block-level element
774
- # [Usage context] Where block-level elements are expected
775
- # [Content model] None
776
- #
777
- # Represents a horizontal line.
778
- #
779
- #
780
- # === :table
781
- #
782
- # [Category] Block-level element
783
- # [Usage context] Where block-level elements are expected
784
- # [Content model] Zero or one :thead elements, one or more :tbody elements, zero or one :tfoot
785
- # elements
786
- #
787
- # Represents a table. Each table row (i.e. :tr element) of the table has to contain the same
788
- # number of :td elements.
789
- #
790
- # The option :alignment has to be an array containing the alignment values, exactly one for each
791
- # column of the table. The possible alignment values are :left, :center, :right and :default.
792
- #
793
- #
794
- # === :thead
795
- #
796
- # [Category] None
797
- # [Usage context] As first element inside a :table element
798
- # [Content model] One or more :tr elements
799
- #
800
- # Represents the table header.
801
- #
802
- #
803
- # === :tbody
804
- #
805
- # [Category] None
806
- # [Usage context] After a :thead element but before a :tfoot element inside a :table element
807
- # [Content model] One or more :tr elements
808
- #
809
- # Represents a table body.
810
- #
811
- #
812
- # === :tfoot
813
- #
814
- # [Category] None
815
- # [Usage context] As last element inside a :table element
816
- # [Content model] One or more :tr elements
817
- #
818
- # Represents the table footer.
819
- #
820
- #
821
- # === :tr
822
- #
823
- # [Category] None
824
- # [Usage context] Inside :thead, :tbody and :tfoot elements
825
- # [Content model] One or more :td elements
826
- #
827
- # Represents a table row.
828
- #
829
- #
830
- # === :td
831
- #
832
- # [Category] Block-level element
833
- # [Usage context] Inside :tr elements
834
- # [Content model] As child of :thead/:tr span-level elements, as child of :tbody/:tr and
835
- # :tfoot/:tr block-level elements
836
- #
837
- # Represents a table cell.
838
- #
839
- #
840
- # === :math
841
- #
842
- # [Category] Block/span-level element
843
- # [Usage context] Where block/span-level elements are expected
844
- # [Content model] None
845
- #
846
- # Represents mathematical text that is written in LaTeX.
847
- #
848
- # The +value+ field has to contain the actual mathematical text.
849
- #
850
- # The option :category has to be set to either :span or :block depending on the context where the
851
- # element is used.
852
- #
853
- #
854
- # == Text Markup Elements
855
- #
856
- # === :text
857
- #
858
- # [Category] Span-level element
859
- # [Usage context] Where span-level elements are expected
860
- # [Content model] None
861
- #
862
- # Represents text.
863
- #
864
- # The +value+ field has to contain the text itself.
865
- #
866
- #
867
- # === :br
868
- #
869
- # [Category] Span-level element
870
- # [Usage context] Where span-level elements are expected
871
- # [Content model] None
872
- #
873
- # Represents a hard line break.
874
- #
875
- #
876
- # === :a
877
- #
878
- # [Category] Span-level element
879
- # [Usage context] Where span-level elements are expected
880
- # [Content model] Span-level elements
881
- #
882
- # Represents a link to an URL.
883
- #
884
- # The attribute +href+ has to be set to the URL to which the link points. The attribute +title+
885
- # optionally contains the title of the link.
886
- #
887
- #
888
- # === :img
889
- #
890
- # [Category] Span-level element
891
- # [Usage context] Where span-level elements are expected
892
- # [Content model] None
893
- #
894
- # Represents an image.
895
- #
896
- # The attribute +src+ has to be set to the URL of the image. The attribute +alt+ has to contain a
897
- # text description of the image. The attribute +title+ optionally contains the title of the image.
898
- #
899
- #
900
- # === :codespan
901
- #
902
- # [Category] Span-level element
903
- # [Usage context] Where span-level elements are expected
904
- # [Content model] None
905
- #
906
- # Represents verbatim text.
907
- #
908
- # The +value+ field has to contain the content of the code span.
909
- #
910
- #
911
- # === :footnote
912
- #
913
- # [Category] Span-level element
914
- # [Usage context] Where span-level elements are expected
915
- # [Content model] None
916
- #
917
- # Represents a footnote marker.
918
- #
919
- # The +value+ field has to contain an element whose children are the content of the footnote. The
920
- # option :name has to contain a valid and unique footnote name. A valid footnote name consists of
921
- # a word character or a digit and then optionally followed by other word characters, digits or
922
- # dashes.
923
- #
924
- #
925
- # === :em
926
- #
927
- # [Category] Span-level element
928
- # [Usage context] Where span-level elements are expected
929
- # [Content model] Span-level elements
930
- #
931
- # Represents emphasis of its contents.
932
- #
933
- #
934
- # === :strong
935
- #
936
- # [Category] Span-level element
937
- # [Usage context] Where span-level elements are expected
938
- # [Content model] Span-level elements
939
- #
940
- # Represents strong importance for its contents.
941
- #
942
- #
943
- # === :entity
944
- #
945
- # [Category] Span-level element
946
- # [Usage context] Where span-level elements are expected
947
- # [Content model] None
948
- #
949
- # Represents an HTML entity.
950
- #
951
- # The +value+ field has to contain an instance of Kramdown::Utils::Entities::Entity. The option
952
- # :original can be used to store the original representation of the entity.
953
- #
954
- #
955
- # === :typographic_sym
956
- #
957
- # [Category] Span-level element
958
- # [Usage context] Where span-level elements are expected
959
- # [Content model] None
960
- #
961
- # Represents a typographic symbol.
962
- #
963
- # The +value+ field needs to contain a Symbol representing the specific typographic symbol from
964
- # the following list:
965
- #
966
- # :mdash:: An mdash character (---)
967
- # :ndash:: An ndash character (--)
968
- # :hellip:: An ellipsis (...)
969
- # :laquo:: A left guillemet (<<)
970
- # :raquo:: A right guillemet (>>)
971
- # :laquo_space:: A left guillemet with a space (<< )
972
- # :raquo_space:: A right guillemet with a space ( >>)
973
- #
974
- #
975
- # === :smart_quote
976
- #
977
- # [Category] Span-level element
978
- # [Usage context] Where span-level elements are expected
979
- # [Content model] None
980
- #
981
- # Represents a quotation character.
982
- #
983
- # The +value+ field needs to contain a Symbol representing the specific quotation character:
984
- #
985
- # :lsquo:: Left single quote
986
- # :rsquo:: Right single quote
987
- # :ldquo:: Left double quote
988
- # :rdquo:: Right double quote
989
- #
990
- #
991
- # === :abbreviation
992
- #
993
- # [Category] Span-level element
994
- # [Usage context] Where span-level elements are expected
995
- # [Content model] None
996
- #
997
- # Represents a text part that is an abbreviation.
998
- #
999
- # The +value+ field has to contain the text part that is the abbreviation. The definition of the
1000
- # abbreviation is stored in the :root element of the document.
1001
- #
1002
- #
1003
- # == Other Elements
1004
- #
1005
- # === :html_element
1006
- #
1007
- # [Category] Block/span-level element
1008
- # [Usage context] Where block/span-level elements or raw HTML elements are expected
1009
- # [Content model] Depends on the element
1010
- #
1011
- # Represents an HTML element.
1012
- #
1013
- # The +value+ field has to contain the name of the HTML element the element is representing.
1014
- #
1015
- # The option :category has to be set to either :span or :block depending on the whether the
1016
- # element is a block-level or a span-level element. The option :content_model has to be set to the
1017
- # content model for the element (either :block if it contains block-level elements, :span if it
1018
- # contains span-level elements or :raw if it contains raw content).
1019
- #
1020
- #
1021
- # === :xml_comment
1022
- #
1023
- # [Category] Block/span-level element
1024
- # [Usage context] Where block/span-level elements are expected or in raw HTML elements
1025
- # [Content model] None
1026
- #
1027
- # Represents an XML/HTML comment.
1028
- #
1029
- # The +value+ field has to contain the whole XML/HTML comment including the delimiters.
1030
- #
1031
- # The option :category has to be set to either :span or :block depending on the context where the
1032
- # element is used.
1033
- #
1034
- #
1035
- # === :xml_pi
1036
- #
1037
- # [Category] Block/span-level element
1038
- # [Usage context] Where block/span-level elements are expected or in raw HTML elements
1039
- # [Content model] None
1040
- #
1041
- # Represents an XML/HTML processing instruction.
1042
- #
1043
- # The +value+ field has to contain the whole XML/HTML processing instruction including the
1044
- # delimiters.
1045
- #
1046
- # The option :category has to be set to either :span or :block depending on the context where the
1047
- # element is used.
1048
- #
1049
- #
1050
- # === :comment
1051
- #
1052
- # [Category] Block/span-level element
1053
- # [Usage context] Where block/span-level elements are expected
1054
- # [Content model] None
1055
- #
1056
- # Represents a comment.
1057
- #
1058
- # The +value+ field has to contain the comment.
1059
- #
1060
- # The option :category has to be set to either :span or :block depending on the context where the
1061
- # element is used. If it is set to :span, then no blank lines are allowed in the comment.
1062
- #
1063
- #
1064
- # === :raw
1065
- #
1066
- # [Category] Block/span-level element
1067
- # [Usage context] Where block/span-level elements are expected
1068
- # [Content model] None
1069
- #
1070
- # Represents a raw string that should not be modified. For example, the element could contain some
1071
- # HTML code that should be output as-is without modification and escaping.
1072
- #
1073
- # The +value+ field has to contain the actual raw text.
1074
- #
1075
- # The option :category has to be set to either :span or :block depending on the context where the
1076
- # element is used. If it is set to :span, then no blank lines are allowed in the raw text.
1077
- #
1078
- # The option :type can be set to an array of strings to define for which converters the raw string
1079
- # is valid.
1080
- class Kramdown::Element
1081
- # Create a new Element object of type +type+. The optional parameters +value+, +attr+ and
1082
- # +options+ can also be set in this constructor for convenience.
1083
- #
1084
- # @return [Element] a new instance of Element
1085
- def initialize(type, value = T.unsafe(nil), attr = T.unsafe(nil), options = T.unsafe(nil)); end
1086
-
1087
- # The attributes of the element.
1088
- def attr; end
1089
-
1090
- # syntactic sugar to simplify calls such as +Kramdown::Element.category(el) == :block+ with
1091
- # +el.block?+.
1092
- #
1093
- # Returns boolean true or false.
1094
- #
1095
- # @return [Boolean]
1096
- def block?; end
1097
-
1098
- # The child elements of this element.
1099
- def children; end
1100
-
1101
- # The child elements of this element.
1102
- def children=(_arg0); end
1103
-
1104
- def inspect; end
1105
-
1106
- # The options hash for the element. It is used for storing arbitray options.
1107
- def options; end
1108
-
1109
- # syntactic sugar to simplify calls such as +Kramdown::Element.category(el) == :span+ with
1110
- # +el.span?+.
1111
- #
1112
- # Returns boolean true or false.
1113
- #
1114
- # @return [Boolean]
1115
- def span?; end
1116
-
1117
- # A symbol representing the element type. For example, :p or :blockquote.
1118
- def type; end
1119
-
1120
- # A symbol representing the element type. For example, :p or :blockquote.
1121
- def type=(_arg0); end
1122
-
1123
- # The value of the element. The interpretation of this field depends on the type of the element.
1124
- # Many elements don't use this field.
1125
- def value; end
1126
-
1127
- # The value of the element. The interpretation of this field depends on the type of the element.
1128
- # Many elements don't use this field.
1129
- def value=(_arg0); end
1130
-
1131
- class << self
1132
- # Return the category of +el+ which can be :block, :span or +nil+.
1133
- #
1134
- # Most elements have a fixed category, however, some elements can either appear in a block-level
1135
- # or a span-level context. These elements need to have the option :category correctly set.
1136
- def category(el); end
1137
- end
1138
- end
1139
-
1140
- Kramdown::Element::CATEGORY = T.let(T.unsafe(nil), Hash)
1141
-
1142
- # This error is raised when an error condition is encountered.
1143
- #
1144
- # *Note* that this error is only raised by the support framework for the parsers and converters.
1145
- class Kramdown::Error < ::RuntimeError; end
1146
-
1147
- # This module defines all options that are used by parsers and/or converters as well as providing
1148
- # methods to deal with the options.
1149
- module Kramdown::Options
1150
- class << self
1151
- # Return a Hash with the default values for all options.
1152
- def defaults; end
1153
-
1154
- # Define a new option called +name+ (a Symbol) with the given +type+ (String, Integer, Float,
1155
- # Symbol, Boolean, Object), default value +default+ and the description +desc+. If a block is
1156
- # specified, it should validate the value and either raise an error or return a valid value.
1157
- #
1158
- # The type 'Object' should only be used for complex types for which none of the other types
1159
- # suffices. A block needs to be specified when using type 'Object' and it has to cope with
1160
- # a value given as string and as the opaque type.
1161
- #
1162
- # @raise [ArgumentError]
1163
- def define(name, type, default, desc, &block); end
1164
-
1165
- # Return +true+ if an option called +name+ is defined.
1166
- #
1167
- # @return [Boolean]
1168
- def defined?(name); end
1169
-
1170
- # Return all option definitions.
1171
- def definitions; end
1172
-
1173
- # Merge the #defaults Hash with the *parsed* options from the given Hash, i.e. only valid option
1174
- # names are considered and their value is run through the #parse method.
1175
- def merge(hash); end
1176
-
1177
- # Parse the given value +data+ as if it was a value for the option +name+ and return the parsed
1178
- # value with the correct type.
1179
- #
1180
- # If +data+ already has the correct type, it is just returned. Otherwise it is converted to a
1181
- # String and then to the correct type.
1182
- #
1183
- # @raise [ArgumentError]
1184
- def parse(name, data); end
1185
-
1186
- # Ensures that the option value +val+ for the option called +name+ is a valid array. The
1187
- # parameter +val+ can be
1188
- #
1189
- # - a comma separated string which is split into an array of values
1190
- # - or an array.
1191
- #
1192
- # Optionally, the array is checked for the correct size.
1193
- def simple_array_validator(val, name, size = T.unsafe(nil)); end
1194
-
1195
- # Ensures that the option value +val+ for the option called +name+ is a valid hash. The
1196
- # parameter +val+ can be
1197
- #
1198
- # - a hash in YAML format
1199
- # - or a Ruby Hash object.
1200
- #
1201
- # @raise [Kramdown::Error]
1202
- def simple_hash_validator(val, name); end
1203
-
1204
- # Converts the given String +data+ into a Symbol or +nil+ with the
1205
- # following provisions:
1206
- #
1207
- # - A leading colon is stripped from the string.
1208
- # - An empty value or a value equal to "nil" results in +nil+.
1209
- def str_to_sym(data); end
1210
- end
1211
- end
1212
-
1213
- # Allowed option types.
1214
- Kramdown::Options::ALLOWED_TYPES = T.let(T.unsafe(nil), Array)
1215
-
1216
- # Helper class introducing a boolean type for specifying boolean values (+true+ and +false+) as
1217
- # option types.
1218
- class Kramdown::Options::Boolean
1219
- class << self
1220
- # Return +true+ if +other+ is either +true+ or +false+
1221
- def ===(other); end
1222
- end
1223
- end
1224
-
1225
- # Struct class for storing the definition of an option.
1226
- class Kramdown::Options::Definition < ::Struct
1227
- # Returns the value of attribute default
1228
- #
1229
- # @return [Object] the current value of default
1230
- def default; end
1231
-
1232
- # Sets the attribute default
1233
- #
1234
- # @param value [Object] the value to set the attribute default to.
1235
- # @return [Object] the newly set value
1236
- def default=(_); end
1237
-
1238
- # Returns the value of attribute desc
1239
- #
1240
- # @return [Object] the current value of desc
1241
- def desc; end
1242
-
1243
- # Sets the attribute desc
1244
- #
1245
- # @param value [Object] the value to set the attribute desc to.
1246
- # @return [Object] the newly set value
1247
- def desc=(_); end
1248
-
1249
- # Returns the value of attribute name
1250
- #
1251
- # @return [Object] the current value of name
1252
- def name; end
1253
-
1254
- # Sets the attribute name
1255
- #
1256
- # @param value [Object] the value to set the attribute name to.
1257
- # @return [Object] the newly set value
1258
- def name=(_); end
1259
-
1260
- # Returns the value of attribute type
1261
- #
1262
- # @return [Object] the current value of type
1263
- def type; end
1264
-
1265
- # Sets the attribute type
1266
- #
1267
- # @param value [Object] the value to set the attribute type to.
1268
- # @return [Object] the newly set value
1269
- def type=(_); end
1270
-
1271
- # Returns the value of attribute validator
1272
- #
1273
- # @return [Object] the current value of validator
1274
- def validator; end
1275
-
1276
- # Sets the attribute validator
1277
- #
1278
- # @param value [Object] the value to set the attribute validator to.
1279
- # @return [Object] the newly set value
1280
- def validator=(_); end
1281
-
1282
- class << self
1283
- def [](*_arg0); end
1284
- def inspect; end
1285
- def members; end
1286
- def new(*_arg0); end
1287
- end
1288
- end
1289
-
1290
- Kramdown::Options::SMART_QUOTES_ENTITIES = T.let(T.unsafe(nil), Array)
1291
- Kramdown::Options::SMART_QUOTES_STR = T.let(T.unsafe(nil), String)
1292
- Kramdown::Options::TOC_LEVELS_ARRAY = T.let(T.unsafe(nil), Array)
1293
- Kramdown::Options::TOC_LEVELS_RANGE = T.let(T.unsafe(nil), Range)
1294
-
1295
- # This module contains all available parsers. A parser takes an input string and converts the
1296
- # string to an element tree.
1297
- #
1298
- # New parsers should be derived from the Base class which provides common functionality - see its
1299
- # API documentation for how to create a custom converter class.
1300
- module Kramdown::Parser; end
1301
-
1302
- # == \Base class for parsers
1303
- #
1304
- # This class serves as base class for parsers. It provides common methods that can/should be
1305
- # used by all parsers, especially by those using StringScanner(Kramdown) for parsing.
1306
- #
1307
- # A parser object is used as a throw-away object, i.e. it is only used for storing the needed
1308
- # state information during parsing. Therefore one can't instantiate a parser object directly but
1309
- # only use the Base::parse method.
1310
- #
1311
- # == Implementing a parser
1312
- #
1313
- # Implementing a new parser is rather easy: just derive a new class from this class and put it
1314
- # in the Kramdown::Parser module -- the latter is needed so that the auto-detection of the new
1315
- # parser works correctly. Then you need to implement the +#parse+ method which has to contain
1316
- # the parsing code.
1317
- #
1318
- # Have a look at the Base::parse, Base::new and Base#parse methods for additional information!
1319
- class Kramdown::Parser::Base
1320
- # Initialize the parser object with the +source+ string and the parsing +options+.
1321
- #
1322
- # The @root element, the @warnings array and @text_type (specifies the default type for newly
1323
- # created text nodes) are automatically initialized.
1324
- #
1325
- # @return [Base] a new instance of Base
1326
- def initialize(source, options); end
1327
-
1328
- # Modify the string +source+ to be usable by the parser (unifies line ending characters to
1329
- # +\n+ and makes sure +source+ ends with a new line character).
1330
- def adapt_source(source); end
1331
-
1332
- # This helper method adds the given +text+ either to the last element in the +tree+ if it is a
1333
- # +type+ element or creates a new text element with the given +type+.
1334
- def add_text(text, tree = T.unsafe(nil), type = T.unsafe(nil)); end
1335
-
1336
- # Extract the part of the StringScanner +strscan+ backed string specified by the +range+. This
1337
- # method works correctly under Ruby 1.8 and Ruby 1.9.
1338
- def extract_string(range, strscan); end
1339
-
1340
- # The hash with the parsing options.
1341
- def options; end
1342
-
1343
- # Parse the source string into an element tree.
1344
- #
1345
- # The parsing code should parse the source provided in @source and build an element tree the
1346
- # root of which should be @root.
1347
- #
1348
- # This is the only method that has to be implemented by sub-classes!
1349
- #
1350
- # @raise [NotImplementedError]
1351
- def parse; end
1352
-
1353
- # The root element of element tree that is created from the source string.
1354
- def root; end
1355
-
1356
- # The original source string.
1357
- def source; end
1358
-
1359
- # Add the given warning +text+ to the warning array.
1360
- def warning(text); end
1361
-
1362
- # The array with the parser warnings.
1363
- def warnings; end
1364
-
1365
- class << self
1366
- # Parse the +source+ string into an element tree, possibly using the parsing +options+, and
1367
- # return the root element of the element tree and an array with warning messages.
1368
- #
1369
- # Initializes a new instance of the calling class and then calls the +#parse+ method that must
1370
- # be implemented by each subclass.
1371
- def parse(source, options = T.unsafe(nil)); end
1372
- end
1373
- end
1374
-
1375
- # Used for parsing an HTML document.
1376
- #
1377
- # The parsing code is in the Parser module that can also be used by other parsers.
1378
- class Kramdown::Parser::Html < ::Kramdown::Parser::Base
1379
- include ::Kramdown::Parser::Html::Constants
1380
- include ::Kramdown::Parser::Html::Parser
1381
-
1382
- # Parse the source string provided on initialization as HTML document.
1383
- def parse; end
1384
- end
1385
-
1386
- # Contains all constants that are used when parsing.
1387
- module Kramdown::Parser::Html::Constants; end
1388
-
1389
- Kramdown::Parser::Html::Constants::HTML_ATTRIBUTE_RE = T.let(T.unsafe(nil), Regexp)
1390
- Kramdown::Parser::Html::Constants::HTML_BLOCK_ELEMENTS = T.let(T.unsafe(nil), Array)
1391
- Kramdown::Parser::Html::Constants::HTML_COMMENT_RE = T.let(T.unsafe(nil), Regexp)
1392
-
1393
- # The following elements are also parsed as raw since they need child elements that cannot
1394
- # be expressed using kramdown syntax: colgroup table tbody thead tfoot tr ul ol
1395
- Kramdown::Parser::Html::Constants::HTML_CONTENT_MODEL = T.let(T.unsafe(nil), Hash)
1396
-
1397
- Kramdown::Parser::Html::Constants::HTML_CONTENT_MODEL_BLOCK = T.let(T.unsafe(nil), Array)
1398
- Kramdown::Parser::Html::Constants::HTML_CONTENT_MODEL_RAW = T.let(T.unsafe(nil), Array)
1399
- Kramdown::Parser::Html::Constants::HTML_CONTENT_MODEL_SPAN = T.let(T.unsafe(nil), Array)
1400
-
1401
- # :stopdoc:
1402
- # The following regexps are based on the ones used by REXML, with some slight modifications.
1403
- Kramdown::Parser::Html::Constants::HTML_DOCTYPE_RE = T.let(T.unsafe(nil), Regexp)
1404
-
1405
- Kramdown::Parser::Html::Constants::HTML_ELEMENT = T.let(T.unsafe(nil), Hash)
1406
- Kramdown::Parser::Html::Constants::HTML_ELEMENTS_WITHOUT_BODY = T.let(T.unsafe(nil), Array)
1407
- Kramdown::Parser::Html::Constants::HTML_ENTITY_RE = T.let(T.unsafe(nil), Regexp)
1408
- Kramdown::Parser::Html::Constants::HTML_INSTRUCTION_RE = T.let(T.unsafe(nil), Regexp)
1409
-
1410
- # Some HTML elements like script belong to both categories (i.e. are valid in block and
1411
- # span HTML) and don't appear therefore!
1412
- # script, textarea
1413
- Kramdown::Parser::Html::Constants::HTML_SPAN_ELEMENTS = T.let(T.unsafe(nil), Array)
1414
-
1415
- Kramdown::Parser::Html::Constants::HTML_TAG_CLOSE_RE = T.let(T.unsafe(nil), Regexp)
1416
- Kramdown::Parser::Html::Constants::HTML_TAG_RE = T.let(T.unsafe(nil), Regexp)
1417
-
1418
- # Converts HTML elements to native elements if possible.
1419
- class Kramdown::Parser::Html::ElementConverter
1420
- include ::Kramdown::Parser::Html::Constants
1421
- include ::Kramdown::Utils::Entities
1422
-
1423
- # @return [ElementConverter] a new instance of ElementConverter
1424
- def initialize(root); end
1425
-
1426
- def convert_a(el); end
1427
- def convert_b(el); end
1428
- def convert_code(el); end
1429
- def convert_em(el); end
1430
- def convert_h1(el); end
1431
- def convert_h2(el); end
1432
- def convert_h3(el); end
1433
- def convert_h4(el); end
1434
- def convert_h5(el); end
1435
- def convert_h6(el); end
1436
- def convert_i(el); end
1437
- def convert_pre(el); end
1438
- def convert_script(el); end
1439
- def convert_strong(el); end
1440
- def convert_table(el); end
1441
- def convert_textarea(el); end
1442
- def extract_text(el, raw); end
1443
- def handle_math_tag(el); end
1444
-
1445
- # @return [Boolean]
1446
- def is_math_tag?(el); end
1447
-
1448
- # @return [Boolean]
1449
- def is_simple_table?(el); end
1450
-
1451
- # Convert the element +el+ and its children.
1452
- def process(el, do_conversion = T.unsafe(nil), preserve_text = T.unsafe(nil), parent = T.unsafe(nil)); end
1453
-
1454
- def process_children(el, do_conversion = T.unsafe(nil), preserve_text = T.unsafe(nil)); end
1455
- def process_html_element(el, do_conversion = T.unsafe(nil), preserve_text = T.unsafe(nil)); end
1456
-
1457
- # Process the HTML text +raw+: compress whitespace (if +preserve+ is +false+) and convert
1458
- # entities in entity elements.
1459
- def process_text(raw, preserve = T.unsafe(nil)); end
1460
-
1461
- def remove_text_children(el); end
1462
- def remove_whitespace_children(el); end
1463
- def set_basics(el, type, opts = T.unsafe(nil)); end
1464
- def strip_whitespace(el); end
1465
- def wrap_text_children(el); end
1466
-
1467
- class << self
1468
- def convert(root, el = T.unsafe(nil)); end
1469
- end
1470
- end
1471
-
1472
- Kramdown::Parser::Html::ElementConverter::EMPHASIS_TYPE_MAP = T.let(T.unsafe(nil), Hash)
1473
- Kramdown::Parser::Html::ElementConverter::REMOVE_TEXT_CHILDREN = T.let(T.unsafe(nil), Array)
1474
- Kramdown::Parser::Html::ElementConverter::REMOVE_WHITESPACE_CHILDREN = T.let(T.unsafe(nil), Array)
1475
- Kramdown::Parser::Html::ElementConverter::SIMPLE_ELEMENTS = T.let(T.unsafe(nil), Array)
1476
- Kramdown::Parser::Html::ElementConverter::STRIP_WHITESPACE = T.let(T.unsafe(nil), Array)
1477
- Kramdown::Parser::Html::ElementConverter::WRAP_TEXT_CHILDREN = T.let(T.unsafe(nil), Array)
1478
-
1479
- # Contains the parsing methods. This module can be mixed into any parser to get HTML parsing
1480
- # functionality. The only thing that must be provided by the class are instance variable
1481
- # parsing.
1482
- module Kramdown::Parser::Html::Parser
1483
- include ::Kramdown::Parser::Html::Constants
1484
-
1485
- # Process the HTML start tag that has already be scanned/checked via @src.
1486
- #
1487
- # Does the common processing steps and then yields to the caller for further processing
1488
- # (first parameter is the created element; the second parameter is +true+ if the HTML
1489
- # element is already closed, ie. contains no body; the third parameter specifies whether the
1490
- # body - and the end tag - need to be handled in case closed=false).
1491
- def handle_html_start_tag(line = T.unsafe(nil)); end
1492
-
1493
- # Handle the raw HTML tag at the current position.
1494
- def handle_raw_html_tag(name); end
1495
-
1496
- # Parses the given string for HTML attributes and returns the resulting hash.
1497
- #
1498
- # If the optional +line+ parameter is supplied, it is used in warning messages.
1499
- #
1500
- # If the optional +in_html_tag+ parameter is set to +false+, attributes are not modified to
1501
- # contain only lowercase letters.
1502
- def parse_html_attributes(str, line = T.unsafe(nil), in_html_tag = T.unsafe(nil)); end
1503
-
1504
- # Parse raw HTML from the current source position, storing the found elements in +el+.
1505
- # Parsing continues until one of the following criteria are fulfilled:
1506
- #
1507
- # - The end of the document is reached.
1508
- # - The matching end tag for the element +el+ is found (only used if +el+ is an HTML
1509
- # element).
1510
- #
1511
- # When an HTML start tag is found, processing is deferred to #handle_html_start_tag,
1512
- # providing the block given to this method.
1513
- def parse_raw_html(el, &block); end
1514
- end
1515
-
1516
- Kramdown::Parser::Html::Parser::HTML_RAW_START = T.let(T.unsafe(nil), Regexp)
1517
-
1518
- # Used for parsing a document in kramdown format.
1519
- #
1520
- # If you want to extend the functionality of the parser, you need to do the following:
1521
- #
1522
- # * Create a new subclass
1523
- # * add the needed parser methods
1524
- # * modify the @block_parsers and @span_parsers variables and add the names of your parser
1525
- # methods
1526
- #
1527
- # Here is a small example for an extended parser class that parses ERB style tags as raw text if
1528
- # they are used as span-level elements (an equivalent block-level parser should probably also be
1529
- # made to handle the block case):
1530
- #
1531
- # require 'kramdown/parser/kramdown'
1532
- #
1533
- # class Kramdown::Parser::ERBKramdown < Kramdown::Parser::Kramdown
1534
- #
1535
- # def initialize(source, options)
1536
- # super
1537
- # @span_parsers.unshift(:erb_tags)
1538
- # end
1539
- #
1540
- # ERB_TAGS_START = /<%.*?%>/
1541
- #
1542
- # def parse_erb_tags
1543
- # @src.pos += @src.matched_size
1544
- # @tree.children << Element.new(:raw, @src.matched)
1545
- # end
1546
- # define_parser(:erb_tags, ERB_TAGS_START, '<%')
1547
- #
1548
- # end
1549
- #
1550
- # The new parser can be used like this:
1551
- #
1552
- # require 'kramdown/document'
1553
- # # require the file with the above parser class
1554
- #
1555
- # Kramdown::Document.new(input_text, :input => 'ERBKramdown').to_html
1556
- class Kramdown::Parser::Kramdown < ::Kramdown::Parser::Base
1557
- include ::Kramdown
1558
- include ::Kramdown::Parser::Html::Constants
1559
- include ::Kramdown::Parser::Html::Parser
1560
-
1561
- # Create a new Kramdown parser object with the given +options+.
1562
- #
1563
- # @return [Kramdown] a new instance of Kramdown
1564
- def initialize(source, options); end
1565
-
1566
- # This helper methods adds the approriate attributes to the element +el+ of type +a+ or +img+
1567
- # and the element itself to the @tree.
1568
- def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end
1569
-
1570
- # Return +true+ if we are after a block boundary.
1571
- #
1572
- # @return [Boolean]
1573
- def after_block_boundary?; end
1574
-
1575
- # Return +true+ if we are before a block boundary.
1576
- #
1577
- # @return [Boolean]
1578
- def before_block_boundary?; end
1579
-
1580
- # Correct abbreviation attributes.
1581
- def correct_abbreviations_attributes; end
1582
-
1583
- def handle_extension(name, opts, body, type, line_no = T.unsafe(nil)); end
1584
- def handle_kramdown_html_tag(el, closed, handle_body); end
1585
-
1586
- # Normalize the link identifier.
1587
- def normalize_link_id(id); end
1588
-
1589
- def paragraph_end; end
1590
-
1591
- # The source string provided on initialization is parsed into the @root element.
1592
- def parse; end
1593
-
1594
- # Parse the link definition at the current location.
1595
- def parse_abbrev_definition; end
1596
-
1597
- # Parse the string +str+ and extract all attributes and add all found attributes to the hash
1598
- # +opts+.
1599
- def parse_attribute_list(str, opts); end
1600
-
1601
- # Parse the Atx header at the current location.
1602
- def parse_atx_header; end
1603
-
1604
- # Parse the autolink at the current location.
1605
- def parse_autolink; end
1606
-
1607
- # Parse the blank line at the current postition.
1608
- def parse_blank_line; end
1609
-
1610
- # Parse one of the block extensions (ALD, block IAL or generic extension) at the current
1611
- # location.
1612
- def parse_block_extensions; end
1613
-
1614
- # Parse the HTML at the current position as block-level HTML.
1615
- def parse_block_html; end
1616
-
1617
- # Parse the math block at the current location.
1618
- def parse_block_math; end
1619
-
1620
- # Parse the blockquote at the current location.
1621
- def parse_blockquote; end
1622
-
1623
- # Parse the indented codeblock at the current location.
1624
- def parse_codeblock; end
1625
-
1626
- # Parse the fenced codeblock at the current location.
1627
- def parse_codeblock_fenced; end
1628
-
1629
- # Parse the codespan at the current scanner location.
1630
- def parse_codespan; end
1631
-
1632
- # Parse the ordered or unordered list at the current location.
1633
- def parse_definition_list; end
1634
-
1635
- # Parse the emphasis at the current location.
1636
- def parse_emphasis; end
1637
-
1638
- # Parse the EOB marker at the current location.
1639
- def parse_eob_marker; end
1640
-
1641
- # Parse the backslash-escaped character at the current location.
1642
- def parse_escaped_chars; end
1643
-
1644
- # Parse the generic extension at the current point. The parameter +type+ can either be :block
1645
- # or :span depending whether we parse a block or span extension tag.
1646
- def parse_extension_start_tag(type); end
1647
-
1648
- # Used for parsing the first line of a list item or a definition, i.e. the line with list item
1649
- # marker or the definition marker.
1650
- def parse_first_list_line(indentation, content); end
1651
-
1652
- # Parse the foot note definition at the current location.
1653
- def parse_footnote_definition; end
1654
-
1655
- # Parse the footnote marker at the current location.
1656
- def parse_footnote_marker; end
1657
-
1658
- # Parse the horizontal rule at the current location.
1659
- def parse_horizontal_rule; end
1660
-
1661
- # Parse the HTML entity at the current location.
1662
- def parse_html_entity; end
1663
-
1664
- # Parse the inline math at the current location.
1665
- def parse_inline_math; end
1666
-
1667
- # Parse the line break at the current location.
1668
- def parse_line_break; end
1669
-
1670
- # Parse the link at the current scanner position. This method is used to parse normal links as
1671
- # well as image links.
1672
- def parse_link; end
1673
-
1674
- # Parse the link definition at the current location.
1675
- def parse_link_definition; end
1676
-
1677
- # Parse the ordered or unordered list at the current location.
1678
- def parse_list; end
1679
-
1680
- # Parse the paragraph at the current location.
1681
- def parse_paragraph; end
1682
-
1683
- # Parse the Setext header at the current location.
1684
- def parse_setext_header; end
1685
-
1686
- # Parse the smart quotes at current location.
1687
- def parse_smart_quotes; end
1688
-
1689
- # Parse the extension span at the current location.
1690
- def parse_span_extensions; end
1691
-
1692
- # Parse the HTML at the current position as span-level HTML.
1693
- def parse_span_html; end
1694
-
1695
- # Parse the table at the current location.
1696
- def parse_table; end
1697
-
1698
- # Parse the typographic symbols at the current location.
1699
- def parse_typographic_syms; end
1700
-
1701
- # Replace the abbreviation text with elements.
1702
- def replace_abbreviations(el, regexps = T.unsafe(nil)); end
1703
-
1704
- # Update the +ial+ with the information from the inline attribute list +opts+.
1705
- def update_ial_with_ial(ial, opts); end
1706
-
1707
- protected
1708
-
1709
- def add_header(level, text, id); end
1710
-
1711
- # Adapt the object to allow parsing like specified in the options.
1712
- def configure_parser; end
1713
-
1714
- # Create a new block-level element, taking care of applying a preceding block IAL if it
1715
- # exists. This method should always be used for creating a block-level element!
1716
- def new_block_el(*args); end
1717
-
1718
- # Parse all block-level elements in +text+ into the element +el+.
1719
- def parse_blocks(el, text = T.unsafe(nil)); end
1720
-
1721
- # Returns header text and optional ID.
1722
- def parse_header_contents; end
1723
-
1724
- # Parse all span-level elements in the source string of @src into +el+.
1725
- #
1726
- # If the parameter +stop_re+ (a regexp) is used, parsing is immediately stopped if the regexp
1727
- # matches and if no block is given or if a block is given and it returns +true+.
1728
- #
1729
- # The parameter +parsers+ can be used to specify the (span-level) parsing methods that should
1730
- # be used for parsing.
1731
- #
1732
- # The parameter +text_type+ specifies the type which should be used for created text nodes.
1733
- def parse_spans(el, stop_re = T.unsafe(nil), parsers = T.unsafe(nil), text_type = T.unsafe(nil)); end
1734
-
1735
- # Reset the current parsing environment. The parameter +env+ can be used to set initial
1736
- # values for one or more environment variables.
1737
- def reset_env(opts = T.unsafe(nil)); end
1738
-
1739
- # Restore the current parsing environment.
1740
- def restore_env(env); end
1741
-
1742
- # Return the current parsing environment.
1743
- def save_env; end
1744
-
1745
- # Create the needed span parser regexps.
1746
- def span_parser_regexps(parsers = T.unsafe(nil)); end
1747
-
1748
- # Update the given attributes hash +attr+ with the information from the inline attribute list
1749
- # +ial+ and all referenced ALDs.
1750
- def update_attr_with_ial(attr, ial); end
1751
-
1752
- #
1753
- # Update the parser specific link definitions with the data from +link_defs+ (the value of the
1754
- # :link_defs option).
1755
- #
1756
- # The parameter +link_defs+ is a hash where the keys are possibly unnormalized link IDs and
1757
- # the values are two element arrays consisting of the link target and a title (can be +nil+).
1758
- def update_link_definitions(link_defs); end
1759
-
1760
- # Update the raw text for automatic ID generation.
1761
- def update_raw_text(item); end
1762
-
1763
- # Update the tree by parsing all :+raw_text+ elements with the span-level parser (resets the
1764
- # environment) and by updating the attributes from the IALs.
1765
- def update_tree(element); end
1766
-
1767
- private
1768
-
1769
- # precomputed patterns for indentations 1..4 and fallback expression
1770
- # to compute pattern when indentation is outside the 1..4 range.
1771
- def fetch_pattern(type, indentation); end
1772
-
1773
- def span_pattern_cache(stop_re, span_start); end
1774
-
1775
- class << self
1776
- # Add a parser method
1777
- #
1778
- # * with the given +name+,
1779
- # * using +start_re+ as start regexp
1780
- # * and, for span parsers, +span_start+ as a String that can be used in a regexp and
1781
- # which identifies the starting character(s)
1782
- #
1783
- # to the registry. The method name is automatically derived from the +name+ or can explicitly
1784
- # be set by using the +meth_name+ parameter.
1785
- def define_parser(name, start_re, span_start = T.unsafe(nil), meth_name = T.unsafe(nil)); end
1786
-
1787
- # Return +true+ if there is a parser called +name+.
1788
- #
1789
- # @return [Boolean]
1790
- def has_parser?(name); end
1791
-
1792
- # Return the Data structure for the parser +name+.
1793
- def parser(name = T.unsafe(nil)); end
1794
- end
1795
- end
1796
-
1797
- Kramdown::Parser::Kramdown::ABBREV_DEFINITION_START = T.let(T.unsafe(nil), Regexp)
1798
- Kramdown::Parser::Kramdown::ACHARS = T.let(T.unsafe(nil), String)
1799
- Kramdown::Parser::Kramdown::ALD_ANY_CHARS = T.let(T.unsafe(nil), Regexp)
1800
- Kramdown::Parser::Kramdown::ALD_CLASS_NAME = T.let(T.unsafe(nil), Regexp)
1801
- Kramdown::Parser::Kramdown::ALD_ID_CHARS = T.let(T.unsafe(nil), Regexp)
1802
- Kramdown::Parser::Kramdown::ALD_ID_NAME = T.let(T.unsafe(nil), Regexp)
1803
- Kramdown::Parser::Kramdown::ALD_START = T.let(T.unsafe(nil), Regexp)
1804
- Kramdown::Parser::Kramdown::ALD_TYPE_ANY = T.let(T.unsafe(nil), Regexp)
1805
- Kramdown::Parser::Kramdown::ALD_TYPE_CLASS_NAME = T.let(T.unsafe(nil), Regexp)
1806
- Kramdown::Parser::Kramdown::ALD_TYPE_ID_NAME = T.let(T.unsafe(nil), Regexp)
1807
- Kramdown::Parser::Kramdown::ALD_TYPE_ID_OR_CLASS = T.let(T.unsafe(nil), Regexp)
1808
- Kramdown::Parser::Kramdown::ALD_TYPE_ID_OR_CLASS_MULTI = T.let(T.unsafe(nil), Regexp)
1809
- Kramdown::Parser::Kramdown::ALD_TYPE_KEY_VALUE_PAIR = T.let(T.unsafe(nil), Regexp)
1810
- Kramdown::Parser::Kramdown::ALD_TYPE_REF = T.let(T.unsafe(nil), Regexp)
1811
- Kramdown::Parser::Kramdown::ATX_HEADER_START = T.let(T.unsafe(nil), Regexp)
1812
- Kramdown::Parser::Kramdown::AUTOLINK_START = T.let(T.unsafe(nil), Regexp)
1813
- Kramdown::Parser::Kramdown::AUTOLINK_START_STR = T.let(T.unsafe(nil), String)
1814
- Kramdown::Parser::Kramdown::BLANK_LINE = T.let(T.unsafe(nil), Regexp)
1815
- Kramdown::Parser::Kramdown::BLOCKQUOTE_START = T.let(T.unsafe(nil), Regexp)
1816
- Kramdown::Parser::Kramdown::BLOCK_BOUNDARY = T.let(T.unsafe(nil), Regexp)
1817
- Kramdown::Parser::Kramdown::BLOCK_EXTENSIONS_START = T.let(T.unsafe(nil), Regexp)
1818
- Kramdown::Parser::Kramdown::BLOCK_MATH_START = T.let(T.unsafe(nil), Regexp)
1819
- Kramdown::Parser::Kramdown::CODEBLOCK_MATCH = T.let(T.unsafe(nil), Regexp)
1820
- Kramdown::Parser::Kramdown::CODEBLOCK_START = T.let(T.unsafe(nil), Regexp)
1821
- Kramdown::Parser::Kramdown::CODESPAN_DELIMITER = T.let(T.unsafe(nil), Regexp)
1822
- Kramdown::Parser::Kramdown::DEFINITION_LIST_START = T.let(T.unsafe(nil), Regexp)
1823
-
1824
- # Struct class holding all the needed data for one block/span-level parser method.
1825
- class Kramdown::Parser::Kramdown::Data < ::Struct
1826
- # Returns the value of attribute method
1827
- #
1828
- # @return [Object] the current value of method
1829
- def method; end
1830
-
1831
- # Sets the attribute method
1832
- #
1833
- # @param value [Object] the value to set the attribute method to.
1834
- # @return [Object] the newly set value
1835
- def method=(_); end
1836
-
1837
- # Returns the value of attribute name
1838
- #
1839
- # @return [Object] the current value of name
1840
- def name; end
1841
-
1842
- # Sets the attribute name
1843
- #
1844
- # @param value [Object] the value to set the attribute name to.
1845
- # @return [Object] the newly set value
1846
- def name=(_); end
1847
-
1848
- # Returns the value of attribute span_start
1849
- #
1850
- # @return [Object] the current value of span_start
1851
- def span_start; end
1852
-
1853
- # Sets the attribute span_start
1854
- #
1855
- # @param value [Object] the value to set the attribute span_start to.
1856
- # @return [Object] the newly set value
1857
- def span_start=(_); end
1858
-
1859
- # Returns the value of attribute start_re
1860
- #
1861
- # @return [Object] the current value of start_re
1862
- def start_re; end
1863
-
1864
- # Sets the attribute start_re
1865
- #
1866
- # @param value [Object] the value to set the attribute start_re to.
1867
- # @return [Object] the newly set value
1868
- def start_re=(_); end
1869
-
1870
- class << self
1871
- def [](*_arg0); end
1872
- def inspect; end
1873
- def members; end
1874
- def new(*_arg0); end
1875
- end
1876
- end
1877
-
1878
- Kramdown::Parser::Kramdown::EMPHASIS_START = T.let(T.unsafe(nil), Regexp)
1879
- Kramdown::Parser::Kramdown::EOB_MARKER = T.let(T.unsafe(nil), Regexp)
1880
- Kramdown::Parser::Kramdown::ESCAPED_CHARS = T.let(T.unsafe(nil), Regexp)
1881
- Kramdown::Parser::Kramdown::EXT_BLOCK_START = T.let(T.unsafe(nil), Regexp)
1882
- Kramdown::Parser::Kramdown::EXT_BLOCK_STOP_STR = T.let(T.unsafe(nil), String)
1883
- Kramdown::Parser::Kramdown::EXT_SPAN_START = T.let(T.unsafe(nil), Regexp)
1884
- Kramdown::Parser::Kramdown::EXT_START_STR = T.let(T.unsafe(nil), String)
1885
- Kramdown::Parser::Kramdown::EXT_STOP_STR = T.let(T.unsafe(nil), String)
1886
- Kramdown::Parser::Kramdown::FENCED_CODEBLOCK_MATCH = T.let(T.unsafe(nil), Regexp)
1887
- Kramdown::Parser::Kramdown::FENCED_CODEBLOCK_START = T.let(T.unsafe(nil), Regexp)
1888
- Kramdown::Parser::Kramdown::FOOTNOTE_DEFINITION_START = T.let(T.unsafe(nil), Regexp)
1889
- Kramdown::Parser::Kramdown::FOOTNOTE_MARKER_START = T.let(T.unsafe(nil), Regexp)
1890
- Kramdown::Parser::Kramdown::HEADER_ID = T.let(T.unsafe(nil), Regexp)
1891
- Kramdown::Parser::Kramdown::HR_START = T.let(T.unsafe(nil), Regexp)
1892
- Kramdown::Parser::Kramdown::HTML_BLOCK_START = T.let(T.unsafe(nil), Regexp)
1893
-
1894
- # Mapping of markdown attribute value to content model. I.e. :raw when "0", :default when "1"
1895
- # (use default content model for the HTML element), :span when "span", :block when block and
1896
- # for everything else +nil+ is returned.
1897
- Kramdown::Parser::Kramdown::HTML_MARKDOWN_ATTR_MAP = T.let(T.unsafe(nil), Hash)
1898
-
1899
- Kramdown::Parser::Kramdown::HTML_SPAN_START = T.let(T.unsafe(nil), Regexp)
1900
- Kramdown::Parser::Kramdown::IAL_BLOCK = T.let(T.unsafe(nil), Regexp)
1901
- Kramdown::Parser::Kramdown::IAL_BLOCK_START = T.let(T.unsafe(nil), Regexp)
1902
- Kramdown::Parser::Kramdown::IAL_CLASS_ATTR = T.let(T.unsafe(nil), String)
1903
- Kramdown::Parser::Kramdown::IAL_SPAN_START = T.let(T.unsafe(nil), Regexp)
1904
-
1905
- # Regexp for matching indentation (one tab or four spaces)
1906
- Kramdown::Parser::Kramdown::INDENT = T.let(T.unsafe(nil), Regexp)
1907
-
1908
- Kramdown::Parser::Kramdown::INLINE_MATH_START = T.let(T.unsafe(nil), Regexp)
1909
- Kramdown::Parser::Kramdown::LAZY_END = T.let(T.unsafe(nil), Regexp)
1910
- Kramdown::Parser::Kramdown::LAZY_END_HTML_SPAN_ELEMENTS = T.let(T.unsafe(nil), Array)
1911
- Kramdown::Parser::Kramdown::LAZY_END_HTML_START = T.let(T.unsafe(nil), Regexp)
1912
- Kramdown::Parser::Kramdown::LAZY_END_HTML_STOP = T.let(T.unsafe(nil), Regexp)
1913
- Kramdown::Parser::Kramdown::LINE_BREAK = T.let(T.unsafe(nil), Regexp)
1914
- Kramdown::Parser::Kramdown::LINK_BRACKET_STOP_RE = T.let(T.unsafe(nil), Regexp)
1915
- Kramdown::Parser::Kramdown::LINK_DEFINITION_START = T.let(T.unsafe(nil), Regexp)
1916
- Kramdown::Parser::Kramdown::LINK_INLINE_ID_RE = T.let(T.unsafe(nil), Regexp)
1917
- Kramdown::Parser::Kramdown::LINK_INLINE_TITLE_RE = T.let(T.unsafe(nil), Regexp)
1918
- Kramdown::Parser::Kramdown::LINK_PAREN_STOP_RE = T.let(T.unsafe(nil), Regexp)
1919
- Kramdown::Parser::Kramdown::LINK_START = T.let(T.unsafe(nil), Regexp)
1920
- Kramdown::Parser::Kramdown::LIST_ITEM_IAL = T.let(T.unsafe(nil), Regexp)
1921
- Kramdown::Parser::Kramdown::LIST_ITEM_IAL_CHECK = T.let(T.unsafe(nil), Regexp)
1922
- Kramdown::Parser::Kramdown::LIST_START = T.let(T.unsafe(nil), Regexp)
1923
- Kramdown::Parser::Kramdown::LIST_START_OL = T.let(T.unsafe(nil), Regexp)
1924
- Kramdown::Parser::Kramdown::LIST_START_UL = T.let(T.unsafe(nil), Regexp)
1925
-
1926
- # Regexp for matching the optional space (zero or up to three spaces)
1927
- Kramdown::Parser::Kramdown::OPT_SPACE = T.let(T.unsafe(nil), Regexp)
1928
-
1929
- Kramdown::Parser::Kramdown::PARAGRAPH_END = T.let(T.unsafe(nil), Regexp)
1930
- Kramdown::Parser::Kramdown::PARAGRAPH_MATCH = T.let(T.unsafe(nil), Regexp)
1931
- Kramdown::Parser::Kramdown::PARAGRAPH_START = T.let(T.unsafe(nil), Regexp)
1932
- Kramdown::Parser::Kramdown::PARSE_FIRST_LIST_LINE_REGEXP_CACHE = T.let(T.unsafe(nil), Hash)
1933
- Kramdown::Parser::Kramdown::PATTERN_TAIL = T.let(T.unsafe(nil), Regexp)
1934
- Kramdown::Parser::Kramdown::SETEXT_HEADER_START = T.let(T.unsafe(nil), Regexp)
1935
- Kramdown::Parser::Kramdown::SMART_QUOTES_RE = T.let(T.unsafe(nil), Regexp)
1936
- Kramdown::Parser::Kramdown::SPAN_EXTENSIONS_START = T.let(T.unsafe(nil), Regexp)
1937
- Kramdown::Parser::Kramdown::SQ_CLOSE = T.let(T.unsafe(nil), String)
1938
- Kramdown::Parser::Kramdown::SQ_PUNCT = T.let(T.unsafe(nil), String)
1939
- Kramdown::Parser::Kramdown::SQ_RULES = T.let(T.unsafe(nil), Array)
1940
-
1941
- # '"
1942
- Kramdown::Parser::Kramdown::SQ_SUBSTS = T.let(T.unsafe(nil), Hash)
1943
-
1944
- Kramdown::Parser::Kramdown::TABLE_FSEP_LINE = T.let(T.unsafe(nil), Regexp)
1945
- Kramdown::Parser::Kramdown::TABLE_HSEP_ALIGN = T.let(T.unsafe(nil), Regexp)
1946
- Kramdown::Parser::Kramdown::TABLE_LINE = T.let(T.unsafe(nil), Regexp)
1947
- Kramdown::Parser::Kramdown::TABLE_PIPE_CHECK = T.let(T.unsafe(nil), Regexp)
1948
- Kramdown::Parser::Kramdown::TABLE_ROW_LINE = T.let(T.unsafe(nil), Regexp)
1949
- Kramdown::Parser::Kramdown::TABLE_SEP_LINE = T.let(T.unsafe(nil), Regexp)
1950
- Kramdown::Parser::Kramdown::TABLE_START = T.let(T.unsafe(nil), Regexp)
1951
- Kramdown::Parser::Kramdown::TRAILING_WHITESPACE = T.let(T.unsafe(nil), Regexp)
1952
- Kramdown::Parser::Kramdown::TYPOGRAPHIC_SYMS = T.let(T.unsafe(nil), Array)
1953
- Kramdown::Parser::Kramdown::TYPOGRAPHIC_SYMS_RE = T.let(T.unsafe(nil), Regexp)
1954
- Kramdown::Parser::Kramdown::TYPOGRAPHIC_SYMS_SUBST = T.let(T.unsafe(nil), Hash)
1955
-
1956
- # Used for parsing a document in Markdown format.
1957
- #
1958
- # This parser is based on the kramdown parser and removes the parser methods for the additional
1959
- # non-Markdown features. However, since some things are handled differently by the kramdown
1960
- # parser methods (like deciding when a list item contains just text), this parser differs from
1961
- # real Markdown parsers in some respects.
1962
- #
1963
- # Note, though, that the parser basically fails just one of the Markdown test cases (some others
1964
- # also fail but those failures are negligible).
1965
- class Kramdown::Parser::Markdown < ::Kramdown::Parser::Kramdown
1966
- # @return [Markdown] a new instance of Markdown
1967
- def initialize(source, options); end
1968
- end
1969
-
1970
- # :stopdoc:
1971
- Kramdown::Parser::Markdown::BLOCK_BOUNDARY = T.let(T.unsafe(nil), Regexp)
1972
-
1973
- Kramdown::Parser::Markdown::CODEBLOCK_MATCH = T.let(T.unsafe(nil), Regexp)
1974
-
1975
- # Array with all the parsing methods that should be removed from the standard kramdown parser.
1976
- Kramdown::Parser::Markdown::EXTENDED = T.let(T.unsafe(nil), Array)
1977
-
1978
- Kramdown::Parser::Markdown::IAL_RAND_CHARS = T.let(T.unsafe(nil), Array)
1979
- Kramdown::Parser::Markdown::IAL_RAND_STRING = T.let(T.unsafe(nil), String)
1980
- Kramdown::Parser::Markdown::IAL_SPAN_START = T.let(T.unsafe(nil), Regexp)
1981
- Kramdown::Parser::Markdown::LAZY_END = T.let(T.unsafe(nil), Regexp)
1982
- Kramdown::Parser::Markdown::LIST_ITEM_IAL = T.let(T.unsafe(nil), Regexp)
1983
- Kramdown::Parser::Markdown::PARAGRAPH_END = T.let(T.unsafe(nil), Regexp)
1984
-
1985
- # == \Utils Module
1986
- #
1987
- # This module contains utility class/modules/methods that can be used by both parsers and
1988
- # converters.
1989
- module Kramdown::Utils
1990
- class << self
1991
- # Treat +name+ as if it were snake cased (e.g. snake_case) and camelize it (e.g. SnakeCase).
1992
- def camelize(name); end
1993
-
1994
- def deep_const_get(str); end
1995
-
1996
- # Treat +name+ as if it were camelized (e.g. CamelizedName) and snake-case it (e.g. camelized_name).
1997
- def snake_case(name); end
1998
- end
1999
- end
2000
-
2001
- # Methods for registering configurable extensions.
2002
- module Kramdown::Utils::Configurable
2003
- # Create a new configurable extension called +name+.
2004
- #
2005
- # Three methods will be defined on the calling object which allow to use this configurable
2006
- # extension:
2007
- #
2008
- # configurables:: Returns a hash of hashes that is used to store all configurables of the
2009
- # object.
2010
- #
2011
- # <name>(ext_name):: Return the configured extension +ext_name+.
2012
- #
2013
- # add_<name>(ext_name, data=nil, &block):: Define an extension +ext_name+ by specifying either
2014
- # the data as argument or by using a block.
2015
- def configurable(name); end
2016
- end
2017
-
2018
- # Provides convenience methods for handling named and numeric entities.
2019
- module Kramdown::Utils::Entities
2020
- private
2021
-
2022
- # Return the entity for the given code point or name +point_or_name+.
2023
- def entity(point_or_name); end
2024
-
2025
- class << self
2026
- # Return the entity for the given code point or name +point_or_name+.
2027
- def entity(point_or_name); end
2028
- end
2029
- end
2030
-
2031
- # Contains the mapping of code point (or name) to the actual Entity object.
2032
- Kramdown::Utils::Entities::ENTITY_MAP = T.let(T.unsafe(nil), Hash)
2033
-
2034
- # Array of arrays. Each sub-array specifies a code point and the associated name.
2035
- #
2036
- # This table is not used directly -- Entity objects are automatically created from it and put
2037
- # into a Hash map when this file is loaded.
2038
- Kramdown::Utils::Entities::ENTITY_TABLE = T.let(T.unsafe(nil), Array)
2039
-
2040
- # Represents an entity that has a +code_point+ and +name+.
2041
- class Kramdown::Utils::Entities::Entity < ::Struct
2042
- # Return the UTF8 representation of the entity.
2043
- def char; end
2044
-
2045
- # Returns the value of attribute code_point
2046
- #
2047
- # @return [Object] the current value of code_point
2048
- def code_point; end
2049
-
2050
- # Sets the attribute code_point
2051
- #
2052
- # @param value [Object] the value to set the attribute code_point to.
2053
- # @return [Object] the newly set value
2054
- def code_point=(_); end
2055
-
2056
- # Returns the value of attribute name
2057
- #
2058
- # @return [Object] the current value of name
2059
- def name; end
2060
-
2061
- # Sets the attribute name
2062
- #
2063
- # @param value [Object] the value to set the attribute name to.
2064
- # @return [Object] the newly set value
2065
- def name=(_); end
2066
-
2067
- class << self
2068
- def [](*_arg0); end
2069
- def inspect; end
2070
- def members; end
2071
- def new(*_arg0); end
2072
- end
2073
- end
2074
-
2075
- # Provides convenience methods for HTML related tasks.
2076
- #
2077
- # *Note* that this module has to be mixed into a class that has a @root (containing an element
2078
- # of type :root) and an @options (containing an options hash) instance variable so that some of
2079
- # the methods can work correctly.
2080
- module Kramdown::Utils::Html
2081
- # Convert the entity +e+ to a string. The optional parameter +original+ may contain the
2082
- # original representation of the entity.
2083
- #
2084
- # This method uses the option +entity_output+ to determine the output form for the entity.
2085
- def entity_to_str(e, original = T.unsafe(nil)); end
2086
-
2087
- # Escape the special HTML characters in the string +str+. The parameter +type+ specifies what
2088
- # is escaped: :all - all special HTML characters except the quotation mark as well as
2089
- # entities, :text - all special HTML characters except the quotation mark but no entities and
2090
- # :attribute - all special HTML characters including the quotation mark but no entities.
2091
- def escape_html(str, type = T.unsafe(nil)); end
2092
-
2093
- def fix_cjk_line_break(str); end
2094
-
2095
- # Return the HTML representation of the attributes +attr+.
2096
- def html_attributes(attr); end
2097
- end
2098
-
2099
- Kramdown::Utils::Html::ESCAPE_ALL_RE = T.let(T.unsafe(nil), Regexp)
2100
- Kramdown::Utils::Html::ESCAPE_ATTRIBUTE_RE = T.let(T.unsafe(nil), Regexp)
2101
-
2102
- # :stopdoc:
2103
- Kramdown::Utils::Html::ESCAPE_MAP = T.let(T.unsafe(nil), Hash)
2104
-
2105
- Kramdown::Utils::Html::ESCAPE_RE_FROM_TYPE = T.let(T.unsafe(nil), Hash)
2106
- Kramdown::Utils::Html::ESCAPE_TEXT_RE = T.let(T.unsafe(nil), Regexp)
2107
- Kramdown::Utils::Html::REDUNDANT_LINE_BREAK_REGEX = T.let(T.unsafe(nil), Regexp)
2108
-
2109
- # A simple least recently used (LRU) cache.
2110
- #
2111
- # The cache relies on the fact that Ruby's Hash class maintains insertion order. So deleting
2112
- # and re-inserting a key-value pair on access moves the key to the last position. When an
2113
- # entry is added and the cache is full, the first entry is removed.
2114
- class Kramdown::Utils::LRUCache
2115
- # Creates a new LRUCache that can hold +size+ entries.
2116
- #
2117
- # @return [LRUCache] a new instance of LRUCache
2118
- def initialize(size); end
2119
-
2120
- # Returns the stored value for +key+ or +nil+ if no value was stored under the key.
2121
- def [](key); end
2122
-
2123
- # Stores the +value+ under the +key+.
2124
- def []=(key, value); end
2125
- end
2126
-
2127
- # This patched StringScanner adds line number information for current scan position and a
2128
- # start_line_number override for nested StringScanners.
2129
- class Kramdown::Utils::StringScanner < ::StringScanner
2130
- # Takes the start line number as optional second argument.
2131
- #
2132
- # Note: The original second argument is no longer used so this should be safe.
2133
- #
2134
- # @return [StringScanner] a new instance of StringScanner
2135
- def initialize(string, start_line_number = T.unsafe(nil)); end
2136
-
2137
- # Returns the line number for current charpos.
2138
- #
2139
- # NOTE: Requires that all line endings are normalized to '\n'
2140
- #
2141
- # NOTE: Normally we'd have to add one to the count of newlines to get the correct line number.
2142
- # However we add the one indirectly by using a one-based start_line_number.
2143
- def current_line_number; end
2144
-
2145
- # Sets the byte position of the scan pointer.
2146
- #
2147
- # Note: This also resets some internal variables, so always use pos= when setting the position
2148
- # and don't use any other method for that!
2149
- def pos=(pos); end
2150
-
2151
- # Revert the position to one saved by #save_pos.
2152
- def revert_pos(data); end
2153
-
2154
- # Return information needed to revert the byte position of the string scanner in a performant
2155
- # way.
2156
- #
2157
- # The returned data can be fed to #revert_pos to revert the position to the saved one.
2158
- #
2159
- # Note: Just saving #pos won't be enough.
2160
- def save_pos; end
2161
-
2162
- # The start line number. Used for nested StringScanners that scan a sub-string of the source
2163
- # document. The kramdown parser uses this, e.g., for span level parsers.
2164
- def start_line_number; end
2165
- end
2166
-
2167
- # The kramdown version.
2168
- Kramdown::VERSION = T.let(T.unsafe(nil), String)