daqing_kramdown 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +1 -0
- data/CONTRIBUTERS +78 -0
- data/COPYING +30 -0
- data/README.md +71 -0
- data/VERSION +1 -0
- data/bin/daqing_kramdown +132 -0
- data/data/kramdown/document.html +22 -0
- data/data/kramdown/document.latex +50 -0
- data/lib/kramdown.rb +10 -0
- data/lib/kramdown/converter.rb +68 -0
- data/lib/kramdown/converter/base.rb +261 -0
- data/lib/kramdown/converter/hash_ast.rb +38 -0
- data/lib/kramdown/converter/html.rb +535 -0
- data/lib/kramdown/converter/kramdown.rb +448 -0
- data/lib/kramdown/converter/latex.rb +625 -0
- data/lib/kramdown/converter/man.rb +300 -0
- data/lib/kramdown/converter/math_engine/mathjax.rb +32 -0
- data/lib/kramdown/converter/remove_html_tags.rb +57 -0
- data/lib/kramdown/converter/syntax_highlighter.rb +56 -0
- data/lib/kramdown/converter/syntax_highlighter/minted.rb +35 -0
- data/lib/kramdown/converter/syntax_highlighter/rouge.rb +85 -0
- data/lib/kramdown/converter/toc.rb +69 -0
- data/lib/kramdown/document.rb +139 -0
- data/lib/kramdown/element.rb +551 -0
- data/lib/kramdown/error.rb +17 -0
- data/lib/kramdown/options.rb +604 -0
- data/lib/kramdown/parser.rb +26 -0
- data/lib/kramdown/parser/base.rb +131 -0
- data/lib/kramdown/parser/html.rb +608 -0
- data/lib/kramdown/parser/kramdown.rb +376 -0
- data/lib/kramdown/parser/kramdown/abbreviation.rb +78 -0
- data/lib/kramdown/parser/kramdown/autolink.rb +31 -0
- data/lib/kramdown/parser/kramdown/blank_line.rb +30 -0
- data/lib/kramdown/parser/kramdown/block_boundary.rb +34 -0
- data/lib/kramdown/parser/kramdown/blockquote.rb +38 -0
- data/lib/kramdown/parser/kramdown/codeblock.rb +57 -0
- data/lib/kramdown/parser/kramdown/codespan.rb +54 -0
- data/lib/kramdown/parser/kramdown/emphasis.rb +61 -0
- data/lib/kramdown/parser/kramdown/eob.rb +26 -0
- data/lib/kramdown/parser/kramdown/escaped_chars.rb +25 -0
- data/lib/kramdown/parser/kramdown/extensions.rb +214 -0
- data/lib/kramdown/parser/kramdown/footnote.rb +64 -0
- data/lib/kramdown/parser/kramdown/header.rb +70 -0
- data/lib/kramdown/parser/kramdown/horizontal_rule.rb +27 -0
- data/lib/kramdown/parser/kramdown/html.rb +162 -0
- data/lib/kramdown/parser/kramdown/html_entity.rb +34 -0
- data/lib/kramdown/parser/kramdown/line_break.rb +25 -0
- data/lib/kramdown/parser/kramdown/link.rb +149 -0
- data/lib/kramdown/parser/kramdown/list.rb +284 -0
- data/lib/kramdown/parser/kramdown/math.rb +53 -0
- data/lib/kramdown/parser/kramdown/paragraph.rb +62 -0
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +174 -0
- data/lib/kramdown/parser/kramdown/table.rb +171 -0
- data/lib/kramdown/parser/kramdown/typographic_symbol.rb +44 -0
- data/lib/kramdown/parser/markdown.rb +57 -0
- data/lib/kramdown/utils.rb +45 -0
- data/lib/kramdown/utils/configurable.rb +45 -0
- data/lib/kramdown/utils/entities.rb +344 -0
- data/lib/kramdown/utils/html.rb +84 -0
- data/lib/kramdown/utils/lru_cache.rb +41 -0
- data/lib/kramdown/utils/string_scanner.rb +81 -0
- data/lib/kramdown/utils/unidecoder.rb +50 -0
- data/lib/kramdown/version.rb +15 -0
- data/man/man1/kramdown.1 +0 -0
- data/test/run_tests.rb +46 -0
- data/test/test_files.rb +298 -0
- data/test/test_location.rb +216 -0
- data/test/test_string_scanner_kramdown.rb +27 -0
- data/test/testcases/block/01_blank_line/spaces.html +1 -0
- data/test/testcases/block/01_blank_line/spaces.text +3 -0
- data/test/testcases/block/01_blank_line/tabs.html +1 -0
- data/test/testcases/block/01_blank_line/tabs.text +6 -0
- data/test/testcases/block/02_eob/beginning.html +1 -0
- data/test/testcases/block/02_eob/beginning.text +3 -0
- data/test/testcases/block/02_eob/end.html +1 -0
- data/test/testcases/block/02_eob/end.text +3 -0
- data/test/testcases/block/02_eob/middle.html +1 -0
- data/test/testcases/block/02_eob/middle.text +5 -0
- data/test/testcases/block/03_paragraph/indented.html +18 -0
- data/test/testcases/block/03_paragraph/indented.html.gfm +18 -0
- data/test/testcases/block/03_paragraph/indented.text +19 -0
- data/test/testcases/block/03_paragraph/line_break_last_line.html +9 -0
- data/test/testcases/block/03_paragraph/line_break_last_line.text +9 -0
- data/test/testcases/block/03_paragraph/no_newline_at_end.html +5 -0
- data/test/testcases/block/03_paragraph/no_newline_at_end.text +5 -0
- data/test/testcases/block/03_paragraph/one_para.html +1 -0
- data/test/testcases/block/03_paragraph/one_para.text +1 -0
- data/test/testcases/block/03_paragraph/standalone_image.html +8 -0
- data/test/testcases/block/03_paragraph/standalone_image.text +6 -0
- data/test/testcases/block/03_paragraph/two_para.html +4 -0
- data/test/testcases/block/03_paragraph/two_para.text +4 -0
- data/test/testcases/block/03_paragraph/with_html_to_native.html +1 -0
- data/test/testcases/block/03_paragraph/with_html_to_native.options +1 -0
- data/test/testcases/block/03_paragraph/with_html_to_native.text +1 -0
- data/test/testcases/block/04_header/atx_header.html +57 -0
- data/test/testcases/block/04_header/atx_header.text +54 -0
- data/test/testcases/block/04_header/atx_header_no_newline_at_end.html +1 -0
- data/test/testcases/block/04_header/atx_header_no_newline_at_end.text +1 -0
- data/test/testcases/block/04_header/header_type_offset.html +11 -0
- data/test/testcases/block/04_header/header_type_offset.kramdown +12 -0
- data/test/testcases/block/04_header/header_type_offset.latex +12 -0
- data/test/testcases/block/04_header/header_type_offset.options +2 -0
- data/test/testcases/block/04_header/header_type_offset.text +13 -0
- data/test/testcases/block/04_header/setext_header.html +32 -0
- data/test/testcases/block/04_header/setext_header.text +39 -0
- data/test/testcases/block/04_header/setext_header_no_newline_at_end.html +1 -0
- data/test/testcases/block/04_header/setext_header_no_newline_at_end.text +2 -0
- data/test/testcases/block/04_header/with_auto_id_prefix.html +3 -0
- data/test/testcases/block/04_header/with_auto_id_prefix.options +2 -0
- data/test/testcases/block/04_header/with_auto_id_prefix.text +3 -0
- data/test/testcases/block/04_header/with_auto_id_stripping.html +1 -0
- data/test/testcases/block/04_header/with_auto_id_stripping.options +1 -0
- data/test/testcases/block/04_header/with_auto_id_stripping.text +1 -0
- data/test/testcases/block/04_header/with_auto_ids.html +21 -0
- data/test/testcases/block/04_header/with_auto_ids.options +2 -0
- data/test/testcases/block/04_header/with_auto_ids.text +24 -0
- data/test/testcases/block/05_blockquote/indented.html +25 -0
- data/test/testcases/block/05_blockquote/indented.text +14 -0
- data/test/testcases/block/05_blockquote/lazy.html +34 -0
- data/test/testcases/block/05_blockquote/lazy.text +20 -0
- data/test/testcases/block/05_blockquote/nested.html +10 -0
- data/test/testcases/block/05_blockquote/nested.text +6 -0
- data/test/testcases/block/05_blockquote/no_newline_at_end.html +4 -0
- data/test/testcases/block/05_blockquote/no_newline_at_end.text +2 -0
- data/test/testcases/block/05_blockquote/very_long_line.html +3 -0
- data/test/testcases/block/05_blockquote/very_long_line.text +1 -0
- data/test/testcases/block/05_blockquote/with_code_blocks.html +15 -0
- data/test/testcases/block/05_blockquote/with_code_blocks.text +11 -0
- data/test/testcases/block/06_codeblock/disable-highlighting.html +4 -0
- data/test/testcases/block/06_codeblock/disable-highlighting.options +1 -0
- data/test/testcases/block/06_codeblock/disable-highlighting.text +4 -0
- data/test/testcases/block/06_codeblock/error.html +4 -0
- data/test/testcases/block/06_codeblock/error.text +4 -0
- data/test/testcases/block/06_codeblock/guess_lang_css_class.html +15 -0
- data/test/testcases/block/06_codeblock/guess_lang_css_class.options +2 -0
- data/test/testcases/block/06_codeblock/guess_lang_css_class.text +13 -0
- data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.latex +9 -0
- data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.options +4 -0
- data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.text +5 -0
- data/test/testcases/block/06_codeblock/highlighting-minted.latex +8 -0
- data/test/testcases/block/06_codeblock/highlighting-minted.options +3 -0
- data/test/testcases/block/06_codeblock/highlighting-minted.text +4 -0
- data/test/testcases/block/06_codeblock/highlighting-opts.html +6 -0
- data/test/testcases/block/06_codeblock/highlighting-opts.options +7 -0
- data/test/testcases/block/06_codeblock/highlighting-opts.text +4 -0
- data/test/testcases/block/06_codeblock/highlighting.html +5 -0
- data/test/testcases/block/06_codeblock/highlighting.options +5 -0
- data/test/testcases/block/06_codeblock/highlighting.text +4 -0
- data/test/testcases/block/06_codeblock/issue_gh45.html +164 -0
- data/test/testcases/block/06_codeblock/issue_gh45.test +188 -0
- data/test/testcases/block/06_codeblock/lazy.html +4 -0
- data/test/testcases/block/06_codeblock/lazy.text +5 -0
- data/test/testcases/block/06_codeblock/no_newline_at_end.html +2 -0
- data/test/testcases/block/06_codeblock/no_newline_at_end.text +1 -0
- data/test/testcases/block/06_codeblock/no_newline_at_end_1.html +2 -0
- data/test/testcases/block/06_codeblock/no_newline_at_end_1.text +2 -0
- data/test/testcases/block/06_codeblock/normal.html +13 -0
- data/test/testcases/block/06_codeblock/normal.text +10 -0
- data/test/testcases/block/06_codeblock/rouge/disabled.html +2 -0
- data/test/testcases/block/06_codeblock/rouge/disabled.options +4 -0
- data/test/testcases/block/06_codeblock/rouge/disabled.text +1 -0
- data/test/testcases/block/06_codeblock/rouge/multiple.html +11 -0
- data/test/testcases/block/06_codeblock/rouge/multiple.options +4 -0
- data/test/testcases/block/06_codeblock/rouge/multiple.text +11 -0
- data/test/testcases/block/06_codeblock/rouge/simple.html +10 -0
- data/test/testcases/block/06_codeblock/rouge/simple.options +3 -0
- data/test/testcases/block/06_codeblock/rouge/simple.text +9 -0
- data/test/testcases/block/06_codeblock/tilde_syntax.html +7 -0
- data/test/testcases/block/06_codeblock/tilde_syntax.text +9 -0
- data/test/testcases/block/06_codeblock/whitespace.html +3 -0
- data/test/testcases/block/06_codeblock/whitespace.text +3 -0
- data/test/testcases/block/06_codeblock/with_blank_line.html +13 -0
- data/test/testcases/block/06_codeblock/with_blank_line.text +12 -0
- data/test/testcases/block/06_codeblock/with_eob_marker.html +6 -0
- data/test/testcases/block/06_codeblock/with_eob_marker.text +5 -0
- data/test/testcases/block/06_codeblock/with_ial.html +6 -0
- data/test/testcases/block/06_codeblock/with_ial.text +5 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block.html +24 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block.options +2 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block.text +33 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.html +8 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.options +2 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.text +11 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.html +3 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.options +2 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.text +4 -0
- data/test/testcases/block/07_horizontal_rule/error.html +7 -0
- data/test/testcases/block/07_horizontal_rule/error.text +7 -0
- data/test/testcases/block/07_horizontal_rule/normal.html +19 -0
- data/test/testcases/block/07_horizontal_rule/normal.text +20 -0
- data/test/testcases/block/07_horizontal_rule/sepspaces.html +3 -0
- data/test/testcases/block/07_horizontal_rule/sepspaces.text +3 -0
- data/test/testcases/block/07_horizontal_rule/septabs.html +3 -0
- data/test/testcases/block/07_horizontal_rule/septabs.text +3 -0
- data/test/testcases/block/08_list/brackets_in_item.latex +3 -0
- data/test/testcases/block/08_list/brackets_in_item.text +1 -0
- data/test/testcases/block/08_list/escaping.html +17 -0
- data/test/testcases/block/08_list/escaping.text +17 -0
- data/test/testcases/block/08_list/item_ial.html +10 -0
- data/test/testcases/block/08_list/item_ial.text +8 -0
- data/test/testcases/block/08_list/lazy.html +39 -0
- data/test/testcases/block/08_list/lazy.text +29 -0
- data/test/testcases/block/08_list/lazy_and_nested.html +9 -0
- data/test/testcases/block/08_list/lazy_and_nested.text +4 -0
- data/test/testcases/block/08_list/list_and_hr.html +9 -0
- data/test/testcases/block/08_list/list_and_hr.text +5 -0
- data/test/testcases/block/08_list/list_and_others.html +40 -0
- data/test/testcases/block/08_list/list_and_others.text +26 -0
- data/test/testcases/block/08_list/mixed.html +117 -0
- data/test/testcases/block/08_list/mixed.text +66 -0
- data/test/testcases/block/08_list/nested.html +17 -0
- data/test/testcases/block/08_list/nested.text +7 -0
- data/test/testcases/block/08_list/other_first_element.html +39 -0
- data/test/testcases/block/08_list/other_first_element.text +18 -0
- data/test/testcases/block/08_list/simple_ol.html +19 -0
- data/test/testcases/block/08_list/simple_ol.text +13 -0
- data/test/testcases/block/08_list/simple_ul.html +48 -0
- data/test/testcases/block/08_list/simple_ul.text +36 -0
- data/test/testcases/block/08_list/single_item.html +3 -0
- data/test/testcases/block/08_list/single_item.text +1 -0
- data/test/testcases/block/08_list/special_cases.html +62 -0
- data/test/testcases/block/08_list/special_cases.text +40 -0
- data/test/testcases/block/09_html/comment.html +18 -0
- data/test/testcases/block/09_html/comment.text +15 -0
- data/test/testcases/block/09_html/content_model/deflists.html +6 -0
- data/test/testcases/block/09_html/content_model/deflists.options +1 -0
- data/test/testcases/block/09_html/content_model/deflists.text +6 -0
- data/test/testcases/block/09_html/content_model/tables.html +14 -0
- data/test/testcases/block/09_html/content_model/tables.options +1 -0
- data/test/testcases/block/09_html/content_model/tables.text +14 -0
- data/test/testcases/block/09_html/html5_attributes.html +15 -0
- data/test/testcases/block/09_html/html5_attributes.text +15 -0
- data/test/testcases/block/09_html/html_after_block.html +7 -0
- data/test/testcases/block/09_html/html_after_block.text +5 -0
- data/test/testcases/block/09_html/html_and_codeblocks.html +15 -0
- data/test/testcases/block/09_html/html_and_codeblocks.options +1 -0
- data/test/testcases/block/09_html/html_and_codeblocks.text +13 -0
- data/test/testcases/block/09_html/html_and_headers.html +5 -0
- data/test/testcases/block/09_html/html_and_headers.text +6 -0
- data/test/testcases/block/09_html/html_to_native/code.html +10 -0
- data/test/testcases/block/09_html/html_to_native/code.text +9 -0
- data/test/testcases/block/09_html/html_to_native/comment.html +7 -0
- data/test/testcases/block/09_html/html_to_native/comment.text +8 -0
- data/test/testcases/block/09_html/html_to_native/emphasis.html +6 -0
- data/test/testcases/block/09_html/html_to_native/emphasis.text +6 -0
- data/test/testcases/block/09_html/html_to_native/entity.html +1 -0
- data/test/testcases/block/09_html/html_to_native/entity.text +1 -0
- data/test/testcases/block/09_html/html_to_native/header.html +6 -0
- data/test/testcases/block/09_html/html_to_native/header.options +2 -0
- data/test/testcases/block/09_html/html_to_native/header.text +6 -0
- data/test/testcases/block/09_html/html_to_native/list_dl.html +8 -0
- data/test/testcases/block/09_html/html_to_native/list_dl.text +8 -0
- data/test/testcases/block/09_html/html_to_native/list_ol.html +15 -0
- data/test/testcases/block/09_html/html_to_native/list_ol.text +17 -0
- data/test/testcases/block/09_html/html_to_native/list_ul.html +19 -0
- data/test/testcases/block/09_html/html_to_native/list_ul.text +22 -0
- data/test/testcases/block/09_html/html_to_native/options +1 -0
- data/test/testcases/block/09_html/html_to_native/paragraph.html +3 -0
- data/test/testcases/block/09_html/html_to_native/paragraph.text +4 -0
- data/test/testcases/block/09_html/html_to_native/table_normal.html +12 -0
- data/test/testcases/block/09_html/html_to_native/table_normal.text +12 -0
- data/test/testcases/block/09_html/html_to_native/table_simple.html +61 -0
- data/test/testcases/block/09_html/html_to_native/table_simple.text +71 -0
- data/test/testcases/block/09_html/html_to_native/typography.html +1 -0
- data/test/testcases/block/09_html/html_to_native/typography.text +1 -0
- data/test/testcases/block/09_html/invalid_html_1.html +5 -0
- data/test/testcases/block/09_html/invalid_html_1.text +5 -0
- data/test/testcases/block/09_html/invalid_html_2.html +5 -0
- data/test/testcases/block/09_html/invalid_html_2.text +5 -0
- data/test/testcases/block/09_html/markdown_attr.html +38 -0
- data/test/testcases/block/09_html/markdown_attr.text +38 -0
- data/test/testcases/block/09_html/not_parsed.html +24 -0
- data/test/testcases/block/09_html/not_parsed.text +24 -0
- data/test/testcases/block/09_html/parse_as_raw.html +35 -0
- data/test/testcases/block/09_html/parse_as_raw.htmlinput +34 -0
- data/test/testcases/block/09_html/parse_as_raw.options +1 -0
- data/test/testcases/block/09_html/parse_as_raw.text +33 -0
- data/test/testcases/block/09_html/parse_as_span.html +12 -0
- data/test/testcases/block/09_html/parse_as_span.htmlinput +12 -0
- data/test/testcases/block/09_html/parse_as_span.options +1 -0
- data/test/testcases/block/09_html/parse_as_span.text +9 -0
- data/test/testcases/block/09_html/parse_block_html.html +21 -0
- data/test/testcases/block/09_html/parse_block_html.options +1 -0
- data/test/testcases/block/09_html/parse_block_html.text +17 -0
- data/test/testcases/block/09_html/processing_instruction.html +12 -0
- data/test/testcases/block/09_html/processing_instruction.text +12 -0
- data/test/testcases/block/09_html/simple.html +60 -0
- data/test/testcases/block/09_html/simple.options +1 -0
- data/test/testcases/block/09_html/simple.text +55 -0
- data/test/testcases/block/09_html/standalone_image_in_div.htmlinput +7 -0
- data/test/testcases/block/09_html/standalone_image_in_div.text +8 -0
- data/test/testcases/block/09_html/textarea.html +8 -0
- data/test/testcases/block/09_html/textarea.text +8 -0
- data/test/testcases/block/09_html/xml.html +8 -0
- data/test/testcases/block/09_html/xml.text +7 -0
- data/test/testcases/block/10_ald/simple.html +2 -0
- data/test/testcases/block/10_ald/simple.text +8 -0
- data/test/testcases/block/11_ial/auto_id_and_ial.html +1 -0
- data/test/testcases/block/11_ial/auto_id_and_ial.options +1 -0
- data/test/testcases/block/11_ial/auto_id_and_ial.text +2 -0
- data/test/testcases/block/11_ial/nested.html +11 -0
- data/test/testcases/block/11_ial/nested.text +15 -0
- data/test/testcases/block/11_ial/simple.html +29 -0
- data/test/testcases/block/11_ial/simple.text +41 -0
- data/test/testcases/block/12_extension/comment.html +8 -0
- data/test/testcases/block/12_extension/comment.text +12 -0
- data/test/testcases/block/12_extension/ignored.html +8 -0
- data/test/testcases/block/12_extension/ignored.text +8 -0
- data/test/testcases/block/12_extension/nomarkdown.html +10 -0
- data/test/testcases/block/12_extension/nomarkdown.kramdown +20 -0
- data/test/testcases/block/12_extension/nomarkdown.latex +13 -0
- data/test/testcases/block/12_extension/nomarkdown.text +21 -0
- data/test/testcases/block/12_extension/options.html +21 -0
- data/test/testcases/block/12_extension/options.text +23 -0
- data/test/testcases/block/12_extension/options2.html +10 -0
- data/test/testcases/block/12_extension/options2.text +5 -0
- data/test/testcases/block/12_extension/options3.html +8 -0
- data/test/testcases/block/12_extension/options3.text +7 -0
- data/test/testcases/block/13_definition_list/auto_ids.html +15 -0
- data/test/testcases/block/13_definition_list/auto_ids.text +18 -0
- data/test/testcases/block/13_definition_list/definition_at_beginning.html +1 -0
- data/test/testcases/block/13_definition_list/definition_at_beginning.text +1 -0
- data/test/testcases/block/13_definition_list/deflist_ial.html +4 -0
- data/test/testcases/block/13_definition_list/deflist_ial.text +4 -0
- data/test/testcases/block/13_definition_list/item_ial.html +17 -0
- data/test/testcases/block/13_definition_list/item_ial.text +16 -0
- data/test/testcases/block/13_definition_list/multiple_terms.html +13 -0
- data/test/testcases/block/13_definition_list/multiple_terms.text +10 -0
- data/test/testcases/block/13_definition_list/no_def_list.html +2 -0
- data/test/testcases/block/13_definition_list/no_def_list.text +2 -0
- data/test/testcases/block/13_definition_list/para_wrapping.html +10 -0
- data/test/testcases/block/13_definition_list/para_wrapping.text +6 -0
- data/test/testcases/block/13_definition_list/separated_by_eob.html +8 -0
- data/test/testcases/block/13_definition_list/separated_by_eob.text +5 -0
- data/test/testcases/block/13_definition_list/simple.html +10 -0
- data/test/testcases/block/13_definition_list/simple.text +10 -0
- data/test/testcases/block/13_definition_list/styled_terms.html +4 -0
- data/test/testcases/block/13_definition_list/styled_terms.text +2 -0
- data/test/testcases/block/13_definition_list/too_much_space.html +3 -0
- data/test/testcases/block/13_definition_list/too_much_space.text +4 -0
- data/test/testcases/block/13_definition_list/with_blocks.html +38 -0
- data/test/testcases/block/13_definition_list/with_blocks.text +24 -0
- data/test/testcases/block/14_table/empty_tag_in_cell.html +8 -0
- data/test/testcases/block/14_table/empty_tag_in_cell.options +1 -0
- data/test/testcases/block/14_table/empty_tag_in_cell.text +1 -0
- data/test/testcases/block/14_table/errors.html +12 -0
- data/test/testcases/block/14_table/errors.text +13 -0
- data/test/testcases/block/14_table/escaping.html +52 -0
- data/test/testcases/block/14_table/escaping.text +19 -0
- data/test/testcases/block/14_table/footer.html +65 -0
- data/test/testcases/block/14_table/footer.text +25 -0
- data/test/testcases/block/14_table/header.html +117 -0
- data/test/testcases/block/14_table/header.text +39 -0
- data/test/testcases/block/14_table/no_table.html +3 -0
- data/test/testcases/block/14_table/no_table.text +3 -0
- data/test/testcases/block/14_table/simple.html +192 -0
- data/test/testcases/block/14_table/simple.text +53 -0
- data/test/testcases/block/14_table/table_with_footnote.html +25 -0
- data/test/testcases/block/14_table/table_with_footnote.latex +11 -0
- data/test/testcases/block/14_table/table_with_footnote.text +6 -0
- data/test/testcases/block/15_math/gh_128.html +1 -0
- data/test/testcases/block/15_math/gh_128.text +1 -0
- data/test/testcases/block/15_math/no_engine.html +3 -0
- data/test/testcases/block/15_math/no_engine.options +1 -0
- data/test/testcases/block/15_math/no_engine.text +2 -0
- data/test/testcases/block/15_math/normal.html +30 -0
- data/test/testcases/block/15_math/normal.text +30 -0
- data/test/testcases/block/16_toc/no_toc.html +14 -0
- data/test/testcases/block/16_toc/no_toc.text +16 -0
- data/test/testcases/block/16_toc/toc_exclude.html +35 -0
- data/test/testcases/block/16_toc/toc_exclude.options +1 -0
- data/test/testcases/block/16_toc/toc_exclude.text +19 -0
- data/test/testcases/block/16_toc/toc_levels.html +24 -0
- data/test/testcases/block/16_toc/toc_levels.options +2 -0
- data/test/testcases/block/16_toc/toc_levels.text +16 -0
- data/test/testcases/block/16_toc/toc_with_footnotes.html +13 -0
- data/test/testcases/block/16_toc/toc_with_footnotes.options +1 -0
- data/test/testcases/block/16_toc/toc_with_footnotes.text +6 -0
- data/test/testcases/block/16_toc/toc_with_links.html +8 -0
- data/test/testcases/block/16_toc/toc_with_links.options +2 -0
- data/test/testcases/block/16_toc/toc_with_links.text +8 -0
- data/test/testcases/cjk-line-break.html +4 -0
- data/test/testcases/cjk-line-break.options +1 -0
- data/test/testcases/cjk-line-break.text +12 -0
- data/test/testcases/encoding.html +46 -0
- data/test/testcases/encoding.text +28 -0
- data/test/testcases/man/example.man +123 -0
- data/test/testcases/man/example.text +85 -0
- data/test/testcases/man/heading-name-dash-description.man +4 -0
- data/test/testcases/man/heading-name-dash-description.text +1 -0
- data/test/testcases/man/heading-name-description.man +4 -0
- data/test/testcases/man/heading-name-description.text +2 -0
- data/test/testcases/man/heading-name-section-description.man +4 -0
- data/test/testcases/man/heading-name-section-description.text +1 -0
- data/test/testcases/man/heading-name-section.man +2 -0
- data/test/testcases/man/heading-name-section.text +1 -0
- data/test/testcases/man/heading-name.man +2 -0
- data/test/testcases/man/heading-name.text +1 -0
- data/test/testcases/man/sections.man +4 -0
- data/test/testcases/man/sections.text +11 -0
- data/test/testcases/man/text-escaping.man +8 -0
- data/test/testcases/man/text-escaping.text +7 -0
- data/test/testcases/span/01_link/empty.html +5 -0
- data/test/testcases/span/01_link/empty.text +5 -0
- data/test/testcases/span/01_link/empty_title.htmlinput +3 -0
- data/test/testcases/span/01_link/empty_title.text +7 -0
- data/test/testcases/span/01_link/image_in_a.html +5 -0
- data/test/testcases/span/01_link/image_in_a.text +5 -0
- data/test/testcases/span/01_link/imagelinks.html +15 -0
- data/test/testcases/span/01_link/imagelinks.text +18 -0
- data/test/testcases/span/01_link/inline.html +46 -0
- data/test/testcases/span/01_link/inline.text +48 -0
- data/test/testcases/span/01_link/latex_escaping.latex +6 -0
- data/test/testcases/span/01_link/latex_escaping.text +5 -0
- data/test/testcases/span/01_link/link_defs.html +9 -0
- data/test/testcases/span/01_link/link_defs.text +27 -0
- data/test/testcases/span/01_link/link_defs_with_ial.html +4 -0
- data/test/testcases/span/01_link/link_defs_with_ial.text +16 -0
- data/test/testcases/span/01_link/links_with_angle_brackets.html +3 -0
- data/test/testcases/span/01_link/links_with_angle_brackets.text +3 -0
- data/test/testcases/span/01_link/reference.html +37 -0
- data/test/testcases/span/01_link/reference.options +3 -0
- data/test/testcases/span/01_link/reference.text +53 -0
- data/test/testcases/span/02_emphasis/empty.html +3 -0
- data/test/testcases/span/02_emphasis/empty.text +3 -0
- data/test/testcases/span/02_emphasis/errors.html +9 -0
- data/test/testcases/span/02_emphasis/errors.text +9 -0
- data/test/testcases/span/02_emphasis/nesting.html +41 -0
- data/test/testcases/span/02_emphasis/nesting.text +36 -0
- data/test/testcases/span/02_emphasis/normal.html +65 -0
- data/test/testcases/span/02_emphasis/normal.options +1 -0
- data/test/testcases/span/02_emphasis/normal.text +63 -0
- data/test/testcases/span/03_codespan/empty.html +5 -0
- data/test/testcases/span/03_codespan/empty.text +5 -0
- data/test/testcases/span/03_codespan/errors.html +1 -0
- data/test/testcases/span/03_codespan/errors.text +1 -0
- data/test/testcases/span/03_codespan/highlighting-minted.latex +2 -0
- data/test/testcases/span/03_codespan/highlighting-minted.options +1 -0
- data/test/testcases/span/03_codespan/highlighting-minted.text +1 -0
- data/test/testcases/span/03_codespan/highlighting.html +1 -0
- data/test/testcases/span/03_codespan/highlighting.text +1 -0
- data/test/testcases/span/03_codespan/normal-css-class.html +1 -0
- data/test/testcases/span/03_codespan/normal-css-class.options +2 -0
- data/test/testcases/span/03_codespan/normal-css-class.text +1 -0
- data/test/testcases/span/03_codespan/normal.html +16 -0
- data/test/testcases/span/03_codespan/normal.text +16 -0
- data/test/testcases/span/03_codespan/rouge/disabled.html +1 -0
- data/test/testcases/span/03_codespan/rouge/disabled.options +4 -0
- data/test/testcases/span/03_codespan/rouge/disabled.text +1 -0
- data/test/testcases/span/03_codespan/rouge/simple.html +1 -0
- data/test/testcases/span/03_codespan/rouge/simple.options +1 -0
- data/test/testcases/span/03_codespan/rouge/simple.text +1 -0
- data/test/testcases/span/04_footnote/backlink_inline.html +79 -0
- data/test/testcases/span/04_footnote/backlink_inline.options +1 -0
- data/test/testcases/span/04_footnote/backlink_inline.text +38 -0
- data/test/testcases/span/04_footnote/backlink_text.html +9 -0
- data/test/testcases/span/04_footnote/backlink_text.options +1 -0
- data/test/testcases/span/04_footnote/backlink_text.text +3 -0
- data/test/testcases/span/04_footnote/definitions.html +17 -0
- data/test/testcases/span/04_footnote/definitions.latex +17 -0
- data/test/testcases/span/04_footnote/definitions.text +24 -0
- data/test/testcases/span/04_footnote/footnote_nr.html +12 -0
- data/test/testcases/span/04_footnote/footnote_nr.latex +2 -0
- data/test/testcases/span/04_footnote/footnote_nr.options +1 -0
- data/test/testcases/span/04_footnote/footnote_nr.text +4 -0
- data/test/testcases/span/04_footnote/footnote_prefix.html +12 -0
- data/test/testcases/span/04_footnote/footnote_prefix.options +1 -0
- data/test/testcases/span/04_footnote/footnote_prefix.text +4 -0
- data/test/testcases/span/04_footnote/inside_footnote.html +17 -0
- data/test/testcases/span/04_footnote/inside_footnote.text +9 -0
- data/test/testcases/span/04_footnote/markers.html +46 -0
- data/test/testcases/span/04_footnote/markers.latex +23 -0
- data/test/testcases/span/04_footnote/markers.options +2 -0
- data/test/testcases/span/04_footnote/markers.text +27 -0
- data/test/testcases/span/04_footnote/placement.html +11 -0
- data/test/testcases/span/04_footnote/placement.options +1 -0
- data/test/testcases/span/04_footnote/placement.text +8 -0
- data/test/testcases/span/04_footnote/regexp_problem.html +14 -0
- data/test/testcases/span/04_footnote/regexp_problem.options +2 -0
- data/test/testcases/span/04_footnote/regexp_problem.text +52 -0
- data/test/testcases/span/04_footnote/without_backlink.html +9 -0
- data/test/testcases/span/04_footnote/without_backlink.options +1 -0
- data/test/testcases/span/04_footnote/without_backlink.text +3 -0
- data/test/testcases/span/05_html/across_lines.html +1 -0
- data/test/testcases/span/05_html/across_lines.text +2 -0
- data/test/testcases/span/05_html/button.html +7 -0
- data/test/testcases/span/05_html/button.text +7 -0
- data/test/testcases/span/05_html/invalid.html +1 -0
- data/test/testcases/span/05_html/invalid.text +1 -0
- data/test/testcases/span/05_html/link_with_mailto.html +1 -0
- data/test/testcases/span/05_html/link_with_mailto.text +1 -0
- data/test/testcases/span/05_html/mark_element.html +3 -0
- data/test/testcases/span/05_html/mark_element.text +3 -0
- data/test/testcases/span/05_html/markdown_attr.html +6 -0
- data/test/testcases/span/05_html/markdown_attr.text +6 -0
- data/test/testcases/span/05_html/normal.html +43 -0
- data/test/testcases/span/05_html/normal.text +43 -0
- data/test/testcases/span/05_html/raw_span_elements.html +2 -0
- data/test/testcases/span/05_html/raw_span_elements.text +2 -0
- data/test/testcases/span/05_html/xml.html +5 -0
- data/test/testcases/span/05_html/xml.text +5 -0
- data/test/testcases/span/abbreviations/abbrev.html +21 -0
- data/test/testcases/span/abbreviations/abbrev.text +34 -0
- data/test/testcases/span/abbreviations/abbrev_defs.html +2 -0
- data/test/testcases/span/abbreviations/abbrev_defs.text +5 -0
- data/test/testcases/span/abbreviations/in_footnote.html +9 -0
- data/test/testcases/span/abbreviations/in_footnote.text +5 -0
- data/test/testcases/span/autolinks/url_links.html +15 -0
- data/test/testcases/span/autolinks/url_links.text +16 -0
- data/test/testcases/span/escaped_chars/normal.html +47 -0
- data/test/testcases/span/escaped_chars/normal.text +47 -0
- data/test/testcases/span/extension/comment.html +6 -0
- data/test/testcases/span/extension/comment.text +6 -0
- data/test/testcases/span/extension/ignored.html +1 -0
- data/test/testcases/span/extension/ignored.text +1 -0
- data/test/testcases/span/extension/nomarkdown.html +1 -0
- data/test/testcases/span/extension/nomarkdown.text +1 -0
- data/test/testcases/span/extension/options.html +1 -0
- data/test/testcases/span/extension/options.text +1 -0
- data/test/testcases/span/ial/simple.html +6 -0
- data/test/testcases/span/ial/simple.text +6 -0
- data/test/testcases/span/line_breaks/normal.html +11 -0
- data/test/testcases/span/line_breaks/normal.latex +12 -0
- data/test/testcases/span/line_breaks/normal.text +11 -0
- data/test/testcases/span/math/no_engine.html +1 -0
- data/test/testcases/span/math/no_engine.options +1 -0
- data/test/testcases/span/math/no_engine.text +1 -0
- data/test/testcases/span/math/normal.html +10 -0
- data/test/testcases/span/math/normal.text +10 -0
- data/test/testcases/span/text_substitutions/entities.html +6 -0
- data/test/testcases/span/text_substitutions/entities.options +1 -0
- data/test/testcases/span/text_substitutions/entities.text +6 -0
- data/test/testcases/span/text_substitutions/entities_as_char.html +1 -0
- data/test/testcases/span/text_substitutions/entities_as_char.options +2 -0
- data/test/testcases/span/text_substitutions/entities_as_char.text +1 -0
- data/test/testcases/span/text_substitutions/entities_as_input.html +1 -0
- data/test/testcases/span/text_substitutions/entities_as_input.options +1 -0
- data/test/testcases/span/text_substitutions/entities_as_input.text +1 -0
- data/test/testcases/span/text_substitutions/entities_numeric.html +1 -0
- data/test/testcases/span/text_substitutions/entities_numeric.options +1 -0
- data/test/testcases/span/text_substitutions/entities_numeric.text +1 -0
- data/test/testcases/span/text_substitutions/entities_symbolic.html +1 -0
- data/test/testcases/span/text_substitutions/entities_symbolic.options +1 -0
- data/test/testcases/span/text_substitutions/entities_symbolic.text +1 -0
- data/test/testcases/span/text_substitutions/greaterthan.html +1 -0
- data/test/testcases/span/text_substitutions/greaterthan.text +1 -0
- data/test/testcases/span/text_substitutions/lowerthan.html +1 -0
- data/test/testcases/span/text_substitutions/lowerthan.text +1 -0
- data/test/testcases/span/text_substitutions/typography.html +40 -0
- data/test/testcases/span/text_substitutions/typography.options +1 -0
- data/test/testcases/span/text_substitutions/typography.text +40 -0
- data/test/testcases/span/text_substitutions/typography_subst.html +3 -0
- data/test/testcases/span/text_substitutions/typography_subst.latex +4 -0
- data/test/testcases/span/text_substitutions/typography_subst.options +8 -0
- data/test/testcases/span/text_substitutions/typography_subst.text +3 -0
- metadata +659 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- coding: utf-8; frozen_string_literal: true -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
7
|
+
#++
|
8
|
+
#
|
9
|
+
|
10
|
+
module Kramdown
|
11
|
+
|
12
|
+
# This error is raised when an error condition is encountered.
|
13
|
+
#
|
14
|
+
# *Note* that this error is only raised by the support framework for the parsers and converters.
|
15
|
+
class Error < RuntimeError; end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,604 @@
|
|
1
|
+
# -*- coding: utf-8; frozen_string_literal: true -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
7
|
+
#++
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'yaml'
|
11
|
+
|
12
|
+
module Kramdown
|
13
|
+
|
14
|
+
# This module defines all options that are used by parsers and/or converters as well as providing
|
15
|
+
# methods to deal with the options.
|
16
|
+
module Options
|
17
|
+
|
18
|
+
# Helper class introducing a boolean type for specifying boolean values (+true+ and +false+) as
|
19
|
+
# option types.
|
20
|
+
class Boolean
|
21
|
+
|
22
|
+
# Return +true+ if +other+ is either +true+ or +false+
|
23
|
+
def self.===(other)
|
24
|
+
FalseClass === other || TrueClass === other
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
# ----------------------------
|
30
|
+
# :section: Option definitions
|
31
|
+
#
|
32
|
+
# This sections describes the methods that can be used on the Options module.
|
33
|
+
# ----------------------------
|
34
|
+
|
35
|
+
# Struct class for storing the definition of an option.
|
36
|
+
Definition = Struct.new(:name, :type, :default, :desc, :validator)
|
37
|
+
|
38
|
+
# Allowed option types.
|
39
|
+
ALLOWED_TYPES = [String, Integer, Float, Symbol, Boolean, Object]
|
40
|
+
|
41
|
+
@options = {}
|
42
|
+
|
43
|
+
# Define a new option called +name+ (a Symbol) with the given +type+ (String, Integer, Float,
|
44
|
+
# Symbol, Boolean, Object), default value +default+ and the description +desc+. If a block is
|
45
|
+
# specified, it should validate the value and either raise an error or return a valid value.
|
46
|
+
#
|
47
|
+
# The type 'Object' should only be used for complex types for which none of the other types
|
48
|
+
# suffices. A block needs to be specified when using type 'Object' and it has to cope with
|
49
|
+
# a value given as string and as the opaque type.
|
50
|
+
def self.define(name, type, default, desc, &block)
|
51
|
+
name = name.to_sym
|
52
|
+
raise ArgumentError, "Option name #{name} is already used" if @options.key?(name)
|
53
|
+
raise ArgumentError, "Invalid option type #{type} specified" unless ALLOWED_TYPES.include?(type)
|
54
|
+
raise ArgumentError, "Invalid type for default value" if !(type === default) && !default.nil?
|
55
|
+
raise ArgumentError, "Missing validator block" if type == Object && block.nil?
|
56
|
+
@options[name] = Definition.new(name, type, default, desc, block)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Return all option definitions.
|
60
|
+
def self.definitions
|
61
|
+
@options
|
62
|
+
end
|
63
|
+
|
64
|
+
# Return +true+ if an option called +name+ is defined.
|
65
|
+
def self.defined?(name)
|
66
|
+
@options.key?(name.to_sym)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Return a Hash with the default values for all options.
|
70
|
+
def self.defaults
|
71
|
+
temp = {}
|
72
|
+
@options.each {|_n, o| temp[o.name] = o.default }
|
73
|
+
temp
|
74
|
+
end
|
75
|
+
|
76
|
+
# Merge the #defaults Hash with the *parsed* options from the given Hash, i.e. only valid option
|
77
|
+
# names are considered and their value is run through the #parse method.
|
78
|
+
def self.merge(hash)
|
79
|
+
temp = defaults
|
80
|
+
hash.each do |k, v|
|
81
|
+
k = k.to_sym
|
82
|
+
temp[k] = @options.key?(k) ? parse(k, v) : v
|
83
|
+
end
|
84
|
+
temp
|
85
|
+
end
|
86
|
+
|
87
|
+
# Parse the given value +data+ as if it was a value for the option +name+ and return the parsed
|
88
|
+
# value with the correct type.
|
89
|
+
#
|
90
|
+
# If +data+ already has the correct type, it is just returned. Otherwise it is converted to a
|
91
|
+
# String and then to the correct type.
|
92
|
+
def self.parse(name, data)
|
93
|
+
name = name.to_sym
|
94
|
+
raise ArgumentError, "No option named #{name} defined" unless @options.key?(name)
|
95
|
+
unless @options[name].type === data
|
96
|
+
data = data.to_s
|
97
|
+
data = if @options[name].type == String
|
98
|
+
data
|
99
|
+
elsif @options[name].type == Integer
|
100
|
+
Integer(data) rescue raise Kramdown::Error, "Invalid integer value for option '#{name}': '#{data}'"
|
101
|
+
elsif @options[name].type == Float
|
102
|
+
Float(data) rescue raise Kramdown::Error, "Invalid float value for option '#{name}': '#{data}'"
|
103
|
+
elsif @options[name].type == Symbol
|
104
|
+
str_to_sym(data)
|
105
|
+
elsif @options[name].type == Boolean
|
106
|
+
data.downcase.strip != 'false' && !data.empty?
|
107
|
+
end
|
108
|
+
end
|
109
|
+
data = @options[name].validator[data] if @options[name].validator
|
110
|
+
data
|
111
|
+
end
|
112
|
+
|
113
|
+
# Converts the given String +data+ into a Symbol or +nil+ with the
|
114
|
+
# following provisions:
|
115
|
+
#
|
116
|
+
# - A leading colon is stripped from the string.
|
117
|
+
# - An empty value or a value equal to "nil" results in +nil+.
|
118
|
+
def self.str_to_sym(data)
|
119
|
+
data = data.strip
|
120
|
+
data = data[1..-1] if data[0] == ':'
|
121
|
+
(data.empty? || data == 'nil' ? nil : data.to_sym)
|
122
|
+
end
|
123
|
+
|
124
|
+
# ----------------------------
|
125
|
+
# :section: Option Validators
|
126
|
+
#
|
127
|
+
# This sections contains all pre-defined option validators.
|
128
|
+
# ----------------------------
|
129
|
+
|
130
|
+
# Ensures that the option value +val+ for the option called +name+ is a valid array. The
|
131
|
+
# parameter +val+ can be
|
132
|
+
#
|
133
|
+
# - a comma separated string which is split into an array of values
|
134
|
+
# - or an array.
|
135
|
+
#
|
136
|
+
# Optionally, the array is checked for the correct size.
|
137
|
+
def self.simple_array_validator(val, name, size = nil)
|
138
|
+
if String === val
|
139
|
+
val = val.split(/,/)
|
140
|
+
elsif !(Array === val)
|
141
|
+
raise Kramdown::Error, "Invalid type #{val.class} for option #{name}"
|
142
|
+
end
|
143
|
+
if size && val.size != size
|
144
|
+
raise Kramdown::Error, "Option #{name} needs exactly #{size} values"
|
145
|
+
end
|
146
|
+
val
|
147
|
+
end
|
148
|
+
|
149
|
+
# Ensures that the option value +val+ for the option called +name+ is a valid hash. The
|
150
|
+
# parameter +val+ can be
|
151
|
+
#
|
152
|
+
# - a hash in YAML format
|
153
|
+
# - or a Ruby Hash object.
|
154
|
+
def self.simple_hash_validator(val, name)
|
155
|
+
if String === val
|
156
|
+
begin
|
157
|
+
val = YAML.safe_load(val)
|
158
|
+
rescue RuntimeError, ArgumentError, SyntaxError
|
159
|
+
raise Kramdown::Error, "Invalid YAML value for option #{name}"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
raise Kramdown::Error, "Invalid type #{val.class} for option #{name}" unless Hash === val
|
163
|
+
val
|
164
|
+
end
|
165
|
+
|
166
|
+
# ----------------------------
|
167
|
+
# :section: Option Definitions
|
168
|
+
#
|
169
|
+
# This sections contains all option definitions that are used by the included
|
170
|
+
# parsers/converters.
|
171
|
+
# ----------------------------
|
172
|
+
|
173
|
+
define(:template, String, '', <<~EOF)
|
174
|
+
The name of an ERB template file that should be used to wrap the output
|
175
|
+
or the ERB template itself.
|
176
|
+
|
177
|
+
This is used to wrap the output in an environment so that the output can
|
178
|
+
be used as a stand-alone document. For example, an HTML template would
|
179
|
+
provide the needed header and body tags so that the whole output is a
|
180
|
+
valid HTML file. If no template is specified, the output will be just
|
181
|
+
the converted text.
|
182
|
+
|
183
|
+
When resolving the template file, the given template name is used first.
|
184
|
+
If such a file is not found, the converter extension (the same as the
|
185
|
+
converter name) is appended. If the file still cannot be found, the
|
186
|
+
templates name is interpreted as a template name that is provided by
|
187
|
+
kramdown (without the converter extension). If the file is still not
|
188
|
+
found, the template name is checked if it starts with 'string://' and if
|
189
|
+
it does, this prefix is removed and the rest is used as template
|
190
|
+
content.
|
191
|
+
|
192
|
+
kramdown provides a default template named 'document' for each converter.
|
193
|
+
|
194
|
+
Default: ''
|
195
|
+
Used by: all converters
|
196
|
+
EOF
|
197
|
+
|
198
|
+
define(:auto_ids, Boolean, true, <<~EOF)
|
199
|
+
Use automatic header ID generation
|
200
|
+
|
201
|
+
If this option is `true`, ID values for all headers are automatically
|
202
|
+
generated if no ID is explicitly specified.
|
203
|
+
|
204
|
+
Default: true
|
205
|
+
Used by: HTML/Latex converter
|
206
|
+
EOF
|
207
|
+
|
208
|
+
define(:auto_id_stripping, Boolean, false, <<~EOF)
|
209
|
+
Strip all formatting from header text for automatic ID generation
|
210
|
+
|
211
|
+
If this option is `true`, only the text elements of a header are used
|
212
|
+
for generating the ID later (in contrast to just using the raw header
|
213
|
+
text line).
|
214
|
+
|
215
|
+
This option will be removed in version 2.0 because this will be the
|
216
|
+
default then.
|
217
|
+
|
218
|
+
Default: false
|
219
|
+
Used by: kramdown parser
|
220
|
+
EOF
|
221
|
+
|
222
|
+
define(:auto_id_prefix, String, '', <<~EOF)
|
223
|
+
Prefix used for automatically generated header IDs
|
224
|
+
|
225
|
+
This option can be used to set a prefix for the automatically generated
|
226
|
+
header IDs so that there is no conflict when rendering multiple kramdown
|
227
|
+
documents into one output file separately. The prefix should only
|
228
|
+
contain characters that are valid in an ID!
|
229
|
+
|
230
|
+
Default: ''
|
231
|
+
Used by: HTML/Latex converter
|
232
|
+
EOF
|
233
|
+
|
234
|
+
define(:transliterated_header_ids, Boolean, false, <<~EOF)
|
235
|
+
Transliterate the header text before generating the ID
|
236
|
+
|
237
|
+
Only ASCII characters are used in headers IDs. This is not good for
|
238
|
+
languages with many non-ASCII characters. By enabling this option
|
239
|
+
the header text is transliterated to ASCII as good as possible so that
|
240
|
+
the resulting header ID is more useful.
|
241
|
+
|
242
|
+
The stringex library needs to be installed for this feature to work!
|
243
|
+
|
244
|
+
Default: false
|
245
|
+
Used by: HTML/Latex converter
|
246
|
+
EOF
|
247
|
+
|
248
|
+
define(:parse_block_html, Boolean, false, <<~EOF)
|
249
|
+
Process kramdown syntax in block HTML tags
|
250
|
+
|
251
|
+
If this option is `true`, the kramdown parser processes the content of
|
252
|
+
block HTML tags as text containing block-level elements. Since this is
|
253
|
+
not wanted normally, the default is `false`. It is normally better to
|
254
|
+
selectively enable kramdown processing via the markdown attribute.
|
255
|
+
|
256
|
+
Default: false
|
257
|
+
Used by: kramdown parser
|
258
|
+
EOF
|
259
|
+
|
260
|
+
define(:parse_span_html, Boolean, true, <<~EOF)
|
261
|
+
Process kramdown syntax in span HTML tags
|
262
|
+
|
263
|
+
If this option is `true`, the kramdown parser processes the content of
|
264
|
+
span HTML tags as text containing span-level elements.
|
265
|
+
|
266
|
+
Default: true
|
267
|
+
Used by: kramdown parser
|
268
|
+
EOF
|
269
|
+
|
270
|
+
define(:html_to_native, Boolean, false, <<~EOF)
|
271
|
+
Convert HTML elements to native elements
|
272
|
+
|
273
|
+
If this option is `true`, the parser converts HTML elements to native
|
274
|
+
elements. For example, when parsing `<em>hallo</em>` the emphasis tag
|
275
|
+
would normally be converted to an `:html` element with tag type `:em`.
|
276
|
+
If `html_to_native` is `true`, then the emphasis would be converted to a
|
277
|
+
native `:em` element.
|
278
|
+
|
279
|
+
This is useful for converters that cannot deal with HTML elements.
|
280
|
+
|
281
|
+
Default: false
|
282
|
+
Used by: kramdown parser
|
283
|
+
EOF
|
284
|
+
|
285
|
+
define(:link_defs, Object, {}, <<~EOF) do |val|
|
286
|
+
Pre-defines link definitions
|
287
|
+
|
288
|
+
This option can be used to pre-define link definitions. The value needs
|
289
|
+
to be a Hash where the keys are the link identifiers and the values are
|
290
|
+
two element Arrays with the link URL and the link title.
|
291
|
+
|
292
|
+
If the value is a String, it has to contain a valid YAML hash and the
|
293
|
+
hash has to follow the above guidelines.
|
294
|
+
|
295
|
+
Default: {}
|
296
|
+
Used by: kramdown parser
|
297
|
+
EOF
|
298
|
+
val = simple_hash_validator(val, :link_defs)
|
299
|
+
val.each do |_k, v|
|
300
|
+
if !(Array === v) || v.size > 2 || v.empty?
|
301
|
+
raise Kramdown::Error, "Invalid structure for hash value of option #{name}"
|
302
|
+
end
|
303
|
+
v << nil if v.size == 1
|
304
|
+
end
|
305
|
+
val
|
306
|
+
end
|
307
|
+
|
308
|
+
define(:footnote_nr, Integer, 1, <<~EOF)
|
309
|
+
The number of the first footnote
|
310
|
+
|
311
|
+
This option can be used to specify the number that is used for the first
|
312
|
+
footnote.
|
313
|
+
|
314
|
+
Default: 1
|
315
|
+
Used by: HTML converter
|
316
|
+
EOF
|
317
|
+
|
318
|
+
define(:entity_output, Symbol, :as_char, <<~EOF)
|
319
|
+
Defines how entities are output
|
320
|
+
|
321
|
+
The possible values are :as_input (entities are output in the same
|
322
|
+
form as found in the input), :numeric (entities are output in numeric
|
323
|
+
form), :symbolic (entities are output in symbolic form if possible) or
|
324
|
+
:as_char (entities are output as characters if possible, only available
|
325
|
+
on Ruby 1.9).
|
326
|
+
|
327
|
+
Default: :as_char
|
328
|
+
Used by: HTML converter, kramdown converter
|
329
|
+
EOF
|
330
|
+
|
331
|
+
TOC_LEVELS_RANGE = (1..6).freeze
|
332
|
+
TOC_LEVELS_ARRAY = TOC_LEVELS_RANGE.to_a.freeze
|
333
|
+
private_constant :TOC_LEVELS_RANGE, :TOC_LEVELS_ARRAY
|
334
|
+
|
335
|
+
define(:toc_levels, Object, TOC_LEVELS_ARRAY, <<~EOF) do |val|
|
336
|
+
Defines the levels that are used for the table of contents
|
337
|
+
|
338
|
+
The individual levels can be specified by separating them with commas
|
339
|
+
(e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the
|
340
|
+
specified levels are used for the table of contents.
|
341
|
+
|
342
|
+
Default: 1..6
|
343
|
+
Used by: HTML/Latex converter
|
344
|
+
EOF
|
345
|
+
case val
|
346
|
+
when String
|
347
|
+
if val =~ /^(\d)\.\.(\d)$/
|
348
|
+
val = Range.new($1.to_i, $2.to_i).to_a
|
349
|
+
elsif val =~ /^\d(?:,\d)*$/
|
350
|
+
val = val.split(/,/).map(&:to_i).uniq
|
351
|
+
else
|
352
|
+
raise Kramdown::Error, "Invalid syntax for option toc_levels"
|
353
|
+
end
|
354
|
+
when Array
|
355
|
+
unless val.eql?(TOC_LEVELS_ARRAY)
|
356
|
+
val = val.map(&:to_i).uniq
|
357
|
+
end
|
358
|
+
when Range
|
359
|
+
if val.eql?(TOC_LEVELS_RANGE)
|
360
|
+
val = TOC_LEVELS_ARRAY
|
361
|
+
else
|
362
|
+
val = val.map(&:to_i).uniq
|
363
|
+
end
|
364
|
+
else
|
365
|
+
raise Kramdown::Error, "Invalid type #{val.class} for option toc_levels"
|
366
|
+
end
|
367
|
+
if val.any? {|i| !TOC_LEVELS_RANGE.cover?(i) }
|
368
|
+
raise Kramdown::Error, "Level numbers for option toc_levels have to be integers from 1 to 6"
|
369
|
+
end
|
370
|
+
val
|
371
|
+
end
|
372
|
+
|
373
|
+
define(:line_width, Integer, 72, <<~EOF)
|
374
|
+
Defines the line width to be used when outputting a document
|
375
|
+
|
376
|
+
Default: 72
|
377
|
+
Used by: kramdown converter
|
378
|
+
EOF
|
379
|
+
|
380
|
+
define(:latex_headers, Object, %w[section subsection subsubsection paragraph subparagraph subparagraph], <<~EOF) do |val|
|
381
|
+
Defines the LaTeX commands for different header levels
|
382
|
+
|
383
|
+
The commands for the header levels one to six can be specified by
|
384
|
+
separating them with commas.
|
385
|
+
|
386
|
+
Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph
|
387
|
+
Used by: Latex converter
|
388
|
+
EOF
|
389
|
+
simple_array_validator(val, :latex_headers, 6)
|
390
|
+
end
|
391
|
+
|
392
|
+
SMART_QUOTES_ENTITIES = %w[lsquo rsquo ldquo rdquo].freeze
|
393
|
+
SMART_QUOTES_STR = SMART_QUOTES_ENTITIES.join(',').freeze
|
394
|
+
private_constant :SMART_QUOTES_ENTITIES, :SMART_QUOTES_STR
|
395
|
+
|
396
|
+
define(:smart_quotes, Object, SMART_QUOTES_ENTITIES, <<~EOF) do |val|
|
397
|
+
Defines the HTML entity names or code points for smart quote output
|
398
|
+
|
399
|
+
The entities identified by entity name or code point that should be
|
400
|
+
used for, in order, a left single quote, a right single quote, a left
|
401
|
+
double and a right double quote are specified by separating them with
|
402
|
+
commas.
|
403
|
+
|
404
|
+
Default: lsquo,rsquo,ldquo,rdquo
|
405
|
+
Used by: HTML/Latex converter
|
406
|
+
EOF
|
407
|
+
if val == SMART_QUOTES_STR || val == SMART_QUOTES_ENTITIES
|
408
|
+
SMART_QUOTES_ENTITIES
|
409
|
+
else
|
410
|
+
val = simple_array_validator(val, :smart_quotes, 4)
|
411
|
+
val.map! {|v| Integer(v) rescue v }
|
412
|
+
val
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
define(:typographic_symbols, Object, {}, <<~EOF) do |val|
|
417
|
+
Defines a mapping from typographical symbol to output characters
|
418
|
+
|
419
|
+
Typographical symbols are normally output using their equivalent Unicode
|
420
|
+
codepoint. However, sometimes one wants to change the output, mostly to
|
421
|
+
fallback to a sequence of ASCII characters.
|
422
|
+
|
423
|
+
This option allows this by specifying a mapping from typographical
|
424
|
+
symbol to its output string. For example, the mapping {hellip: ...} would
|
425
|
+
output the standard ASCII representation of an ellipsis.
|
426
|
+
|
427
|
+
The available typographical symbol names are:
|
428
|
+
|
429
|
+
* hellip: ellipsis
|
430
|
+
* mdash: em-dash
|
431
|
+
* ndash: en-dash
|
432
|
+
* laquo: left guillemet
|
433
|
+
* raquo: right guillemet
|
434
|
+
* laquo_space: left guillemet followed by a space
|
435
|
+
* raquo_space: right guillemet preceeded by a space
|
436
|
+
|
437
|
+
Default: {}
|
438
|
+
Used by: HTML/Latex converter
|
439
|
+
EOF
|
440
|
+
val = simple_hash_validator(val, :typographic_symbols)
|
441
|
+
val.keys.each do |k|
|
442
|
+
val[k.kind_of?(String) ? str_to_sym(k) : k] = val.delete(k).to_s
|
443
|
+
end
|
444
|
+
val
|
445
|
+
end
|
446
|
+
|
447
|
+
define(:remove_block_html_tags, Boolean, true, <<~EOF)
|
448
|
+
Remove block HTML tags
|
449
|
+
|
450
|
+
If this option is `true`, the RemoveHtmlTags converter removes
|
451
|
+
block HTML tags.
|
452
|
+
|
453
|
+
Default: true
|
454
|
+
Used by: RemoveHtmlTags converter
|
455
|
+
EOF
|
456
|
+
|
457
|
+
define(:remove_span_html_tags, Boolean, false, <<~EOF)
|
458
|
+
Remove span HTML tags
|
459
|
+
|
460
|
+
If this option is `true`, the RemoveHtmlTags converter removes
|
461
|
+
span HTML tags.
|
462
|
+
|
463
|
+
Default: false
|
464
|
+
Used by: RemoveHtmlTags converter
|
465
|
+
EOF
|
466
|
+
|
467
|
+
define(:header_offset, Integer, 0, <<~EOF)
|
468
|
+
Sets the output offset for headers
|
469
|
+
|
470
|
+
If this option is c (may also be negative) then a header with level n
|
471
|
+
will be output as a header with level c+n. If c+n is lower than 1,
|
472
|
+
level 1 will be used. If c+n is greater than 6, level 6 will be used.
|
473
|
+
|
474
|
+
Default: 0
|
475
|
+
Used by: HTML converter, Kramdown converter, Latex converter
|
476
|
+
EOF
|
477
|
+
|
478
|
+
define(:syntax_highlighter, Symbol, :rouge, <<~EOF)
|
479
|
+
Set the syntax highlighter
|
480
|
+
|
481
|
+
Specifies the syntax highlighter that should be used for highlighting
|
482
|
+
code blocks and spans. If this option is set to +nil+, no syntax
|
483
|
+
highlighting is done.
|
484
|
+
|
485
|
+
Options for the syntax highlighter can be set with the
|
486
|
+
syntax_highlighter_opts configuration option.
|
487
|
+
|
488
|
+
Default: rouge
|
489
|
+
Used by: HTML/Latex converter
|
490
|
+
EOF
|
491
|
+
|
492
|
+
define(:syntax_highlighter_opts, Object, {}, <<~EOF) do |val|
|
493
|
+
Set the syntax highlighter options
|
494
|
+
|
495
|
+
Specifies options for the syntax highlighter set via the
|
496
|
+
syntax_highlighter configuration option.
|
497
|
+
|
498
|
+
The value needs to be a hash with key-value pairs that are understood by
|
499
|
+
the used syntax highlighter.
|
500
|
+
|
501
|
+
Default: {}
|
502
|
+
Used by: HTML/Latex converter
|
503
|
+
EOF
|
504
|
+
val = simple_hash_validator(val, :syntax_highlighter_opts)
|
505
|
+
val.keys.each do |k|
|
506
|
+
val[k.kind_of?(String) ? str_to_sym(k) : k] = val.delete(k)
|
507
|
+
end
|
508
|
+
val
|
509
|
+
end
|
510
|
+
|
511
|
+
define(:math_engine, Symbol, :mathjax, <<~EOF)
|
512
|
+
Set the math engine
|
513
|
+
|
514
|
+
Specifies the math engine that should be used for converting math
|
515
|
+
blocks/spans. If this option is set to +nil+, no math engine is used and
|
516
|
+
the math blocks/spans are output as is.
|
517
|
+
|
518
|
+
Options for the selected math engine can be set with the
|
519
|
+
math_engine_opts configuration option.
|
520
|
+
|
521
|
+
Default: mathjax
|
522
|
+
Used by: HTML converter
|
523
|
+
EOF
|
524
|
+
|
525
|
+
define(:math_engine_opts, Object, {}, <<~EOF) do |val|
|
526
|
+
Set the math engine options
|
527
|
+
|
528
|
+
Specifies options for the math engine set via the math_engine
|
529
|
+
configuration option.
|
530
|
+
|
531
|
+
The value needs to be a hash with key-value pairs that are understood by
|
532
|
+
the used math engine.
|
533
|
+
|
534
|
+
Default: {}
|
535
|
+
Used by: HTML converter
|
536
|
+
EOF
|
537
|
+
val = simple_hash_validator(val, :math_engine_opts)
|
538
|
+
val.keys.each do |k|
|
539
|
+
val[k.kind_of?(String) ? str_to_sym(k) : k] = val.delete(k)
|
540
|
+
end
|
541
|
+
val
|
542
|
+
end
|
543
|
+
|
544
|
+
define(:footnote_backlink, String, '↩', <<~EOF)
|
545
|
+
Defines the text that should be used for the footnote backlinks
|
546
|
+
|
547
|
+
The footnote backlink is just text, so any special HTML characters will
|
548
|
+
be escaped.
|
549
|
+
|
550
|
+
If the footnote backlint text is an empty string, no footnote backlinks
|
551
|
+
will be generated.
|
552
|
+
|
553
|
+
Default: '&8617;'
|
554
|
+
Used by: HTML converter
|
555
|
+
EOF
|
556
|
+
|
557
|
+
define(:footnote_backlink_inline, Boolean, false, <<~EOF)
|
558
|
+
Specifies whether the footnote backlink should always be inline
|
559
|
+
|
560
|
+
With the default of false the footnote backlink is placed at the end of
|
561
|
+
the last paragraph if there is one, or an extra paragraph with only the
|
562
|
+
footnote backlink is created.
|
563
|
+
|
564
|
+
Setting this option to true tries to place the footnote backlink in the
|
565
|
+
last, possibly nested paragraph or header. If this fails (e.g. in the
|
566
|
+
case of a table), an extra paragraph with only the footnote backlink is
|
567
|
+
created.
|
568
|
+
|
569
|
+
Default: false
|
570
|
+
Used by: HTML converter
|
571
|
+
EOF
|
572
|
+
|
573
|
+
define(:footnote_prefix, String, '', <<~EOF)
|
574
|
+
Prefix used for footnote IDs
|
575
|
+
|
576
|
+
This option can be used to set a prefix for footnote IDs. This is useful
|
577
|
+
when rendering multiple documents into the same output file to avoid
|
578
|
+
duplicate IDs. The prefix should only contain characters that are valid
|
579
|
+
in an ID!
|
580
|
+
|
581
|
+
Default: ''
|
582
|
+
Used by: HTML
|
583
|
+
EOF
|
584
|
+
|
585
|
+
define(:remove_line_breaks_for_cjk, Boolean, false, <<~EOF)
|
586
|
+
Specifies whether line breaks should be removed between CJK characters
|
587
|
+
|
588
|
+
Default: false
|
589
|
+
Used by: HTML converter
|
590
|
+
EOF
|
591
|
+
|
592
|
+
define(:forbidden_inline_options, Object, %w[template], <<~EOF) do |val|
|
593
|
+
Defines the options that may not be set using the {::options} extension
|
594
|
+
|
595
|
+
Default: template
|
596
|
+
Used by: HTML converter
|
597
|
+
EOF
|
598
|
+
val.map! {|item| item.kind_of?(String) ? str_to_sym(item) : item }
|
599
|
+
simple_array_validator(val, :forbidden_inline_options)
|
600
|
+
end
|
601
|
+
|
602
|
+
end
|
603
|
+
|
604
|
+
end
|