reverse_adoc 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +27 -0
  3. data/.github/workflows/ubuntu.yml +27 -0
  4. data/.github/workflows/windows.yml +30 -0
  5. data/.hound.yml +3 -0
  6. data/.rubocop.yml +10 -0
  7. data/Gemfile +6 -0
  8. data/LICENSE.txt +25 -0
  9. data/README.adoc +290 -0
  10. data/Rakefile +14 -0
  11. data/bin/reverse_adoc +67 -0
  12. data/bin/w2a +85 -0
  13. data/lib/reverse_asciidoctor.rb +70 -0
  14. data/lib/reverse_asciidoctor/cleaner.rb +90 -0
  15. data/lib/reverse_asciidoctor/config.rb +53 -0
  16. data/lib/reverse_asciidoctor/converters.rb +33 -0
  17. data/lib/reverse_asciidoctor/converters/a.rb +38 -0
  18. data/lib/reverse_asciidoctor/converters/aside.rb +14 -0
  19. data/lib/reverse_asciidoctor/converters/audio.rb +34 -0
  20. data/lib/reverse_asciidoctor/converters/base.rb +24 -0
  21. data/lib/reverse_asciidoctor/converters/blockquote.rb +18 -0
  22. data/lib/reverse_asciidoctor/converters/br.rb +11 -0
  23. data/lib/reverse_asciidoctor/converters/bypass.rb +77 -0
  24. data/lib/reverse_asciidoctor/converters/code.rb +15 -0
  25. data/lib/reverse_asciidoctor/converters/div.rb +14 -0
  26. data/lib/reverse_asciidoctor/converters/drop.rb +18 -0
  27. data/lib/reverse_asciidoctor/converters/em.rb +18 -0
  28. data/lib/reverse_asciidoctor/converters/figure.rb +21 -0
  29. data/lib/reverse_asciidoctor/converters/h.rb +19 -0
  30. data/lib/reverse_asciidoctor/converters/head.rb +18 -0
  31. data/lib/reverse_asciidoctor/converters/hr.rb +11 -0
  32. data/lib/reverse_asciidoctor/converters/ignore.rb +12 -0
  33. data/lib/reverse_asciidoctor/converters/img.rb +80 -0
  34. data/lib/reverse_asciidoctor/converters/li.rb +24 -0
  35. data/lib/reverse_asciidoctor/converters/mark.rb +12 -0
  36. data/lib/reverse_asciidoctor/converters/math.rb +20 -0
  37. data/lib/reverse_asciidoctor/converters/ol.rb +46 -0
  38. data/lib/reverse_asciidoctor/converters/p.rb +17 -0
  39. data/lib/reverse_asciidoctor/converters/pass_through.rb +9 -0
  40. data/lib/reverse_asciidoctor/converters/pre.rb +38 -0
  41. data/lib/reverse_asciidoctor/converters/q.rb +12 -0
  42. data/lib/reverse_asciidoctor/converters/strong.rb +17 -0
  43. data/lib/reverse_asciidoctor/converters/sub.rb +12 -0
  44. data/lib/reverse_asciidoctor/converters/sup.rb +12 -0
  45. data/lib/reverse_asciidoctor/converters/table.rb +64 -0
  46. data/lib/reverse_asciidoctor/converters/td.rb +67 -0
  47. data/lib/reverse_asciidoctor/converters/text.rb +65 -0
  48. data/lib/reverse_asciidoctor/converters/th.rb +16 -0
  49. data/lib/reverse_asciidoctor/converters/tr.rb +22 -0
  50. data/lib/reverse_asciidoctor/converters/video.rb +36 -0
  51. data/lib/reverse_asciidoctor/errors.rb +10 -0
  52. data/lib/reverse_asciidoctor/version.rb +3 -0
  53. data/reverse_adoc.gemspec +35 -0
  54. data/spec/assets/anchors.html +22 -0
  55. data/spec/assets/basic.html +58 -0
  56. data/spec/assets/code.html +22 -0
  57. data/spec/assets/escapables.html +15 -0
  58. data/spec/assets/from_the_wild.html +23 -0
  59. data/spec/assets/full_example.html +49 -0
  60. data/spec/assets/html_fragment.html +3 -0
  61. data/spec/assets/lists.html +137 -0
  62. data/spec/assets/minimum.html +4 -0
  63. data/spec/assets/paragraphs.html +24 -0
  64. data/spec/assets/quotation.html +12 -0
  65. data/spec/assets/tables.html +99 -0
  66. data/spec/assets/unknown_tags.html +9 -0
  67. data/spec/components/anchors_spec.rb +21 -0
  68. data/spec/components/basic_spec.rb +49 -0
  69. data/spec/components/code_spec.rb +28 -0
  70. data/spec/components/escapables_spec.rb +23 -0
  71. data/spec/components/from_the_wild_spec.rb +17 -0
  72. data/spec/components/html_fragment_spec.rb +11 -0
  73. data/spec/components/lists_spec.rb +86 -0
  74. data/spec/components/paragraphs_spec.rb +15 -0
  75. data/spec/components/quotation_spec.rb +12 -0
  76. data/spec/components/tables_spec.rb +31 -0
  77. data/spec/components/unknown_tags_spec.rb +39 -0
  78. data/spec/lib/reverse_asciidoctor/cleaner_spec.rb +157 -0
  79. data/spec/lib/reverse_asciidoctor/config_spec.rb +26 -0
  80. data/spec/lib/reverse_asciidoctor/converters/aside_spec.rb +12 -0
  81. data/spec/lib/reverse_asciidoctor/converters/audio_spec.rb +18 -0
  82. data/spec/lib/reverse_asciidoctor/converters/blockquote_spec.rb +24 -0
  83. data/spec/lib/reverse_asciidoctor/converters/br_spec.rb +9 -0
  84. data/spec/lib/reverse_asciidoctor/converters/code_spec.rb +18 -0
  85. data/spec/lib/reverse_asciidoctor/converters/div_spec.rb +18 -0
  86. data/spec/lib/reverse_asciidoctor/converters/figure_spec.rb +13 -0
  87. data/spec/lib/reverse_asciidoctor/converters/img_spec.rb +28 -0
  88. data/spec/lib/reverse_asciidoctor/converters/li_spec.rb +13 -0
  89. data/spec/lib/reverse_asciidoctor/converters/mark_spec.rb +10 -0
  90. data/spec/lib/reverse_asciidoctor/converters/p_spec.rb +12 -0
  91. data/spec/lib/reverse_asciidoctor/converters/pre_spec.rb +45 -0
  92. data/spec/lib/reverse_asciidoctor/converters/q_spec.rb +10 -0
  93. data/spec/lib/reverse_asciidoctor/converters/strong_spec.rb +20 -0
  94. data/spec/lib/reverse_asciidoctor/converters/text_spec.rb +62 -0
  95. data/spec/lib/reverse_asciidoctor/converters/video_spec.rb +18 -0
  96. data/spec/lib/reverse_asciidoctor/converters_spec.rb +19 -0
  97. data/spec/lib/reverse_asciidoctor_spec.rb +37 -0
  98. data/spec/spec_helper.rb +21 -0
  99. metadata +299 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8003d7dcf58a0561295e898bbcc93ce2c4f6168f5b9e2bcb17791fc183a48d04
