asciisourcerer 0.3.1 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c7773a8343dbad45adce3b1c32d959ed8e8da23afb1779e308999801eb32404
4
- data.tar.gz: a9ff1c4838338f0302e9dbb202092309254be9c73dfe245f6ea61594a38e966e
3
+ metadata.gz: 862206bd89bcd6930165344b8623239c8220f5d598f12d3050508b8386432546
4
+ data.tar.gz: 6b95b84ae0f56421fc10b75a440cf4beaa29c24d7c3f7be50f9c168b3e4b9a63
5
5
  SHA512:
6
- metadata.gz: e49749d692bd70ce7196fb54312e016b0daf5074d3949c49a4586e3c7f3da7e85d9e3c9b0d50013c3d8c8e8a14a9353323cd0f195cda0255956657aee42bf441
7
- data.tar.gz: 9d10b6d87d315d5d5d254103cc82a3491b43f11fb784da16dc0516ee4697373e5b45d75a2aec29b4bab90d70e74d32f48ee5194108d576b5e7f4cd4f206506f9
6
+ metadata.gz: a6ef512103f8978b1fe583a7e55061d94cade1f783cffb43bb68044d154a7c438f7a9e2a2e55a9a0ad499304881c30f375eb6b666f12e5d7d1ce56dc3401d49a
7
+ data.tar.gz: 6101084fa33316a51458b08878a17b956dbb93558fe7acdd6f95675167daa2d7f8ee29e76943123b18889a54780914a6cc95fcef0ee7aee628daf0d201b0f550
@@ -0,0 +1,17 @@
1
+ = Bill of Materials
2
+ :toc:
3
+
4
+ This document lists third-party source code and documentation code copied (rather than referenced) in this repository, per license terms requiring attribution.
5
+
6
+ [[shopify-liquid]]
7
+ == Shopify Liquid
8
+
9
+ [horizontal]
10
+ Project::
11
+ https://github.com/Shopify/liquid[Shopify/liquid]
12
+
13
+ License::
14
+ https://github.com/Shopify/liquid/blob/main/LICENSE[MIT], Copyright (C) 2005, 2006 Tobias Luetke
15
+
16
+ Version::
17
+ https://github.com/Shopify/liquid/blob/v5.13.0/lib/liquid/standardfilters.rb[`v5.13.0`]
data/README.adoc CHANGED
@@ -37,12 +37,13 @@ endif::[]
37
37
  :this_prod_name: {this_proj_name}
38
38
  // end::universal-settings[]
39
39
  :this_prod_vrsn_major: 0
40
- :this_prod_vrsn_minor: 3
40
+ :this_prod_vrsn_minor: 5
41
41
  :this_prod_vrsn_majmin: {this_prod_vrsn_major}.{this_prod_vrsn_minor}
42
- :this_prod_vrsn_patch: 1
42
+ :this_prod_vrsn_patch: 0
43
43
  :this_prod_vrsn: {this_prod_vrsn_majmin}.{this_prod_vrsn_patch}
44
- :next_prod_vrsn: 0.4.0
44
+ :next_prod_vrsn: 0.6.0
45
45
  // end::global-settings[]
46
+ // end::ai-prompt[]
46
47
  :toc: macro
47
48
  :toclevels: 4
48
49
  :this_prod_repo_files_path: {this_proj_src_www_url}/tree/main
@@ -89,7 +90,7 @@ Initialize a Jekyll-routed Liquid runtime with DocOps Lab filters and tags, so J
89
90
  See <<templating-liquid-runtime>>.
90
91
 
91
92
  Build-time generation::
92
- Generate prebuild artifacts (attributes, snippets, regions) for downstream builds and runtime access.
93
+ Generate pre-build artifacts (attributes, snippets, regions) for downstream builds and runtime access.
93
94
  See <<pipelines>>.
94
95
 
95
96
  AsciiDoc-to-manpage conversion::
@@ -99,8 +100,10 @@ AsciiDoc-to-Markdown conversion::
99
100
  Convert AsciiDoc documents to Markdown for agentic consumption, with a focus on preserving semantic structure and document frontmatter.
100
101
  See <<markdowngrade>>.
101
102
 
