repubmark 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +46 -0
  3. data/.rubocop_todo.yml +129 -0
  4. data/.yardopts +4 -0
  5. data/LICENSE +21 -0
  6. data/README.md +21 -0
  7. data/Rakefile +60 -0
  8. data/examples/config.yml +71 -0
  9. data/examples/full.chapters.json +22 -0
  10. data/examples/full.gmi +44 -0
  11. data/examples/full.html +114 -0
  12. data/examples/full.repub +91 -0
  13. data/examples/full.summary.txt +2 -0
  14. data/examples/hello.chapters.json +3 -0
  15. data/examples/hello.gmi +1 -0
  16. data/examples/hello.html +5 -0
  17. data/examples/hello.repub +3 -0
  18. data/examples/hello.summary.txt +1 -0
  19. data/exe/repubmark +46 -0
  20. data/lib/repubmark/config.rb +53 -0
  21. data/lib/repubmark/elems/abbrev.rb +52 -0
  22. data/lib/repubmark/elems/annotation.rb +48 -0
  23. data/lib/repubmark/elems/article.rb +96 -0
  24. data/lib/repubmark/elems/base.rb +104 -0
  25. data/lib/repubmark/elems/blockquote.rb +80 -0
  26. data/lib/repubmark/elems/canvas.rb +104 -0
  27. data/lib/repubmark/elems/caption.rb +69 -0
  28. data/lib/repubmark/elems/chapter.rb +148 -0
  29. data/lib/repubmark/elems/code_block.rb +70 -0
  30. data/lib/repubmark/elems/code_inline.rb +35 -0
  31. data/lib/repubmark/elems/figure.rb +73 -0
  32. data/lib/repubmark/elems/figures.rb +47 -0
  33. data/lib/repubmark/elems/footnote.rb +87 -0
  34. data/lib/repubmark/elems/footnotes_category.rb +48 -0
  35. data/lib/repubmark/elems/fraction.rb +31 -0
  36. data/lib/repubmark/elems/iframe.rb +62 -0
  37. data/lib/repubmark/elems/joint.rb +176 -0
  38. data/lib/repubmark/elems/link.rb +56 -0
  39. data/lib/repubmark/elems/list.rb +84 -0
  40. data/lib/repubmark/elems/list_item.rb +147 -0
  41. data/lib/repubmark/elems/note.rb +40 -0
  42. data/lib/repubmark/elems/paragraph.rb +42 -0
  43. data/lib/repubmark/elems/power.rb +34 -0
  44. data/lib/repubmark/elems/quote.rb +53 -0
  45. data/lib/repubmark/elems/section.rb +58 -0
  46. data/lib/repubmark/elems/separator.rb +17 -0
  47. data/lib/repubmark/elems/special.rb +37 -0
  48. data/lib/repubmark/elems/text.rb +43 -0
  49. data/lib/repubmark/highlight.rb +85 -0
  50. data/lib/repubmark/titled_ref.rb +16 -0
  51. data/lib/repubmark/version.rb +6 -0
  52. data/lib/repubmark.rb +125 -0
  53. data/tests/examples.rb +51 -0
  54. metadata +129 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2c0aaf7101907ec701d795d02c812760f17fd8e0140bea9c5c2eea31911140ea
