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,873 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# Generate Dash docset for Apex documentation
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# ./generate_docset.rb [single|multi]
|
|
6
|
+
#
|
|
7
|
+
# single - Generate single-page CLI options docset (ApexCLI.docset)
|
|
8
|
+
# multi - Generate multi-page docset from wiki files (Apex.docset, default)
|
|
9
|
+
|
|
10
|
+
require 'fileutils'
|
|
11
|
+
require 'yaml'
|
|
12
|
+
require 'uri'
|
|
13
|
+
|
|
14
|
+
begin
|
|
15
|
+
require 'rouge'
|
|
16
|
+
ROUGE_AVAILABLE = true
|
|
17
|
+
puts "Rouge loaded successfully (version: #{Rouge::VERSION rescue 'unknown'})"
|
|
18
|
+
rescue LoadError => e
|
|
19
|
+
ROUGE_AVAILABLE = false
|
|
20
|
+
puts "Warning: Rouge gem not found. Install with: gem install rouge"
|
|
21
|
+
puts "Error: #{e.message}" if e.message
|
|
22
|
+
puts "Syntax highlighting will be disabled."
|
|
23
|
+
rescue => e
|
|
24
|
+
ROUGE_AVAILABLE = false
|
|
25
|
+
puts "Warning: Error loading Rouge: #{e.class}: #{e.message}"
|
|
26
|
+
puts "Syntax highlighting will be disabled."
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Only require sqlite3 for multi-page docset
|
|
30
|
+
def require_sqlite3
|
|
31
|
+
require 'sqlite3'
|
|
32
|
+
rescue LoadError
|
|
33
|
+
puts "Error: sqlite3 gem is required for multi-page docset generation"
|
|
34
|
+
puts "Install it with: gem install sqlite3"
|
|
35
|
+
exit 1
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
MODE = ARGV[0] || 'multi' # Default to multi-page docset
|
|
39
|
+
SCRIPT_DIR = File.expand_path(__dir__)
|
|
40
|
+
DOCS_DIR = File.join(SCRIPT_DIR, '..')
|
|
41
|
+
DOCSETS_DIR = File.join(DOCS_DIR, 'documentation', 'docsets')
|
|
42
|
+
WIKI_DIR = File.join(DOCS_DIR, 'documentation', 'apex.wiki')
|
|
43
|
+
MMD2CHEATSET = File.expand_path('~/Desktop/Code/mmd2cheatset/mmd2cheatset.rb')
|
|
44
|
+
|
|
45
|
+
# Find Apex binary - prioritize build/apex (most recent build)
|
|
46
|
+
def find_apex_binary
|
|
47
|
+
# Prioritize build/apex if it exists (most recent build)
|
|
48
|
+
build_apex = File.expand_path('../build/apex', __dir__)
|
|
49
|
+
return build_apex if File.exist?(build_apex)
|
|
50
|
+
|
|
51
|
+
# Try build-release (relative to repo root, not script dir)
|
|
52
|
+
build_release_apex = File.expand_path('../build-release/apex', __dir__)
|
|
53
|
+
return build_release_apex if File.exist?(build_release_apex)
|
|
54
|
+
|
|
55
|
+
# Try other common build directories
|
|
56
|
+
['../build-debug/apex'].each do |path|
|
|
57
|
+
full_path = File.expand_path(path, __dir__)
|
|
58
|
+
return full_path if File.exist?(full_path)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Fall back to system-installed apex
|
|
62
|
+
system_apex = `which apex 2>/dev/null`.strip
|
|
63
|
+
return system_apex if system_apex != '' && File.exist?(system_apex)
|
|
64
|
+
|
|
65
|
+
nil
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
APEX_BIN = find_apex_binary
|
|
69
|
+
|
|
70
|
+
def generate_single_page_docset
|
|
71
|
+
puts "Generating single-page docset using mmd2cheatset..."
|
|
72
|
+
|
|
73
|
+
# Ensure output directory exists
|
|
74
|
+
FileUtils.mkdir_p(DOCSETS_DIR)
|
|
75
|
+
|
|
76
|
+
# Change to docsets directory for output
|
|
77
|
+
original_dir = Dir.pwd
|
|
78
|
+
Dir.chdir(DOCSETS_DIR)
|
|
79
|
+
|
|
80
|
+
# Create a cheatsheet markdown file for command-line options
|
|
81
|
+
cheatsheet_md = <<~MARKDOWN
|
|
82
|
+
title: Apex Command Line Options
|
|
83
|
+
name: ApexCLI
|
|
84
|
+
keyword: apex
|
|
85
|
+
|
|
86
|
+
Complete reference for all Apex command-line flags and options.
|
|
87
|
+
|
|
88
|
+
| name | command | note |
|
|
89
|
+
|------|---------|------|
|
|
90
|
+
| Help | -h, --help | Display help message and exit |
|
|
91
|
+
| Version | -v, --version | Display version information and exit |
|
|
92
|
+
| Progress | --[no-]progress | Show progress indicator during processing |
|
|
93
|
+
| Combine | --combine | Concatenate Markdown files into a single stream |
|
|
94
|
+
| MMD Merge | --mmd-merge | Merge files from MultiMarkdown index files |
|
|
95
|
+
| Mode | -m, --mode MODE | Set processor mode (commonmark, gfm, mmd, kramdown, unified) |
|
|
96
|
+
| Output | -o, --output FILE | Write output to a file instead of stdout |
|
|
97
|
+
| Standalone | -s, --standalone | Generate complete HTML document |
|
|
98
|
+
| Style | --style FILE, --css FILE | Link to a CSS file in document head |
|
|
99
|
+
| Embed CSS | --embed-css | Embed CSS file contents into style tag |
|
|
100
|
+
| Script | --script VALUE | Inject script tags (mermaid, mathjax, katex, etc.) |
|
|
101
|
+
| Title | --title TITLE | Set the document title |
|
|
102
|
+
| Pretty | --pretty | Pretty-print HTML with indentation |
|
|
103
|
+
| ARIA | --aria | Add ARIA labels and accessibility attributes |
|
|
104
|
+
| Plugins | --plugins, --no-plugins | Enable or disable plugin processing |
|
|
105
|
+
| List Plugins | --list-plugins | List installed and available plugins |
|
|
106
|
+
| Install Plugin | --install-plugin ID-or-URL | Install a plugin by ID or URL |
|
|
107
|
+
| Uninstall Plugin | --uninstall-plugin ID | Uninstall a locally installed plugin |
|
|
108
|
+
| ID Format | --id-format FORMAT | Set header ID generation format (gfm, mmd, kramdown) |
|
|
109
|
+
| No IDs | --no-ids | Disable automatic header ID generation |
|
|
110
|
+
| Header Anchors | --header-anchors | Generate anchor tags instead of id attributes |
|
|
111
|
+
| Relaxed Tables | --relaxed-tables | Enable relaxed table parsing |
|
|
112
|
+
| No Relaxed Tables | --no-relaxed-tables | Disable relaxed table parsing |
|
|
113
|
+
| Captions | --captions POSITION | Control table caption position (above, below) |
|
|
114
|
+
| No Tables | --no-tables | Disable table support entirely |
|
|
115
|
+
| Alpha Lists | --[no-]alpha-lists | Control alphabetic list markers (a., b., c.) |
|
|
116
|
+
| Mixed Lists | --[no-]mixed-lists | Control mixed list marker types |
|
|
117
|
+
| No Footnotes | --no-footnotes | Disable footnote support |
|
|
118
|
+
| No Smart | --no-smart | Disable smart typography |
|
|
119
|
+
| No Math | --no-math | Disable math support |
|
|
120
|
+
| Autolink | --[no-]autolink | Control automatic linking of URLs and email addresses |
|
|
121
|
+
| Obfuscate Emails | --obfuscate-emails | Obfuscate email links by hex-encoding |
|
|
122
|
+
| Includes | --includes, --no-includes | Enable or disable file inclusion features |
|
|
123
|
+
| Embed Images | --embed-images | Embed local images as base64 data URLs |
|
|
124
|
+
| Base Dir | --base-dir DIR | Set base directory for resolving relative paths |
|
|
125
|
+
| Transforms | --[no-]transforms | Control metadata variable transforms |
|
|
126
|
+
| Meta File | --meta-file FILE | Load metadata from external file |
|
|
127
|
+
| Meta | --meta KEY=VALUE | Set metadata from command line |
|
|
128
|
+
| Bibliography | --bibliography FILE | Specify bibliography file (BibTeX, CSL JSON, CSL YAML) |
|
|
129
|
+
| CSL | --csl FILE | Specify Citation Style Language file |
|
|
130
|
+
| No Bibliography | --no-bibliography | Suppress bibliography output |
|
|
131
|
+
| Link Citations | --link-citations | Link citations to bibliography entries |
|
|
132
|
+
| Show Tooltips | --show-tooltips | Enable tooltips on citations when hovering |
|
|
133
|
+
| Indices | --indices | Enable index processing |
|
|
134
|
+
| No Indices | --no-indices | Disable index processing entirely |
|
|
135
|
+
| No Index | --no-index | Suppress index generation while creating markers |
|
|
136
|
+
| Hardbreaks | --hardbreaks | Treat newlines as hard breaks (GFM style) |
|
|
137
|
+
| Sup Sub | --[no-]sup-sub | Control MultiMarkdown-style superscript and subscript |
|
|
138
|
+
| Divs | --[no-]divs | Control Pandoc fenced divs syntax |
|
|
139
|
+
| Spans | --[no-]spans | Control Pandoc-style bracketed spans |
|
|
140
|
+
| Emoji Autocorrect | --[no-]emoji-autocorrect | Control emoji name autocorrect |
|
|
141
|
+
| Unsafe | --[no-]unsafe | Control whether raw HTML is allowed |
|
|
142
|
+
| Wikilinks | --[no-]wikilinks | Control wiki link syntax |
|
|
143
|
+
| Wikilink Space | --wikilink-space MODE | Control how spaces in wiki links are handled |
|
|
144
|
+
| Wikilink Extension | --wikilink-extension EXT | Add file extension to wiki link URLs |
|
|
145
|
+
| Accept | --accept | Accept all Critic Markup changes |
|
|
146
|
+
| Reject | --reject | Reject all Critic Markup changes |
|
|
147
|
+
[Command Line Options]
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
For complete documentation, see the Apex wiki at https://github.com/ApexMarkdown/apex/wiki
|
|
152
|
+
MARKDOWN
|
|
153
|
+
|
|
154
|
+
File.write('Apex_Command_Line_Options.md', cheatsheet_md)
|
|
155
|
+
|
|
156
|
+
if File.exist?(MMD2CHEATSET)
|
|
157
|
+
system("#{MMD2CHEATSET} Apex_Command_Line_Options.md")
|
|
158
|
+
FileUtils.rm('Apex_Command_Line_Options.md')
|
|
159
|
+
puts "\nSingle-page docset generated successfully!"
|
|
160
|
+
puts "Docset location: #{File.join(DOCSETS_DIR, "ApexCLI.docset")}"
|
|
161
|
+
else
|
|
162
|
+
puts "Error: mmd2cheatset.rb not found at #{MMD2CHEATSET}"
|
|
163
|
+
puts "Please check the path or install mmd2cheatset"
|
|
164
|
+
Dir.chdir(original_dir)
|
|
165
|
+
exit 1
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Return to original directory
|
|
169
|
+
Dir.chdir(original_dir)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def highlight_code_blocks(html_content)
|
|
173
|
+
return html_content unless ROUGE_AVAILABLE
|
|
174
|
+
|
|
175
|
+
code_block_count = 0
|
|
176
|
+
highlighted_count = 0
|
|
177
|
+
error_count = 0
|
|
178
|
+
|
|
179
|
+
begin
|
|
180
|
+
# Find all code blocks - handle various formats
|
|
181
|
+
# Apex outputs: <pre lang="language"><code>...</code></pre>
|
|
182
|
+
# Or: <pre><code class="language-xxx">...</code></pre>
|
|
183
|
+
# Use non-greedy matching and ensure we match complete code blocks
|
|
184
|
+
# Match <pre> tag (with optional lang attribute), then <code> tag (with optional class), then content, then closing tags
|
|
185
|
+
result = html_content.gsub(/<pre(\s+lang=["']([^"']+)["'])?[^>]*>\s*<code(\s+class=["'](?:language-)?([^"'\s]+)["'])?[^>]*>([\s\S]*?)<\/code>\s*<\/pre>/i) do |match|
|
|
186
|
+
code_block_count += 1
|
|
187
|
+
lang = $2 || $4 # Get lang from <pre lang="..."> ($2) or class from <code class="..."> ($4)
|
|
188
|
+
code = $5
|
|
189
|
+
|
|
190
|
+
# Skip if code is empty or suspiciously large (might be a regex error)
|
|
191
|
+
if code.nil? || code.empty? || code.length > 100000
|
|
192
|
+
match
|
|
193
|
+
else
|
|
194
|
+
begin
|
|
195
|
+
# Unescape HTML entities
|
|
196
|
+
code = code.gsub(/</, '<').gsub(/>/, '>').gsub(/&/, '&').gsub(/"/, '"')
|
|
197
|
+
|
|
198
|
+
if lang && !lang.empty?
|
|
199
|
+
lang_normalized = lang.downcase
|
|
200
|
+
# Handle common language aliases
|
|
201
|
+
lang_aliases = {
|
|
202
|
+
'yml' => 'yaml',
|
|
203
|
+
'md' => 'markdown',
|
|
204
|
+
'mkd' => 'markdown',
|
|
205
|
+
'mkdn' => 'markdown',
|
|
206
|
+
'mdown' => 'markdown'
|
|
207
|
+
}
|
|
208
|
+
lang_normalized = lang_aliases[lang_normalized] || lang_normalized
|
|
209
|
+
|
|
210
|
+
lexer = Rouge::Lexer.find(lang_normalized)
|
|
211
|
+
if lexer.nil?
|
|
212
|
+
puts " Warning: No lexer found for language '#{lang}' (normalized: '#{lang_normalized}'), using PlainText"
|
|
213
|
+
lexer = Rouge::Lexers::PlainText
|
|
214
|
+
end
|
|
215
|
+
else
|
|
216
|
+
lexer = Rouge::Lexers::PlainText
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
formatter = Rouge::Formatters::HTML.new
|
|
220
|
+
highlighted = formatter.format(lexer.lex(code))
|
|
221
|
+
highlighted_count += 1
|
|
222
|
+
|
|
223
|
+
# Return highlighted code with proper classes
|
|
224
|
+
"<pre><code class=\"highlight #{lang ? "language-#{lang}" : ''}\">#{highlighted}</code></pre>"
|
|
225
|
+
rescue => e
|
|
226
|
+
error_count += 1
|
|
227
|
+
# If highlighting fails, return original
|
|
228
|
+
puts " Warning: Failed to highlight code block (lang: #{lang || 'none'}): #{e.class}: #{e.message}"
|
|
229
|
+
puts " Backtrace: #{e.backtrace.first(2).join(' | ')}" if $DEBUG
|
|
230
|
+
match
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
if code_block_count > 0
|
|
236
|
+
puts " Highlighted #{highlighted_count}/#{code_block_count} code blocks"
|
|
237
|
+
puts " Errors: #{error_count}" if error_count > 0
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
result
|
|
241
|
+
rescue => e
|
|
242
|
+
puts "Warning: Error in highlight_code_blocks: #{e.class}: #{e.message}"
|
|
243
|
+
puts "Backtrace: #{e.backtrace.first(3).join("\n")}" if $DEBUG
|
|
244
|
+
puts "Returning original HTML without highlighting"
|
|
245
|
+
html_content
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Rouge CSS is now included in shared_styles.css
|
|
250
|
+
|
|
251
|
+
def extract_headers(html_content)
|
|
252
|
+
headers = []
|
|
253
|
+
# Match headers with IDs, handling multi-line formatting
|
|
254
|
+
html_content.scan(/<h([1-6])[^>]*id=["']([^"']+)["'][^>]*>([\s\S]*?)<\/h[1-6]>/i) do |level, id, text|
|
|
255
|
+
# Remove HTML tags and normalize whitespace
|
|
256
|
+
text = text.gsub(/<[^>]+>/, '').gsub(/\s+/, ' ').strip
|
|
257
|
+
headers << { level: level.to_i, id: id, text: text } unless text.empty?
|
|
258
|
+
end
|
|
259
|
+
headers
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def parse_sidebar_toc
|
|
263
|
+
sidebar_file = File.join(WIKI_DIR, '_Sidebar.md')
|
|
264
|
+
toc_html = '<nav class="main-toc">'
|
|
265
|
+
toc_html += '<ul>'
|
|
266
|
+
|
|
267
|
+
# Always add Home first
|
|
268
|
+
toc_html += '<li><a href="Home.html">Home</a></li>'
|
|
269
|
+
|
|
270
|
+
if File.exist?(sidebar_file)
|
|
271
|
+
sidebar_content = File.read(sidebar_file)
|
|
272
|
+
# Parse markdown links: [Text](PageName) or [Text](Page-Name)
|
|
273
|
+
sidebar_content.scan(/\[([^\]]+)\]\(([^)]+)\)/) do |text, link|
|
|
274
|
+
# Remove .md extension if present, add .html
|
|
275
|
+
page_name = link.gsub(/\.md$/, '')
|
|
276
|
+
# Skip if it's Home (already added)
|
|
277
|
+
next if page_name.downcase == 'home'
|
|
278
|
+
toc_html += "<li><a href=\"#{page_name}.html\">#{text}</a></li>"
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
toc_html += '</ul>'
|
|
283
|
+
toc_html += '</nav>'
|
|
284
|
+
toc_html
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def generate_page_toc(headers)
|
|
288
|
+
return '' if headers.empty?
|
|
289
|
+
|
|
290
|
+
toc_html = '<nav class="page-toc">'
|
|
291
|
+
toc_html += '<ul>'
|
|
292
|
+
stack = [] # Track open list items that need closing
|
|
293
|
+
|
|
294
|
+
headers.each_with_index do |header, idx|
|
|
295
|
+
level = header[:level]
|
|
296
|
+
next_header = headers[idx + 1]
|
|
297
|
+
next_level = next_header ? next_header[:level] : 1
|
|
298
|
+
|
|
299
|
+
# Close lists if we're going up in level
|
|
300
|
+
while !stack.empty? && stack.last >= level
|
|
301
|
+
toc_html += '</ul></li>'
|
|
302
|
+
stack.pop
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# If next item is deeper, this item will have children
|
|
306
|
+
if next_level > level
|
|
307
|
+
toc_html += "<li><a href=\"##{header[:id]}\">#{header[:text]}</a><ul>"
|
|
308
|
+
stack.push(level)
|
|
309
|
+
else
|
|
310
|
+
toc_html += "<li><a href=\"##{header[:id]}\">#{header[:text]}</a></li>"
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Close all remaining lists
|
|
315
|
+
while !stack.empty?
|
|
316
|
+
toc_html += '</ul></li>'
|
|
317
|
+
stack.pop
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
toc_html += '</ul>'
|
|
321
|
+
toc_html += '</nav>'
|
|
322
|
+
toc_html
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
def inject_toc_into_html(html_content, main_toc_html, page_toc_html)
|
|
326
|
+
# Load shared CSS
|
|
327
|
+
shared_css_file = File.join(SCRIPT_DIR, 'shared_styles.css')
|
|
328
|
+
shared_css = File.exist?(shared_css_file) ? File.read(shared_css_file) : ''
|
|
329
|
+
toc_css = "<style>\n#{shared_css}\n</style>"
|
|
330
|
+
|
|
331
|
+
# Inject CSS into head (Rouge CSS is included in shared_styles.css)
|
|
332
|
+
combined_css = toc_css
|
|
333
|
+
if html_content =~ /(<\/head>)/i
|
|
334
|
+
html_content = html_content.sub(/(<\/head>)/i, "#{combined_css}\\1")
|
|
335
|
+
elsif html_content =~ /(<\/style>)/i
|
|
336
|
+
html_content = html_content.sub(/(<\/style>)/i, "\\1\n#{combined_css}")
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
# Inject hamburger menu and mobile overlay
|
|
340
|
+
hamburger_html = <<~HTML
|
|
341
|
+
<button class="hamburger-menu" id="hamburger-menu" aria-label="Toggle navigation"></button>
|
|
342
|
+
<div class="mobile-menu-overlay" id="mobile-menu-overlay"></div>
|
|
343
|
+
HTML
|
|
344
|
+
|
|
345
|
+
# Inject main TOC into body (left sidebar)
|
|
346
|
+
if html_content =~ /(<body[^>]*>)/i
|
|
347
|
+
html_content = html_content.sub(/(<body[^>]*>)/i, "\\1\n#{hamburger_html}\n#{main_toc_html}")
|
|
348
|
+
else
|
|
349
|
+
puts "Warning: Could not find <body> tag to inject main TOC"
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# Inject page TOC at top of content (after first h1, or at start of body if no h1)
|
|
353
|
+
# Handle multi-line h1 tags (from pretty printing)
|
|
354
|
+
# Add ID to page TOC for scroll detection
|
|
355
|
+
unless page_toc_html.empty?
|
|
356
|
+
page_toc_with_id = page_toc_html.sub(/<nav class="page-toc">/, '<nav class="page-toc" id="page-toc-top">')
|
|
357
|
+
|
|
358
|
+
if html_content =~ /<h1[^>]*>[\s\S]*?<\/h1>/i
|
|
359
|
+
html_content = html_content.sub(/(<h1[^>]*>[\s\S]*?<\/h1>)/i, "\\1\n#{page_toc_with_id}")
|
|
360
|
+
elsif html_content =~ /(<body[^>]*>)/i
|
|
361
|
+
# If no h1, inject TOC right after body tag
|
|
362
|
+
html_content = html_content.sub(/(<body[^>]*>)/i, "\\1\n#{page_toc_with_id}")
|
|
363
|
+
else
|
|
364
|
+
puts "Warning: Could not find <h1> or <body> tag to inject page TOC"
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Add floating TOC HTML structure
|
|
369
|
+
floating_toc_html = <<~HTML
|
|
370
|
+
<div class="floating-toc" id="floating-toc">
|
|
371
|
+
<div class="floating-toc-container">
|
|
372
|
+
<div class="floating-toc-header">
|
|
373
|
+
<span>Table of Contents 🔻</span>
|
|
374
|
+
</div>
|
|
375
|
+
<div class="floating-toc-content" id="floating-toc-content">
|
|
376
|
+
<!-- Content will be populated by JavaScript -->
|
|
377
|
+
</div>
|
|
378
|
+
</div>
|
|
379
|
+
</div>
|
|
380
|
+
HTML
|
|
381
|
+
|
|
382
|
+
# Inject floating TOC after body tag
|
|
383
|
+
if html_content =~ /(<body[^>]*>)/i
|
|
384
|
+
html_content = html_content.sub(/(<body[^>]*>)/i, "\\1\n#{floating_toc_html}")
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
# Add JavaScript for floating TOC
|
|
388
|
+
floating_toc_js = <<~JS
|
|
389
|
+
<script>
|
|
390
|
+
(function() {
|
|
391
|
+
// Clone the page TOC for floating TOC
|
|
392
|
+
function initFloatingTOC() {
|
|
393
|
+
var pageTOC = document.getElementById('page-toc-top');
|
|
394
|
+
var floatingTOCContent = document.getElementById('floating-toc-content');
|
|
395
|
+
var floatingTOC = document.getElementById('floating-toc');
|
|
396
|
+
|
|
397
|
+
if (!pageTOC || !floatingTOCContent || !floatingTOC) return;
|
|
398
|
+
|
|
399
|
+
// Clone the TOC structure
|
|
400
|
+
var tocClone = pageTOC.cloneNode(true);
|
|
401
|
+
tocClone.id = 'floating-toc-clone';
|
|
402
|
+
floatingTOCContent.appendChild(tocClone);
|
|
403
|
+
|
|
404
|
+
// Update all links to use smooth scrolling
|
|
405
|
+
var allTOCLinks = document.querySelectorAll('.page-toc a, .floating-toc-content a');
|
|
406
|
+
allTOCLinks.forEach(function(link) {
|
|
407
|
+
link.addEventListener('click', function(e) {
|
|
408
|
+
var href = this.getAttribute('href');
|
|
409
|
+
if (href && href.startsWith('#')) {
|
|
410
|
+
e.preventDefault();
|
|
411
|
+
var targetId = href.substring(1);
|
|
412
|
+
var targetElement = document.getElementById(targetId);
|
|
413
|
+
if (targetElement) {
|
|
414
|
+
var offset = 20; // Offset from top
|
|
415
|
+
|
|
416
|
+
// Function to calculate absolute position from document top
|
|
417
|
+
function getAbsoluteTop(element) {
|
|
418
|
+
var top = 0;
|
|
419
|
+
while (element) {
|
|
420
|
+
top += element.offsetTop;
|
|
421
|
+
element = element.offsetParent;
|
|
422
|
+
}
|
|
423
|
+
return top;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
var absoluteTop = getAbsoluteTop(targetElement);
|
|
427
|
+
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
428
|
+
var offsetPosition = absoluteTop - offset;
|
|
429
|
+
|
|
430
|
+
// Only scroll if we're not already at the target position
|
|
431
|
+
if (Math.abs(scrollTop - offsetPosition) > 10) {
|
|
432
|
+
window.scrollTo({
|
|
433
|
+
top: Math.max(0, offsetPosition),
|
|
434
|
+
behavior: 'smooth'
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// Update URL hash without triggering scroll
|
|
439
|
+
if (history.pushState) {
|
|
440
|
+
history.pushState(null, null, href);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
// Handle scroll to show/hide floating TOC
|
|
448
|
+
var tocTop = pageTOC.getBoundingClientRect().top + window.pageYOffset;
|
|
449
|
+
var tocBottom = tocTop + pageTOC.offsetHeight;
|
|
450
|
+
|
|
451
|
+
function updateFloatingTOC() {
|
|
452
|
+
var scrollY = window.pageYOffset || document.documentElement.scrollTop;
|
|
453
|
+
|
|
454
|
+
if (scrollY > tocBottom) {
|
|
455
|
+
floatingTOC.classList.add('visible');
|
|
456
|
+
} else {
|
|
457
|
+
floatingTOC.classList.remove('visible');
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// Throttle scroll events
|
|
462
|
+
var ticking = false;
|
|
463
|
+
window.addEventListener('scroll', function() {
|
|
464
|
+
if (!ticking) {
|
|
465
|
+
window.requestAnimationFrame(function() {
|
|
466
|
+
updateFloatingTOC();
|
|
467
|
+
ticking = false;
|
|
468
|
+
});
|
|
469
|
+
ticking = true;
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// Initial check
|
|
474
|
+
updateFloatingTOC();
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Initialize when DOM is ready
|
|
478
|
+
if (document.readyState === 'loading') {
|
|
479
|
+
document.addEventListener('DOMContentLoaded', initFloatingTOC);
|
|
480
|
+
} else {
|
|
481
|
+
initFloatingTOC();
|
|
482
|
+
}
|
|
483
|
+
})();
|
|
484
|
+
</script>
|
|
485
|
+
JS
|
|
486
|
+
|
|
487
|
+
# Load shared JavaScript
|
|
488
|
+
shared_js_file = File.join(SCRIPT_DIR, 'shared_scripts.js')
|
|
489
|
+
shared_js = File.exist?(shared_js_file) ? File.read(shared_js_file) : ''
|
|
490
|
+
|
|
491
|
+
# Combine shared JS and floating TOC JS
|
|
492
|
+
combined_js = "<script>\n#{shared_js}\n</script>\n#{floating_toc_js}"
|
|
493
|
+
|
|
494
|
+
# Inject JavaScript before closing body tag
|
|
495
|
+
if html_content =~ /(<\/body>)/i
|
|
496
|
+
html_content = html_content.sub(/(<\/body>)/i, "#{combined_js}\\1")
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
html_content
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
def parse_footer
|
|
503
|
+
footer_file = File.join(WIKI_DIR, '_Footer.md')
|
|
504
|
+
return '' unless File.exist?(footer_file)
|
|
505
|
+
|
|
506
|
+
# Convert markdown to HTML using Apex
|
|
507
|
+
footer_html_content = `#{APEX_BIN} "#{footer_file}" 2>/dev/null`
|
|
508
|
+
|
|
509
|
+
if $?.success? && !footer_html_content.empty?
|
|
510
|
+
footer_html = '<footer class="page-footer">'
|
|
511
|
+
footer_html += footer_html_content.strip
|
|
512
|
+
footer_html += '</footer>'
|
|
513
|
+
footer_html
|
|
514
|
+
else
|
|
515
|
+
# Fallback: simple text conversion
|
|
516
|
+
footer_content = File.read(footer_file)
|
|
517
|
+
footer_html = '<footer class="page-footer">'
|
|
518
|
+
footer_html += '<p>' + footer_content.strip.gsub(/\n/, '<br>') + '</p>'
|
|
519
|
+
footer_html += '</footer>'
|
|
520
|
+
footer_html
|
|
521
|
+
end
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
def inject_footer_into_html(html_content, footer_html)
|
|
525
|
+
return html_content if footer_html.empty?
|
|
526
|
+
|
|
527
|
+
# Inject footer before closing body tag
|
|
528
|
+
if html_content =~ /(<\/body>)/i
|
|
529
|
+
html_content = html_content.sub(/(<\/body>)/i, "#{footer_html}\\1")
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
html_content
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
def fix_links_in_html(html_content, available_files)
|
|
536
|
+
# Create a mapping of page names to HTML files
|
|
537
|
+
file_map = {}
|
|
538
|
+
available_files.each do |file|
|
|
539
|
+
basename = File.basename(file, '.html')
|
|
540
|
+
file_map[basename] = "#{basename}.html"
|
|
541
|
+
# Also map with different cases/spaces
|
|
542
|
+
file_map[basename.gsub('-', ' ')] = "#{basename}.html"
|
|
543
|
+
file_map[basename.gsub('-', '_')] = "#{basename}.html"
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
# Fix relative links that don't have .html extension
|
|
547
|
+
# Match href="PageName" or href="Page-Name" (but not external links, anchors, or already .html)
|
|
548
|
+
html_content.gsub(/<a\s+([^>]*\s+)?href=["']([^"']+)["']([^>]*)>/i) do |match|
|
|
549
|
+
attrs_before = $1 || ''
|
|
550
|
+
href = $2
|
|
551
|
+
attrs_after = $3 || ''
|
|
552
|
+
|
|
553
|
+
# Skip if it's already an external link, anchor, or has extension
|
|
554
|
+
if href =~ /^(https?:\/\/|mailto:|#|.*\.(html|md|pdf|png|jpg|jpeg|gif|svg|webp))/i
|
|
555
|
+
match
|
|
556
|
+
elsif file_map[href]
|
|
557
|
+
# Found a matching file, add .html extension
|
|
558
|
+
"<a #{attrs_before}href=\"#{file_map[href]}\"#{attrs_after}>"
|
|
559
|
+
elsif file_map[href.gsub(/\s+/, '-')]
|
|
560
|
+
# Try with spaces converted to dashes
|
|
561
|
+
fixed_href = file_map[href.gsub(/\s+/, '-')]
|
|
562
|
+
"<a #{attrs_before}href=\"#{fixed_href}\"#{attrs_after}>"
|
|
563
|
+
else
|
|
564
|
+
# Try to find a case-insensitive match
|
|
565
|
+
found = available_files.find { |f| File.basename(f, '.html').downcase == href.downcase }
|
|
566
|
+
if found
|
|
567
|
+
"<a #{attrs_before}href=\"#{File.basename(found)}\"#{attrs_after}>"
|
|
568
|
+
else
|
|
569
|
+
match # Keep original if no match found
|
|
570
|
+
end
|
|
571
|
+
end
|
|
572
|
+
end
|
|
573
|
+
end
|
|
574
|
+
|
|
575
|
+
def clone_wiki
|
|
576
|
+
wiki_url = 'https://github.com/ApexMarkdown/apex.wiki.git'
|
|
577
|
+
puts "Cloning wiki from GitHub..."
|
|
578
|
+
|
|
579
|
+
if File.exist?(WIKI_DIR)
|
|
580
|
+
puts "Wiki directory already exists, removing..."
|
|
581
|
+
FileUtils.rm_rf(WIKI_DIR)
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
success = system("git clone #{wiki_url} \"#{WIKI_DIR}\" 2>&1")
|
|
585
|
+
unless success
|
|
586
|
+
puts "Error: Failed to clone wiki from #{wiki_url}"
|
|
587
|
+
exit 1
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
puts "Wiki cloned successfully"
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
def cleanup_wiki
|
|
594
|
+
if File.exist?(WIKI_DIR)
|
|
595
|
+
puts "\nCleaning up wiki clone..."
|
|
596
|
+
FileUtils.rm_rf(WIKI_DIR)
|
|
597
|
+
puts "Wiki clone removed"
|
|
598
|
+
end
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
def generate_multi_page_docset
|
|
602
|
+
require_sqlite3 # Only needed for multi-page mode
|
|
603
|
+
|
|
604
|
+
puts "Generating multi-page docset from wiki files..."
|
|
605
|
+
|
|
606
|
+
# Clone wiki if needed
|
|
607
|
+
clone_wiki unless File.exist?(WIKI_DIR)
|
|
608
|
+
|
|
609
|
+
unless File.exist?(WIKI_DIR)
|
|
610
|
+
puts "Error: Wiki directory not found at #{WIKI_DIR}"
|
|
611
|
+
exit 1
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
unless File.exist?(APEX_BIN)
|
|
615
|
+
puts "Error: Apex binary not found at #{APEX_BIN}"
|
|
616
|
+
puts "Please build Apex first: cd build-release && make"
|
|
617
|
+
puts "Or ensure 'apex' is in your PATH"
|
|
618
|
+
cleanup_wiki
|
|
619
|
+
exit 1
|
|
620
|
+
end
|
|
621
|
+
|
|
622
|
+
# Ensure output directory exists
|
|
623
|
+
FileUtils.mkdir_p(DOCSETS_DIR)
|
|
624
|
+
|
|
625
|
+
docset_name = 'Apex.docset'
|
|
626
|
+
docset_path = File.join(DOCSETS_DIR, docset_name)
|
|
627
|
+
contents_path = File.join(docset_path, 'Contents')
|
|
628
|
+
resources_path = File.join(contents_path, 'Resources')
|
|
629
|
+
documents_path = File.join(resources_path, 'Documents')
|
|
630
|
+
|
|
631
|
+
# Clean up existing docset
|
|
632
|
+
FileUtils.rm_rf(docset_path) if File.exist?(docset_path)
|
|
633
|
+
|
|
634
|
+
# Create directory structure
|
|
635
|
+
FileUtils.mkdir_p(documents_path)
|
|
636
|
+
|
|
637
|
+
# Get all markdown files from wiki (excluding special files)
|
|
638
|
+
wiki_files = Dir.glob(File.join(WIKI_DIR, '*.md')).reject do |f|
|
|
639
|
+
basename = File.basename(f)
|
|
640
|
+
basename =~ /^(_|\.)/ || basename == 'commit_message.txt'
|
|
641
|
+
end.sort
|
|
642
|
+
|
|
643
|
+
# Ensure Home.md is first (it's the index file)
|
|
644
|
+
home_file = wiki_files.find { |f| File.basename(f) == 'Home.md' }
|
|
645
|
+
if home_file
|
|
646
|
+
wiki_files.delete(home_file)
|
|
647
|
+
wiki_files.unshift(home_file)
|
|
648
|
+
end
|
|
649
|
+
|
|
650
|
+
puts "Found #{wiki_files.length} wiki files to process..."
|
|
651
|
+
|
|
652
|
+
# Process each wiki file - first pass: convert to HTML
|
|
653
|
+
html_files = []
|
|
654
|
+
wiki_files.each do |md_file|
|
|
655
|
+
basename = File.basename(md_file, '.md')
|
|
656
|
+
html_file = File.join(documents_path, "#{basename}.html")
|
|
657
|
+
html_files << html_file
|
|
658
|
+
|
|
659
|
+
puts "Processing #{basename}..."
|
|
660
|
+
|
|
661
|
+
# Convert markdown to HTML using Apex
|
|
662
|
+
html_content = `#{APEX_BIN} "#{md_file}" --standalone --pretty 2>/dev/null`
|
|
663
|
+
|
|
664
|
+
if $?.success? && !html_content.empty?
|
|
665
|
+
# Write HTML file (will fix links in second pass)
|
|
666
|
+
File.write(html_file, html_content)
|
|
667
|
+
else
|
|
668
|
+
puts " Warning: Failed to process #{basename}"
|
|
669
|
+
end
|
|
670
|
+
end
|
|
671
|
+
|
|
672
|
+
# Generate main TOC from sidebar
|
|
673
|
+
puts "\nGenerating main TOC from sidebar..."
|
|
674
|
+
main_toc_html = parse_sidebar_toc
|
|
675
|
+
puts "Main TOC generated (#{main_toc_html.length} chars)"
|
|
676
|
+
if main_toc_html.length < 100
|
|
677
|
+
puts "Warning: TOC seems too short, checking..."
|
|
678
|
+
puts "First 200 chars: #{main_toc_html[0..200]}"
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
# Generate footer
|
|
682
|
+
puts "Generating footer..."
|
|
683
|
+
footer_html = parse_footer
|
|
684
|
+
puts "Footer generated (#{footer_html.length} chars)"
|
|
685
|
+
|
|
686
|
+
# Second pass: fix links in all HTML files and add TOCs
|
|
687
|
+
puts "Fixing links and adding TOCs..."
|
|
688
|
+
entries = []
|
|
689
|
+
all_guides = [] # Collect all guide entries for TOC
|
|
690
|
+
|
|
691
|
+
html_files.each do |html_file|
|
|
692
|
+
next unless File.exist?(html_file)
|
|
693
|
+
|
|
694
|
+
basename = File.basename(html_file, '.html')
|
|
695
|
+
html_content = File.read(html_file)
|
|
696
|
+
|
|
697
|
+
# Fix links to add .html extensions
|
|
698
|
+
html_content = fix_links_in_html(html_content, html_files.map { |f| File.basename(f) })
|
|
699
|
+
|
|
700
|
+
# Extract title from first h1 or use filename
|
|
701
|
+
title_match = html_content.match(/<h1[^>]*>(.*?)<\/h1>/i)
|
|
702
|
+
title = title_match ? title_match[1].gsub(/<[^>]+>/, '').strip : basename
|
|
703
|
+
|
|
704
|
+
# Collect guide info for TOC
|
|
705
|
+
all_guides << { basename: basename, title: title, path: "#{basename}.html" }
|
|
706
|
+
|
|
707
|
+
# Extract headers for index and TOC
|
|
708
|
+
headers = extract_headers(html_content)
|
|
709
|
+
|
|
710
|
+
# Generate TOC for this page
|
|
711
|
+
page_toc_html = generate_page_toc(headers)
|
|
712
|
+
if page_toc_html.empty?
|
|
713
|
+
puts " No page TOC for #{basename} (no headers found)"
|
|
714
|
+
else
|
|
715
|
+
puts " Generated page TOC for #{basename} (#{headers.length} headers)"
|
|
716
|
+
end
|
|
717
|
+
|
|
718
|
+
# Highlight code blocks before injecting TOC
|
|
719
|
+
html_content = highlight_code_blocks(html_content)
|
|
720
|
+
|
|
721
|
+
# Inject both TOCs and footer into HTML
|
|
722
|
+
html_content = inject_toc_into_html(html_content, main_toc_html, page_toc_html)
|
|
723
|
+
html_content = inject_footer_into_html(html_content, footer_html)
|
|
724
|
+
|
|
725
|
+
# Write updated HTML file with TOCs and footer
|
|
726
|
+
File.write(html_file, html_content)
|
|
727
|
+
|
|
728
|
+
# Add main entry
|
|
729
|
+
entries << {
|
|
730
|
+
name: title,
|
|
731
|
+
type: 'Guide',
|
|
732
|
+
path: "#{basename}.html"
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
# Add header entries
|
|
736
|
+
headers.each do |header|
|
|
737
|
+
entries << {
|
|
738
|
+
name: header[:text],
|
|
739
|
+
type: 'Section',
|
|
740
|
+
path: "#{basename}.html##{header[:id]}"
|
|
741
|
+
}
|
|
742
|
+
end
|
|
743
|
+
end
|
|
744
|
+
|
|
745
|
+
# Add table of contents to Home.html for Dash index
|
|
746
|
+
home_html_file = html_files.find { |f| File.basename(f, '.html') == 'Home' }
|
|
747
|
+
if home_html_file && File.exist?(home_html_file)
|
|
748
|
+
puts "Adding table of contents to index page..."
|
|
749
|
+
html_content = File.read(home_html_file)
|
|
750
|
+
|
|
751
|
+
# Generate TOC HTML
|
|
752
|
+
toc_html = "<nav class=\"dash-toc\">\n<h2>Documentation</h2>\n<ul>\n"
|
|
753
|
+
all_guides.each do |guide|
|
|
754
|
+
toc_html += " <li><a href=\"#{guide[:path]}\">#{guide[:title]}</a></li>\n"
|
|
755
|
+
end
|
|
756
|
+
toc_html += "</ul>\n</nav>\n"
|
|
757
|
+
|
|
758
|
+
# Insert TOC after the first h1 or at the beginning of body
|
|
759
|
+
if html_content =~ /(<h1[^>]*>.*?<\/h1>)/i
|
|
760
|
+
html_content = html_content.sub(/(<h1[^>]*>.*?<\/h1>)/i, "\\1\n#{toc_html}")
|
|
761
|
+
elsif html_content =~ /(<body[^>]*>)/i
|
|
762
|
+
html_content = html_content.sub(/(<body[^>]*>)/i, "\\1\n#{toc_html}")
|
|
763
|
+
end
|
|
764
|
+
|
|
765
|
+
File.write(home_html_file, html_content)
|
|
766
|
+
end
|
|
767
|
+
|
|
768
|
+
# Determine index file
|
|
769
|
+
index_file = if entries.any? { |e| e[:path] == 'Home.html' }
|
|
770
|
+
'Home.html'
|
|
771
|
+
elsif entries.first
|
|
772
|
+
entries.first[:path]
|
|
773
|
+
else
|
|
774
|
+
'index.html'
|
|
775
|
+
end
|
|
776
|
+
|
|
777
|
+
# Create Info.plist
|
|
778
|
+
info_plist = <<~PLIST
|
|
779
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
780
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
781
|
+
<plist version="1.0">
|
|
782
|
+
<dict>
|
|
783
|
+
<key>CFBundleIdentifier</key>
|
|
784
|
+
<string>apex</string>
|
|
785
|
+
<key>CFBundleName</key>
|
|
786
|
+
<string>Apex</string>
|
|
787
|
+
<key>DocSetPlatformFamily</key>
|
|
788
|
+
<string>apex</string>
|
|
789
|
+
<key>isDashDocset</key>
|
|
790
|
+
<true/>
|
|
791
|
+
<key>dashIndexFilePath</key>
|
|
792
|
+
<string>#{index_file}</string>
|
|
793
|
+
<key>DashDocSetFamily</key>
|
|
794
|
+
<string>dashtoc</string>
|
|
795
|
+
<key>DashDocSetPluginKeyword</key>
|
|
796
|
+
<string>apex</string>
|
|
797
|
+
<key>DashDocSetFallbackURL</key>
|
|
798
|
+
<string>#{index_file}</string>
|
|
799
|
+
<key>DashDocSetDeclaredInStyle</key>
|
|
800
|
+
<string>originalName</string>
|
|
801
|
+
</dict>
|
|
802
|
+
</plist>
|
|
803
|
+
PLIST
|
|
804
|
+
|
|
805
|
+
File.write(File.join(contents_path, 'Info.plist'), info_plist)
|
|
806
|
+
|
|
807
|
+
# Create SQLite index
|
|
808
|
+
db_path = File.join(resources_path, 'docSet.dsidx')
|
|
809
|
+
# Open database with busy timeout and retry logic
|
|
810
|
+
db = nil
|
|
811
|
+
max_retries = 5
|
|
812
|
+
retry_count = 0
|
|
813
|
+
|
|
814
|
+
begin
|
|
815
|
+
db = SQLite3::Database.new(db_path)
|
|
816
|
+
db.busy_timeout = 5000 # Wait up to 5 seconds for database to be available
|
|
817
|
+
|
|
818
|
+
db.execute <<~SQL
|
|
819
|
+
CREATE TABLE IF NOT EXISTS searchIndex(
|
|
820
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
821
|
+
name TEXT,
|
|
822
|
+
type TEXT,
|
|
823
|
+
path TEXT
|
|
824
|
+
);
|
|
825
|
+
CREATE UNIQUE INDEX IF NOT EXISTS anchor ON searchIndex(name, type, path);
|
|
826
|
+
SQL
|
|
827
|
+
|
|
828
|
+
# Clear existing entries if regenerating
|
|
829
|
+
db.execute("DELETE FROM searchIndex")
|
|
830
|
+
|
|
831
|
+
# Use a transaction for better performance and atomicity
|
|
832
|
+
db.transaction do
|
|
833
|
+
entries.each do |entry|
|
|
834
|
+
db.execute(
|
|
835
|
+
"INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES(?, ?, ?)",
|
|
836
|
+
[entry[:name], entry[:type], entry[:path]]
|
|
837
|
+
)
|
|
838
|
+
end
|
|
839
|
+
end
|
|
840
|
+
rescue SQLite3::BusyException => e
|
|
841
|
+
retry_count += 1
|
|
842
|
+
if retry_count < max_retries
|
|
843
|
+
puts "Database busy, retrying (#{retry_count}/#{max_retries})..."
|
|
844
|
+
sleep(0.5 * retry_count) # Exponential backoff
|
|
845
|
+
db.close if db
|
|
846
|
+
retry
|
|
847
|
+
else
|
|
848
|
+
puts "\nError: Database is locked after #{max_retries} retries."
|
|
849
|
+
puts "Please close Dash if it's open with this docset, then try again."
|
|
850
|
+
raise
|
|
851
|
+
end
|
|
852
|
+
ensure
|
|
853
|
+
db.close if db
|
|
854
|
+
end
|
|
855
|
+
|
|
856
|
+
puts "\nMulti-page docset generated successfully!"
|
|
857
|
+
puts "Docset location: #{docset_path}"
|
|
858
|
+
puts "Total entries: #{entries.length}"
|
|
859
|
+
|
|
860
|
+
# Clean up wiki clone
|
|
861
|
+
cleanup_wiki
|
|
862
|
+
end
|
|
863
|
+
|
|
864
|
+
case MODE
|
|
865
|
+
when 'single'
|
|
866
|
+
generate_single_page_docset
|
|
867
|
+
when 'multi'
|
|
868
|
+
generate_multi_page_docset
|
|
869
|
+
else
|
|
870
|
+
puts "Unknown mode: #{MODE}"
|
|
871
|
+
puts "Usage: #{$0} [single|multi]"
|
|
872
|
+
exit 1
|
|
873
|
+
end
|