apex-ruby 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +119 -0
- data/apex-ruby.gemspec +31 -0
- data/ext/apex_ext/apex_ext.c +215 -0
- data/ext/apex_ext/apex_src/BENCHMARK.md +32 -0
- data/ext/apex_ext/apex_src/BENCHMARK_COMPARISON.md +67 -0
- data/ext/apex_ext/apex_src/CHANGELOG.md +2454 -0
- data/ext/apex_ext/apex_src/CMakeLists.txt +454 -0
- data/ext/apex_ext/apex_src/Dockerfile.linux-build +15 -0
- data/ext/apex_ext/apex_src/Formula/apex.rb +38 -0
- data/ext/apex_ext/apex_src/Info.plist.in +27 -0
- data/ext/apex_ext/apex_src/LICENSE +21 -0
- data/ext/apex_ext/apex_src/Package.swift +160 -0
- data/ext/apex_ext/apex_src/PackageSupport/README.md +17 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark-gfm_export.h +20 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark-gfm_version.h +14 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/cmark_gfm_spm_stub.c +4 -0
- data/ext/apex_ext/apex_src/PackageSupport/cmark-gfm/config.h +41 -0
- data/ext/apex_ext/apex_src/README.md +452 -0
- data/ext/apex_ext/apex_src/VERSION +1 -0
- data/ext/apex_ext/apex_src/apex-header-2-rb@2x.webp +0 -0
- data/ext/apex_ext/apex_src/apex-plugins.json.example +20 -0
- data/ext/apex_ext/apex_src/apex.pc.in +11 -0
- data/ext/apex_ext/apex_src/cli/main.c +2720 -0
- data/ext/apex_ext/apex_src/debug_test.sh +22 -0
- data/ext/apex_ext/apex_src/docs/API_REFERENCE.md +451 -0
- data/ext/apex_ext/apex_src/docs/ARCHITECTURE.md +166 -0
- data/ext/apex_ext/apex_src/docs/CMARK_INTEGRATION.md +220 -0
- data/ext/apex_ext/apex_src/docs/CRITICMARKUP.md +501 -0
- data/ext/apex_ext/apex_src/docs/DEBUGGING.md +73 -0
- data/ext/apex_ext/apex_src/docs/FINAL_STATUS.md +391 -0
- data/ext/apex_ext/apex_src/docs/FINAL_STATUS_UPDATE.md +237 -0
- data/ext/apex_ext/apex_src/docs/FUTURE_FEATURES.md +456 -0
- data/ext/apex_ext/apex_src/docs/IAL_FEATURES.md +210 -0
- data/ext/apex_ext/apex_src/docs/IAL_STATUS.md +344 -0
- data/ext/apex_ext/apex_src/docs/INTEGRATION_EXAMPLE.m +144 -0
- data/ext/apex_ext/apex_src/docs/LIMITATIONS_RESOLVED.md +278 -0
- data/ext/apex_ext/apex_src/docs/OUTPUT_MODES.md +321 -0
- data/ext/apex_ext/apex_src/docs/PROGRESS.md +167 -0
- data/ext/apex_ext/apex_src/docs/STANDALONE_FEATURE.md +174 -0
- data/ext/apex_ext/apex_src/docs/TABLE_SPANS_STATUS.md +243 -0
- data/ext/apex_ext/apex_src/docs/TEST_COVERAGE.md +316 -0
- data/ext/apex_ext/apex_src/docs/USER_GUIDE.md +803 -0
- data/ext/apex_ext/apex_src/docs/WIKI_LINKS_ISSUE.md +91 -0
- data/ext/apex_ext/apex_src/documentation/README.md +160 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex Command Line Options.cheatsheet.txt +365 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Info.plist +24 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/C-API.html +1737 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Citations.html +1420 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Command-Line-Options.html +3574 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Configuration.html +1603 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Credits.html +910 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Examples.html +1168 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Getting-Started.html +1003 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Header-IDs.html +1308 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Home.html +1078 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Inline-Attribute-Lists.html +1622 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Installation.html +1168 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Limitations-and-Roadmap.html +1698 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Metadata-Transforms.html +1531 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Modes.html +1980 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Multi-File-Documents.html +1368 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Pandoc-Integration.html +1151 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Plugins.html +2861 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Syntax.html +3981 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Troubleshooting.html +1454 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Usage.html +1200 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/Documents/Xcode-Integration.html +2066 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/docSet.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/Apex.docset/Contents/Resources/tempOptimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Info.plist +22 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Bold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Bold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Extrabold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Extrabold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Semibold.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/cheatset_resources/Open_Sans_Semibold_Italic.woff +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/index.html +914 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/Documents/style.css +399 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/docSet.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/docsets/ApexCLI.docset/Contents/Resources/optimizedIndex.dsidx +0 -0
- data/ext/apex_ext/apex_src/documentation/generate_app_docs.rb +772 -0
- data/ext/apex_ext/apex_src/documentation/generate_app_docs_ai.rb +678 -0
- data/ext/apex_ext/apex_src/documentation/generate_docset.rb +873 -0
- data/ext/apex_ext/apex_src/documentation/generate_single_html.rb +733 -0
- data/ext/apex_ext/apex_src/documentation/html/apex-docs.html +17073 -0
- data/ext/apex_ext/apex_src/documentation/shared_scripts.js +64 -0
- data/ext/apex_ext/apex_src/documentation/shared_styles.css +646 -0
- data/ext/apex_ext/apex_src/documentation/transform_for_app.example.md +260 -0
- data/ext/apex_ext/apex_src/examples/bracketed_spans_demo.md +119 -0
- data/ext/apex_ext/apex_src/examples/emoji_span_plugin.yml +11 -0
- data/ext/apex_ext/apex_src/examples/example.html +53 -0
- data/ext/apex_ext/apex_src/examples/example.md +85 -0
- data/ext/apex_ext/apex_src/examples/fenced_divs_demo.md +158 -0
- data/ext/apex_ext/apex_src/examples/kbd.md +8 -0
- data/ext/apex_ext/apex_src/examples/kbd_plugin.rb +250 -0
- data/ext/apex_ext/apex_src/examples/kbd_plugin.yml +9 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-black.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-black@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-mark.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-mark@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-white.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon-outline-white@2x.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon.png +0 -0
- data/ext/apex_ext/apex_src/icon/apexicon@2x.png +0 -0
- data/ext/apex_ext/apex_src/include/apex/apex.h +247 -0
- data/ext/apex_ext/apex_src/include/apex/buffer.h +93 -0
- data/ext/apex_ext/apex_src/include/apex/module.modulemap +16 -0
- data/ext/apex_ext/apex_src/include/apex/parser.h +150 -0
- data/ext/apex_ext/apex_src/include/apex/renderer.h +39 -0
- data/ext/apex_ext/apex_src/man/apex-config.5 +374 -0
- data/ext/apex_ext/apex_src/man/apex-config.5.md +260 -0
- data/ext/apex_ext/apex_src/man/apex-plugins.7 +456 -0
- data/ext/apex_ext/apex_src/man/apex-plugins.7.md +365 -0
- data/ext/apex_ext/apex_src/man/apex.1 +828 -0
- data/ext/apex_ext/apex_src/man/apex.1.md +643 -0
- data/ext/apex_ext/apex_src/man/apex.1.new +338 -0
- data/ext/apex_ext/apex_src/objc/Apex.swift +237 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.h +117 -0
- data/ext/apex_ext/apex_src/objc/NSString+Apex.m +332 -0
- data/ext/apex_ext/apex_src/src/_README.md +358 -0
- data/ext/apex_ext/apex_src/src/apex.c +6326 -0
- data/ext/apex_ext/apex_src/src/buffer.c +93 -0
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.c +362 -0
- data/ext/apex_ext/apex_src/src/extensions/abbreviations.h +45 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_footnotes.c +184 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_footnotes.h +50 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_tables.c +1897 -0
- data/ext/apex_ext/apex_src/src/extensions/advanced_tables.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/callouts.c +215 -0
- data/ext/apex_ext/apex_src/src/extensions/callouts.h +53 -0
- data/ext/apex_ext/apex_src/src/extensions/citations.c +2042 -0
- data/ext/apex_ext/apex_src/src/extensions/citations.h +163 -0
- data/ext/apex_ext/apex_src/src/extensions/critic.c +329 -0
- data/ext/apex_ext/apex_src/src/extensions/critic.h +48 -0
- data/ext/apex_ext/apex_src/src/extensions/definition_list.c +1670 -0
- data/ext/apex_ext/apex_src/src/extensions/definition_list.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji.c +710 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji.h +38 -0
- data/ext/apex_ext/apex_src/src/extensions/emoji_data.h +942 -0
- data/ext/apex_ext/apex_src/src/extensions/fenced_divs.c +925 -0
- data/ext/apex_ext/apex_src/src/extensions/fenced_divs.h +43 -0
- data/ext/apex_ext/apex_src/src/extensions/github-emoji.txt +869 -0
- data/ext/apex_ext/apex_src/src/extensions/grid_tables.c +1121 -0
- data/ext/apex_ext/apex_src/src/extensions/grid_tables.h +33 -0
- data/ext/apex_ext/apex_src/src/extensions/header_ids.c +626 -0
- data/ext/apex_ext/apex_src/src/extensions/header_ids.h +60 -0
- data/ext/apex_ext/apex_src/src/extensions/highlight.c +135 -0
- data/ext/apex_ext/apex_src/src/extensions/highlight.h +16 -0
- data/ext/apex_ext/apex_src/src/extensions/html_markdown.c +408 -0
- data/ext/apex_ext/apex_src/src/extensions/html_markdown.h +42 -0
- data/ext/apex_ext/apex_src/src/extensions/ial.c +4084 -0
- data/ext/apex_ext/apex_src/src/extensions/ial.h +145 -0
- data/ext/apex_ext/apex_src/src/extensions/includes.c +1536 -0
- data/ext/apex_ext/apex_src/src/extensions/includes.h +54 -0
- data/ext/apex_ext/apex_src/src/extensions/index.c +967 -0
- data/ext/apex_ext/apex_src/src/extensions/index.h +90 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_footnotes.c +205 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_footnotes.h +34 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_tables.c +332 -0
- data/ext/apex_ext/apex_src/src/extensions/inline_tables.h +13 -0
- data/ext/apex_ext/apex_src/src/extensions/insert.c +248 -0
- data/ext/apex_ext/apex_src/src/extensions/insert.h +18 -0
- data/ext/apex_ext/apex_src/src/extensions/math.c +279 -0
- data/ext/apex_ext/apex_src/src/extensions/math.h +32 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.c +3046 -0
- data/ext/apex_ext/apex_src/src/extensions/metadata.h +125 -0
- data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.c +1297 -0
- data/ext/apex_ext/apex_src/src/extensions/relaxed_tables.h +39 -0
- data/ext/apex_ext/apex_src/src/extensions/special_markers.c +194 -0
- data/ext/apex_ext/apex_src/src/extensions/special_markers.h +29 -0
- data/ext/apex_ext/apex_src/src/extensions/sup_sub.c +405 -0
- data/ext/apex_ext/apex_src/src/extensions/sup_sub.h +16 -0
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.c +468 -0
- data/ext/apex_ext/apex_src/src/extensions/syntax_highlight.h +44 -0
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.c +2679 -0
- data/ext/apex_ext/apex_src/src/extensions/table_html_postprocess.h +23 -0
- data/ext/apex_ext/apex_src/src/extensions/toc.c +255 -0
- data/ext/apex_ext/apex_src/src/extensions/toc.h +34 -0
- data/ext/apex_ext/apex_src/src/extensions/wiki_links.c +624 -0
- data/ext/apex_ext/apex_src/src/extensions/wiki_links.h +58 -0
- data/ext/apex_ext/apex_src/src/html_renderer.c +2762 -0
- data/ext/apex_ext/apex_src/src/html_renderer.h +126 -0
- data/ext/apex_ext/apex_src/src/parser.c +227 -0
- data/ext/apex_ext/apex_src/src/plugins.c +895 -0
- data/ext/apex_ext/apex_src/src/plugins.h +39 -0
- data/ext/apex_ext/apex_src/src/plugins_env.c +187 -0
- data/ext/apex_ext/apex_src/src/plugins_remote.c +263 -0
- data/ext/apex_ext/apex_src/src/pretty_html.c +358 -0
- data/ext/apex_ext/apex_src/src/renderer.c +241 -0
- data/ext/apex_ext/apex_src/src/utf8.c +56 -0
- data/ext/apex_ext/apex_src/test-linux-build.sh +20 -0
- data/ext/apex_ext/apex_src/test.html +103 -0
- data/ext/apex_ext/apex_src/test_coverage.sh +121 -0
- data/ext/apex_ext/apex_src/test_ial_fenced.md +6 -0
- data/ext/apex_ext/apex_src/test_math_norm.py +79 -0
- data/ext/apex_ext/apex_src/test_pandoc_output.html +48 -0
- data/ext/apex_ext/apex_src/test_spm.sh +107 -0
- data/ext/apex_ext/apex_src/tests/ApexSPMTest/main.swift +50 -0
- data/ext/apex_ext/apex_src/tests/BENCHMARK_RESULTS.md +229 -0
- data/ext/apex_ext/apex_src/tests/CMakeLists.txt +24 -0
- data/ext/apex_ext/apex_src/tests/README.md +146 -0
- data/ext/apex_ext/apex_src/tests/benchmark.sh +113 -0
- data/ext/apex_ext/apex_src/tests/benchmark_comparison.sh +166 -0
- data/ext/apex_ext/apex_src/tests/compare_header_ids.sh +31 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/headers.md +25 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/list-interruption.md +24 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/misc_markup.md +33 -0
- data/ext/apex_ext/apex_src/tests/fixtures/basic/test_basic.md +26 -0
- data/ext/apex_ext/apex_src/tests/fixtures/code/code-blocks.md +260 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/SUMMARY.md +6 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/chapter1.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/index.txt +9 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/intro.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/combine_summary/section1_1.md +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/comprehensive_test.md +620 -0
- data/ext/apex_ext/apex_src/tests/fixtures/debug_ref_image_ial.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/demos/ial.md +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/demos/ial_demo.md +177 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/emoji-autocorrect.md +94 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/emoji_test.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/extensions/kbd_test.md +3 -0
- data/ext/apex_ext/apex_src/tests/fixtures/ial/bracketed_spans_test.md +74 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/image_and_encoding_test.md +27 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/multimarkdown_image_attributes_test.md +60 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/pandoc_ial_image_test.md +27 -0
- data/ext/apex_ext/apex_src/tests/fixtures/images/width_height_conversion_test.md +94 -0
- data/ext/apex_ext/apex_src/tests/fixtures/img-in-div.md +16 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/code.py +4 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/data.csv +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/data.tsv +5 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/image.png +2 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/metadata_options.yml +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/nested.md +8 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/raw.html +4 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/simple.md +7 -0
- data/ext/apex_ext/apex_src/tests/fixtures/includes/test_image.png +0 -0
- data/ext/apex_ext/apex_src/tests/fixtures/large_doc.md +1094 -0
- data/ext/apex_ext/apex_src/tests/fixtures/metadata_options.yml +11 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/gfm_header_id_test.md +96 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_citations.md +43 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_def_list_links.md +12 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_index_mmark.md +53 -0
- data/ext/apex_ext/apex_src/tests/fixtures/output/test_index_textindex.md +37 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/advanced_tables_test.md +93 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/inline_tables_test.md +38 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/relaxed-table.md +12 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/table_cr_line_endings.md +15 -0
- data/ext/apex_ext/apex_src/tests/fixtures/tables/table_no_trailing_newline.md +15 -0
- data/ext/apex_ext/apex_src/tests/generate_gfm_ids.sh +105 -0
- data/ext/apex_ext/apex_src/tests/generate_ial_demo.sh +143 -0
- data/ext/apex_ext/apex_src/tests/gfm_id_comparison_summary.md +96 -0
- data/ext/apex_ext/apex_src/tests/gh_api_test.md +6 -0
- data/ext/apex_ext/apex_src/tests/ial_demo.html +186 -0
- data/ext/apex_ext/apex_src/tests/include_code.py +19 -0
- data/ext/apex_ext/apex_src/tests/include_snippet.md +15 -0
- data/ext/apex_ext/apex_src/tests/multi_file_cli_test.sh +64 -0
- data/ext/apex_ext/apex_src/tests/sample_data.csv +7 -0
- data/ext/apex_ext/apex_src/tests/table_escaped_ltlt.md +4 -0
- data/ext/apex_ext/apex_src/tests/test_basic.c +74 -0
- data/ext/apex_ext/apex_src/tests/test_extensions.c +2116 -0
- data/ext/apex_ext/apex_src/tests/test_helpers.c +183 -0
- data/ext/apex_ext/apex_src/tests/test_helpers.h +91 -0
- data/ext/apex_ext/apex_src/tests/test_ial.c +282 -0
- data/ext/apex_ext/apex_src/tests/test_links.c +418 -0
- data/ext/apex_ext/apex_src/tests/test_marked_integration.c +265 -0
- data/ext/apex_ext/apex_src/tests/test_metadata.c +908 -0
- data/ext/apex_ext/apex_src/tests/test_output.c +1118 -0
- data/ext/apex_ext/apex_src/tests/test_plugins.c +219 -0
- data/ext/apex_ext/apex_src/tests/test_refs.bib +31 -0
- data/ext/apex_ext/apex_src/tests/test_runner.c +244 -0
- data/ext/apex_ext/apex_src/tests/test_syntax_highlight.c +198 -0
- data/ext/apex_ext/apex_src/tests/test_tables.c +862 -0
- data/ext/apex_ext/apex_src/tests/update_benchmarks.sh +9 -0
- data/ext/apex_ext/apex_src/tests/yaml_test.md +13 -0
- data/ext/apex_ext/apex_src/tests.rb +39 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CMakeLists.txt +48 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/COPYING +170 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CheckFileOffsetBits.c +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/CheckFileOffsetBits.cmake +43 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/FindAsan.cmake +74 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/Makefile.nmake +38 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/README.md +206 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/CMakeLists.txt +30 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/cplusplus.cpp +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/cplusplus.h +16 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/harness.c +111 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/harness.h +35 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/api_test/main.c +1169 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/appveyor.yml +21 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-bq-flat.md +16 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-bq-nested.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-code.md +11 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-fences.md +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-heading.md +9 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-hr.md +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-html.md +32 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-lheading.md +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-list-flat.md +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-list-nested.md +36 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-ref-flat.md +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/block-ref-nested.md +17 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-autolink.md +14 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-backticks.md +3 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-flat.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-nested.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-em-worst.md +5 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-entity.md +11 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-escape.md +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-html.md +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-links-flat.md +23 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-links-nested.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/inline-newlines.md +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/lorem1.md +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/samples/rawtabs.md +18 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/statistics.py +595 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/bench/stats.py +19 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/benchmarks.md +33 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/changelog.txt +1245 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/data/CaseFolding.txt +1495 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/CMakeLists.txt +119 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.c +508 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/autolink.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/cmark-gfm-core-extensions.h +54 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/core-extensions.c +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.c +879 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.h +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/ext_scanners.re +92 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/strikethrough.c +167 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/strikethrough.h +9 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.c +917 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/table.h +12 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tagfilter.c +60 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tagfilter.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tasklist.c +156 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/extensions/tasklist.h +8 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/CMakeLists.txt +22 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/README.md +12 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzz_quadratic.c +91 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzz_quadratic_brackets.c +110 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/fuzz/fuzzloop.sh +28 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/CMakeLists.txt +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/make_man_page.py +133 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/man1/cmark-gfm.1 +78 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/man/man3/cmark-gfm.3 +1041 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/nmake.bat +1 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/CMakeLists.txt +230 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/arena.c +104 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/blocks.c +1622 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/buffer.c +278 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/buffer.h +116 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/case_fold_switch.inc +4327 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/chunk.h +135 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm-extension_api.h +737 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm.h +833 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark-gfm_version.h.in +7 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark.c +55 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark_ctype.c +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/cmark_ctype.h +33 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/commonmark.c +514 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/config.h.in +76 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/entities.inc +2138 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/footnotes.c +63 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/footnotes.h +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini.h +57 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_href_e.c +100 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_html_e.c +66 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/houdini_html_u.c +149 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/html.c +502 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/html.h +27 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/inlines.c +1788 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/inlines.h +29 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/iterator.c +159 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/iterator.h +26 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/latex.c +468 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/libcmark-gfm.pc.in +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/linked_list.c +37 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/main.c +328 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/man.c +274 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/map.c +129 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/map.h +44 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/node.c +1045 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/node.h +167 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/parser.h +59 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plaintext.c +218 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plugin.c +36 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/plugin.h +34 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/references.c +43 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/references.h +26 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/registry.c +63 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/registry.h +24 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/render.c +213 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/render.h +62 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.c +14056 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.h +70 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/scanners.re +365 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/syntax_extension.c +149 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/syntax_extension.h +34 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/utf8.c +317 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/utf8.h +35 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/src/xml.c +182 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/suppressions +10 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/CMakeLists.txt +114 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/afl_test_cases/test.md +49 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/cmark-fuzz.c +58 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/cmark.py +105 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/entity_tests.py +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions-full-info-string.txt +0 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions-table-prefer-style-attributes.txt +38 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/extensions.txt +920 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/fuzzing_dictionary +67 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/normalize.py +194 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/pathological_tests.py +160 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/regression.txt +375 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/roundtrip_tests.py +50 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/run-cmark-fuzz +4 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/smart_punct.txt +177 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/spec.txt +10212 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/test/spec_tests.py +152 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/toolchain-mingw32.cmake +17 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/Dockerfile +41 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/appveyor-build.bat +13 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/make_entities_inc.py +32 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/mkcasefold.pl +22 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/xml2md.xsl +319 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/tools/xml2md_gfm.xsl +80 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/why-cmark-and-not-x.md +104 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.js +6 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.py +37 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.rb +15 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper.rkt +208 -0
- data/ext/apex_ext/apex_src/vendor/cmark-gfm/wrappers/wrapper_ext.py +109 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/CMakeLists.txt +160 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/Changes +372 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/License +20 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/Makefile.am +51 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/ReadMe.md +46 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/announcement.msg +89 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/bootstrap +3 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/cmake/config.h.in +4 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/configure.ac +73 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/doc/doxygen.cfg +222 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/README.mkd +17 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/alpine-3.7 +26 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/fedora-25 +26 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/ubuntu-14.04 +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/docker/ubuntu-16.04 +24 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/anchors.yaml +10 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/array.yaml +2 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/global-tag.yaml +14 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/json.yaml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/mapping.yaml +2 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/numbers.yaml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/strings.yaml +7 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/tags.yaml +7 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/examples/yaml-version.yaml +3 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/include/Makefile.am +17 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/include/yaml.h +1999 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/ReadMe.md +77 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/Dockerfile +32 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/output/ReadMe +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/pkg/docker/scripts/libyaml-dist.sh +23 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/regression-inputs/clusterfuzz-testcase-minimized-5607885063061504.yml +1 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/Makefile.am +4 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/api.c +1393 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/dumper.c +394 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/emitter.c +2358 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/loader.c +544 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/parser.c +1416 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/reader.c +469 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/scanner.c +3598 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/writer.c +141 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/src/yaml_private.h +684 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/CMakeLists.txt +27 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/Makefile.am +9 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/ReadMe.md +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-deconstructor-alt.c +800 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-deconstructor.c +1127 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-reformatter-alt.c +217 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/example-reformatter.c +202 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-all-tests.sh +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-dumper.c +314 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-emitter-test-suite.c +290 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-emitter.c +327 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-loader.c +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-parser-test-suite.c +196 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-parser.c +88 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/run-scanner.c +63 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/test-reader.c +354 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/tests/test-version.c +29 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/yaml-0.1.pc.in +10 -0
- data/ext/apex_ext/apex_src/vendor/libyaml/yamlConfig.cmake.in +16 -0
- data/ext/apex_ext/extconf.rb +103 -0
- data/lib/apex/configurable.rb +46 -0
- data/lib/apex/document.rb +66 -0
- data/lib/apex/version.rb +15 -0
- data/lib/apex.rb +28 -0
- metadata +544 -0
|
@@ -0,0 +1,908 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata Tests
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include "test_helpers.h"
|
|
6
|
+
#include "apex/apex.h"
|
|
7
|
+
#include "../src/extensions/metadata.h"
|
|
8
|
+
#include <string.h>
|
|
9
|
+
#include <stdlib.h>
|
|
10
|
+
|
|
11
|
+
void test_metadata(void) {
|
|
12
|
+
int suite_failures = suite_start();
|
|
13
|
+
print_suite_title("Metadata Tests", false, true);
|
|
14
|
+
|
|
15
|
+
apex_options opts = apex_options_for_mode(APEX_MODE_MULTIMARKDOWN);
|
|
16
|
+
char *html;
|
|
17
|
+
|
|
18
|
+
/* Test YAML metadata with variables */
|
|
19
|
+
const char *yaml_doc = "---\ntitle: Test Doc\nauthor: John\n---\n\n# [%title]\n\nBy [%author]";
|
|
20
|
+
html = apex_markdown_to_html(yaml_doc, strlen(yaml_doc), &opts);
|
|
21
|
+
assert_contains(html, "<h1", "YAML metadata variable in header");
|
|
22
|
+
assert_contains(html, "Test Doc</h1>", "YAML metadata variable content");
|
|
23
|
+
assert_contains(html, "By John", "YAML metadata variable in text");
|
|
24
|
+
apex_free_string(html);
|
|
25
|
+
|
|
26
|
+
/* Test YAML arrays + nested mappings (libyaml flattening) and end marker '...'. */
|
|
27
|
+
const char *yaml_nested =
|
|
28
|
+
"---\n"
|
|
29
|
+
"tags:\n"
|
|
30
|
+
" - one\n"
|
|
31
|
+
" - two\n"
|
|
32
|
+
"nested:\n"
|
|
33
|
+
" a: 1\n"
|
|
34
|
+
" b:\n"
|
|
35
|
+
" - x\n"
|
|
36
|
+
" - y\n"
|
|
37
|
+
"...\n"
|
|
38
|
+
"\n"
|
|
39
|
+
"Tags: [%tags]\n"
|
|
40
|
+
"Nested a: [%nested.a]\n"
|
|
41
|
+
"Nested b: [%nested.b]\n"
|
|
42
|
+
"Nested b0: [%nested.b.0]\n";
|
|
43
|
+
html = apex_markdown_to_html(yaml_nested, strlen(yaml_nested), &opts);
|
|
44
|
+
assert_contains(html, "Tags: one, two", "YAML array flattened to joined string");
|
|
45
|
+
assert_contains(html, "Nested a: 1", "YAML nested mapping flattened (nested.a)");
|
|
46
|
+
assert_contains(html, "Nested b: x, y", "YAML nested sequence flattened (nested.b)");
|
|
47
|
+
/* Note: scalar-only sequences are normalized to a joined string; index keys are not generated. */
|
|
48
|
+
assert_contains(html, "Nested b0: [%nested.b.0]", "YAML scalar sequence does not generate index keys");
|
|
49
|
+
apex_free_string(html);
|
|
50
|
+
|
|
51
|
+
/* Test YAML sequence containing a nested mapping: scalar items join, mapping items flatten with index keys. */
|
|
52
|
+
const char *yaml_seq_map =
|
|
53
|
+
"---\n"
|
|
54
|
+
"arr:\n"
|
|
55
|
+
" - one\n"
|
|
56
|
+
" - k: v\n"
|
|
57
|
+
"---\n"
|
|
58
|
+
"\n"
|
|
59
|
+
"Arr: [%arr]\n"
|
|
60
|
+
"Arr0: [%arr.0]\n"
|
|
61
|
+
"Arr1.k: [%arr.1.k]\n";
|
|
62
|
+
html = apex_markdown_to_html(yaml_seq_map, strlen(yaml_seq_map), &opts);
|
|
63
|
+
/* Note: mixed scalar+mapping sequences fall back to indexed keys (no joined base key). */
|
|
64
|
+
assert_contains(html, "Arr: [%arr]", "YAML mixed sequence: base key not generated");
|
|
65
|
+
assert_contains(html, "Arr0: one", "YAML sequence scalar index flattened (arr.0)");
|
|
66
|
+
assert_contains(html, "Arr1.k: v", "YAML sequence mapping flattened with index key (arr.1.k)");
|
|
67
|
+
apex_free_string(html);
|
|
68
|
+
|
|
69
|
+
/* Test MMD metadata */
|
|
70
|
+
const char *mmd_doc = "Title: My Title\n\n# [%Title]";
|
|
71
|
+
html = apex_markdown_to_html(mmd_doc, strlen(mmd_doc), &opts);
|
|
72
|
+
assert_contains(html, "<h1", "MMD metadata variable");
|
|
73
|
+
assert_contains(html, "My Title</h1>", "MMD metadata variable content");
|
|
74
|
+
apex_free_string(html);
|
|
75
|
+
|
|
76
|
+
/* Test Pandoc metadata */
|
|
77
|
+
const char *pandoc_doc = "% The Title\n% The Author\n\n# [%title]";
|
|
78
|
+
html = apex_markdown_to_html(pandoc_doc, strlen(pandoc_doc), &opts);
|
|
79
|
+
assert_contains(html, "<h1", "Pandoc metadata variable");
|
|
80
|
+
assert_contains(html, "The Title</h1>", "Pandoc metadata variable content");
|
|
81
|
+
apex_free_string(html);
|
|
82
|
+
|
|
83
|
+
/* Test that list items with colons are not treated as metadata in unified mode */
|
|
84
|
+
apex_options unified_opts = apex_options_for_mode(APEX_MODE_UNIFIED);
|
|
85
|
+
const char *list_with_colon_doc = "## A Header\n\n- Foo: Bar\n- Another item\n- Third item";
|
|
86
|
+
html = apex_markdown_to_html(list_with_colon_doc, strlen(list_with_colon_doc), &unified_opts);
|
|
87
|
+
assert_contains(html, "<h2", "List with colon: header is rendered");
|
|
88
|
+
assert_contains(html, "A Header</h2>", "List with colon: header content");
|
|
89
|
+
assert_contains(html, "<ul>", "List with colon: unordered list rendered");
|
|
90
|
+
assert_contains(html, "<li>Foo: Bar</li>", "List with colon: first item with colon rendered");
|
|
91
|
+
assert_contains(html, "<li>Another item</li>", "List with colon: second item rendered");
|
|
92
|
+
assert_contains(html, "<li>Third item</li>", "List with colon: third item rendered");
|
|
93
|
+
apex_free_string(html);
|
|
94
|
+
|
|
95
|
+
bool had_failures = suite_end(suite_failures);
|
|
96
|
+
print_suite_title("Metadata Tests", had_failures, false);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Test MultiMarkdown metadata keys
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
void test_mmd_metadata_keys(void) {
|
|
104
|
+
int suite_failures = suite_start();
|
|
105
|
+
print_suite_title("MultiMarkdown Metadata Keys Tests", false, true);
|
|
106
|
+
|
|
107
|
+
apex_options opts = apex_options_for_mode(APEX_MODE_MULTIMARKDOWN);
|
|
108
|
+
char *html;
|
|
109
|
+
|
|
110
|
+
/* Test Base Header Level */
|
|
111
|
+
const char *base_header_doc = "Base Header Level: 2\n\n# Header 1\n## Header 2";
|
|
112
|
+
html = apex_markdown_to_html(base_header_doc, strlen(base_header_doc), &opts);
|
|
113
|
+
assert_contains(html, "<h2", "Base Header Level: h1 becomes h2");
|
|
114
|
+
assert_contains(html, "Header 1</h2>", "Base Header Level: h1 content in h2 tag");
|
|
115
|
+
assert_contains(html, "<h3", "Base Header Level: h2 becomes h3");
|
|
116
|
+
assert_contains(html, "Header 2</h3>", "Base Header Level: h2 content in h3 tag");
|
|
117
|
+
apex_free_string(html);
|
|
118
|
+
|
|
119
|
+
/* Test HTML Header Level (format-specific) */
|
|
120
|
+
const char *html_header_level_doc = "HTML Header Level: 3\n\n# Header 1";
|
|
121
|
+
html = apex_markdown_to_html(html_header_level_doc, strlen(html_header_level_doc), &opts);
|
|
122
|
+
assert_contains(html, "<h3", "HTML Header Level: h1 becomes h3");
|
|
123
|
+
assert_contains(html, "Header 1</h3>", "HTML Header Level: h1 content in h3 tag");
|
|
124
|
+
apex_free_string(html);
|
|
125
|
+
|
|
126
|
+
/* Test Language metadata in standalone document */
|
|
127
|
+
opts.standalone = true;
|
|
128
|
+
const char *language_doc = "Language: fr\n\n# Bonjour";
|
|
129
|
+
html = apex_markdown_to_html(language_doc, strlen(language_doc), &opts);
|
|
130
|
+
assert_contains(html, "<html lang=\"fr\">", "Language metadata sets HTML lang attribute");
|
|
131
|
+
apex_free_string(html);
|
|
132
|
+
|
|
133
|
+
/* Test Quotes Language - French (requires smart typography) */
|
|
134
|
+
opts.standalone = false;
|
|
135
|
+
opts.enable_smart_typography = true; /* Ensure smart typography is enabled */
|
|
136
|
+
const char *quotes_fr_doc = "Quotes Language: french\n\nHe said \"hello\" to me.";
|
|
137
|
+
html = apex_markdown_to_html(quotes_fr_doc, strlen(quotes_fr_doc), &opts);
|
|
138
|
+
assert_contains(html, "« ", "Quotes Language: French opening quote");
|
|
139
|
+
assert_contains(html, " »", "Quotes Language: French closing quote");
|
|
140
|
+
apex_free_string(html);
|
|
141
|
+
|
|
142
|
+
/* Test Quotes Language - German */
|
|
143
|
+
const char *quotes_de_doc = "Quotes Language: german\n\nHe said \"hello\" to me.";
|
|
144
|
+
html = apex_markdown_to_html(quotes_de_doc, strlen(quotes_de_doc), &opts);
|
|
145
|
+
assert_contains(html, "„", "Quotes Language: German opening quote");
|
|
146
|
+
assert_contains(html, "“", "Quotes Language: German closing quote");
|
|
147
|
+
apex_free_string(html);
|
|
148
|
+
|
|
149
|
+
/* Test Quotes Language fallback to Language */
|
|
150
|
+
opts.standalone = true;
|
|
151
|
+
const char *lang_fallback_doc = "Language: fr\n\nHe said \"hello\" to me.";
|
|
152
|
+
html = apex_markdown_to_html(lang_fallback_doc, strlen(lang_fallback_doc), &opts);
|
|
153
|
+
assert_contains(html, "<html lang=\"fr\">", "Language metadata sets HTML lang");
|
|
154
|
+
/* Quotes should also use French since Quotes Language not specified */
|
|
155
|
+
assert_contains(html, "« ", "Quotes Language falls back to Language");
|
|
156
|
+
apex_free_string(html);
|
|
157
|
+
|
|
158
|
+
/* Test CSS metadata in standalone document */
|
|
159
|
+
opts.standalone = true;
|
|
160
|
+
const char *css_doc = "CSS: styles.css\n\n# Test";
|
|
161
|
+
html = apex_markdown_to_html(css_doc, strlen(css_doc), &opts);
|
|
162
|
+
assert_contains(html, "<link rel=\"stylesheet\" href=\"styles.css\">", "CSS metadata adds stylesheet link");
|
|
163
|
+
assert_not_contains(html, "<style>", "CSS metadata: no default styles when CSS specified");
|
|
164
|
+
apex_free_string(html);
|
|
165
|
+
|
|
166
|
+
/* Test CSS metadata: default styles when no CSS */
|
|
167
|
+
const char *no_css_doc = "Title: Test\n\n# Content";
|
|
168
|
+
html = apex_markdown_to_html(no_css_doc, strlen(no_css_doc), &opts);
|
|
169
|
+
assert_contains(html, "<style>", "No CSS metadata: default styles included");
|
|
170
|
+
apex_free_string(html);
|
|
171
|
+
|
|
172
|
+
/* Test HTML Header metadata */
|
|
173
|
+
const char *html_header_doc = "HTML Header: <script src=\"mathjax.js\"></script>\n\n# Test";
|
|
174
|
+
html = apex_markdown_to_html(html_header_doc, strlen(html_header_doc), &opts);
|
|
175
|
+
assert_contains(html, "<script src=\"mathjax.js\"></script>", "HTML Header metadata inserted in head");
|
|
176
|
+
assert_contains(html, "</head>", "HTML Header metadata before </head>");
|
|
177
|
+
apex_free_string(html);
|
|
178
|
+
|
|
179
|
+
/* Test HTML Footer metadata */
|
|
180
|
+
const char *html_footer_doc = "HTML Footer: <script>init();</script>\n\n# Test";
|
|
181
|
+
html = apex_markdown_to_html(html_footer_doc, strlen(html_footer_doc), &opts);
|
|
182
|
+
assert_contains(html, "<script>init();</script>", "HTML Footer metadata inserted before </body>");
|
|
183
|
+
assert_contains(html, "</body>", "HTML Footer metadata before </body>");
|
|
184
|
+
apex_free_string(html);
|
|
185
|
+
|
|
186
|
+
/* Test normalized key matching (spaces removed, case-insensitive) */
|
|
187
|
+
opts.standalone = false;
|
|
188
|
+
opts.enable_smart_typography = true; /* Ensure smart typography is enabled */
|
|
189
|
+
const char *normalized_doc = "quoteslanguage: french\nbaseheaderlevel: 2\n\n# Header\nHe said \"hello\".";
|
|
190
|
+
html = apex_markdown_to_html(normalized_doc, strlen(normalized_doc), &opts);
|
|
191
|
+
assert_contains(html, "<h2", "Normalized key: baseheaderlevel works");
|
|
192
|
+
assert_contains(html, "« ", "Normalized key: quoteslanguage works");
|
|
193
|
+
apex_free_string(html);
|
|
194
|
+
|
|
195
|
+
/* Test case-insensitive matching */
|
|
196
|
+
opts.enable_smart_typography = true; /* Ensure smart typography is enabled */
|
|
197
|
+
const char *case_doc = "QUOTES LANGUAGE: german\nBASE HEADER LEVEL: 3\n\n# Header\nHe said \"hello\".";
|
|
198
|
+
html = apex_markdown_to_html(case_doc, strlen(case_doc), &opts);
|
|
199
|
+
assert_contains(html, "<h3", "Case-insensitive: BASE HEADER LEVEL works");
|
|
200
|
+
assert_contains(html, "„", "Case-insensitive: QUOTES LANGUAGE works");
|
|
201
|
+
apex_free_string(html);
|
|
202
|
+
|
|
203
|
+
bool had_failures = suite_end(suite_failures);
|
|
204
|
+
print_suite_title("MultiMarkdown Metadata Keys Tests", had_failures, false);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Test metadata transforms
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
void test_metadata_transforms(void) {
|
|
212
|
+
int suite_failures = suite_start();
|
|
213
|
+
print_suite_title("Metadata Transforms Tests", false, true);
|
|
214
|
+
|
|
215
|
+
apex_options opts = apex_options_for_mode(APEX_MODE_UNIFIED);
|
|
216
|
+
char *html;
|
|
217
|
+
|
|
218
|
+
/* Test basic transforms: upper */
|
|
219
|
+
const char *upper_doc = "---\ntitle: hello world\n---\n\n# [%title:upper]";
|
|
220
|
+
html = apex_markdown_to_html(upper_doc, strlen(upper_doc), &opts);
|
|
221
|
+
assert_contains(html, "HELLO WORLD</h1>", "upper transform");
|
|
222
|
+
apex_free_string(html);
|
|
223
|
+
|
|
224
|
+
/* Test basic transforms: lower */
|
|
225
|
+
const char *lower_doc = "---\ntitle: HELLO WORLD\n---\n\n# [%title:lower]";
|
|
226
|
+
html = apex_markdown_to_html(lower_doc, strlen(lower_doc), &opts);
|
|
227
|
+
assert_contains(html, "hello world</h1>", "lower transform");
|
|
228
|
+
apex_free_string(html);
|
|
229
|
+
|
|
230
|
+
/* Test basic transforms: title */
|
|
231
|
+
const char *title_doc = "---\ntitle: hello world\n---\n\n# [%title:title]";
|
|
232
|
+
html = apex_markdown_to_html(title_doc, strlen(title_doc), &opts);
|
|
233
|
+
assert_contains(html, "Hello World</h1>", "title transform");
|
|
234
|
+
apex_free_string(html);
|
|
235
|
+
|
|
236
|
+
/* Test basic transforms: capitalize */
|
|
237
|
+
const char *capitalize_doc = "---\ntitle: hello world\n---\n\n# [%title:capitalize]";
|
|
238
|
+
html = apex_markdown_to_html(capitalize_doc, strlen(capitalize_doc), &opts);
|
|
239
|
+
assert_contains(html, "Hello world</h1>", "capitalize transform");
|
|
240
|
+
apex_free_string(html);
|
|
241
|
+
|
|
242
|
+
/* Test basic transforms: trim */
|
|
243
|
+
const char *trim_doc = "---\ntitle: \" hello world \"\n---\n\n# [%title:trim]";
|
|
244
|
+
html = apex_markdown_to_html(trim_doc, strlen(trim_doc), &opts);
|
|
245
|
+
assert_contains(html, "hello world</h1>", "trim transform");
|
|
246
|
+
apex_free_string(html);
|
|
247
|
+
|
|
248
|
+
/* Test slug transform */
|
|
249
|
+
const char *slug_doc = "---\ntitle: My Great Post!\n---\n\n[%title:slug]";
|
|
250
|
+
html = apex_markdown_to_html(slug_doc, strlen(slug_doc), &opts);
|
|
251
|
+
assert_contains(html, "my-great-post", "slug transform");
|
|
252
|
+
apex_free_string(html);
|
|
253
|
+
|
|
254
|
+
/* Test replace transform (simple) */
|
|
255
|
+
const char *replace_doc = "---\nurl: http://example.com\n---\n\n[%url:replace(http:,https:)]";
|
|
256
|
+
html = apex_markdown_to_html(replace_doc, strlen(replace_doc), &opts);
|
|
257
|
+
assert_contains(html, "https://example.com", "replace transform");
|
|
258
|
+
apex_free_string(html);
|
|
259
|
+
|
|
260
|
+
/* Test replace transform (regex) - use simple pattern without brackets first */
|
|
261
|
+
const char *regex_doc = "---\ntext: Hello 123 World\n---\n\n[%text:replace(regex:123,N)]";
|
|
262
|
+
html = apex_markdown_to_html(regex_doc, strlen(regex_doc), &opts);
|
|
263
|
+
assert_contains(html, "Hello N World", "replace with regex");
|
|
264
|
+
apex_free_string(html);
|
|
265
|
+
|
|
266
|
+
/* Test regex with character class [0-9]+ */
|
|
267
|
+
const char *regex_doc2 = "---\ntext: Hello 123 World\n---\n\n[%text:replace(regex:[0-9]+,N)]";
|
|
268
|
+
html = apex_markdown_to_html(regex_doc2, strlen(regex_doc2), &opts);
|
|
269
|
+
assert_contains(html, "Hello N World", "replace with regex pattern with brackets");
|
|
270
|
+
apex_free_string(html);
|
|
271
|
+
|
|
272
|
+
/* Test regex with simpler pattern that definitely works */
|
|
273
|
+
const char *regex_doc3 = "---\ntext: Hello 123 World\n---\n\n[%text:replace(regex:12,N)]";
|
|
274
|
+
html = apex_markdown_to_html(regex_doc3, strlen(regex_doc3), &opts);
|
|
275
|
+
assert_contains(html, "Hello N3 World", "replace with regex simple pattern");
|
|
276
|
+
apex_free_string(html);
|
|
277
|
+
|
|
278
|
+
/* Test substring transform */
|
|
279
|
+
const char *substr_doc = "---\ntitle: Hello World\n---\n\n[%title:substr(0,5)]";
|
|
280
|
+
html = apex_markdown_to_html(substr_doc, strlen(substr_doc), &opts);
|
|
281
|
+
assert_contains(html, "Hello", "substring transform");
|
|
282
|
+
apex_free_string(html);
|
|
283
|
+
|
|
284
|
+
/* Test truncate transform - note: smart typography may convert ... to … */
|
|
285
|
+
const char *truncate_doc = "---\ntitle: This is a very long title\n---\n\n[%title:truncate(15,...)]";
|
|
286
|
+
html = apex_markdown_to_html(truncate_doc, strlen(truncate_doc), &opts);
|
|
287
|
+
/* Check for either ... or … (smart typography ellipsis) */
|
|
288
|
+
if (strstr(html, "This is a very...") || strstr(html, "This is a very…") || strstr(html, "This is a ve")) {
|
|
289
|
+
test_result(true, "truncate transform");
|
|
290
|
+
} else {
|
|
291
|
+
test_result(false, "truncate transform failed");
|
|
292
|
+
}
|
|
293
|
+
apex_free_string(html);
|
|
294
|
+
|
|
295
|
+
/* Test default transform */
|
|
296
|
+
const char *default_doc = "---\ndesc: \"\"\n---\n\n[%desc:default(No description)]";
|
|
297
|
+
html = apex_markdown_to_html(default_doc, strlen(default_doc), &opts);
|
|
298
|
+
assert_contains(html, "No description", "default transform with empty value");
|
|
299
|
+
apex_free_string(html);
|
|
300
|
+
|
|
301
|
+
/* Test default transform with non-empty value */
|
|
302
|
+
const char *default_nonempty_doc = "---\ndesc: Has value\n---\n\n[%desc:default(No description)]";
|
|
303
|
+
html = apex_markdown_to_html(default_nonempty_doc, strlen(default_nonempty_doc), &opts);
|
|
304
|
+
assert_contains(html, "Has value", "default transform preserves non-empty");
|
|
305
|
+
apex_free_string(html);
|
|
306
|
+
|
|
307
|
+
/* Test html_escape transform */
|
|
308
|
+
const char *escape_doc = "---\ntitle: A & B\n---\n\n[%title:html_escape]";
|
|
309
|
+
html = apex_markdown_to_html(escape_doc, strlen(escape_doc), &opts);
|
|
310
|
+
assert_contains(html, "&", "html_escape transform");
|
|
311
|
+
apex_free_string(html);
|
|
312
|
+
|
|
313
|
+
/* Test basename transform */
|
|
314
|
+
const char *basename_doc = "---\nimage: /path/to/image.jpg\n---\n\n[%image:basename]";
|
|
315
|
+
html = apex_markdown_to_html(basename_doc, strlen(basename_doc), &opts);
|
|
316
|
+
assert_contains(html, "image.jpg", "basename transform");
|
|
317
|
+
apex_free_string(html);
|
|
318
|
+
|
|
319
|
+
/* Test urlencode transform */
|
|
320
|
+
const char *urlencode_doc = "---\nsearch: hello world\n---\n\n[%search:urlencode]";
|
|
321
|
+
html = apex_markdown_to_html(urlencode_doc, strlen(urlencode_doc), &opts);
|
|
322
|
+
assert_contains(html, "hello%20world", "urlencode transform");
|
|
323
|
+
apex_free_string(html);
|
|
324
|
+
|
|
325
|
+
/* Test urldecode transform */
|
|
326
|
+
const char *urldecode_doc = "---\nsearch: hello%20world\n---\n\n[%search:urldecode]";
|
|
327
|
+
html = apex_markdown_to_html(urldecode_doc, strlen(urldecode_doc), &opts);
|
|
328
|
+
assert_contains(html, "hello world", "urldecode transform");
|
|
329
|
+
apex_free_string(html);
|
|
330
|
+
|
|
331
|
+
/* Test prefix transform */
|
|
332
|
+
const char *prefix_doc = "---\nurl: example.com\n---\n\n[%url:prefix(https://)]";
|
|
333
|
+
html = apex_markdown_to_html(prefix_doc, strlen(prefix_doc), &opts);
|
|
334
|
+
assert_contains(html, "https://example.com", "prefix transform");
|
|
335
|
+
apex_free_string(html);
|
|
336
|
+
|
|
337
|
+
/* Test suffix transform */
|
|
338
|
+
const char *suffix_doc = "---\ntitle: Hello\n---\n\n[%title:suffix(!)]";
|
|
339
|
+
html = apex_markdown_to_html(suffix_doc, strlen(suffix_doc), &opts);
|
|
340
|
+
assert_contains(html, "Hello!", "suffix transform");
|
|
341
|
+
apex_free_string(html);
|
|
342
|
+
|
|
343
|
+
/* Test remove transform */
|
|
344
|
+
const char *remove_doc = "---\ntitle: Hello'World\n---\n\n[%title:remove(')]";
|
|
345
|
+
html = apex_markdown_to_html(remove_doc, strlen(remove_doc), &opts);
|
|
346
|
+
assert_contains(html, "HelloWorld", "remove transform");
|
|
347
|
+
apex_free_string(html);
|
|
348
|
+
|
|
349
|
+
/* Test repeat transform - escape the result to avoid markdown HR interpretation */
|
|
350
|
+
const char *repeat_doc = "---\nsep: -\n---\n\n`[%sep:repeat(3)]`";
|
|
351
|
+
html = apex_markdown_to_html(repeat_doc, strlen(repeat_doc), &opts);
|
|
352
|
+
/* Check inside code span to avoid HR interpretation */
|
|
353
|
+
assert_contains(html, "<code>---</code>", "repeat transform");
|
|
354
|
+
apex_free_string(html);
|
|
355
|
+
|
|
356
|
+
/* Test reverse transform */
|
|
357
|
+
const char *reverse_doc = "---\ntext: Hello\n---\n\n[%text:reverse]";
|
|
358
|
+
html = apex_markdown_to_html(reverse_doc, strlen(reverse_doc), &opts);
|
|
359
|
+
assert_contains(html, "olleH", "reverse transform");
|
|
360
|
+
apex_free_string(html);
|
|
361
|
+
|
|
362
|
+
/* Test format transform */
|
|
363
|
+
const char *format_doc = "---\nprice: 42.5\n---\n\n[%price:format($%.2f)]";
|
|
364
|
+
html = apex_markdown_to_html(format_doc, strlen(format_doc), &opts);
|
|
365
|
+
assert_contains(html, "$42.50", "format transform");
|
|
366
|
+
apex_free_string(html);
|
|
367
|
+
|
|
368
|
+
/* Test length transform */
|
|
369
|
+
const char *length_doc = "---\ntext: Hello\n---\n\n[%text:length]";
|
|
370
|
+
html = apex_markdown_to_html(length_doc, strlen(length_doc), &opts);
|
|
371
|
+
assert_contains(html, "5", "length transform");
|
|
372
|
+
apex_free_string(html);
|
|
373
|
+
|
|
374
|
+
/* Test pad transform */
|
|
375
|
+
const char *pad_doc = "---\nnumber: 42\n---\n\n[%number:pad(5,0)]";
|
|
376
|
+
html = apex_markdown_to_html(pad_doc, strlen(pad_doc), &opts);
|
|
377
|
+
assert_contains(html, "00042", "pad transform");
|
|
378
|
+
apex_free_string(html);
|
|
379
|
+
|
|
380
|
+
/* Test contains transform */
|
|
381
|
+
const char *contains_doc = "---\ntags: javascript,html,css\n---\n\n[%tags:contains(javascript)]";
|
|
382
|
+
html = apex_markdown_to_html(contains_doc, strlen(contains_doc), &opts);
|
|
383
|
+
assert_contains(html, "true", "contains transform");
|
|
384
|
+
apex_free_string(html);
|
|
385
|
+
|
|
386
|
+
/* Test array transforms: split */
|
|
387
|
+
const char *split_doc = "---\ntags: tag1,tag2,tag3\n---\n\n[%tags:split(,):first]";
|
|
388
|
+
html = apex_markdown_to_html(split_doc, strlen(split_doc), &opts);
|
|
389
|
+
assert_contains(html, "tag1", "split and first transforms");
|
|
390
|
+
apex_free_string(html);
|
|
391
|
+
|
|
392
|
+
/* Test array transforms: join */
|
|
393
|
+
const char *join_doc = "---\ntags: tag1,tag2,tag3\n---\n\n[%tags:split(,):join( | )]";
|
|
394
|
+
html = apex_markdown_to_html(join_doc, strlen(join_doc), &opts);
|
|
395
|
+
assert_contains(html, "tag1 | tag2 | tag3", "split and join transforms");
|
|
396
|
+
apex_free_string(html);
|
|
397
|
+
|
|
398
|
+
/* Test array transforms: last */
|
|
399
|
+
const char *last_doc = "---\ntags: tag1,tag2,tag3\n---\n\n[%tags:split(,):last]";
|
|
400
|
+
html = apex_markdown_to_html(last_doc, strlen(last_doc), &opts);
|
|
401
|
+
assert_contains(html, "tag3", "last transform");
|
|
402
|
+
apex_free_string(html);
|
|
403
|
+
|
|
404
|
+
/* Test array transforms: slice */
|
|
405
|
+
const char *slice_doc = "---\ntags: tag1,tag2,tag3\n---\n\n[%tags:split(,):slice(0,2):join(,)]";
|
|
406
|
+
html = apex_markdown_to_html(slice_doc, strlen(slice_doc), &opts);
|
|
407
|
+
assert_contains(html, "tag1,tag2", "slice transform");
|
|
408
|
+
apex_free_string(html);
|
|
409
|
+
|
|
410
|
+
/* Test slice with string (character-by-character) */
|
|
411
|
+
const char *slice_str_doc = "---\ntext: Hello\n---\n\n[%text:slice(0,5)]";
|
|
412
|
+
html = apex_markdown_to_html(slice_str_doc, strlen(slice_str_doc), &opts);
|
|
413
|
+
assert_contains(html, "Hello", "slice transform on string");
|
|
414
|
+
apex_free_string(html);
|
|
415
|
+
|
|
416
|
+
/* Test strftime transform */
|
|
417
|
+
const char *strftime_doc = "---\ndate: 2024-03-15\n---\n\n[%date:strftime(%Y)]";
|
|
418
|
+
html = apex_markdown_to_html(strftime_doc, strlen(strftime_doc), &opts);
|
|
419
|
+
assert_contains(html, "2024", "strftime transform");
|
|
420
|
+
apex_free_string(html);
|
|
421
|
+
|
|
422
|
+
/* Test transform chaining */
|
|
423
|
+
const char *chain_doc = "---\ntitle: hello world\n---\n\n# [%title:title:split( ):first]";
|
|
424
|
+
html = apex_markdown_to_html(chain_doc, strlen(chain_doc), &opts);
|
|
425
|
+
assert_contains(html, "Hello</h1>", "transform chaining");
|
|
426
|
+
apex_free_string(html);
|
|
427
|
+
|
|
428
|
+
/* Test transform chaining with date */
|
|
429
|
+
const char *date_chain_doc = "---\ndate: 2024-03-15 14:30\n---\n\n[%date:strftime(%Y)]";
|
|
430
|
+
html = apex_markdown_to_html(date_chain_doc, strlen(date_chain_doc), &opts);
|
|
431
|
+
assert_contains(html, "2024", "strftime with time");
|
|
432
|
+
apex_free_string(html);
|
|
433
|
+
|
|
434
|
+
/* Test that transforms are disabled when flag is off */
|
|
435
|
+
apex_options no_transforms = apex_options_for_mode(APEX_MODE_UNIFIED);
|
|
436
|
+
no_transforms.enable_metadata_transforms = false;
|
|
437
|
+
const char *disabled_doc = "---\ntitle: Hello\n---\n\n[%title:upper]";
|
|
438
|
+
html = apex_markdown_to_html(disabled_doc, strlen(disabled_doc), &no_transforms);
|
|
439
|
+
/* Should keep the transform syntax verbatim or use simple replacement */
|
|
440
|
+
if (strstr(html, "[%title:upper]") != NULL || strstr(html, "Hello") != NULL) {
|
|
441
|
+
test_result(true, "Transforms disabled when flag is off");
|
|
442
|
+
} else {
|
|
443
|
+
test_result(false, "Transforms not disabled when flag is off");
|
|
444
|
+
}
|
|
445
|
+
apex_free_string(html);
|
|
446
|
+
|
|
447
|
+
/* Test that transforms are disabled in non-unified modes by default */
|
|
448
|
+
apex_options mmd_opts = apex_options_for_mode(APEX_MODE_MULTIMARKDOWN);
|
|
449
|
+
html = apex_markdown_to_html(disabled_doc, strlen(disabled_doc), &mmd_opts);
|
|
450
|
+
if (strstr(html, "[%title:upper]") != NULL || strstr(html, "Hello") != NULL) {
|
|
451
|
+
test_result(true, "Transforms disabled in MMD mode by default");
|
|
452
|
+
} else {
|
|
453
|
+
test_result(false, "Transforms incorrectly enabled in MMD mode");
|
|
454
|
+
}
|
|
455
|
+
apex_free_string(html);
|
|
456
|
+
|
|
457
|
+
/* Test that simple [%key] still works with transforms enabled */
|
|
458
|
+
const char *simple_doc = "---\ntitle: Hello\n---\n\n[%title]";
|
|
459
|
+
html = apex_markdown_to_html(simple_doc, strlen(simple_doc), &opts);
|
|
460
|
+
assert_contains(html, "Hello", "Simple metadata replacement still works");
|
|
461
|
+
apex_free_string(html);
|
|
462
|
+
|
|
463
|
+
bool had_failures = suite_end(suite_failures);
|
|
464
|
+
print_suite_title("Metadata Transforms Tests", had_failures, false);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Test wiki links
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
void test_metadata_control_options(void) {
|
|
472
|
+
int suite_failures = suite_start();
|
|
473
|
+
print_suite_title("Metadata Control of Options Tests", false, true);
|
|
474
|
+
|
|
475
|
+
/* Test boolean options via metadata */
|
|
476
|
+
apex_options opts = apex_options_default();
|
|
477
|
+
opts.enable_indices = true; /* Start with indices enabled */
|
|
478
|
+
opts.enable_wiki_links = false; /* Start with wikilinks disabled */
|
|
479
|
+
|
|
480
|
+
/* Create metadata with boolean options */
|
|
481
|
+
apex_metadata_item *metadata = NULL;
|
|
482
|
+
apex_metadata_item *item;
|
|
483
|
+
|
|
484
|
+
/* Test indices: false */
|
|
485
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
486
|
+
item->key = strdup("indices");
|
|
487
|
+
item->value = strdup("false");
|
|
488
|
+
item->next = metadata;
|
|
489
|
+
metadata = item;
|
|
490
|
+
|
|
491
|
+
/* Test wikilinks: true */
|
|
492
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
493
|
+
item->key = strdup("wikilinks");
|
|
494
|
+
item->value = strdup("true");
|
|
495
|
+
item->next = metadata;
|
|
496
|
+
metadata = item;
|
|
497
|
+
|
|
498
|
+
/* Test pretty: yes */
|
|
499
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
500
|
+
item->key = strdup("pretty");
|
|
501
|
+
item->value = strdup("yes");
|
|
502
|
+
item->next = metadata;
|
|
503
|
+
metadata = item;
|
|
504
|
+
|
|
505
|
+
/* Test standalone: 1 */
|
|
506
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
507
|
+
item->key = strdup("standalone");
|
|
508
|
+
item->value = strdup("1");
|
|
509
|
+
item->next = metadata;
|
|
510
|
+
metadata = item;
|
|
511
|
+
|
|
512
|
+
/* Apply metadata */
|
|
513
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
514
|
+
|
|
515
|
+
/* Verify boolean options */
|
|
516
|
+
assert_option_bool(opts.enable_indices, false, "indices: false sets enable_indices to false");
|
|
517
|
+
assert_option_bool(opts.enable_wiki_links, true, "wikilinks: true sets enable_wiki_links to true");
|
|
518
|
+
assert_option_bool(opts.pretty, true, "pretty: yes sets pretty to true");
|
|
519
|
+
assert_option_bool(opts.standalone, true, "standalone: 1 sets standalone to true");
|
|
520
|
+
|
|
521
|
+
/* Clean up */
|
|
522
|
+
apex_free_metadata(metadata);
|
|
523
|
+
metadata = NULL;
|
|
524
|
+
|
|
525
|
+
/* Test string options */
|
|
526
|
+
opts = apex_options_default();
|
|
527
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
528
|
+
item->key = strdup("title");
|
|
529
|
+
item->value = strdup("My Test Document");
|
|
530
|
+
item->next = NULL;
|
|
531
|
+
metadata = item;
|
|
532
|
+
|
|
533
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
534
|
+
item->key = strdup("csl");
|
|
535
|
+
item->value = strdup("apa.csl");
|
|
536
|
+
item->next = metadata;
|
|
537
|
+
metadata = item;
|
|
538
|
+
|
|
539
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
540
|
+
item->key = strdup("id-format");
|
|
541
|
+
item->value = strdup("mmd");
|
|
542
|
+
item->next = metadata;
|
|
543
|
+
metadata = item;
|
|
544
|
+
|
|
545
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
546
|
+
|
|
547
|
+
assert_option_string(opts.document_title, "My Test Document", "title sets document_title");
|
|
548
|
+
assert_option_string(opts.csl_file, "apa.csl", "csl sets csl_file");
|
|
549
|
+
assert_option_bool(opts.id_format == 1, true, "id-format: mmd sets id_format to 1 (MMD)");
|
|
550
|
+
|
|
551
|
+
apex_free_metadata(metadata);
|
|
552
|
+
metadata = NULL;
|
|
553
|
+
|
|
554
|
+
/* Test mode option (should reset options) */
|
|
555
|
+
opts = apex_options_default();
|
|
556
|
+
opts.enable_indices = true;
|
|
557
|
+
opts.enable_wiki_links = true;
|
|
558
|
+
|
|
559
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
560
|
+
item->key = strdup("mode");
|
|
561
|
+
item->value = strdup("gfm");
|
|
562
|
+
item->next = NULL;
|
|
563
|
+
metadata = item;
|
|
564
|
+
|
|
565
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
566
|
+
item->key = strdup("wikilinks");
|
|
567
|
+
item->value = strdup("true");
|
|
568
|
+
item->next = metadata;
|
|
569
|
+
metadata = item;
|
|
570
|
+
|
|
571
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
572
|
+
|
|
573
|
+
assert_option_bool(opts.mode == APEX_MODE_GFM, true, "mode: gfm sets mode to GFM");
|
|
574
|
+
/* After mode reset, wikilinks should still be applied */
|
|
575
|
+
assert_option_bool(opts.enable_wiki_links, true, "wikilinks applied after mode reset");
|
|
576
|
+
|
|
577
|
+
apex_free_metadata(metadata);
|
|
578
|
+
metadata = NULL;
|
|
579
|
+
|
|
580
|
+
/* Test case-insensitive boolean values */
|
|
581
|
+
opts = apex_options_default();
|
|
582
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
583
|
+
item->key = strdup("indices");
|
|
584
|
+
item->value = strdup("TRUE");
|
|
585
|
+
item->next = NULL;
|
|
586
|
+
metadata = item;
|
|
587
|
+
|
|
588
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
589
|
+
item->key = strdup("wikilinks");
|
|
590
|
+
item->value = strdup("FALSE");
|
|
591
|
+
item->next = metadata;
|
|
592
|
+
metadata = item;
|
|
593
|
+
|
|
594
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
595
|
+
|
|
596
|
+
assert_option_bool(opts.enable_indices, true, "indices: TRUE (uppercase) sets enable_indices to true");
|
|
597
|
+
assert_option_bool(opts.enable_wiki_links, false, "wikilinks: FALSE (uppercase) sets enable_wiki_links to false");
|
|
598
|
+
|
|
599
|
+
apex_free_metadata(metadata);
|
|
600
|
+
metadata = NULL;
|
|
601
|
+
|
|
602
|
+
/* Test more boolean options */
|
|
603
|
+
opts = apex_options_default();
|
|
604
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
605
|
+
item->key = strdup("relaxed-tables");
|
|
606
|
+
item->value = strdup("true");
|
|
607
|
+
item->next = NULL;
|
|
608
|
+
metadata = item;
|
|
609
|
+
|
|
610
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
611
|
+
item->key = strdup("link-citations");
|
|
612
|
+
item->value = strdup("yes");
|
|
613
|
+
item->next = metadata;
|
|
614
|
+
metadata = item;
|
|
615
|
+
|
|
616
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
617
|
+
item->key = strdup("suppress-bibliography");
|
|
618
|
+
item->value = strdup("1");
|
|
619
|
+
item->next = metadata;
|
|
620
|
+
metadata = item;
|
|
621
|
+
|
|
622
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
623
|
+
|
|
624
|
+
assert_option_bool(opts.relaxed_tables, true, "relaxed-tables: true sets relaxed_tables");
|
|
625
|
+
assert_option_bool(opts.link_citations, true, "link-citations: yes sets link_citations");
|
|
626
|
+
assert_option_bool(opts.suppress_bibliography, true, "suppress-bibliography: 1 sets suppress_bibliography");
|
|
627
|
+
|
|
628
|
+
apex_free_metadata(metadata);
|
|
629
|
+
|
|
630
|
+
/* Test loading metadata from file */
|
|
631
|
+
#ifdef TEST_FIXTURES_DIR
|
|
632
|
+
opts = apex_options_default();
|
|
633
|
+
char metadata_file_path[512];
|
|
634
|
+
snprintf(metadata_file_path, sizeof(metadata_file_path), "%s/metadata_options.yml", TEST_FIXTURES_DIR);
|
|
635
|
+
apex_metadata_item *file_metadata = apex_load_metadata_from_file(metadata_file_path);
|
|
636
|
+
if (file_metadata) {
|
|
637
|
+
apex_apply_metadata_to_options(file_metadata, &opts);
|
|
638
|
+
|
|
639
|
+
assert_option_bool(opts.enable_indices, false, "metadata file: indices: false");
|
|
640
|
+
assert_option_bool(opts.enable_wiki_links, true, "metadata file: wikilinks: true");
|
|
641
|
+
assert_option_bool(opts.pretty, true, "metadata file: pretty: true");
|
|
642
|
+
assert_option_bool(opts.standalone, true, "metadata file: standalone: true");
|
|
643
|
+
assert_option_string(opts.document_title, "Test Document from File", "metadata file: title");
|
|
644
|
+
assert_option_string(opts.csl_file, "test.csl", "metadata file: csl");
|
|
645
|
+
assert_option_bool(opts.id_format == 2, true, "metadata file: id-format: kramdown sets id_format to 2");
|
|
646
|
+
assert_option_bool(opts.link_citations, true, "metadata file: link-citations: true");
|
|
647
|
+
assert_option_bool(opts.suppress_bibliography, false, "metadata file: suppress-bibliography: false");
|
|
648
|
+
|
|
649
|
+
apex_free_metadata(file_metadata);
|
|
650
|
+
} else {
|
|
651
|
+
tests_run++;
|
|
652
|
+
tests_failed++;
|
|
653
|
+
printf(COLOR_RED "✗" COLOR_RESET " metadata file: Failed to load metadata_options.yml\n");
|
|
654
|
+
}
|
|
655
|
+
#endif
|
|
656
|
+
|
|
657
|
+
bool had_failures = suite_end(suite_failures);
|
|
658
|
+
print_suite_title("Metadata Control of Options Tests", had_failures, false);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Test syntax highlighting options via metadata
|
|
663
|
+
*/
|
|
664
|
+
void test_syntax_highlight_options(void) {
|
|
665
|
+
int suite_failures = suite_start();
|
|
666
|
+
print_suite_title("Syntax Highlighting Options Tests", false, true);
|
|
667
|
+
|
|
668
|
+
apex_options opts;
|
|
669
|
+
apex_metadata_item *metadata = NULL;
|
|
670
|
+
apex_metadata_item *item;
|
|
671
|
+
|
|
672
|
+
/* Test code-highlight option: pygments (full name) */
|
|
673
|
+
opts = apex_options_default();
|
|
674
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
675
|
+
item->key = strdup("code-highlight");
|
|
676
|
+
item->value = strdup("pygments");
|
|
677
|
+
item->next = NULL;
|
|
678
|
+
metadata = item;
|
|
679
|
+
|
|
680
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
681
|
+
assert_option_string(opts.code_highlighter, "pygments", "code-highlight: pygments sets code_highlighter");
|
|
682
|
+
apex_free_metadata(metadata);
|
|
683
|
+
metadata = NULL;
|
|
684
|
+
|
|
685
|
+
/* Test code-highlight option: skylighting (full name) */
|
|
686
|
+
opts = apex_options_default();
|
|
687
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
688
|
+
item->key = strdup("code-highlight");
|
|
689
|
+
item->value = strdup("skylighting");
|
|
690
|
+
item->next = NULL;
|
|
691
|
+
metadata = item;
|
|
692
|
+
|
|
693
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
694
|
+
assert_option_string(opts.code_highlighter, "skylighting", "code-highlight: skylighting sets code_highlighter");
|
|
695
|
+
apex_free_metadata(metadata);
|
|
696
|
+
metadata = NULL;
|
|
697
|
+
|
|
698
|
+
/* Test code-highlight option: p (abbreviation for pygments) */
|
|
699
|
+
opts = apex_options_default();
|
|
700
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
701
|
+
item->key = strdup("code-highlight");
|
|
702
|
+
item->value = strdup("p");
|
|
703
|
+
item->next = NULL;
|
|
704
|
+
metadata = item;
|
|
705
|
+
|
|
706
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
707
|
+
assert_option_string(opts.code_highlighter, "pygments", "code-highlight: p (abbreviation) sets pygments");
|
|
708
|
+
apex_free_metadata(metadata);
|
|
709
|
+
metadata = NULL;
|
|
710
|
+
|
|
711
|
+
/* Test code-highlight option: s (abbreviation for skylighting) */
|
|
712
|
+
opts = apex_options_default();
|
|
713
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
714
|
+
item->key = strdup("code-highlight");
|
|
715
|
+
item->value = strdup("s");
|
|
716
|
+
item->next = NULL;
|
|
717
|
+
metadata = item;
|
|
718
|
+
|
|
719
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
720
|
+
assert_option_string(opts.code_highlighter, "skylighting", "code-highlight: s (abbreviation) sets skylighting");
|
|
721
|
+
apex_free_metadata(metadata);
|
|
722
|
+
metadata = NULL;
|
|
723
|
+
|
|
724
|
+
/* Test code-highlight option: pyg (abbreviation for pygments) */
|
|
725
|
+
opts = apex_options_default();
|
|
726
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
727
|
+
item->key = strdup("code-highlight");
|
|
728
|
+
item->value = strdup("pyg");
|
|
729
|
+
item->next = NULL;
|
|
730
|
+
metadata = item;
|
|
731
|
+
|
|
732
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
733
|
+
assert_option_string(opts.code_highlighter, "pygments", "code-highlight: pyg (abbreviation) sets pygments");
|
|
734
|
+
apex_free_metadata(metadata);
|
|
735
|
+
metadata = NULL;
|
|
736
|
+
|
|
737
|
+
/* Test code-highlight option: sky (abbreviation for skylighting) */
|
|
738
|
+
opts = apex_options_default();
|
|
739
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
740
|
+
item->key = strdup("code-highlight");
|
|
741
|
+
item->value = strdup("sky");
|
|
742
|
+
item->next = NULL;
|
|
743
|
+
metadata = item;
|
|
744
|
+
|
|
745
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
746
|
+
assert_option_string(opts.code_highlighter, "skylighting", "code-highlight: sky (abbreviation) sets skylighting");
|
|
747
|
+
apex_free_metadata(metadata);
|
|
748
|
+
metadata = NULL;
|
|
749
|
+
|
|
750
|
+
/* Test code-highlight option: false disables */
|
|
751
|
+
opts = apex_options_default();
|
|
752
|
+
opts.code_highlighter = "pygments"; /* Start with it enabled */
|
|
753
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
754
|
+
item->key = strdup("code-highlight");
|
|
755
|
+
item->value = strdup("false");
|
|
756
|
+
item->next = NULL;
|
|
757
|
+
metadata = item;
|
|
758
|
+
|
|
759
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
760
|
+
assert_option_bool(opts.code_highlighter == NULL, true, "code-highlight: false disables highlighting");
|
|
761
|
+
apex_free_metadata(metadata);
|
|
762
|
+
metadata = NULL;
|
|
763
|
+
|
|
764
|
+
/* Test code-highlight option: none disables */
|
|
765
|
+
opts = apex_options_default();
|
|
766
|
+
opts.code_highlighter = "pygments"; /* Start with it enabled */
|
|
767
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
768
|
+
item->key = strdup("code-highlight");
|
|
769
|
+
item->value = strdup("none");
|
|
770
|
+
item->next = NULL;
|
|
771
|
+
metadata = item;
|
|
772
|
+
|
|
773
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
774
|
+
assert_option_bool(opts.code_highlighter == NULL, true, "code-highlight: none disables highlighting");
|
|
775
|
+
apex_free_metadata(metadata);
|
|
776
|
+
metadata = NULL;
|
|
777
|
+
|
|
778
|
+
/* Test code-line-numbers option: true */
|
|
779
|
+
opts = apex_options_default();
|
|
780
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
781
|
+
item->key = strdup("code-line-numbers");
|
|
782
|
+
item->value = strdup("true");
|
|
783
|
+
item->next = NULL;
|
|
784
|
+
metadata = item;
|
|
785
|
+
|
|
786
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
787
|
+
assert_option_bool(opts.code_line_numbers, true, "code-line-numbers: true enables line numbers");
|
|
788
|
+
apex_free_metadata(metadata);
|
|
789
|
+
metadata = NULL;
|
|
790
|
+
|
|
791
|
+
/* Test code-line-numbers option: false */
|
|
792
|
+
opts = apex_options_default();
|
|
793
|
+
opts.code_line_numbers = true; /* Start enabled */
|
|
794
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
795
|
+
item->key = strdup("code-line-numbers");
|
|
796
|
+
item->value = strdup("false");
|
|
797
|
+
item->next = NULL;
|
|
798
|
+
metadata = item;
|
|
799
|
+
|
|
800
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
801
|
+
assert_option_bool(opts.code_line_numbers, false, "code-line-numbers: false disables line numbers");
|
|
802
|
+
apex_free_metadata(metadata);
|
|
803
|
+
metadata = NULL;
|
|
804
|
+
|
|
805
|
+
/* Test code_line_numbers option with underscore (alternate key format) */
|
|
806
|
+
opts = apex_options_default();
|
|
807
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
808
|
+
item->key = strdup("code_line_numbers");
|
|
809
|
+
item->value = strdup("yes");
|
|
810
|
+
item->next = NULL;
|
|
811
|
+
metadata = item;
|
|
812
|
+
|
|
813
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
814
|
+
assert_option_bool(opts.code_line_numbers, true, "code_line_numbers (underscore): yes enables line numbers");
|
|
815
|
+
apex_free_metadata(metadata);
|
|
816
|
+
metadata = NULL;
|
|
817
|
+
|
|
818
|
+
/* Test highlight-language-only option: true */
|
|
819
|
+
opts = apex_options_default();
|
|
820
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
821
|
+
item->key = strdup("highlight-language-only");
|
|
822
|
+
item->value = strdup("true");
|
|
823
|
+
item->next = NULL;
|
|
824
|
+
metadata = item;
|
|
825
|
+
|
|
826
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
827
|
+
assert_option_bool(opts.highlight_language_only, true, "highlight-language-only: true enables language-only mode");
|
|
828
|
+
apex_free_metadata(metadata);
|
|
829
|
+
metadata = NULL;
|
|
830
|
+
|
|
831
|
+
/* Test highlight-language-only option: false */
|
|
832
|
+
opts = apex_options_default();
|
|
833
|
+
opts.highlight_language_only = true; /* Start enabled */
|
|
834
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
835
|
+
item->key = strdup("highlight-language-only");
|
|
836
|
+
item->value = strdup("false");
|
|
837
|
+
item->next = NULL;
|
|
838
|
+
metadata = item;
|
|
839
|
+
|
|
840
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
841
|
+
assert_option_bool(opts.highlight_language_only, false, "highlight-language-only: false disables language-only mode");
|
|
842
|
+
apex_free_metadata(metadata);
|
|
843
|
+
metadata = NULL;
|
|
844
|
+
|
|
845
|
+
/* Test highlight_language_only option with underscore (alternate key format) */
|
|
846
|
+
opts = apex_options_default();
|
|
847
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
848
|
+
item->key = strdup("highlight_language_only");
|
|
849
|
+
item->value = strdup("1");
|
|
850
|
+
item->next = NULL;
|
|
851
|
+
metadata = item;
|
|
852
|
+
|
|
853
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
854
|
+
assert_option_bool(opts.highlight_language_only, true, "highlight_language_only (underscore): 1 enables language-only mode");
|
|
855
|
+
apex_free_metadata(metadata);
|
|
856
|
+
metadata = NULL;
|
|
857
|
+
|
|
858
|
+
/* Test combined syntax highlighting options */
|
|
859
|
+
opts = apex_options_default();
|
|
860
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
861
|
+
item->key = strdup("code-highlight");
|
|
862
|
+
item->value = strdup("pygments");
|
|
863
|
+
item->next = NULL;
|
|
864
|
+
metadata = item;
|
|
865
|
+
|
|
866
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
867
|
+
item->key = strdup("code-line-numbers");
|
|
868
|
+
item->value = strdup("true");
|
|
869
|
+
item->next = metadata;
|
|
870
|
+
metadata = item;
|
|
871
|
+
|
|
872
|
+
item = malloc(sizeof(apex_metadata_item));
|
|
873
|
+
item->key = strdup("highlight-language-only");
|
|
874
|
+
item->value = strdup("true");
|
|
875
|
+
item->next = metadata;
|
|
876
|
+
metadata = item;
|
|
877
|
+
|
|
878
|
+
apex_apply_metadata_to_options(metadata, &opts);
|
|
879
|
+
assert_option_string(opts.code_highlighter, "pygments", "Combined: code-highlight set");
|
|
880
|
+
assert_option_bool(opts.code_line_numbers, true, "Combined: code-line-numbers set");
|
|
881
|
+
assert_option_bool(opts.highlight_language_only, true, "Combined: highlight-language-only set");
|
|
882
|
+
apex_free_metadata(metadata);
|
|
883
|
+
metadata = NULL;
|
|
884
|
+
|
|
885
|
+
/* Test via YAML front matter in document */
|
|
886
|
+
apex_options yaml_opts = apex_options_for_mode(APEX_MODE_UNIFIED);
|
|
887
|
+
char *html;
|
|
888
|
+
|
|
889
|
+
/* Note: We can't fully test external highlighting without the tools installed,
|
|
890
|
+
* but we can verify that the options are parsed from YAML metadata correctly.
|
|
891
|
+
* The actual highlighting would require pygments/skylighting to be installed. */
|
|
892
|
+
|
|
893
|
+
/* Test that code blocks are rendered when no highlighting tool is available */
|
|
894
|
+
const char *code_doc = "---\ncode-highlight: pygments\n---\n\n```python\nprint('hello')\n```";
|
|
895
|
+
html = apex_markdown_to_html(code_doc, strlen(code_doc), &yaml_opts);
|
|
896
|
+
/* Should have code block regardless of whether pygments is available */
|
|
897
|
+
assert_contains(html, "<pre", "Code block has pre tag");
|
|
898
|
+
assert_contains(html, "<code", "Code block has code tag");
|
|
899
|
+
assert_contains(html, "print", "Code content preserved");
|
|
900
|
+
apex_free_string(html);
|
|
901
|
+
|
|
902
|
+
bool had_failures = suite_end(suite_failures);
|
|
903
|
+
print_suite_title("Syntax Highlighting Options Tests", had_failures, false);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Test ARIA labels and accessibility attributes
|
|
908
|
+
*/
|