Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
da706cd
Initial work on extended asciidoc
lorrden Feb 26, 2026
6a27cc5
Initial work on XAD attributes
lorrden Feb 26, 2026
bef8e64
Add test
lorrden Feb 27, 2026
b7db1d0
Multiline xad attribute support
lorrden Feb 27, 2026
c9f5cd1
Address various warnings
lorrden Feb 27, 2026
7a1e31a
Rework attribute handling to make get / set macros possible
lorrden Feb 27, 2026
f821ec8
Implement get/set as well as tests for attr shorthand
lorrden Feb 27, 2026
c62c436
Array indexing in attribute references
lorrden Feb 27, 2026
4784172
Add tests for path based overrides
lorrden Feb 28, 2026
fdea142
Implement scoped attributes
lorrden Feb 28, 2026
0f963f1
Update readme
lorrden Feb 28, 2026
d907859
Eliminate several Apple specific dependencies
lorrden Feb 28, 2026
e9c96ea
Fix JSON5 handling by switching ty YYJson
lorrden Feb 28, 2026
1be14a1
Support for multiple revision lines
lorrden Feb 28, 2026
4b9c121
Scaffolding for XAD control and macro handling
lorrden Feb 28, 2026
bc5236e
Implement control logic
lorrden Feb 28, 2026
eb185a3
Add warnings for different control issues
lorrden Feb 28, 2026
7820cd7
Initial macro implementation
lorrden Feb 28, 2026
897ffe5
Support macros attaching to block bodies
lorrden Feb 28, 2026
2f03517
Implement docpush, docset and docput macros
lorrden Mar 1, 2026
473f09f
Update readme
lorrden Mar 1, 2026
73f8647
Add test cases verifying recursion prevention
lorrden Mar 1, 2026
6748f80
Implement xad AST based include
lorrden Mar 1, 2026
a81b130
Add initial layout DSL parser
lorrden Mar 1, 2026
0725c74
Layout template ingestion and command line flags
lorrden Mar 2, 2026
d5ac205
Additional integration with rendering pipeline
lorrden Mar 2, 2026
279464b
Update documentation
lorrden Mar 2, 2026
3fbfce0
Initial slot collection
lorrden Mar 2, 2026
ce92376
Initial work on hooking up paged rendering
lorrden Mar 2, 2026
368203c
Add sample layouts
lorrden Mar 2, 2026
fe7e404
Add initial examples
lorrden Mar 2, 2026
b46555d
Fix template and add rendering via script
lorrden Mar 3, 2026
0c47010
Enable paged.js inclusion
lorrden Mar 3, 2026
05c7ef9
Use of adoc-hosted templates
lorrden Mar 3, 2026
7e56a4c
Ensure layouts are passed through raw
lorrden Mar 3, 2026
a8cba94
Adjust document style to support double column layout
lorrden Mar 4, 2026
5b58d60
Improvements in column flow handling
lorrden Mar 4, 2026
82c7dc7
Ensure we rely on adoc roles for slot assignment where applicable
lorrden Mar 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ DerivedData/
artifacts/
.vscode
.cache
.swiftpm
11 changes: 10 additions & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ let package = Package(
.library(name: "AsciiDocExtensions", targets: ["AsciiDocExtensions"]),
.library(name: "AsciiDocTools", targets: ["AsciiDocTools"]),
.library(name: "AsciiDocAntora", targets: ["AsciiDocAntora"]),
.library(name: "AsciiDocPagedRendering", targets: ["AsciiDocPagedRendering"]),

.executable(name: "asciidoc-swift", targets: ["asciidoc-swift"])
],
Expand All @@ -28,12 +29,15 @@ let package = Package(
.package(url: "https://github.com/openorbit/swift-hunspell", branch: "main"),
.package(url: "https://github.com/openorbit/swift-yaml", branch: "main"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/mattt/swift-yyjson.git", from: "0.5.0"),
],
targets: [
// Core parsing/semantic engine (Foundation + RegexBuilder only)
.target(
name: "AsciiDocCore",
dependencies: [],
dependencies: [
.product(name: "YYJSON", package: "swift-yyjson")
],
path: "Sources/AsciiDocCore",
swiftSettings: [
// Keep indexes Unicode-safe, discourage unsafe operations
Expand All @@ -45,6 +49,7 @@ let package = Package(
dependencies: [
.product(name: "Stencil", package: "Stencil"),
"AsciiDocCore",
"AsciiDocPagedRendering",
],
path: "Sources/AsciiDocRender",
swiftSettings: [
Expand Down Expand Up @@ -81,6 +86,11 @@ let package = Package(
path: "Sources/AsciiDocAntora"
),

.target(
name: "AsciiDocPagedRendering",
dependencies: ["AsciiDocCore"],
path: "Sources/AsciiDocPagedRendering"
),

// CLI executable that the TCK will invoke
.executableTarget(
Expand All @@ -91,6 +101,7 @@ let package = Package(
"AsciiDocExtensions",
"AsciiDocTools",
"AsciiDocAntora",
"AsciiDocPagedRendering",
.product(name: "ArgumentParser", package: "swift-argument-parser")
],
path: "Sources/asciidoc-swift",
Expand All @@ -105,7 +116,7 @@ let package = Package(
// Unit tests for the core; add fixture files under Tests/AsciiDocCoreTests/Fixtures as needed
.testTarget(
name: "AsciiDocCoreTests",
dependencies: ["AsciiDocCore", "AsciiDocTools", "AsciiDocRender"],
dependencies: ["AsciiDocCore", "AsciiDocTools", "AsciiDocRender", "AsciiDocPagedRendering"],
path: "Tests/AsciiDocCoreTests",
swiftSettings: [
.interoperabilityMode(.Cxx)
Expand Down
26 changes: 26 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

A swift implementation of AsciiDoc

== XAD Overview

XAD is an opt-in set of extensions that adds structured, JSON-like attributes and layout helpers for paged media output.
Enable it by passing the `--xad` flag or by using a backend that requires XAD.

Current additions include:

* Typed attributes parsed from JSON/JSON5 values (dictionaries and arrays) in header attribute entries.
* Multi-line JSON/JSON5 attribute values without explicit continuation escapes.
* Attribute accessors for nested values (e.g. `foo.bar` and bracket indexing).
* XAD access macros for nested values (`get::path[]` and `set::path[value]`), plus shorthand access with `{foo.bar}`.
* User-defined macros (block and inline) with parameters, defaults, and `{body}` substitution for block macros.
* Macro recursion detection (direct and indirect) with warnings.
* Macro side-effect allow list via `effects="docpush docset docput"` (or `effects=all`).
* Control directives: `if`/`elif`/`else`/`end` and `for` loops, with expression validation warnings.
* Document variables (`docset`, `docpush`, `docput`) for building registries under `doc.*`.
* Layout-oriented attributes intended for paged and PDF-style renderers.
* Scoped attributes for block- and section-level overrides.

Scoped attributes:

* `attrpush::[]` and `attrpop::[]` push/pop the attribute environment.
* `blockattr::[foo=bar]` applies attributes to the next block only.
* `[blockattr]` followed by a listing-style block of `:name:` entries applies to the next block only.
* `attrs::[foo=bar]` (or `[attrs]` + listing block) immediately after a section title scopes attributes to that section.

== License

Licensed under the Apache License, Version 2.0.
Expand Down
Loading