102
- AsciiDoc and Markdown source inspection::
103
- Skim AsciiDoc documents to produce machine-oriented outlines of sections, code blocks, tables, and other semantic elements for tooling and agent consumption.
103
+ AsciiDoc, Markdown, and Ruby source inspection::
104
+ Skim source files to produce machine-oriented outlines.
105
+ For AsciiDoc files, includes sections, code blocks, tables, and other semantic elements for tooling and agent consumption.
106
+ For Ruby files, includes classes, modules, methods and their docstrings.
104
107
  See <<source-skim>>.
105
108
 
106
109
  General-purpose utilities::
@@ -144,7 +147,7 @@ The most common workflows are summarized below.
144
147
  Basic render flow::
145
148
  Load YAML data, optionally enrich it with AsciiDoc attributes, render a template, and write output to a file.
146
149
 
147
- Prebuild flow::
150
+ Pre-build flow::
148
151
  Extract attributes and tagged content from AsciiDoc into artifacts that are loaded at runtime.
149
152
 
150
153
  Converter flow::
@@ -218,7 +221,8 @@ For end-to-end AsciiDoc conversion, use `Sourcerer::AsciiDoc.mark_down_grade`, w
218
221
 
219
222
  Core behavior defaults::
220
223
  * Preserve section heading anchors.
221
- * Preserve semantic definition lists (`<dl>`, `<dt>`, `<dd>`).
224
+ * Convert definition lists (`<dl>`, `<dt>`, `<dd>`) to Markdown by default (opt-out via `.no-markdown`).
225
+ * Preserve HTML tables as-is by default (opt-in conversion via `.to-markdown`).
222
226
  * Preserve frontmatter when enabled.
223
227
  * Support semantic backend requests with fallback (`asciidoctor-html5s` -> `html5s` or `html5`).
224
228
 