4
+ data.tar.gz: a66dc10e8f729b5bbb49435c9dd76c58efa01cbee71d38dd158b7b2005a8902a
5
+ SHA512:
6
+ metadata.gz: 207ff26689078a17ff150c3ceb3fea702cb5ad7280a7095319d71c648b3501c4cfaf15677b74e244a35598a710d253a21f195be92a37092706ce7654f3f29870
7
+ data.tar.gz: 171f8cd206a169b57a014698f8e5bd0c2bd1e174d3744ebe5393336bb999fa14d49f96a04e1d8c969f51701394926bd36d1bea2761af8fabeeda4eecdd0de244
data/.rubocop.yml ADDED
@@ -0,0 +1,46 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rake
6
+
7
+ AllCops:
8
+ TargetRubyVersion: 3.2
9
+ DisplayCopNames: true
10
+ NewCops: enable
11
+
12
+ Layout/AccessModifierIndentation:
13
+ EnforcedStyle: outdent
14
+
15
+ Layout/LineLength:
16
+ Max: 80
17
+
18
+ Lint/AmbiguousOperatorPrecedence:
19
+ Enabled: false
20
+
21
+ Lint/ReturnInVoidContext:
22
+ Enabled: false
23
+
24
+ Style/AndOr:
25
+ EnforcedStyle: conditionals
26
+
27
+ Style/DoubleNegation:
28
+ Enabled: false
29
+
30
+ Style/HashAsLastArrayItem:
31
+ Enabled: false
32
+
33
+ Style/PerlBackrefs:
34
+ Enabled: false
35
+
36
+ Style/TrailingCommaInArguments:
37
+ EnforcedStyleForMultiline: comma
38
+
39
+ Style/TrailingCommaInArrayLiteral:
40
+ EnforcedStyleForMultiline: comma
41
+
42
+ Style/TrailingCommaInHashLiteral:
43
+ EnforcedStyleForMultiline: comma
44
+
45
+ Style/VariableInterpolation:
46
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,129 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2024-10-18 14:41:13 UTC using RuboCop version 1.67.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
12
+ # SupportedStyles: with_first_argument, with_fixed_indentation
13
+ Layout/ArgumentAlignment:
14
+ Exclude:
15
+ - 'Rakefile'
16
+
17
+ # Offense count: 1
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
20
+ # URISchemes: http, https
21
+ Layout/LineLength:
22
+ Exclude:
23
+ - 'lib/repubmark/elems/footnote.rb'
24
+
25
+ # Offense count: 1
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ # Configuration parameters: AllowedMethods.
28
+ # AllowedMethods: present?, blank?, presence, try, try!, in?
29
+ Lint/SafeNavigationChain:
30
+ Exclude:
31
+ - 'lib/repubmark/elems/article.rb'
32
+
33
+ # Offense count: 1
34
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
35
+ Metrics/AbcSize:
36
+ Max: 35
37
+
38
+ # Offense count: 1
39
+ # Configuration parameters: CountComments, CountAsOne.
40
+ Metrics/ClassLength:
41
+ Max: 104
42
+
43
+ # Offense count: 1
44
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
45
+ Metrics/CyclomaticComplexity:
46
+ Max: 10
47
+
48
+ # Offense count: 5
49
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
50
+ Metrics/MethodLength:
51
+ Max: 33
52
+
53
+ # Offense count: 1
54
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
55
+ Metrics/PerceivedComplexity:
56
+ Max: 11
57
+
58
+ # Offense count: 2
59
+ Performance/MapMethodChain:
60
+ Exclude:
61
+ - 'lib/repubmark/elems/footnotes_category.rb'
62
+
63
+ # Offense count: 14
64
+ # This cop supports safe autocorrection (--autocorrect).
65
+ # Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
66
+ # RedundantRestArgumentNames: args, arguments
67
+ # RedundantKeywordRestArgumentNames: kwargs, options, opts
68
+ # RedundantBlockArgumentNames: blk, block, proc
69
+ Style/ArgumentsForwarding:
70
+ Exclude:
71
+ - 'lib/repubmark/elems/canvas.rb'
72
+ - 'lib/repubmark/elems/footnotes_category.rb'
73
+ - 'lib/repubmark/elems/joint.rb'
74
+ - 'lib/repubmark/elems/link.rb'
75
+
76
+ # Offense count: 34
77
+ # Configuration parameters: AllowedConstants.
78
+ Style/Documentation:
79
+ Enabled: false
80
+
81
+ # Offense count: 7
82
+ # Configuration parameters: AllowedVariables.
83
+ Style/GlobalVars:
84
+ Exclude:
85
+ - 'exe/repubmark'
86
+
87
+ # Offense count: 1
88
+ # This cop supports safe autocorrection (--autocorrect).
89
+ # Configuration parameters: AllowIfModifier.
90
+ Style/IfInsideElse:
91
+ Exclude:
92
+ - 'lib/repubmark/elems/footnote.rb'
93
+
94
+ # Offense count: 4
95
+ # This cop supports safe autocorrection (--autocorrect).
96
+ Style/RedundantFreeze:
97
+ Exclude:
98
+ - 'lib/repubmark/elems/fraction.rb'
99
+ - 'lib/repubmark/elems/power.rb'
100
+
101
+ # Offense count: 2
102
+ # This cop supports safe autocorrection (--autocorrect).
103
+ Style/RedundantStringEscape:
104
+ Exclude:
105
+ - 'lib/repubmark/elems/footnote.rb'
106
+
107
+ # Offense count: 1
108
+ # This cop supports safe autocorrection (--autocorrect).
109
+ # Configuration parameters: AllowModifier.
110
+ Style/SoleNestedConditional:
111
+ Exclude:
112
+ - 'lib/repubmark/elems/footnote.rb'
113
+
114
+ # Offense count: 7
115
+ # This cop supports safe autocorrection (--autocorrect).
116
+ Style/SuperArguments:
117
+ Exclude:
118
+ - 'lib/repubmark/elems/annotation.rb'
119
+ - 'lib/repubmark/elems/blockquote.rb'
120
+ - 'lib/repubmark/elems/canvas.rb'
121
+ - 'lib/repubmark/elems/caption.rb'
122
+ - 'lib/repubmark/elems/figures.rb'
123
+ - 'lib/repubmark/elems/joint.rb'
124
+ - 'lib/repubmark/elems/paragraph.rb'
125
+
126
+ # Offense count: 24
127
+ # This cop supports safe autocorrection (--autocorrect).
128
+ Style/SuperWithArgsParentheses:
129
+ Enabled: false
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --markup markdown
2
+ --readme README.md
3
+ --protected
4
+ --private
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-2024 Alex Kotov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ Repubmark
2
+ =========
3
+
4
+ A Markdown-inspired markup language that can be compiled into HTML and Gemtext.
5
+
6
+
7
+
8
+ Examples
9
+ --------
10
+
11
+ * `./exe/repubmark examples/config.yml word_count < examples/hello.repub`
12
+ * `./exe/repubmark examples/config.yml summary_plain < examples/hello.repub`
13
+ * `./exe/repubmark examples/config.yml http < examples/hello.repub`
14
+ * `./exe/repubmark examples/config.yml gemini < examples/hello.repub`
15
+ * `./exe/repubmark examples/config.yml rss < examples/hello.repub`
16
+
17
+ * `./exe/repubmark examples/config.yml word_count < examples/full.repub`
18
+ * `./exe/repubmark examples/config.yml summary_plain < examples/full.repub`
19
+ * `./exe/repubmark examples/config.yml http < examples/full.repub`
20
+ * `./exe/repubmark examples/config.yml gemini < examples/full.repub`
21
+ * `./exe/repubmark examples/config.yml rss < examples/full.repub`
data/Rakefile ADDED
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+
5
+ CLEAN << '.yardoc'
6
+ CLEAN << 'coverage'
7
+ CLEAN << 'doc'
8
+
9
+ desc 'Run default checks'
10
+ task default: %i[test lint]
11
+
12
+ desc 'Run tests'
13
+ task test: :tests
14
+
15
+ desc 'Run code analysis tools'
16
+ task lint: %i[rubocop yard:cov]
17
+
18
+ desc 'Fix code style (rubocop --auto-correct)'
19
+ task fix: 'rubocop:auto_correct'
20
+
21
+ Rake::Task['release'].prereqs.unshift 'default'
22
+
23
+ begin
24
+ require 'rubocop/rake_task'
25
+ RuboCop::RakeTask.new
26
+ rescue LoadError
27
+ nil
28
+ end
29
+
30
+ begin
31
+ require 'yard'
32
+ YARD::Rake::YardocTask.new
33
+ rescue LoadError
34
+ nil
35
+ end
36
+
37
+ desc 'Open development console'
38
+ task :console do
39
+ sh 'bundle', 'exec',
40
+ File.expand_path(File.join('bin', 'console'), __dir__)
41
+ end
42
+
43
+ desc 'Run tests'
44
+ task :tests do
45
+ sh 'bundle', 'exec',
46
+ File.expand_path(File.join('tests', 'examples.rb'), __dir__)
47
+ end
48
+
49
+ namespace :yard do
50
+ desc 'Measure documentation coverage'
51
+ task :cov do
52
+ result = `bundle exec yard stats`.lines.last.strip.freeze
53
+ m = result.match(/\A(\d+(\.\d+)?)% documented\z/)
54
+ raise 'Invalid result' if m.nil?
55
+
56
+ coverage = m[1].to_f.round(2)
57
+ puts "Documentation coverage: #{coverage}%"
58
+ raise 'Not fully documented!' if coverage < 38.32
59
+ end
60
+ end
@@ -0,0 +1,71 @@
1
+ ---
2
+ ##########
3
+ # Shared #
4
+ ##########
5
+
6
+ common:
7
+ footnotes:
8
+ - category: self
9
+ links: true
10
+ title:
11
+ en: Related articles
12
+ pl: Powiązane artykuły
13
+ tu: Связанные статьи
14
+ - category: link
15
+ links: true
16
+ title:
17
+ en: Links
18
+ pl: Odnośniki
19
+ ru: Ссылки
20
+ - category: book
21
+ links: false
22
+ title:
23
+ en: Literature
24
+ pl: Literature
25
+ ru: Литература
26
+
27
+ paths: &paths
28
+ current_path: '/xxxxx.xxx'
29
+ images_prefix: '/assets/images'
30
+
31
+ css_classes: &css_classes
32
+ css_class_annotation: 'nice-annotation'
33
+ css_class_blockquote_figure: 'nice-blockquote'
34
+ css_class_figure_self: 'nice-figure'
35
+ css_class_figure_wrap: 'd-flex justify-content-center'
36
+ css_class_figures_left: 'col-xl-6'
37
+ css_class_figures_right: 'col-xl-6'
38
+ css_class_figures_wrap: 'row'
39
+ css_class_iframe_wrap: 'ratio ratio-16x9'
40
+
41
+ ############
42
+ # Profiles #
43
+ ############
44
+
45
+ word_count:
46
+ format: word_count
47
+
48
+ chapters:
49
+ format: chapters
50
+
51
+ summary_plain:
52
+ format: summary_plain
53
+
54
+ gemini:
55
+ <<: *paths
56
+ format: gemtext
57
+ relative_urls: true
58
+
59
+ http:
60
+ <<: *paths
61
+ <<: *css_classes
62
+ format: html
63
+ relative_urls: true
64
+ chapter_anchor_prefix: 'chapter'
65
+
66
+ rss:
67
+ <<: *paths
68
+ <<: *css_classes
69
+ format: html
70
+ relative_urls: false
71
+ base_url: 'https://example.com'
@@ -0,0 +1,22 @@
1
+ [
2
+ {
3
+ "slug": "1-юникод",
4
+ "title": "Chapter 1",
5
+ "chapters": [
6
+
7
+ ]
8
+ },
9
+ {
10
+ "slug": "2",
11
+ "title": "Chapter 2",
12
+ "chapters": [
13
+ {
14
+ "slug": "2--nested",
15
+ "title": "Chapter 2.1",
16
+ "chapters": [
17
+
18
+ ]
19
+ }
20
+ ]
21
+ }
22
+ ]
data/examples/full.gmi ADDED
@@ -0,0 +1,44 @@
1
+ Annotation paragraph text
2
+
3
+
4
+
5
+ > Blockquote paragraph text
6
+ Blockquote caption text
7
+
8
+ ```
9
+ [[:foo, 1], [:bar, 2], [:car, 3]].each do |str, num|
10
+ puts str
11
+ puts num**2
12
+ end
13
+ ```
14
+
15
+ => https://example.com Example.com
16
+
17
+ => assets/images/foo.jpg The Foo
18
+
19
+ => assets/images/qwe.jpg The Qwe
20
+ => assets/images/rty.jpg The Rty
21
+
22
+ ## Chapter 1
23
+
24
+ Chapter 1 paragraph text
25
+
26
+ ## Chapter 2
27
+
28
+ Chapter 2 paragraph text
29
+
30
+ ### Chapter 2.1
31
+
32
+ Chapter 2.1 paragraph text
33
+
34
+
35
+
36
+ ## Related articles
37
+
38
+ => ./foo-bar 1) 2024-09-12 Foo Bar — Baz Car Cdr Qwe Rty
39
+
40
+
41
+
42
+ ## Links
43
+
44
+ => https://example.com 2) Example Domain — This domain is for use in illustrative examples in documents
@@ -0,0 +1,114 @@
1
+ <div class="nice-annotation">
2
+ <p>
3
+ <span>
4
+ Annotation paragraph text
5
+ </span>
6
+ </p>
7
+ </div>
8
+ <figure class="nice-blockquote">
9
+ <blockquote>
10
+ <p>
11
+ <span>
12
+ Blockquote paragraph text
13
+ </span>
14
+ </p>
15
+ </blockquote>
16
+ <figcaption>
17
+ <span>
18
+ Blockquote caption text
19
+ </span>
20
+ </figcaption>
21
+ </figure>
22
+ <pre><code><span class="hl lin"> 1 </span><span class="hl opt">[[</span><span class="hl kwc">:foo</span><span class="hl opt">,</span> <span class="hl num">1</span><span class="hl opt">], [</span><span class="hl kwc">:bar</span><span class="hl opt">,</span> <span class="hl num">2</span><span class="hl opt">], [</span><span class="hl kwc">:car</span><span class="hl opt">,</span> <span class="hl num">3</span><span class="hl opt">]].</span>each <span class="hl kwa">do</span> <span class="hl opt">|</span>str<span class="hl opt">,</span> num<span class="hl opt">|</span>
23
+ <span class="hl lin"> 2 </span> puts str
24
+ <span class="hl lin"> 3 </span> puts num<span class="hl opt">**</span><span class="hl num">2</span>
25
+ <span class="hl lin"> 4 </span><span class="hl kwa">end</span>
26
+ </code></pre>
27
+ <div class="ratio ratio-16x9">
28
+ <iframe
29
+ title="Example.com"
30
+ src="https://example.com"
31
+ allowfullscreen=""
32
+ frameborder="0"
33
+ sandbox="allow-same-origin allow-scripts allow-popups"
34
+ ></iframe>
35
+ </div>
36
+ <div class="d-flex justify-content-center">
37
+ <figure class="nice-figure">
38
+ <img src="assets/images/foo.jpg" alt="The Foo"/>
39
+ <figcaption>
40
+ The Foo
41
+ </figcaption>
42
+ </figure>
43
+ </div>
44
+ <div class="row">
45
+ <div class="col-xl-6">
46
+ <div class="d-flex justify-content-center">
47
+ <figure class="nice-figure">
48
+ <img src="assets/images/qwe.jpg" alt="The Qwe"/>
49
+ <figcaption>
50
+ The Qwe
51
+ </figcaption>
52
+ </figure>
53
+ </div>
54
+ </div>
55
+ <div class="col-xl-6">
56
+ <div class="d-flex justify-content-center">
57
+ <figure class="nice-figure">
58
+ <img src="assets/images/rty.jpg" alt="The Rty"/>
59
+ <figcaption>
60
+ The Rty
61
+ </figcaption>
62
+ </figure>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ <h2 id="chapter--1-юникод">Chapter 1</h2>
67
+ <p>
68
+ <span>
69
+ Chapter 1 paragraph text
70
+ </span>
71
+ </p>
72
+ <h2 id="chapter--2">Chapter 2</h2>
73
+ <p>
74
+ <span>
75
+ Chapter 2 paragraph text
76
+ </span>
77
+ </p>
78
+ <h3 id="chapter--2--nested">Chapter 2.1</h3>
79
+ <p>
80
+ <span>
81
+ Chapter 2.1 paragraph text
82
+ </span>
83
+ </p>
84
+ <div>
85
+ <hr/>
86
+ <h2>Related articles</h2>
87
+
88
+ <ol>
89
+ <li id="self-foo-bar" value="1" class="fragment-highlight">
90
+ <span class="text-muted">
91
+ <time datetime="2024-09-12">
92
+ September 12, 2024
93
+ </time>
94
+ </span>
95
+ <a href="./foo-bar">Foo Bar</a>
96
+ <span>
97
+ &mdash;
98
+ Baz Car Cdr Qwe Rty
99
+ </span>
100
+ </li>
101
+ </ol>
102
+ <h2>Links</h2>
103
+
104
+ <ol>
105
+ <li id="link-example-com" value="2" class="fragment-highlight">
106
+ <a href="https://example.com">Example Domain</a>
107
+ <span>
108
+ &mdash;
109
+ This domain is for use in illustrative examples in documents
110
+ </span>
111
+ (<a href="https://web.archive.org/arch/example.com">web.archive.org</a>)
112
+ </li>
113
+ </ol>
114
+ </div>
@@ -0,0 +1,91 @@
1
+ article.annotation do |annotation|
2
+ annotation.paragraph do |paragraph|
3
+ paragraph.text 'Annotation paragraph text'
4
+ end
5
+ end
6
+
7
+
8
+
9
+ article.blockquote do |blockquote|
10
+ blockquote.paragraph do |paragraph|
11
+ paragraph.text 'Blockquote paragraph text'
12
+ end
13
+ blockquote.caption do |caption|
14
+ caption.text 'Blockquote caption text'
15
+ end
16
+ end
17
+
18
+ article.code_block :ruby, <<~CODE
19
+ [[:foo, 1], [:bar, 2], [:car, 3]].each do |str, num|
20
+ puts str
21
+ puts num**2
22
+ end
23
+ CODE
24
+
25
+ article.iframe 'Example.com', 'https://example.com'
26
+
27
+ article.nice_figure 'foo.jpg', 'The Foo'
28
+
29
+ article.nice_figures do |figures|
30
+ figures.figure 'qwe.jpg', 'The Qwe'
31
+ figures.figure 'rty.jpg', 'The Rty'
32
+ end
33
+
34
+
35
+
36
+ article.chapter '1-юникод', 'Chapter 1' do |chapter|
37
+ chapter.paragraph do |paragraph|
38
+ paragraph.text 'Chapter 1 paragraph text'
39
+ end
40
+ end
41
+
42
+
43
+
44
+ article.chapter '2', 'Chapter 2' do |chapter|
45
+ chapter.paragraph do |paragraph|
46
+ paragraph.text 'Chapter 2 paragraph text'
47
+ end
48
+
49
+
50
+
51
+ chapter.chapter 'nested', 'Chapter 2.1' do |chapter|
52
+ chapter.paragraph do |paragraph|
53
+ paragraph.text 'Chapter 2.1 paragraph text'
54
+ end
55
+ end
56
+ end
57
+
58
+
59
+
60
+ article.footnotes_category 'Related articles' do |category|
61
+ category.footnote(
62
+ category: :self,
63
+ slug: 'foo-bar',
64
+ index: 1,
65
+ url: './foo-bar',
66
+ link_text: 'Foo Bar',
67
+ date: '2024-09-12',
68
+ ) do |footnote|
69
+ footnote.mdash
70
+ footnote.text 'Baz Car Cdr Qwe Rty'
71
+ end
72
+ end
73
+
74
+ article.footnotes_category 'Links' do |category|
75
+ category.footnote(
76
+ category: :link,
77
+ slug: 'example-com',
78
+ index: 2,
79
+ url: 'https://example.com',
80
+ link_text: 'Example Domain',
81
+ alt_urls: [
82
+ {
83
+ name: 'web.archive.org',
84
+ url: 'https://web.archive.org/arch/example.com',
85
+ },
86
+ ],
87
+ ) do |footnote|
88
+ footnote.mdash
89
+ footnote.text 'This domain is for use in illustrative examples in documents'
90
+ end
91
+ end
@@ -0,0 +1,2 @@
1
+ Annotation paragraph text Chapter 1 Chapter 1 paragraph text Chapter 2
2
+ Chapter 2 paragraph text Chapter 2.1 Chapter 2.1 paragraph text
@@ -0,0 +1,3 @@
1
+ [
2
+
3
+ ]
@@ -0,0 +1 @@
1
+ Hello, World!
@@ -0,0 +1,5 @@
1
+ <p>
2
+ <span>
3
+ Hello, World!
4
+ </span>
5
+ </p>
@@ -0,0 +1,3 @@
1
+ article.paragraph do |paragraph|
2
+ paragraph.text 'Hello, World!'
3
+ end
@@ -0,0 +1 @@
1
+ Hello, World!