kramdown-asciidoc 1.0.0.alpha.13 → 1.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +24 -0
- data/Gemfile +5 -0
- data/README.adoc +16 -16
- data/kramdown-asciidoc.gemspec +5 -7
- data/lib/kramdown-asciidoc.rb +7 -2
- data/lib/kramdown-asciidoc/api.rb +83 -18
- data/lib/kramdown-asciidoc/cli.rb +1 -1
- data/lib/kramdown-asciidoc/converter.rb +12 -51
- data/lib/kramdown-asciidoc/kramdown_ext/parser/base.rb +8 -1
- data/lib/kramdown-asciidoc/kramdown_ext/parser/html.rb +5 -1
- data/lib/kramdown-asciidoc/preprocessors.rb +64 -0
- data/lib/kramdown-asciidoc/version.rb +1 -1
- data/lib/kramdown-asciidoc/writer.rb +8 -0
- metadata +5 -897
- data/Rakefile +0 -3
- data/spec/api_spec.rb +0 -228
- data/spec/cli_spec.rb +0 -300
- data/spec/converter_spec.rb +0 -271
- data/spec/scenario_spec.rb +0 -25
- data/spec/scenarios/a/bare-interdoc-xref.adoc +0 -1
- data/spec/scenarios/a/bare-interdoc-xref.md +0 -1
- data/spec/scenarios/a/bare-url.adoc +0 -1
- data/spec/scenarios/a/bare-url.md +0 -1
- data/spec/scenarios/a/containing-inline-image.adoc +0 -5
- data/spec/scenarios/a/containing-inline-image.md +0 -5
- data/spec/scenarios/a/double-underscore-in-url.adoc +0 -1
- data/spec/scenarios/a/double-underscore-in-url.md +0 -1
- data/spec/scenarios/a/interdoc-xref.adoc +0 -1
- data/spec/scenarios/a/interdoc-xref.md +0 -1
- data/spec/scenarios/a/internal.adoc +0 -5
- data/spec/scenarios/a/internal.md +0 -5
- data/spec/scenarios/a/local.adoc +0 -1
- data/spec/scenarios/a/local.md +0 -1
- data/spec/scenarios/a/no-auto-links.adoc +0 -3
- data/spec/scenarios/a/no-auto-links.md +0 -3
- data/spec/scenarios/a/no-auto-links.opts +0 -1
- data/spec/scenarios/a/url-matches-text.adoc +0 -2
- data/spec/scenarios/a/url-matches-text.md +0 -2
- data/spec/scenarios/a/url-with-text.adoc +0 -1
- data/spec/scenarios/a/url-with-text.md +0 -1
- data/spec/scenarios/attributes/sorting.adoc +0 -6
- data/spec/scenarios/attributes/sorting.md +0 -3
- data/spec/scenarios/attributes/sorting.opts +0 -3
- data/spec/scenarios/blockquote/attribution-separated.adoc +0 -5
- data/spec/scenarios/blockquote/attribution-separated.md +0 -5
- data/spec/scenarios/blockquote/attribution.adoc +0 -5
- data/spec/scenarios/blockquote/attribution.md +0 -3
- data/spec/scenarios/blockquote/basic.adoc +0 -3
- data/spec/scenarios/blockquote/basic.md +0 -1
- data/spec/scenarios/blockquote/deep-nested.adoc +0 -17
- data/spec/scenarios/blockquote/deep-nested.md +0 -6
- data/spec/scenarios/blockquote/list.adoc +0 -5
- data/spec/scenarios/blockquote/list.md +0 -3
- data/spec/scenarios/blockquote/multiple-lines.adoc +0 -5
- data/spec/scenarios/blockquote/multiple-lines.md +0 -3
- data/spec/scenarios/blockquote/nested.adoc +0 -7
- data/spec/scenarios/blockquote/nested.md +0 -3
- data/spec/scenarios/br/leading-tag.adoc +0 -2
- data/spec/scenarios/br/leading-tag.md +0 -2
- data/spec/scenarios/br/tag-followed-by-newline.adoc +0 -3
- data/spec/scenarios/br/tag-followed-by-newline.md +0 -3
- data/spec/scenarios/br/tag-in-table-cell.adoc +0 -4
- data/spec/scenarios/br/tag-in-table-cell.md +0 -1
- data/spec/scenarios/br/tag-preceded-by-space.adoc +0 -3
- data/spec/scenarios/br/tag-preceded-by-space.md +0 -1
- data/spec/scenarios/br/tag.adoc +0 -3
- data/spec/scenarios/br/tag.md +0 -1
- data/spec/scenarios/br/trailing-double-space.adoc +0 -3
- data/spec/scenarios/br/trailing-double-space.md +0 -3
- data/spec/scenarios/codeblock/command-prompt.adoc +0 -1
- data/spec/scenarios/codeblock/command-prompt.md +0 -1
- data/spec/scenarios/codeblock/contiguous-lines.adoc +0 -3
- data/spec/scenarios/codeblock/contiguous-lines.md +0 -3
- data/spec/scenarios/codeblock/dlist-like.adoc +0 -4
- data/spec/scenarios/codeblock/dlist-like.md +0 -2
- data/spec/scenarios/codeblock/fenced/command-prompt.adoc +0 -1
- data/spec/scenarios/codeblock/fenced/command-prompt.md +0 -3
- data/spec/scenarios/codeblock/fenced/language.adoc +0 -8
- data/spec/scenarios/codeblock/fenced/language.md +0 -7
- data/spec/scenarios/codeblock/fenced/non-contiguous-command-prompts.adoc +0 -6
- data/spec/scenarios/codeblock/fenced/non-contiguous-command-prompts.md +0 -5
- data/spec/scenarios/codeblock/fenced/without-language.adoc +0 -5
- data/spec/scenarios/codeblock/fenced/without-language.md +0 -5
- data/spec/scenarios/codeblock/list-like.adoc +0 -5
- data/spec/scenarios/codeblock/list-like.md +0 -3
- data/spec/scenarios/codeblock/non-contiguous-command-prompts.adoc +0 -6
- data/spec/scenarios/codeblock/non-contiguous-command-prompts.md +0 -3
- data/spec/scenarios/codeblock/non-contiguous-lines.adoc +0 -7
- data/spec/scenarios/codeblock/non-contiguous-lines.md +0 -5
- data/spec/scenarios/codespan/caret.adoc +0 -1
- data/spec/scenarios/codespan/caret.md +0 -1
- data/spec/scenarios/codespan/constrained-triple.adoc +0 -1
- data/spec/scenarios/codespan/constrained-triple.md +0 -1
- data/spec/scenarios/codespan/constrained.adoc +0 -1
- data/spec/scenarios/codespan/constrained.md +0 -1
- data/spec/scenarios/codespan/literal.adoc +0 -15
- data/spec/scenarios/codespan/literal.md +0 -15
- data/spec/scenarios/codespan/plus-plus.adoc +0 -1
- data/spec/scenarios/codespan/plus-plus.md +0 -1
- data/spec/scenarios/codespan/possessive.adoc +0 -3
- data/spec/scenarios/codespan/possessive.md +0 -3
- data/spec/scenarios/codespan/quoted.adoc +0 -1
- data/spec/scenarios/codespan/quoted.md +0 -1
- data/spec/scenarios/codespan/smart-quotes.adoc +0 -1
- data/spec/scenarios/codespan/smart-quotes.md +0 -1
- data/spec/scenarios/codespan/star-star.adoc +0 -1
- data/spec/scenarios/codespan/star-star.md +0 -1
- data/spec/scenarios/codespan/unconstrained.adoc +0 -7
- data/spec/scenarios/codespan/unconstrained.md +0 -7
- data/spec/scenarios/dl/compound-only.adoc +0 -16
- data/spec/scenarios/dl/compound-only.md +0 -13
- data/spec/scenarios/dl/compound.adoc +0 -11
- data/spec/scenarios/dl/compound.md +0 -7
- data/spec/scenarios/dl/empty-dd.adoc +0 -3
- data/spec/scenarios/dl/empty-dd.md +0 -4
- data/spec/scenarios/dl/nested-bookended.adoc +0 -8
- data/spec/scenarios/dl/nested-bookended.md +0 -6
- data/spec/scenarios/dl/nested-mixed.adoc +0 -11
- data/spec/scenarios/dl/nested-mixed.md +0 -11
- data/spec/scenarios/dl/nested.adoc +0 -15
- data/spec/scenarios/dl/nested.md +0 -23
- data/spec/scenarios/dl/simple.adoc +0 -9
- data/spec/scenarios/dl/simple.md +0 -10
- data/spec/scenarios/em/asterisks.adoc +0 -1
- data/spec/scenarios/em/asterisks.md +0 -1
- data/spec/scenarios/em/constrained.adoc +0 -1
- data/spec/scenarios/em/constrained.md +0 -1
- data/spec/scenarios/em/strong.adoc +0 -1
- data/spec/scenarios/em/strong.md +0 -1
- data/spec/scenarios/em/unconstrained.adoc +0 -4
- data/spec/scenarios/em/unconstrained.md +0 -4
- data/spec/scenarios/entity/numeric.adoc +0 -1
- data/spec/scenarios/entity/numeric.md +0 -1
- data/spec/scenarios/entity/reverse.adoc +0 -5
- data/spec/scenarios/entity/reverse.md +0 -5
- data/spec/scenarios/heading/anchor-with-dot.adoc +0 -2
- data/spec/scenarios/heading/anchor-with-dot.md +0 -1
- data/spec/scenarios/heading/auto_ids/auto-id-prefix.adoc +0 -11
- data/spec/scenarios/heading/auto_ids/auto-id-prefix.md +0 -7
- data/spec/scenarios/heading/auto_ids/auto-id-prefix.opts +0 -2
- data/spec/scenarios/heading/auto_ids/character-reference.adoc +0 -8
- data/spec/scenarios/heading/auto_ids/character-reference.md +0 -5
- data/spec/scenarios/heading/auto_ids/character-reference.opts +0 -1
- data/spec/scenarios/heading/auto_ids/disabled.adoc +0 -3
- data/spec/scenarios/heading/auto_ids/disabled.md +0 -3
- data/spec/scenarios/heading/auto_ids/disabled.opts +0 -3
- data/spec/scenarios/heading/auto_ids/dot-separator.adoc +0 -2
- data/spec/scenarios/heading/auto_ids/dot-separator.md +0 -1
- data/spec/scenarios/heading/auto_ids/dot-separator.opts +0 -2
- data/spec/scenarios/heading/auto_ids/explicit-id.adoc +0 -14
- data/spec/scenarios/heading/auto_ids/explicit-id.md +0 -9
- data/spec/scenarios/heading/auto_ids/explicit-id.opts +0 -1
- data/spec/scenarios/heading/auto_ids/kramdown-input-character-reference.adoc +0 -8
- data/spec/scenarios/heading/auto_ids/kramdown-input-character-reference.md +0 -5
- data/spec/scenarios/heading/auto_ids/kramdown-input-character-reference.opts +0 -2
- data/spec/scenarios/heading/auto_ids/kramdown-input.adoc +0 -14
- data/spec/scenarios/heading/auto_ids/kramdown-input.md +0 -9
- data/spec/scenarios/heading/auto_ids/kramdown-input.opts +0 -2
- data/spec/scenarios/heading/auto_ids/no-ids.adoc +0 -14
- data/spec/scenarios/heading/auto_ids/no-ids.md +0 -9
- data/spec/scenarios/heading/auto_ids/no-ids.opts +0 -1
- data/spec/scenarios/heading/block-title.adoc +0 -11
- data/spec/scenarios/heading/block-title.md +0 -11
- data/spec/scenarios/heading/formatting.adoc +0 -1
- data/spec/scenarios/heading/formatting.md +0 -1
- data/spec/scenarios/heading/lazy_ids/auto-ids-sync-id-attrs.adoc +0 -7
- data/spec/scenarios/heading/lazy_ids/auto-ids-sync-id-attrs.md +0 -5
- data/spec/scenarios/heading/lazy_ids/auto-ids-sync-id-attrs.opts +0 -5
- data/spec/scenarios/heading/lazy_ids/auto-ids.adoc +0 -10
- data/spec/scenarios/heading/lazy_ids/auto-ids.md +0 -7
- data/spec/scenarios/heading/lazy_ids/auto-ids.opts +0 -4
- data/spec/scenarios/heading/lazy_ids/explicit-ids-dot-separator.adoc +0 -9
- data/spec/scenarios/heading/lazy_ids/explicit-ids-dot-separator.md +0 -7
- data/spec/scenarios/heading/lazy_ids/explicit-ids-dot-separator.opts +0 -3
- data/spec/scenarios/heading/lazy_ids/explicit-ids-empty-prefix.adoc +0 -9
- data/spec/scenarios/heading/lazy_ids/explicit-ids-empty-prefix.md +0 -7
- data/spec/scenarios/heading/lazy_ids/explicit-ids-empty-prefix.opts +0 -3
- data/spec/scenarios/heading/lazy_ids/explicit-ids-empty-separator.adoc +0 -9
- data/spec/scenarios/heading/lazy_ids/explicit-ids-empty-separator.md +0 -7
- data/spec/scenarios/heading/lazy_ids/explicit-ids-empty-separator.opts +0 -3
- data/spec/scenarios/heading/lazy_ids/explicit-ids-zero-separator.adoc +0 -7
- data/spec/scenarios/heading/lazy_ids/explicit-ids-zero-separator.md +0 -5
- data/spec/scenarios/heading/lazy_ids/explicit-ids-zero-separator.opts +0 -3
- data/spec/scenarios/heading/lazy_ids/explicit-ids.adoc +0 -15
- data/spec/scenarios/heading/lazy_ids/explicit-ids.md +0 -13
- data/spec/scenarios/heading/lazy_ids/explicit-ids.opts +0 -1
- data/spec/scenarios/heading/leading-anchor.adoc +0 -2
- data/spec/scenarios/heading/leading-anchor.md +0 -1
- data/spec/scenarios/heading/not-block-title.adoc +0 -8
- data/spec/scenarios/heading/not-block-title.md +0 -7
- data/spec/scenarios/heading/offset.adoc +0 -5
- data/spec/scenarios/heading/offset.md +0 -5
- data/spec/scenarios/heading/offset.opts +0 -1
- data/spec/scenarios/heading/out-of-sequence.adoc +0 -23
- data/spec/scenarios/heading/out-of-sequence.md +0 -21
- data/spec/scenarios/heading/outline.adoc +0 -13
- data/spec/scenarios/heading/outline.md +0 -13
- data/spec/scenarios/heading/surrounding-anchor.adoc +0 -2
- data/spec/scenarios/heading/surrounding-anchor.md +0 -1
- data/spec/scenarios/hr/around-block.adoc +0 -5
- data/spec/scenarios/hr/around-block.md +0 -5
- data/spec/scenarios/hr/between-blocks.adoc +0 -5
- data/spec/scenarios/hr/between-blocks.md +0 -5
- data/spec/scenarios/hr/dashes.adoc +0 -1
- data/spec/scenarios/hr/dashes.md +0 -1
- data/spec/scenarios/html_element/abbr.adoc +0 -1
- data/spec/scenarios/html_element/abbr.md +0 -1
- data/spec/scenarios/html_element/admonition.adoc +0 -5
- data/spec/scenarios/html_element/admonition.md +0 -7
- data/spec/scenarios/html_element/div-mixed.adoc +0 -1
- data/spec/scenarios/html_element/div-mixed.md +0 -4
- data/spec/scenarios/html_element/div-text-only.adoc +0 -1
- data/spec/scenarios/html_element/div-text-only.md +0 -1
- data/spec/scenarios/html_element/empty-p.adoc +0 -5
- data/spec/scenarios/html_element/empty-p.md +0 -5
- data/spec/scenarios/html_element/heading-with-class.adoc +0 -7
- data/spec/scenarios/html_element/heading-with-class.md +0 -5
- data/spec/scenarios/html_element/heading-with-id.adoc +0 -2
- data/spec/scenarios/html_element/heading-with-id.md +0 -1
- data/spec/scenarios/html_element/image-with-id.adoc +0 -2
- data/spec/scenarios/html_element/image-with-id.md +0 -1
- data/spec/scenarios/html_element/img-with-alt-and-width.adoc +0 -1
- data/spec/scenarios/html_element/img-with-alt-and-width.md +0 -1
- data/spec/scenarios/html_element/img-with-percentage-width-css.adoc +0 -1
- data/spec/scenarios/html_element/img-with-percentage-width-css.md +0 -1
- data/spec/scenarios/html_element/img-with-percentage-width.adoc +0 -1
- data/spec/scenarios/html_element/img-with-percentage-width.md +0 -1
- data/spec/scenarios/html_element/img-with-width-css.adoc +0 -1
- data/spec/scenarios/html_element/img-with-width-css.md +0 -1
- data/spec/scenarios/html_element/img-with-width.adoc +0 -1
- data/spec/scenarios/html_element/img-with-width.md +0 -1
- data/spec/scenarios/html_element/img.adoc +0 -2
- data/spec/scenarios/html_element/img.md +0 -1
- data/spec/scenarios/html_element/mark.adoc +0 -1
- data/spec/scenarios/html_element/mark.md +0 -1
- data/spec/scenarios/html_element/native.adoc +0 -1
- data/spec/scenarios/html_element/native.md +0 -1
- data/spec/scenarios/html_element/pre-code-with-language.adoc +0 -6
- data/spec/scenarios/html_element/pre-code-with-language.md +0 -4
- data/spec/scenarios/html_element/span.adoc +0 -3
- data/spec/scenarios/html_element/span.md +0 -3
- data/spec/scenarios/html_element/strike.adoc +0 -1
- data/spec/scenarios/html_element/strike.md +0 -1
- data/spec/scenarios/html_element/sub.adoc +0 -1
- data/spec/scenarios/html_element/sub.md +0 -1
- data/spec/scenarios/html_element/sup.adoc +0 -1
- data/spec/scenarios/html_element/sup.md +0 -1
- data/spec/scenarios/html_element/unrecognized-admonition.adoc +0 -5
- data/spec/scenarios/html_element/unrecognized-admonition.md +0 -5
- data/spec/scenarios/img/block-in-list.adoc +0 -5
- data/spec/scenarios/img/block-in-list.md +0 -5
- data/spec/scenarios/img/block-with-alt.adoc +0 -1
- data/spec/scenarios/img/block-with-alt.md +0 -1
- data/spec/scenarios/img/block-with-link-and-alt.adoc +0 -1
- data/spec/scenarios/img/block-with-link-and-alt.md +0 -1
- data/spec/scenarios/img/block-with-link.adoc +0 -1
- data/spec/scenarios/img/block-with-link.md +0 -1
- data/spec/scenarios/img/block.adoc +0 -1
- data/spec/scenarios/img/block.md +0 -1
- data/spec/scenarios/img/imagesdir.adoc +0 -4
- data/spec/scenarios/img/imagesdir.md +0 -3
- data/spec/scenarios/img/imagesdir.opts +0 -2
- data/spec/scenarios/img/implicit-imagesdir.adoc +0 -3
- data/spec/scenarios/img/implicit-imagesdir.md +0 -3
- data/spec/scenarios/img/implicit-imagesdir.opts +0 -1
- data/spec/scenarios/img/inline-with-alt.adoc +0 -1
- data/spec/scenarios/img/inline-with-alt.md +0 -1
- data/spec/scenarios/img/inline-with-link-and-alt.adoc +0 -1
- data/spec/scenarios/img/inline-with-link-and-alt.md +0 -1
- data/spec/scenarios/img/inline-with-link.adoc +0 -1
- data/spec/scenarios/img/inline-with-link.md +0 -1
- data/spec/scenarios/img/inline.adoc +0 -1
- data/spec/scenarios/img/inline.md +0 -1
- data/spec/scenarios/ol/compound-separated.adoc +0 -29
- data/spec/scenarios/ol/compound-separated.md +0 -25
- data/spec/scenarios/ol/compound.adoc +0 -29
- data/spec/scenarios/ol/compound.md +0 -20
- data/spec/scenarios/ol/formatted.adoc +0 -3
- data/spec/scenarios/ol/formatted.md +0 -3
- data/spec/scenarios/ol/mixed-separated.adoc +0 -6
- data/spec/scenarios/ol/mixed-separated.md +0 -11
- data/spec/scenarios/ol/mixed.adoc +0 -6
- data/spec/scenarios/ol/mixed.md +0 -6
- data/spec/scenarios/ol/nested-mixed.adoc +0 -8
- data/spec/scenarios/ol/nested-mixed.md +0 -8
- data/spec/scenarios/ol/nested-separated.adoc +0 -7
- data/spec/scenarios/ol/nested-separated.md +0 -13
- data/spec/scenarios/ol/nested.adoc +0 -7
- data/spec/scenarios/ol/nested.md +0 -7
- data/spec/scenarios/ol/simple-separated.adoc +0 -4
- data/spec/scenarios/ol/simple-separated.md +0 -7
- data/spec/scenarios/ol/simple.adoc +0 -4
- data/spec/scenarios/ol/simple.md +0 -4
- data/spec/scenarios/p/admonition/emphasis.adoc +0 -11
- data/spec/scenarios/p/admonition/emphasis.md +0 -11
- data/spec/scenarios/p/admonition/in-blockquote.adoc +0 -1
- data/spec/scenarios/p/admonition/in-blockquote.md +0 -1
- data/spec/scenarios/p/admonition/in-compound-blockquote.adoc +0 -5
- data/spec/scenarios/p/admonition/in-compound-blockquote.md +0 -3
- data/spec/scenarios/p/admonition/in-list-item.adoc +0 -6
- data/spec/scenarios/p/admonition/in-list-item.md +0 -6
- data/spec/scenarios/p/admonition/label-only.adoc +0 -1
- data/spec/scenarios/p/admonition/label-only.md +0 -1
- data/spec/scenarios/p/admonition/plain.adoc +0 -13
- data/spec/scenarios/p/admonition/plain.md +0 -13
- data/spec/scenarios/p/admonition/strong-emphasis.adoc +0 -11
- data/spec/scenarios/p/admonition/strong-emphasis.md +0 -11
- data/spec/scenarios/p/multiple-lines.adoc +0 -2
- data/spec/scenarios/p/multiple-lines.md +0 -2
- data/spec/scenarios/p/sequential.adoc +0 -3
- data/spec/scenarios/p/sequential.md +0 -3
- data/spec/scenarios/p/single-line.adoc +0 -1
- data/spec/scenarios/p/single-line.md +0 -1
- data/spec/scenarios/root/body-only.adoc +0 -1
- data/spec/scenarios/root/body-only.md +0 -1
- data/spec/scenarios/root/book-doctype.adoc +0 -10
- data/spec/scenarios/root/book-doctype.md +0 -9
- data/spec/scenarios/root/header-and-body.adoc +0 -3
- data/spec/scenarios/root/header-and-body.md +0 -3
- data/spec/scenarios/root/header-only.adoc +0 -1
- data/spec/scenarios/root/header-only.md +0 -1
- data/spec/scenarios/smart_quote/apostrophe.adoc +0 -1
- data/spec/scenarios/smart_quote/apostrophe.md +0 -1
- data/spec/scenarios/smart_quote/double-quotes.adoc +0 -1
- data/spec/scenarios/smart_quote/double-quotes.md +0 -1
- data/spec/scenarios/smart_quote/single-quotes.adoc +0 -1
- data/spec/scenarios/smart_quote/single-quotes.md +0 -1
- data/spec/scenarios/strong/constrained.adoc +0 -1
- data/spec/scenarios/strong/constrained.md +0 -1
- data/spec/scenarios/strong/menu.adoc +0 -3
- data/spec/scenarios/strong/menu.md +0 -1
- data/spec/scenarios/strong/nested-emphasis.adoc +0 -1
- data/spec/scenarios/strong/nested-emphasis.md +0 -1
- data/spec/scenarios/strong/unconstrained.adoc +0 -8
- data/spec/scenarios/strong/unconstrained.md +0 -8
- data/spec/scenarios/table/alignment.adoc +0 -19
- data/spec/scenarios/table/alignment.md +0 -8
- data/spec/scenarios/table/cell-with-image.adoc +0 -9
- data/spec/scenarios/table/cell-with-image.md +0 -4
- data/spec/scenarios/table/cell-with-pipe.adoc +0 -5
- data/spec/scenarios/table/cell-with-pipe.md +0 -1
- data/spec/scenarios/table/header.adoc +0 -9
- data/spec/scenarios/table/header.md +0 -4
- data/spec/scenarios/table/no-header.adoc +0 -8
- data/spec/scenarios/table/no-header.md +0 -2
- data/spec/scenarios/table/single-column-with-header.adoc +0 -6
- data/spec/scenarios/table/single-column-with-header.md +0 -4
- data/spec/scenarios/table/single-column-without-header.adoc +0 -4
- data/spec/scenarios/table/single-column-without-header.md +0 -2
- data/spec/scenarios/text/attribute-reference.adoc +0 -1
- data/spec/scenarios/text/attribute-reference.md +0 -1
- data/spec/scenarios/text/caret.adoc +0 -1
- data/spec/scenarios/text/caret.md +0 -1
- data/spec/scenarios/text/lte.adoc +0 -1
- data/spec/scenarios/text/lte.md +0 -1
- data/spec/scenarios/text/nbsp.adoc +0 -1
- data/spec/scenarios/text/nbsp.md +0 -1
- data/spec/scenarios/text/plus-plus.adoc +0 -6
- data/spec/scenarios/text/plus-plus.md +0 -5
- data/spec/scenarios/text/right-arrow.adoc +0 -1
- data/spec/scenarios/text/right-arrow.md +0 -1
- data/spec/scenarios/text/typographic_sym/apostrophe.adoc +0 -3
- data/spec/scenarios/text/typographic_sym/apostrophe.md +0 -3
- data/spec/scenarios/text/typographic_sym/double-quotes.adoc +0 -1
- data/spec/scenarios/text/typographic_sym/double-quotes.md +0 -1
- data/spec/scenarios/text/typographic_sym/ellipsis.adoc +0 -1
- data/spec/scenarios/text/typographic_sym/ellipsis.md +0 -1
- data/spec/scenarios/text/typographic_sym/mdash.adoc +0 -1
- data/spec/scenarios/text/typographic_sym/mdash.md +0 -1
- data/spec/scenarios/text/typographic_sym/ndash.adoc +0 -1
- data/spec/scenarios/text/typographic_sym/ndash.md +0 -1
- data/spec/scenarios/text/typographic_sym/single-quotes.adoc +0 -1
- data/spec/scenarios/text/typographic_sym/single-quotes.md +0 -1
- data/spec/scenarios/trailing_space.adoc +0 -7
- data/spec/scenarios/trailing_space.md +0 -7
- data/spec/scenarios/typographic_sym/ellipsis.adoc +0 -1
- data/spec/scenarios/typographic_sym/ellipsis.md +0 -1
- data/spec/scenarios/typographic_sym/mdash.adoc +0 -1
- data/spec/scenarios/typographic_sym/mdash.md +0 -1
- data/spec/scenarios/typographic_sym/ndash.adoc +0 -1
- data/spec/scenarios/typographic_sym/ndash.md +0 -1
- data/spec/scenarios/ul/blockquote.adoc +0 -5
- data/spec/scenarios/ul/blockquote.md +0 -2
- data/spec/scenarios/ul/compound-nested.adoc +0 -23
- data/spec/scenarios/ul/compound-nested.md +0 -19
- data/spec/scenarios/ul/compound-only.adoc +0 -5
- data/spec/scenarios/ul/compound-only.md +0 -3
- data/spec/scenarios/ul/compound-separated.adoc +0 -41
- data/spec/scenarios/ul/compound-separated.md +0 -32
- data/spec/scenarios/ul/compound.adoc +0 -41
- data/spec/scenarios/ul/compound.md +0 -26
- data/spec/scenarios/ul/formatted.adoc +0 -3
- data/spec/scenarios/ul/formatted.md +0 -3
- data/spec/scenarios/ul/inside-delimited-block.adoc +0 -9
- data/spec/scenarios/ul/inside-delimited-block.md +0 -7
- data/spec/scenarios/ul/nested-bookended.adoc +0 -7
- data/spec/scenarios/ul/nested-bookended.md +0 -7
- data/spec/scenarios/ul/nested-separated.adoc +0 -11
- data/spec/scenarios/ul/nested-separated.md +0 -21
- data/spec/scenarios/ul/nested.adoc +0 -11
- data/spec/scenarios/ul/nested.md +0 -11
- data/spec/scenarios/ul/simple-separated.adoc +0 -3
- data/spec/scenarios/ul/simple-separated.md +0 -5
- data/spec/scenarios/ul/simple.adoc +0 -3
- data/spec/scenarios/ul/simple.md +0 -3
- data/spec/scenarios/wrap/containing-line-comment.adoc +0 -3
- data/spec/scenarios/wrap/containing-line-comment.md +0 -3
- data/spec/scenarios/wrap/containing-line-comment.opts +0 -1
- data/spec/scenarios/wrap/none.adoc +0 -1
- data/spec/scenarios/wrap/none.md +0 -4
- data/spec/scenarios/wrap/none.opts +0 -1
- data/spec/scenarios/wrap/preserve.adoc +0 -5
- data/spec/scenarios/wrap/preserve.md +0 -5
- data/spec/scenarios/wrap/preserve.opts +0 -1
- data/spec/scenarios/wrap/ventilate-exclamation.adoc +0 -3
- data/spec/scenarios/wrap/ventilate-exclamation.md +0 -1
- data/spec/scenarios/wrap/ventilate-exclamation.opts +0 -1
- data/spec/scenarios/wrap/ventilate-french.adoc +0 -3
- data/spec/scenarios/wrap/ventilate-french.md +0 -1
- data/spec/scenarios/wrap/ventilate-french.opts +0 -1
- data/spec/scenarios/wrap/ventilate-question.adoc +0 -3
- data/spec/scenarios/wrap/ventilate-question.md +0 -3
- data/spec/scenarios/wrap/ventilate-question.opts +0 -1
- data/spec/scenarios/wrap/ventilate-table-cell.adoc +0 -9
- data/spec/scenarios/wrap/ventilate-table-cell.md +0 -3
- data/spec/scenarios/wrap/ventilate-table-cell.opts +0 -1
- data/spec/scenarios/wrap/ventilate-with-comments.adoc +0 -5
- data/spec/scenarios/wrap/ventilate-with-comments.md +0 -5
- data/spec/scenarios/wrap/ventilate-with-comments.opts +0 -1
- data/spec/scenarios/wrap/ventilate.adoc +0 -2
- data/spec/scenarios/wrap/ventilate.md +0 -6
- data/spec/scenarios/wrap/ventilate.opts +0 -1
- data/spec/scenarios/xml_comment/above-block.adoc +0 -7
- data/spec/scenarios/xml_comment/above-block.md +0 -5
- data/spec/scenarios/xml_comment/above-header.adoc +0 -13
- data/spec/scenarios/xml_comment/above-header.md +0 -16
- data/spec/scenarios/xml_comment/at-start-of-line.adoc +0 -9
- data/spec/scenarios/xml_comment/at-start-of-line.md +0 -4
- data/spec/scenarios/xml_comment/block.adoc +0 -7
- data/spec/scenarios/xml_comment/block.md +0 -6
- data/spec/scenarios/xml_comment/line-adjacent-to-text.adoc +0 -2
- data/spec/scenarios/xml_comment/line-adjacent-to-text.md +0 -1
- data/spec/scenarios/xml_comment/line-empty.adoc +0 -7
- data/spec/scenarios/xml_comment/line-empty.md +0 -9
- data/spec/scenarios/xml_comment/line-offset-by-space.adoc +0 -1
- data/spec/scenarios/xml_comment/line-offset-by-space.md +0 -1
- data/spec/scenarios/xml_comment/line.adoc +0 -1
- data/spec/scenarios/xml_comment/line.md +0 -1
- data/spec/scenarios/xml_comment/list-separator.adoc +0 -7
- data/spec/scenarios/xml_comment/list-separator.md +0 -7
- data/spec/scenarios/xml_comment/mixed.adoc +0 -7
- data/spec/scenarios/xml_comment/mixed.md +0 -6
- data/spec/scenarios/xml_comment/multiline-span.adoc +0 -8
- data/spec/scenarios/xml_comment/multiline-span.md +0 -7
- data/spec/scenarios/xml_comment/p-separator.adoc +0 -5
- data/spec/scenarios/xml_comment/p-separator.md +0 -5
- data/spec/scenarios/xml_comment/styled.adoc +0 -6
- data/spec/scenarios/xml_comment/styled.md +0 -6
- data/spec/scenarios/xml_comment/surrounded-by-spaces.adoc +0 -3
- data/spec/scenarios/xml_comment/surrounded-by-spaces.md +0 -1
- data/spec/spec_helper.rb +0 -41
data/Rakefile
DELETED
data/spec/api_spec.rb
DELETED
@@ -1,228 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
describe Kramdown::AsciiDoc do
|
4
|
-
context '#convert' do
|
5
|
-
it 'converts Markdown to AsciiDoc' do
|
6
|
-
input = <<~EOS
|
7
|
-
---
|
8
|
-
title: Document Title
|
9
|
-
---
|
10
|
-
|
11
|
-
Body content.
|
12
|
-
EOS
|
13
|
-
|
14
|
-
expected = <<~EOS
|
15
|
-
= Document Title
|
16
|
-
|
17
|
-
Body content.
|
18
|
-
EOS
|
19
|
-
|
20
|
-
(expect subject.convert input).to eql expected
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'encodes Markdown source to UTF-8' do
|
24
|
-
input = %(bien s\u00fbr !).encode Encoding::ISO_8859_1
|
25
|
-
output = subject.convert input
|
26
|
-
(expect output.encoding).to eql Encoding::UTF_8
|
27
|
-
(expect output).to eql %(bien s\u00fbr !\n)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'converts CRLF newlines in Markdown source to LF newlines' do
|
31
|
-
input = %(\r\n\r\none\r\ntwo\r\nthree\r\n)
|
32
|
-
output = subject.convert input
|
33
|
-
(expect output.encoding).to eql Encoding::UTF_8
|
34
|
-
(expect output).to eql %(one\ntwo\nthree\n)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'converts CR newlines in Markdown source to LF newlines' do
|
38
|
-
input = %(\r\rone\rtwo\rthree\r)
|
39
|
-
output = subject.convert input
|
40
|
-
(expect output.encoding).to eql Encoding::UTF_8
|
41
|
-
(expect output).to eql %(one\ntwo\nthree\n)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'writes AsciiDoc to string path specified by :to option' do
|
45
|
-
the_output_file = output_file 'convert-to-string-path.adoc'
|
46
|
-
(expect subject.convert 'Converted using the API', to: the_output_file).to be_nil
|
47
|
-
(expect (IO.read the_output_file)).to eql %(Converted using the API\n)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'creates intermediary directories when writing to string path specified by :to option' do
|
51
|
-
the_output_file = output_file 'path/to/convert-to-string-path.adoc'
|
52
|
-
the_output_dir = (Pathname.new the_output_file).dirname
|
53
|
-
(expect subject.convert 'Converted using the API', to: the_output_file).to be_nil
|
54
|
-
(expect the_output_dir).to exist
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'writes AsciiDoc to pathname specified by :to option' do
|
58
|
-
the_output_file = Pathname.new output_file 'convert-to-pathname.adoc'
|
59
|
-
(expect subject.convert 'Converted using the API', to: the_output_file).to be_nil
|
60
|
-
(expect the_output_file.read).to eql %(Converted using the API\n)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'creates intermediary directories when writing to pathname specified by :to option' do
|
64
|
-
the_output_file = Pathname.new output_file 'path/to/convert-to-pathname.adoc'
|
65
|
-
(expect subject.convert 'Converted using the API', to: the_output_file).to be_nil
|
66
|
-
(expect the_output_file.dirname).to exist
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'writes AsciiDoc to IO object specified by :to option' do
|
70
|
-
old_stdout, $stdout = $stdout, StringIO.new
|
71
|
-
begin
|
72
|
-
(expect subject.convert 'text', to: $stdout).to be_nil
|
73
|
-
(expect $stdout.string).to eql %(text\n)
|
74
|
-
ensure
|
75
|
-
$stdout = old_stdout
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'does not mutate options argument' do
|
80
|
-
the_output_file = Pathname.new output_file 'convert-with-options.adoc'
|
81
|
-
opts = { encode: true, to: the_output_file, attributes: {} }
|
82
|
-
hash = opts.hash
|
83
|
-
(expect subject.convert '**File > Save**', opts).to be_nil
|
84
|
-
(expect the_output_file.read).to eql %(:experimental:\n\nmenu:File[Save]\n)
|
85
|
-
(expect opts.hash).to eql hash
|
86
|
-
end
|
87
|
-
|
88
|
-
it 'adds line feed (EOL) to end of output document if non-empty' do
|
89
|
-
(expect subject.convert 'paragraph').to end_with ?\n
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'does not add line feed (EOL) to end of output document if empty' do
|
93
|
-
(expect subject.convert '').to be_empty
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'duplicates value of :attributes option' do
|
97
|
-
input = <<~EOS
|
98
|
-
# Document Title
|
99
|
-
|
100
|
-
# Part 1
|
101
|
-
|
102
|
-
## Chapter A
|
103
|
-
|
104
|
-
so it begins
|
105
|
-
EOS
|
106
|
-
|
107
|
-
expected = <<~EOS
|
108
|
-
= Document Title
|
109
|
-
:doctype: book
|
110
|
-
|
111
|
-
= Part 1
|
112
|
-
|
113
|
-
== Chapter A
|
114
|
-
|
115
|
-
so it begins
|
116
|
-
EOS
|
117
|
-
|
118
|
-
(expect subject.convert input, attributes: (attributes = {})).to eql expected
|
119
|
-
(expect attributes).to be_empty
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
context '#convert_file' do
|
124
|
-
let(:source) { 'Markdown was *here*, but it has become **AsciiDoc**!' }
|
125
|
-
let(:expected_output) { %(Markdown was _here_, but it has become *AsciiDoc*!\n) }
|
126
|
-
let!(:the_source_file) { (output_file %(convert-file-api-#{object_id}.md)).tap {|file| IO.write file, source } }
|
127
|
-
|
128
|
-
it 'converts Markdown file to AsciiDoc file' do
|
129
|
-
the_output_file = output_file %(convert-file-api-#{object_id}.adoc)
|
130
|
-
(expect subject.convert_file the_source_file).to be_nil
|
131
|
-
(expect Pathname.new the_output_file).to exist
|
132
|
-
(expect (IO.read the_output_file)).to eql expected_output
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'writes output file to string path specified by :to option' do
|
136
|
-
the_output_file = output_file 'convert-file-to-string-path.adoc'
|
137
|
-
(expect subject.convert_file the_source_file, to: the_output_file).to be_nil
|
138
|
-
(expect (IO.read the_output_file)).to eql expected_output
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'creates intermediary directories when writing to string path specified by :to option' do
|
142
|
-
the_output_file = output_file 'path/to/convert-file-to-string-path.adoc'
|
143
|
-
the_output_dir = (Pathname.new the_output_file).dirname
|
144
|
-
(expect subject.convert_file the_source_file, to: the_output_file).to be_nil
|
145
|
-
(expect the_output_dir).to exist
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'writes output file to pathname specified by :to option' do
|
149
|
-
the_output_file = Pathname.new output_file 'convert-file-to-pathname.adoc'
|
150
|
-
(expect subject.convert_file the_source_file, to: the_output_file).to be_nil
|
151
|
-
(expect (the_output_file.read)).to eql expected_output
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'creates intermediary directories when writing to pathname specified by :to option' do
|
155
|
-
the_output_file = Pathname.new output_file 'path/to/convert-file-to-pathname.adoc'
|
156
|
-
(expect subject.convert_file the_source_file, to: the_output_file).to be_nil
|
157
|
-
(expect the_output_file.dirname).to exist
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'returns output as string if value of :to option is falsy' do
|
161
|
-
(expect subject.convert_file the_source_file, to: nil).to eql expected_output
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'writes output to IO object specified by :to option' do
|
165
|
-
output_sink = StringIO.new
|
166
|
-
(expect subject.convert_file the_source_file, to: output_sink).to be_nil
|
167
|
-
(expect output_sink.string).to eql expected_output
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'writes output file as UTF-8 regardless of default external encoding' do
|
171
|
-
source = %(tr\u00e8s bien !)
|
172
|
-
the_output_file = output_file 'force-encoding.adoc'
|
173
|
-
script_file = output_file 'force-encoding.rb'
|
174
|
-
IO.write script_file, <<~EOS
|
175
|
-
require 'kramdown-asciidoc'
|
176
|
-
Kramdoc.convert '#{source}', to: '#{the_output_file}'
|
177
|
-
EOS
|
178
|
-
# NOTE internal encoding must also be set for test to work on JRuby
|
179
|
-
`#{ruby} -E ISO-8859-1:ISO-8859-1 #{Shellwords.escape script_file}`
|
180
|
-
(expect IO.read the_output_file, mode: 'r:UTF-8').to eql %(#{source}\n)
|
181
|
-
end
|
182
|
-
|
183
|
-
it 'does not mutate options argument' do
|
184
|
-
another_source_file = Pathname.new output_file 'convert-file-with-options.md'
|
185
|
-
another_source_file.write '**File > Save**'
|
186
|
-
the_output_file = Pathname.new output_file 'convert-file-with-options.adoc'
|
187
|
-
opts = { to: the_output_file, attributes: {} }
|
188
|
-
hash = opts.hash
|
189
|
-
(expect subject.convert_file another_source_file, opts).to be_nil
|
190
|
-
(expect the_output_file.read).to eql %(:experimental:\n\nmenu:File[Save]\n)
|
191
|
-
(expect opts.hash).to eql hash
|
192
|
-
end
|
193
|
-
|
194
|
-
it 'passes result through postprocess callback if given' do
|
195
|
-
the_output_file = output_file %(convert-file-api-#{object_id}.adoc)
|
196
|
-
postprocess = -> (asciidoc) { asciidoc.gsub 'become', 'become glorious' }
|
197
|
-
(expect subject.convert_file the_source_file, postprocess: postprocess).to be_nil
|
198
|
-
(expect Pathname.new the_output_file).to exist
|
199
|
-
(expect (IO.read the_output_file)).to eql %(Markdown was _here_, but it has become glorious *AsciiDoc*!\n)
|
200
|
-
end
|
201
|
-
|
202
|
-
it 'passes krawdown document to postprocess method if arity is not 1' do
|
203
|
-
the_output_file = output_file %(convert-file-api-#{object_id}.adoc)
|
204
|
-
postprocess = -> (asciidoc, kramdown_doc) { asciidoc.gsub 'Markdown', kramdown_doc.options[:input] }
|
205
|
-
(expect subject.convert_file the_source_file, postprocess: postprocess).to be_nil
|
206
|
-
(expect Pathname.new the_output_file).to exist
|
207
|
-
(expect (IO.read the_output_file)).to eql %(GFM was _here_, but it has become *AsciiDoc*!\n)
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'uses original source if postprocess callback returns falsy' do
|
211
|
-
the_output_file = output_file %(convert-file-api-#{object_id}.adoc)
|
212
|
-
postprocess = -> (asciidoc) { nil }
|
213
|
-
(expect subject.convert_file the_source_file, postprocess: postprocess).to be_nil
|
214
|
-
(expect Pathname.new the_output_file).to exist
|
215
|
-
(expect (IO.read the_output_file)).to eql %(Markdown was _here_, but it has become *AsciiDoc*!\n)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
describe Kramdoc do
|
221
|
-
it 'supports Kramdoc as an alias for Kramdown::AsciiDoc' do
|
222
|
-
(expect Kramdoc).to eql Kramdown::AsciiDoc
|
223
|
-
end
|
224
|
-
|
225
|
-
it 'can be required using the alias kramdoc' do
|
226
|
-
require 'kramdoc'
|
227
|
-
end
|
228
|
-
end
|
data/spec/cli_spec.rb
DELETED
@@ -1,300 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
require 'kramdown-asciidoc/cli'
|
3
|
-
|
4
|
-
describe Kramdown::AsciiDoc::Cli do
|
5
|
-
# NOTE override subject to return class object; RSpec returns instance of class by default
|
6
|
-
subject { Kramdown::AsciiDoc::Cli }
|
7
|
-
|
8
|
-
before :each do
|
9
|
-
@old_stdin, $stdin = $stdin, StringIO.new
|
10
|
-
@old_stdout, $stdout = $stdout, StringIO.new
|
11
|
-
@old_stderr, $stderr = $stderr, StringIO.new
|
12
|
-
end
|
13
|
-
|
14
|
-
after :each do
|
15
|
-
$stdin, $stdout, $stderr = @old_stdin, @old_stdout, @old_stderr
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'option flags' do
|
19
|
-
it 'returns non-zero exit status and displays usage when no arguments are given' do
|
20
|
-
expected = 'kramdoc: Please specify a Markdown file to convert.'
|
21
|
-
(expect subject.run []).to eql 1
|
22
|
-
(expect $stderr.string.chomp).to eql expected
|
23
|
-
(expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'returns non-zero exit status and displays usage when more than one argument is given' do
|
27
|
-
expected = 'kramdoc: extra arguments detected (unparsed arguments: bar.md)'
|
28
|
-
(expect subject.run %w(foo.md bar.md)).to eql 1
|
29
|
-
(expect $stderr.string.chomp).to eql expected
|
30
|
-
(expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'returns non-zero exit status when invalid argument is given' do
|
34
|
-
(expect subject.run %w(--invalid-option)).to eql 1
|
35
|
-
(expect $stderr.string.chomp).to eql 'kramdoc: invalid option: --invalid-option'
|
36
|
-
(expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'displays version when -v flag is used' do
|
40
|
-
(expect subject.run %w(-v)).to eql 0
|
41
|
-
(expect $stdout.string.chomp).to eql %(kramdoc #{Kramdown::AsciiDoc::VERSION})
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'displays help when -h flag is used' do
|
45
|
-
(expect subject.run %w(-h)).to eql 0
|
46
|
-
(expect $stdout.string.chomp).to start_with 'Usage: kramdoc'
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'computes output file from input file' do
|
50
|
-
the_source_file = output_file 'implicit-output.md'
|
51
|
-
the_output_file = output_file 'implicit-output.adoc'
|
52
|
-
IO.write the_source_file, 'This is just a test.'
|
53
|
-
(expect subject.run the_source_file).to eql 0
|
54
|
-
(expect (IO.read the_output_file).chomp).to eql 'This is just a test.'
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'writes output to file specified by the -o option' do
|
58
|
-
the_source_file = output_file 'explicit-output.md'
|
59
|
-
the_output_file = output_file 'my-explicit-output.adoc'
|
60
|
-
IO.write the_source_file, 'This is only a test.'
|
61
|
-
(expect subject.run %W(-o #{the_output_file} #{the_source_file})).to eql 0
|
62
|
-
(expect (IO.read the_output_file).chomp).to eql 'This is only a test.'
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'ensures directory of explicit output file exists before writing' do
|
66
|
-
the_source_file = output_file 'ensure-output-dir.md'
|
67
|
-
the_output_file = output_file 'path/to/output/file.adoc'
|
68
|
-
IO.write the_source_file, 'Everything is going to be fine.'
|
69
|
-
(expect subject.run %W(-o #{the_output_file} #{the_source_file})).to eql 0
|
70
|
-
(expect (IO.read the_output_file).chomp).to eql 'Everything is going to be fine.'
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'prevents computed output file from overwriting input file' do
|
74
|
-
the_source_file = output_file 'implicit-conflict.adoc'
|
75
|
-
IO.write the_source_file, 'No can do.'
|
76
|
-
expected = %(kramdoc: input and output cannot be the same file: #{the_source_file})
|
77
|
-
(expect subject.run the_source_file).to eql 1
|
78
|
-
(expect $stderr.string.chomp).to eql expected
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'prevents explicit output file from overwriting input file' do
|
82
|
-
the_source_file = output_file 'explicit-conflict.md'
|
83
|
-
the_output_file = the_source_file
|
84
|
-
IO.write the_source_file, 'No can do.'
|
85
|
-
expected = %(kramdoc: input and output cannot be the same file: #{the_source_file})
|
86
|
-
(expect subject.run %W(-o #{the_output_file} #{the_source_file})).to eql 1
|
87
|
-
(expect $stderr.string.chomp).to eql expected
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'writes output to stdout when -o option equals -' do
|
91
|
-
the_source_file = scenario_file 'p/single-line.md'
|
92
|
-
(expect subject.run %W(-o - #{the_source_file})).to eql 0
|
93
|
-
(expect $stdout.string.chomp).to eql 'A paragraph that consists of a single line.'
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'reads input from stdin when argument is -' do
|
97
|
-
$stdin.puts '- list item'
|
98
|
-
$stdin.rewind
|
99
|
-
(expect subject.run %w(-o - -)).to eql 0
|
100
|
-
(expect $stdout.string.chomp).to eql '* list item'
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'writes output to stdout when input comes from stdin and -o option is not specified' do
|
104
|
-
$stdin.puts '- list item'
|
105
|
-
$stdin.rewind
|
106
|
-
(expect subject.run '-').to eql 0
|
107
|
-
(expect $stdout.string.chomp).to eql '* list item'
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'writes output to file specified by -o option when input comes from stdin' do
|
111
|
-
the_output_file = output_file 'output-from-stdin.adoc'
|
112
|
-
$stdin.puts '- list item'
|
113
|
-
$stdin.rewind
|
114
|
-
(expect subject.run %W(-o #{the_output_file} -)).to eql 0
|
115
|
-
(expect (IO.read the_output_file).chomp).to eql '* list item'
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'removes leading blank lines and trailing whitespace from source' do
|
119
|
-
the_source_file = output_file 'leading-trailing-space.md'
|
120
|
-
IO.write the_source_file, <<~EOS
|
121
|
-
\n\n\n\n
|
122
|
-
# Heading
|
123
|
-
|
124
|
-
Body content.#{' '}
|
125
|
-
\n\n\n\n
|
126
|
-
EOS
|
127
|
-
(expect subject.run %W(-o - #{the_source_file})).to eql 0
|
128
|
-
(expect $stdout.string.chomp).to eql %(= Heading\n\nBody content.)
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'converts all newlines to line feed characters' do
|
132
|
-
the_source_file = output_file 'newlines.md'
|
133
|
-
IO.write the_source_file, %(\r\n\r\n# Document Title\r\n\r\nFirst paragraph.\r\n\r\nSecond paragraph.\r\n)
|
134
|
-
(expect subject.run %W(-o - #{the_source_file})).to eql 0
|
135
|
-
(expect $stdout.string.chomp).to eql %(= Document Title\n\nFirst paragraph.\n\nSecond paragraph.)
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'processes front matter in source' do
|
139
|
-
the_source_file = output_file 'front-matter.md'
|
140
|
-
IO.write the_source_file, <<~EOS
|
141
|
-
---
|
142
|
-
title: Document Title
|
143
|
-
---
|
144
|
-
Body content.
|
145
|
-
EOS
|
146
|
-
(expect subject.run %W(-o - #{the_source_file})).to eql 0
|
147
|
-
(expect $stdout.string.chomp).to eql %(= Document Title\n\nBody content.)
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'replaces explicit toc in source' do
|
151
|
-
the_source_file = output_file 'toc.md'
|
152
|
-
IO.write the_source_file, <<~EOS
|
153
|
-
# Guide
|
154
|
-
|
155
|
-
<!-- TOC depthFrom:2 depthTo:6 -->
|
156
|
-
- [Prerequisites](#prerequisites)
|
157
|
-
- [Installation](#installation)
|
158
|
-
- [Deployment](#deployment)
|
159
|
-
<!-- /TOC -->
|
160
|
-
|
161
|
-
...
|
162
|
-
EOS
|
163
|
-
(expect subject.run %W(-o - #{the_source_file})).to eql 0
|
164
|
-
(expect $stdout.string.chomp).to eql %(= Guide\n:toc: macro\n\ntoc::[]\n\n...)
|
165
|
-
end
|
166
|
-
|
167
|
-
it 'reads Markdown source using specified format' do
|
168
|
-
the_source_file = output_file 'format-markdown.md'
|
169
|
-
IO.write the_source_file, '#Heading'
|
170
|
-
(expect subject.run %W(-o - --format=markdown #{the_source_file})).to eql 0
|
171
|
-
(expect $stdout.string.chomp).to eql '= Heading'
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'removes directory prefix from image references specified by the --imagesdir option' do
|
175
|
-
the_source_file = scenario_file 'img/implicit-imagesdir.md'
|
176
|
-
expected = IO.read scenario_file 'img/implicit-imagesdir.adoc'
|
177
|
-
(expect subject.run %W(-o - --imagesdir=images #{the_source_file})).to eql 0
|
178
|
-
(expect $stdout.string).to eql expected
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'wraps output as specified by the --wrap option' do
|
182
|
-
the_source_file = scenario_file 'wrap/ventilate.md'
|
183
|
-
expected = IO.read scenario_file 'wrap/ventilate.adoc'
|
184
|
-
(expect subject.run %W(-o - --wrap=ventilate #{the_source_file})).to eql 0
|
185
|
-
(expect $stdout.string).to eql expected
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'does not escape bare URLs when --auto-links is used' do
|
189
|
-
the_source_file = scenario_file 'a/bare-url.md'
|
190
|
-
expected = IO.read scenario_file 'a/bare-url.adoc'
|
191
|
-
(expect subject.run %W(-o - --auto-links #{the_source_file})).to eql 0
|
192
|
-
(expect $stdout.string).to eql expected
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'escapes bare URLs when --no-auto-links is used' do
|
196
|
-
the_source_file = scenario_file 'a/no-auto-links.md'
|
197
|
-
expected = IO.read scenario_file 'a/no-auto-links.adoc'
|
198
|
-
(expect subject.run %W(-o - --no-auto-links #{the_source_file})).to eql 0
|
199
|
-
(expect $stdout.string).to eql expected
|
200
|
-
end
|
201
|
-
|
202
|
-
it 'shifts headings by offset when --heading-offset is used' do
|
203
|
-
the_source_file = scenario_file 'heading/offset.md'
|
204
|
-
expected = IO.read scenario_file 'heading/offset.adoc'
|
205
|
-
(expect subject.run %W(-o - --heading-offset=-1 #{the_source_file})).to eql 0
|
206
|
-
(expect $stdout.string).to eql expected
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'auto generates IDs for section titles when --auto-ids is used' do
|
210
|
-
the_source_file = scenario_file 'heading/auto_ids/no-ids.md'
|
211
|
-
expected = IO.read scenario_file 'heading/auto_ids/no-ids.adoc'
|
212
|
-
(expect subject.run %W(-o - --auto-ids #{the_source_file})).to eql 0
|
213
|
-
(expect $stdout.string).to eql expected
|
214
|
-
end
|
215
|
-
|
216
|
-
it 'adds prefix specified by --auto-id-prefix to any auto-generated section title ID' do
|
217
|
-
the_source_file = scenario_file 'heading/auto_ids/explicit-id.md'
|
218
|
-
expected = <<~EOS
|
219
|
-
[#_heading-1]
|
220
|
-
= Heading 1
|
221
|
-
|
222
|
-
[#_heading]
|
223
|
-
== Heading
|
224
|
-
|
225
|
-
[#_heading-2]
|
226
|
-
== Heading
|
227
|
-
|
228
|
-
[#explicit-id]
|
229
|
-
=== Heading 3
|
230
|
-
|
231
|
-
[#_back-to-heading-2]
|
232
|
-
== Back to Heading 2
|
233
|
-
EOS
|
234
|
-
(expect subject.run %W(-o - --auto-id-prefix=_ --auto-ids #{the_source_file})).to eql 0
|
235
|
-
(expect $stdout.string).to eql expected
|
236
|
-
end
|
237
|
-
|
238
|
-
it 'uses separator specified by --auto-id-separator to any auto-generated section title ID' do
|
239
|
-
the_source_file = scenario_file 'heading/auto_ids/explicit-id.md'
|
240
|
-
expected = <<~EOS
|
241
|
-
[#_heading_1]
|
242
|
-
= Heading 1
|
243
|
-
|
244
|
-
[#_heading]
|
245
|
-
== Heading
|
246
|
-
|
247
|
-
[#_heading_2]
|
248
|
-
== Heading
|
249
|
-
|
250
|
-
[#explicit-id]
|
251
|
-
=== Heading 3
|
252
|
-
|
253
|
-
[#_back_to_heading_2]
|
254
|
-
== Back to Heading 2
|
255
|
-
EOS
|
256
|
-
(expect subject.run %W(-o - --auto-id-prefix=_ --auto-id-separator=_ --auto-ids #{the_source_file})).to eql 0
|
257
|
-
(expect $stdout.string).to eql expected
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'drops ID if matches auto-generated value when --lazy-ids is used' do
|
261
|
-
the_source_file = scenario_file 'heading/lazy_ids/explicit-ids.md'
|
262
|
-
expected = IO.read scenario_file 'heading/lazy_ids/explicit-ids.adoc'
|
263
|
-
(expect subject.run %W(-o - --lazy-ids #{the_source_file})).to eql 0
|
264
|
-
(expect $stdout.string).to eql expected
|
265
|
-
end
|
266
|
-
|
267
|
-
it 'adds specified attributes to document header' do
|
268
|
-
the_source_file = scenario_file 'root/header-and-body.md'
|
269
|
-
(expect subject.run %W(-o - -a idprefix -a idseparator=- #{the_source_file})).to eql 0
|
270
|
-
expected = <<~EOS
|
271
|
-
= Document Title
|
272
|
-
:idprefix:
|
273
|
-
:idseparator: -
|
274
|
-
|
275
|
-
Body content.
|
276
|
-
EOS
|
277
|
-
(expect $stdout.string).to eql expected
|
278
|
-
end
|
279
|
-
|
280
|
-
it 'passes through HTML when --no-html-to-native flag is used' do
|
281
|
-
the_source_file = scenario_file 'html_element/native.md'
|
282
|
-
(expect subject.run %W(-o - --no-html-to-native #{the_source_file})).to eql 0
|
283
|
-
expected = <<~EOS
|
284
|
-
+++<p>++++++<strong>+++strong emphasis (aka bold)+++</strong>+++ +++<em>+++emphasis (aka italic)+++</em>+++ +++<code>+++monospace+++</code>++++++</p>+++
|
285
|
-
EOS
|
286
|
-
(expect $stdout.string).to eql expected
|
287
|
-
end
|
288
|
-
|
289
|
-
it 'reads arguments from ARGV by default' do
|
290
|
-
old_ARGV = ARGV.dup
|
291
|
-
ARGV.replace %w(-v)
|
292
|
-
begin
|
293
|
-
(expect subject.run).to eql 0
|
294
|
-
(expect $stdout.string.chomp).to eql %(kramdoc #{Kramdown::AsciiDoc::VERSION})
|
295
|
-
ensure
|
296
|
-
ARGV.replace old_ARGV
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|