4
+ data.tar.gz: 1229e27b2b00ce61d1004bf3348552b8c3749d3b15f0490c3ab85d63bec94964
5
+ SHA512:
6
+ metadata.gz: 5e162c8c8a83ca274faed8247ff8fde809118e1a2fa02e3cfaf75f1804d9163d6019ee5bd79a33fe3b2dd00aee2780e8809f2139ffbc118899a8985689feedf8
7
+ data.tar.gz: d8c715a4ccb49082a832590f89b4b434b1502e1d7c2bcc9539fb0c5b47ddc09afb8b87236a48913ebe8dbecb02f848ffa20d83f9b7f2100bc3ed57355309bb25
@@ -0,0 +1,27 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: macos
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-macos:
9
+ name: Test on Ruby ${{ matrix.ruby }} macOS
10
+ runs-on: macos-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ run: |
23
+ sudo gem install bundler -v "~> 2" --force
24
+ bundle install --jobs 4 --retry 3
25
+ - name: Run specs
26
+ run: |
27
+ bundle exec rake
@@ -0,0 +1,27 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: ubuntu
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-linux:
9
+ name: Test on Ruby ${{ matrix.ruby }} Ubuntu
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ run: |
23
+ gem install bundler -v "~> 2"
24
+ bundle install --jobs 4 --retry 3
25
+ - name: Run specs
26
+ run: |
27
+ bundle exec rake
@@ -0,0 +1,30 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: windows
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-windows:
9
+ name: Test on Ruby ${{ matrix.ruby }} Windows
10
+ runs-on: windows-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ shell: pwsh
23
+ run: |
24
+ gem install bundler -v "~> 2"
25
+ bundle config --local path vendor/bundle
26
+ bundle update
27
+ bundle install --jobs 4 --retry 3
28
+ - name: Run specs
29
+ run: |
30
+ bundle exec rake
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
+ AllCops:
8
+ TargetRubyVersion: 2.3
9
+ Rails:
10
+ Enabled: true
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in reverse_asciidoctor.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.adoc ADDED
@@ -0,0 +1,290 @@
1
+ = AsciiDoc from HTML and Microsoft Word: reverse_adoc
2
+
3
+ image:https://img.shields.io/gem/v/reverse_adoc.svg["Gem Version", link="https://rubygems.org/gems/reverse_adoc"]
4
+ image:https://img.shields.io/travis/metanorma/reverse_adoc/master.svg["Build Status", link="https://travis-ci.org/metanorma/reverse_adoc"]
5
+ image:https://codeclimate.com/github/metanorma/reverse_adoc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/reverse_adoc"]
6
+ image:https://ci.appveyor.com/api/projects/status/s4st0ft8moay90m6?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/ribose/reverse-asciidoctor"]
7
+
8
+ == Purpose
9
+
10
+ Transforms HTML and Microsoft Word into AsciiDoc.
11
+
12
+ Based on https://github.com/xijo/reverse_markdown
13
+
14
+
15
+ == Installation
16
+
17
+ Install the gem:
18
+
19
+ [source,console]
20
+ ----
21
+ [sudo] gem install reverse_adoc
22
+ ----
23
+
24
+ or add it to your `Gemfile`:
25
+
26
+ [source,ruby]
27
+ ----
28
+ gem 'reverse_adoc'
29
+ ----
30
+
31
+
32
+ == Command-line usage
33
+
34
+ === HTML to AsciiDoc: `reverse_adoc`
35
+
36
+ Convert HTML files to AsciiDoc:
37
+
38
+ [source,console]
39
+ ----
40
+ $ reverse_adoc file.html > file.adoc
41
+ $ cat file.html | reverse_adoc > file.adoc
42
+ ----
43
+
44
+ [source,console]
45
+ ----
46
+ $ reverse_adoc -h
47
+ Usage: reverse_adoc [options] <file>
48
+ -m, --mathml2asciimath Convert MathML to AsciiMath
49
+ -o, --output=FILENAME Output file to write to
50
+ -e, --external-images Export images if data URI
51
+ -u [pass_through, drop, bypass, raise],
52
+ --unknown_tags Unknown tag handling (default: pass_through)
53
+ -v, --version Version information
54
+ -h, --help Prints this help
55
+ ----
56
+
57
+
58
+
59
+ === Microsoft Word to AsciiDoc: `w2a`
60
+
61
+ Convert Word `.doc` or `.docx` files to AsciiDoc:
62
+
63
+ [source,console]
64
+ ----
65
+ $ w2a file.docx > file.adoc
66
+ ----
67
+
68
+ [source,console]
69
+ ----
70
+ $ w2a input.docx -o output.adoc
71
+ ----
72
+
73
+ Help:
74
+
75
+ [source,console]
76
+ ----
77
+ $ w2a -h
78
+ Usage: w2a [options] <file>
79
+ -a, --mathml2asciimath Convert MathML to AsciiMath
80
+ -o, --output=FILENAME Output file to write to
81
+ -e, --external-images Export images if data URI
82
+ -v, --version Version information
83
+ -h, --help Prints this help
84
+ ----
85
+
86
+
87
+ NOTE: `w2a` requires LibreOffice to be installed. It uses LibreOffice's
88
+ export to XHTML. LibreOffice's export of XHTML is superior to the native Microsoft Word export
89
+ to HTML: it exports lists (which Word keeps as paragraphs), and it exports OOMML into MathML.
90
+ On the other hand, the LibreOffice export relies on default styling being used in the
91
+ document, and it may not cope with ordered lists or headings with customised appearance.
92
+ For best results, reset the styles in the document you're converting to those in
93
+ the default `Normal.dot` template.
94
+
95
+ NOTE: Some information in OOMML is not preserved in the export to MathML from LibreOffice;
96
+ in particular, font shifts such as double-struck fonts.
97
+ The LibreOffice exporter does seem to drop some text (possibly associated with
98
+ MathML); use with caution.
99
+
100
+ NOTE: Adapted from `w2m` of
101
+ https://github.com/benbalter/word-to-markdown[Ben Balter's word-to-markdown]
102
+
103
+
104
+ === Common options
105
+
106
+
107
+ ==== MathML to AsciiMath conversion
108
+
109
+ If you wish to convert the MathML in the document to AsciiMath, run the script with the
110
+ `--mathml2asciimath` option:
111
+
112
+ [source,console]
113
+ ----
114
+ $ w2a --mathml2asciimath document.docx > document.adoc
115
+ ----
116
+
117
+
118
+ ==== Extracting images
119
+
120
+ Images referred by the HTML can be extracted into the destination output folder by using:
121
+
122
+ [source,console]
123
+ ----
124
+ $ reverse_adoc input.docx -o output/file.adoc -e
125
+ $ reverse_adoc input.docx --output output/file.adoc --external-images
126
+ ----
127
+
128
+
129
+ Word embedded images can be extracted into the destination output folder by using:
130
+
131
+ [source,console]
132
+ ----
133
+ $ w2a input.docx -o output/file.adoc -e
134
+ $ w2a input.docx --output output/file.adoc --external-images
135
+ ----
136
+
137
+
138
+ ==== Handling unknown HTML tags
139
+
140
+ The `--unknown_tags` option allows you to specify how to handle unknown tags
141
+ (default `pass_through`).
142
+
143
+ Valid options are:
144
+
145
+ * `pass_through` - Include the unknown tag completely into the result
146
+ * `drop` - Drop the unknown tag and its content
147
+ * `bypass` - Ignore the unknown tag but try to convert its content
148
+ * `raise` - Raise an error to let you know
149
+
150
+
151
+ ==== Tagging of borders
152
+
153
+ Specify how to handle tag borders with the option `--tag_border` (default `' '`).
154
+
155
+ Valid options are:
156
+
157
+ * `' '` - Add whitespace if there is none at tag borders.
158
+ * `''` - Do not not add whitespace.
159
+
160
+
161
+ == Features
162
+
163
+ === General
164
+
165
+ `reverse_adoc` shares features as a port of `reverse_markdown`:
166
+
167
+ * Module based -- if you miss a tag, just add it
168
+ * Can deal with nested lists
169
+ * Inline and block code is supported
170
+ * Supports blockquote
171
+
172
+ It supports the following HTML tags (these are supported by `reverse_markdown`):
173
+
174
+ * `a`
175
+ * `blockquote`
176
+ * `br`
177
+ * `code`, `tt` (added: `kbd`, `samp`, `var`)
178
+ * `div`, `article`
179
+ * `em`, `i` (added: `cite`)
180
+ * `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `hr`
181
+ * `img`
182
+ * `li`, `ol`, `ul` (added: `dir`)
183
+ * `p`, `pre`
184
+ * `strong`, `b`
185
+ * `table`, `td`, `th`, `tr`
186
+
187
+ [NOTE]
188
+ ====
189
+ * reverse_adoc does *not* support `del` or `strike`, because Asciidoctor does not out of the box.
190
+ * As with reverse_markdown, `pre` is only treated as sourcecode if it is contained in a `div@class = highlight-` element, or has a `@brush` attribute naming the language (Confluence).
191
+ * The gem does not support `p@align`, because Asciidoctor doesn't
192
+ ====
193
+
194
+ In addition, it supports:
195
+
196
+ * `aside`
197
+ * `audio`, `video` (with `@src` attributes)
198
+ * `figure`, `figcaption`
199
+ * `mark`
200
+ * `q`
201
+ * `sub`, `sup`
202
+ * `@id` anchors
203
+ * `blockquote@cite`
204
+ * `img/@width`, `img/@height`
205
+ * `ol/@style`, `ol/@start`, `ol/@reversed`, `ul/@type`
206
+ * `td/@colspan`, `td/@rowspan`, `td@/align`, `td@/valign`
207
+ * `table/caption`, `table/@width`, `table/@frame` (partial), `table/@rules` (partial)
208
+ * Lists and paragraphs within cells
209
+ ** Not tables within cells: Asciidoctor cannot deal with nested tables
210
+
211
+ The gem does not support:
212
+
213
+ * `col`, `colgroup`
214
+ * `source`, `picture`
215
+ * `bdi`, `bdo`, `ruby`, `rt`, `rp`, `wbr`
216
+ * `frame`, `frameset`, `iframe`, `noframes`, `noscript`, `script`, `input`, `output`, `progress`
217
+ * `map`, `canvas`, `dialog`, `embed`, `object`, `param`, `svg`, `track`
218
+ * `fieldset`, `button`, `datalist`, `form`, `label`, `legend`, `menu`, `menulist`, `optgroup`, `option`, `select`, `textarea`
219
+ * `big`, `dfn`, `font`, `s`, `small`, `span`, `strike`, `u`
220
+ * `center`
221
+ * `data`, `meter`
222
+ * `del`, `ins`
223
+ * `footer`, `header`, `main`, `nav`, `details`, `section`, `summary`, `template`
224
+
225
+
226
+ === MathML support
227
+
228
+ If you are using this gem in the context of https://www.metanorma.com[Metanorma],
229
+ Metanorma Asciidoctor accepts MathML as a native mathematical format. So you do not need
230
+ to convert the MathML to AsciiMath.
231
+
232
+ The gem will optionally invoke the https://github.com/metanorma/mathml2asciimath
233
+ gem, to convert MathML to AsciiMath. The conversion is not perfect, and will need to be
234
+ post-edited; but it's a lot better than nothing.
235
+
236
+ NOTE: Asciidoctor does not support MathML input. HTML uses MathML.
237
+ The gem will recognize MathML expressions in HTML, and will wrap them in Asciidoctor
238
+ `stem:[ ]` macros. The result of this gem is not actually legal Asciidoctor for `stem`:
239
+ Asciidoctor will presumably
240
+ think this is AsciiMath in the `stem:[ ]` macro, try to pass it into MathJax as
241
+ AsciiMath, and fail. But of course, MathJax has no problem with MathML, and some postprocessing
242
+ on the Asciidoctor output can ensure that the MathML is treated by MathJax (or whatever else
243
+ uses the output) as such; so this is still much better than nothing for stem processing.
244
+
245
+
246
+ == Ruby library usage
247
+
248
+ === General
249
+
250
+ Simple to use.
251
+
252
+ [source,ruby]
253
+ ----
254
+ result = ReverseAsciidoctor.convert input
255
+ result.inspect # " *feelings* "
256
+ ----
257
+
258
+ === Configure with options
259
+
260
+ Just pass your chosen configuration options in after the input. The given options will last for this operation only.
261
+
262
+ [source,ruby]
263
+ ----
264
+ ReverseAsciidoctor.convert(input, unknown_tags: :raise, mathml2asciimath: true)
265
+ ----
266
+
267
+
268
+ === Preconfigure using an initializer
269
+
270
+ Or configure it block style on a initializer level. These configurations will last for all conversions until they are set to something different.
271
+
272
+ [source,ruby]
273
+ ----
274
+ ReverseAsciidoctor.config do |config|
275
+ config.unknown_tags = :bypass
276
+ config.mathml2asciimath = true
277
+ config.tag_border = ''
278
+ end
279
+ ----
280
+
281
+
282
+ == Related stuff
283
+
284
+ * https://github.com/xijo/reverse_markdown[Xijo's original reverse_markdown gem]
285
+ * https://github.com/xijo/reverse_markdown/wiki/Write-your-own-converter[Write custom converters] - Wiki entry about how to write your own converter
286
+ * https://github.com/harlantwood/html_massage[html_massage] - A gem by Harlan T. Wood to convert regular sites into markdown using reverse_markdown
287
+ * https://github.com/benbalter/word-to-markdown[word-to-markdown] - Convert word docs into markdown while using reverse_markdown, by Ben Balter
288
+ * https://github.com/asciidocfx/HtmlToAsciidoc[HtmlToAsciidoc] - Javascript regexp-based converter of HTML to Asciidoctor
289
+ * https://asciidoctor.org/docs/user-manual/[The Asciidoctor User Manual]
290
+
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ if File.exist?('.codeclimate')
4
+ ENV["CODECLIMATE_REPO_TOKEN"] = File.read('.codeclimate').strip
5
+ end
6
+
7
+ require 'rspec/core/rake_task'
8
+ RSpec::Core::RakeTask.new(:spec)
9
+ task :default => :spec
10
+
11
+ desc 'Open an irb session preloaded with this library'
12
+ task :console do
13
+ sh 'irb -rubygems -I lib -r reverse_asciidoctor.rb'
14
+ end