@@ -258,6 +262,63 @@ markdown = Sourcerer::MarkDownGrade.convert_html(
258
262
  puts(markdown)
259
263
  ----
260
264
 
265
+ [[markdowngrade-opt-in-conversion]]
266
+ ==== Conversion Controls: Tables and Definition Lists
267
+
268
+ HTML tables are preserved as HTML by default; definition lists are *converted to Markdown by default*.
269
+ Both support the same opt-in/opt-out class, frontmatter, and global-config mechanism.
270
+
271
+ [[table-conversion]]
272
+ ===== Table conversion
273
+
274
+ [cols="1,3",options="header"]
275
+ |===
276
+ | Control | Behavior
277
+ | `.to-markdown` class on `<table>` or its `<div>` wrapper
278
+ | Always convert this table to Markdown pipe syntax.
279
+ | `.no-markdown` class on `<table>` or wrapper
280
+ | Always keep this table as HTML (overrides global and frontmatter settings).
281
+ | `tables-to-markdown: true` in YAML frontmatter
282
+ | Convert all tables in the document unless `.no-markdown` overrides.
283
+ | `convert_tables_to_markdown: true` in `bootstrap!` or `convert_html` options
284
+ | Global default; overridden by frontmatter and per-table classes.
285
+ |===
286
+
287
+ .AsciiDoc example: per-table opt-in
288
+ [source,asciidoc]
289
+ ----
290
+ [.to-markdown]
291
+ |===
292
+ | Col A | Col B
293
+ | value | value
294
+ |===
295
+ ----
296
+
297
+ [[dl-conversion]]
298
+ ===== Definition list (DL) conversion
299
+
300
+ Definition lists (`<dl>/<dt>/<dd>`) are converted to Markdown by default.
301
+ Rich content nested inside `<dd>` elements (lists, fenced code blocks, inline code) is recursively down-graded along with the parent term.
302
+ Use `.no-markdown` to preserve a specific DL as HTML.
303
+
304
+ When converted to Markdown, `<dt>` terms are rendered as `+*Term:*+`, and `<dd>` definitions are indented by three spaces.
305
+ Block-level content inside `<dd>` (lists, fenced code blocks) is preserved within the indented block.
306
+
307
+ [cols="1,3",options="header"]
308
+ |===
309
+ | Control | Behaviour
310
+ | `.to-markdown` class on `<dl>` or its parent `<div>`
311
+ | Force conversion to Markdown even when global mode is disabled.
312
+ | `.no-markdown` class on `<dl>` or parent `<div>`
313
+ | Keep this DL as HTML (overrides global and frontmatter settings).
314
+ | `dls-to-markdown: false` in YAML frontmatter
315
+ | Preserve all DLs in the document as HTML unless `.to-markdown` overrides.
316
+ | `convert_dls_to_markdown: false` in `bootstrap!` or `convert_html` options
317
+ | Disable conversion globally; overridden by frontmatter and per-DL classes.
318
+ |===
319
+
320
+
321
+
261
322
  [[markdowngrade-migration]]
262
323
  ==== Migration Mini-Guide (DocOps Lab)
263
324
 
@@ -329,7 +390,7 @@ NOTE: Only blocks marked `_skip` are not carried over.
329
390
  sync::
330
391
  Ongoing operation that scans for canonical blocks, replaces their content with the prime version (after optional Liquid rendering), and leaves everything else verbatim.
331
392
 
332
- dry_run: true::
393
+ `dry_run: true`::
333
394
  Pass `dry_run: true` to either operation to compute the result without writing any file.
334
395
  The `result.diff` file contains the rendered content (`init`) or a unified diff (`sync`).
335
396
 
@@ -394,10 +455,10 @@ If you are building a Jekyll-compatible templating pipeline, prefer Liquid.
394
455
  If you want a low-friction Ruby template for internal tooling, ERB is available.
395
456
 
396
457
  [[pipelines]]
397
- === Prebuild and Rendering Pipelines
458
+ === Pre-build and Rendering Pipelines
398
459
 
399
- Sourcerer's rendering pipeline is optimized for build tooling and prebuild steps.
400
- A typical prebuild might load attributes from `README.adoc`, extract tagged snippets into `build/snippets/`, and render YAML plus Liquid templates into `build/docs/`.
460
+ Sourcerer's rendering pipeline is optimized for build tooling and pre-build steps.
461
+ A typical pre-build might load attributes from `README.adoc`, extract tagged snippets into `build/snippets/`, and render YAML plus Liquid templates into `build/docs/`.
401
462
 
402
463
  The API is intentionally small.
403
464
  Sourcerer focuses on producing artifacts, not managing a broader build lifecycle.
@@ -436,7 +497,7 @@ Schema-aware filters (including SGYML-specific classification filters) should be
436
497
  [[source-skim]]
437
498
  === SourceSkim
438
499
 
439
- `Sourcerer::SourceSkim` generates machine-oriented _skims_ of AsciiDoc and Markdown source documents.
500
+ `Sourcerer::SourceSkim` generates machine-oriented _skims_ of AsciiDoc, Markdown, and Ruby source documents.
440
501
 
441
502
  A skim is a structured, JSON/YAML-ready outline of selected source elements.
442
503
  AsciiDoc skims include:
@@ -444,6 +505,8 @@ sections, code blocks, definition lists, tables, images, and more.
444
505
 
445
506
  Markdown skims include only sections and frontmatter, since other semantic elements are not reliably parseable in Markdown's freeform syntax.
446
507
 
508
+ Ruby skims include classes, modules, and methods, along with their docstrings.
509
+
447
510
  Skims are intended to help tooling and agents inspect documentation source without ingesting full file contents.
448
511
 
449
512
  .Example: Skim a file for sections and code blocks
@@ -463,6 +526,9 @@ skim = Sourcerer::SourceSkim.skim_string(raw_adoc_content)
463
526
 
464
527
  # Skim Markdown file with flat sections only
465
528
  skim = Sourcerer::SourceSkim.skim_file('README.md', forms: [:flat])
529
+
530
+ # Skim a Ruby file with docstrings
531
+ skim = Sourcerer::SourceSkim.skim_file('lib/my_gem.rb', forms: [:tree], descriptions: true)
466
532
  ----
467
533
 
468
534
  Section shapes::
@@ -491,7 +557,6 @@ require 'asciidoctor/extensions/source-skim-tree-processor/extension'
491
557
  Asciidoctor::Extensions.register Sourcerer::SourceSkim::TreeProcessorExtension
492
558
  ----
493
559
 
494
-
495
560
  [[utilities]]
496
561
  === Utilities
497
562
 
@@ -518,18 +583,18 @@ Sourcerer::Util::ListAmend.apply(default_list, custom_list, normalize: nil) -> A
518
583
  ----
519
584
 
520
585
  Behavior::
521
- `nil` / empty custom:::
522
- Returns `default_list` (stringified) unchanged.
523
- Fixed-list mode:::
524
- If `custom_list` contains *no* tokens starting with `+` or `-`, it fully replaces `default_list`.
525
- Amendment mode:::
526
- If `custom_list` contains *any* `+`/`-` token:
527
- `-slug` removes `slug` from the working set (or no-op if absent). +
528
- `+slug` adds `slug` if not already present. +
529
- bare `slug` is treated as `+slug`.
586
+ `nil` / empty custom:::
587
+ Returns `default_list` (stringified) unchanged.
588
+ Fixed-list mode:::
589
+ If `custom_list` contains *no* tokens starting with `+` or `-`, it fully replaces `default_list`.
590
+ Amendment mode:::
591
+ If `custom_list` contains *any* `+`/`-` token:
592
+ `-slug` removes `slug` from the working set (or no-op if absent). +
593
+ `+slug` adds `slug` if not already present. +
594
+ bare `slug` is treated as `+slug`.
530
595
 
531
596
  `normalize` (optional)::
532
- A callable used to compare items during deduplication and removal, for example `->(s) { s.downcase }`.
597
+ A callable used to compare items during de-duplication and removal, for example `->(s) { s.downcase }`.
533
598
 
534
599
  .Examples
535
600
  [source,ruby]
@@ -573,7 +638,7 @@ result = Sourcerer::Util::Pathifier.match(input, recursive: true, include_dirs:
573
638
  Classification rules::
574
639
  `:file`::: `File.file?(input)` is true.
575
640
  `:dir`::: `File.directory?(input)` is true.
576
- `:glob`::: Input contains glob metacharacters (`* ? [ ] { }`).
641
+ `:glob`::: Input contains glob meta-characters (`* ? [ ] { }`).
577
642
  `:missing`::: None of the above.
578
643
 
579
644
  Options::
@@ -621,7 +686,7 @@ Sourcerer provides it with primitives such as YAML loading, templating, and Liqu
621
686
  SchemaGraphy depends on AsciiSourcerer for these primitives, not the other way around.
622
687
 
623
688
  https://github.com/DocOps/releasehx[ReleaseHx]::
624
- The ReleaseHx API and `rhx` CLI uses Sourcerer for generating source files during a prebuild stage, and at runtime for YAML ingest and template rendering.
689
+ The ReleaseHx API and `rhx` CLI uses Sourcerer for generating source files during a pre-build stage, and at runtime for YAML ingest and template rendering.
625
690
 
626
691
  LiquiDoc::
627
692
  Secondary to SchemaGraphy, the scriptable template-rendering build utility LiquiDoc will use SchemaGraphy and AsciiSourcerer at runtime.
@@ -754,6 +819,20 @@ Use `private_class_method` for singleton helper methods defined with `def self.*
754
819
  Use `private` for instance helper methods in classes or mixins.
755
820
  Avoid exporting helper methods as accidental public API.
756
821
 
822
+ [[generated-docs]]
823
+ === Generated Reference Docs
824
+
825
+ Some reference documentation is generated from data rather than hand-written, so it can't drift from what the code actually does.
826
+ `specs/data/docs-manifest.yml` lists each generation job: a Liquid (or ERB) template, a YAML data source, an output path, and optional `vars` to parameterize a shared template into multiple outputs.
827
+
828
+ For example, `specs/data/liquid-filters.yml` (the same source of truth used by the Liquid filter test suite; see <<tests>>) is rendered through `docs/templates/liquid-filters-ref.adoc.liquid` twice -- once grouped by filter category, once by filter source -- producing the partials committed at `lib/sourcerer/_docs/partials/liquid-filters-by-kind.adoc` and `liquid-filters-by-source.adoc`.
829
+ These partials ship with the gem so downstream tools can `include::` them directly.
830
+
831
+ Regenerate all manifest entries with:
832
+
833
+ [.prompt]
834
+ bundle exec rake generate:docs
835
+
757
836
  [[tests]]
758
837
  === Tests
759
838
 
@@ -810,3 +889,5 @@ AsciiSourcerer does not yet publish a release history document.
810
889
  == Legal
811
890
 
812
891
  Sourcerer is licensed under the MIT License.
892
+
893
+ A `BILL_OF_MATERIALS.adoc` file is available in the source repository and the gem package.