rouge-carve 0.1.0 → 0.1.1

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: fbeb1c2fa0f572f138c6a89a23bafcae682051c9e10474951b5cba9de3bc0aa3
4
- data.tar.gz: 7d089e544a959be5c208ef4e1cc523feda2b1d8cf6632b99086ae41c5cb13c31
3
+ metadata.gz: c4006805a5023dc8b016745f1ab3dc73bf29fa24de27acc46c19696658a9ee36
4
+ data.tar.gz: 85965e83d476add300683d7e5ce7464d6affb784b067b3797318ef45575d5c78
5
5
  SHA512:
6
- metadata.gz: 439cc10aa425adaec2fed2e19e6af9aab75ffec47b699c3a3dff0632ee2503ca6240d7d4f869db0c93f907fee29f43b351ba9a507f89cff5b0a3a11ddb257e72
7
- data.tar.gz: b93c04c6c832959f1a58e238efb161b5d6a7283b104cec5deae971e62065f18b8bf88abf03fc61fdf7cc29da54bac7d3cddaa384f267c7e6e91478cd124f8a59
6
+ metadata.gz: eb1fb40ca27583ebb19f1af32bf208efcdd5d21c2f880f5e400f4c06562d4a79a977988008ec054d448d1e7ac9c0020acdce83db8b2cd19d0bcb6912878896dd
7
+ data.tar.gz: 7bf48fae5c12930737941c834ec4347dcd5f1a30a77e4cbcbdf99e8fa20c4d90c39d9f45bfaa9d1be3a2edea3d1025ef1f31f5ffa3ecbfade9212e0a4a4811ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.1] - 2026-09-21
4
+
5
+ - The reserved include directive `{{ path #section @key:value }}` (PART 9
6
+ section 19, markup-carve/carve#291) is lexed BY PART: the path as
7
+ `Name.Namespace`, the selector as `Name.Label`, and each option as
8
+ `Name.Attribute` plus its value. It used to shred into the constructs its own
9
+ selector is spelled with, so `#intro` in a path was colored as a hashtag.
10
+
3
11
  ## [0.1.0] - 2026-08-27
4
12
 
5
13
  First release.
data/README.md CHANGED
@@ -66,23 +66,6 @@ shared with the Prism, highlight.js and Pygments grammars, so the four agree:
66
66
  it over-colours an indented-at-document-level opener rather than
67
67
  under-colouring the far more common indented construct inside a list item.
68
68
 
69
- ## Testing
70
-
71
- ```bash
72
- bundle install
73
- bundle exec rspec
74
- ```
75
-
76
- Two gates, and the second is the one that finds things:
77
-
78
- - `spec/carve_spec.rb` pins the constructs, including each inverted delimiter.
79
- - `script/corpus_check.rb` lexes every `.crv` document in the Carve spec
80
- repository and fails on a single `Error` token. A lexer emitting `Error` is
81
- telling the reader its own rules ran out. Both bugs found during development -
82
- a blank line inside a comment fence, and a `---` thematic break opening
83
- frontmatter that never closed - came from this and not from an example
84
- anybody thought to write.
85
-
86
69
  ## Related
87
70
 
88
71
  - [carve](https://github.com/markup-carve/carve) - the language and its spec
@@ -93,6 +76,6 @@ Two gates, and the second is the one that finds things:
93
76
  - [carve-css](https://github.com/markup-carve/carve-css) - styles for the HTML
94
77
  Carve renders
95
78
 
96
- ## License
79
+ ## Development
97
80
 
98
- MIT.
81
+ Contributor setup, testing, and maintenance notes are in the [development guide](docs/development.md).
@@ -359,6 +359,26 @@ module Rouge
359
359
  groups Punctuation, Str::Backtick, Punctuation
360
360
  end
361
361
 
362
+ # The reserved include directive `{{ path #section @key:value }}`
363
+ # (PART 9 section 19, grammar.ebnf `include_directive`). The core
364
+ # leaves it literal; a processor expands it only when a host supplies a
365
+ # resolver.
366
+ #
367
+ # One directive rule, because its own selector is spelled with constructs this
368
+ # lexer already knows: `#section` is the tag rule below and an option
369
+ # slot is the mention rule, so without this `#intro` came out coloured
370
+ # as a hashtag inside a path. After the verbatim family, so a directive
371
+ # in a code span stays literal; before every other brace rule, none of
372
+ # which can spell `{{`.
373
+ # THE CLOSER IS IN THE LOOKAHEAD, so an unterminated `{{` never opens
374
+ # the state at all and stays the ordinary text the processor treats it
375
+ # as. Without it the opener scoped and only the newline rule below
376
+ # stopped the damage.
377
+ rule %r/(\{\{)(?=[ \t]+[^\n]*?[ \t]+\}\})([ \t]+)((?:"(?:\\.|[^"\\])*"|[^#@}\s"][^#@}\s]*))/ do
378
+ groups Punctuation, Text, Name::Namespace
379
+ push :includeparts
380
+ end
381
+
362
382
  # CriticMarkup substitution and comment, before the forced family:
363
383
  # `{~old~>new~}` also matches the forced-strike shape.
364
384
  rule %r/(\{~)([^\n]*?)(~>)([^\n]*?)(~\})/ do
@@ -496,6 +516,27 @@ module Rouge
496
516
  rule %r/\.\.\./, Punctuation
497
517
  end
498
518
 
519
+ # The tail of an include directive: its selector, option slots, and
520
+ # anything else written there. Scoped BY PART - the opener rule is what
521
+ # keeps the tag and mention rules out, so painting one token buys nothing,
522
+ # and a reader wants the path to look like a path.
523
+ #
524
+ # A part that is neither a section nor an option stays plain text rather
525
+ # than being refused, matching the processor, which leaves a malformed
526
+ # directive alone. A newline pops: the directive requires its closer on
527
+ # the same line, so anything else is not one.
528
+ state :includeparts do
529
+ rule %r/[ \t]+/, Text
530
+ rule %r/\}\}/, Punctuation, :pop!
531
+ rule %r/#[A-Za-z_][\w-]*/, Name::Label
532
+ rule %r/(@[A-Za-z_][\w-]*)(:)([^\s}]+)/ do
533
+ groups Name::Attribute, Punctuation, Literal
534
+ end
535
+ rule %r/[^\s}]+/, Text
536
+ rule %r/\}/, Text
537
+ rule %r/\n/, Text, :pop!
538
+ end
539
+
499
540
  state :inlinefootnote do
500
541
  rule %r/\]/, Punctuation, :pop!
501
542
  mixin :inlinecontent
data/lib/rouge-carve.rb CHANGED
@@ -9,5 +9,5 @@ require_relative 'rouge/lexers/carve'
9
9
  # registers it, so `Rouge::Lexer.find('carve')` and
10
10
  # `Rouge::Lexer.guess(filename: 'x.crv')` work from that point on.
11
11
  module RougeCarve
12
- VERSION = '0.1.0'
12
+ VERSION = '0.1.1'
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge-carve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Scherer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-27 00:00:00.000000000 Z
11
+ date: 2026-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rouge