asciisourcerer 0.4.0 → 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 +4 -4
- data/BILL_OF_MATERIALS.adoc +17 -0
- data/README.adoc +87 -7
- data/lib/sourcerer/_docs/partials/liquid-filters-by-kind.adoc +3227 -0
- data/lib/sourcerer/_docs/partials/liquid-filters-by-source.adoc +3155 -0
- data/lib/sourcerer/asciidoc.rb +10 -3
- data/lib/sourcerer/builder.rb +1 -1
- data/lib/sourcerer/jekyll/liquid/filters.rb +295 -0
- data/lib/sourcerer/jekyll.rb +7 -2
- data/lib/sourcerer/mark_down_grade.rb +181 -28
- data/lib/sourcerer/rendering.rb +9 -3
- data/lib/sourcerer/source_skim/config.rb +8 -2
- data/lib/sourcerer/source_skim/ruby_skimmer.rb +83 -0
- data/lib/sourcerer/source_skim/skimmer.rb +94 -1
- data/lib/sourcerer/source_skim.rb +11 -2
- data/lib/sourcerer/util/gem_uri.rb +34 -0
- data/lib/sourcerer/version.rb +1 -1
- data/lib/sourcerer.rb +0 -1
- data/specs/data/liquid-filters.yml +1314 -0
- metadata +26 -4
- data/specs/docs/frontmatter-reader_prd.adoc +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 862206bd89bcd6930165344b8623239c8220f5d598f12d3050508b8386432546
|
|
4
|
+
data.tar.gz: 6b95b84ae0f56421fc10b75a440cf4beaa29c24d7c3f7be50f9c168b3e4b9a63
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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,11 +37,11 @@ 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:
|
|
40
|
+
:this_prod_vrsn_minor: 5
|
|
41
41
|
:this_prod_vrsn_majmin: {this_prod_vrsn_major}.{this_prod_vrsn_minor}
|
|
42
42
|
:this_prod_vrsn_patch: 0
|
|
43
43
|
:this_prod_vrsn: {this_prod_vrsn_majmin}.{this_prod_vrsn_patch}
|
|
44
|
-
:next_prod_vrsn: 0.
|
|
44
|
+
:next_prod_vrsn: 0.6.0
|
|
45
45
|
// end::global-settings[]
|
|
46
46
|
// end::ai-prompt[]
|
|
47
47
|
:toc: macro
|
|
@@ -100,8 +100,10 @@ AsciiDoc-to-Markdown conversion::
|
|
|
100
100
|
Convert AsciiDoc documents to Markdown for agentic consumption, with a focus on preserving semantic structure and document frontmatter.
|
|
101
101
|
See <<markdowngrade>>.
|
|
102
102
|
|
|
103
|
-
AsciiDoc and
|
|
104
|
-
Skim
|
|
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.
|
|
105
107
|
See <<source-skim>>.
|
|
106
108
|
|
|
107
109
|
General-purpose utilities::
|
|
@@ -219,7 +221,8 @@ For end-to-end AsciiDoc conversion, use `Sourcerer::AsciiDoc.mark_down_grade`, w
|
|
|
219
221
|
|
|
220
222
|
Core behavior defaults::
|
|
221
223
|
* Preserve section heading anchors.
|
|
222
|
-
*
|
|
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`).
|
|
223
226
|
* Preserve frontmatter when enabled.
|
|
224
227
|
* Support semantic backend requests with fallback (`asciidoctor-html5s` -> `html5s` or `html5`).
|
|
225
228
|
|
|
@@ -259,6 +262,63 @@ markdown = Sourcerer::MarkDownGrade.convert_html(
|
|
|
259
262
|
puts(markdown)
|
|
260
263
|
----
|
|
261
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
|
+
|
|
262
322
|
[[markdowngrade-migration]]
|
|
263
323
|
==== Migration Mini-Guide (DocOps Lab)
|
|
264
324
|
|
|
@@ -437,7 +497,7 @@ Schema-aware filters (including SGYML-specific classification filters) should be
|
|
|
437
497
|
[[source-skim]]
|
|
438
498
|
=== SourceSkim
|
|
439
499
|
|
|
440
|
-
`Sourcerer::SourceSkim` generates machine-oriented _skims_ of AsciiDoc and
|
|
500
|
+
`Sourcerer::SourceSkim` generates machine-oriented _skims_ of AsciiDoc, Markdown, and Ruby source documents.
|
|
441
501
|
|
|
442
502
|
A skim is a structured, JSON/YAML-ready outline of selected source elements.
|
|
443
503
|
AsciiDoc skims include:
|
|
@@ -445,6 +505,8 @@ sections, code blocks, definition lists, tables, images, and more.
|
|
|
445
505
|
|
|
446
506
|
Markdown skims include only sections and frontmatter, since other semantic elements are not reliably parseable in Markdown's freeform syntax.
|
|
447
507
|
|
|
508
|
+
Ruby skims include classes, modules, and methods, along with their docstrings.
|
|
509
|
+
|
|
448
510
|
Skims are intended to help tooling and agents inspect documentation source without ingesting full file contents.
|
|
449
511
|
|
|
450
512
|
.Example: Skim a file for sections and code blocks
|
|
@@ -464,6 +526,9 @@ skim = Sourcerer::SourceSkim.skim_string(raw_adoc_content)
|
|
|
464
526
|
|
|
465
527
|
# Skim Markdown file with flat sections only
|
|
466
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)
|
|
467
532
|
----
|
|
468
533
|
|
|
469
534
|
Section shapes::
|
|
@@ -492,7 +557,6 @@ require 'asciidoctor/extensions/source-skim-tree-processor/extension'
|
|
|
492
557
|
Asciidoctor::Extensions.register Sourcerer::SourceSkim::TreeProcessorExtension
|
|
493
558
|
----
|
|
494
559
|
|
|
495
|
-
|
|
496
560
|
[[utilities]]
|
|
497
561
|
=== Utilities
|
|
498
562
|
|
|
@@ -755,6 +819,20 @@ Use `private_class_method` for singleton helper methods defined with `def self.*
|
|
|
755
819
|
Use `private` for instance helper methods in classes or mixins.
|
|
756
820
|
Avoid exporting helper methods as accidental public API.
|
|
757
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
|
+
|
|
758
836
|
[[tests]]
|
|
759
837
|
=== Tests
|
|
760
838
|
|
|
@@ -811,3 +889,5 @@ AsciiSourcerer does not yet publish a release history document.
|
|
|
811
889
|
== Legal
|
|
812
890
|
|
|
813
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.
|