rouge-ddot 0.1.2 → 0.1.3

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: e6dd196cff29b3d1b7435c68febdf46fec71e7246ef1d1bfa40cc56793bf3094
4
- data.tar.gz: 40e95e043ee75d8bd53ba25a3c411a63a616f9f1a8ca07edd9998bea11e0145f
3
+ metadata.gz: a99cbaae721a52151bcfff4eb8d656c88aade697eab78160a3841f8274c0041e
4
+ data.tar.gz: adda0083411ae5755d34944ca3a194947b95827f73af93b8c55094a7660df8cd
5
5
  SHA512:
6
- metadata.gz: 5bc30e43a5ad1909266a3d4908fea9c94ee3bddab264ad4eea04a4f03ae083db3cc9288f9892f86e86c8fc700fc1e5dae5cc9c99a4d35a0234299cef43a91068
7
- data.tar.gz: a27f2ea628b044ade571952af1638ae661a9b30b00cd674d38bd7169f27807dd2adaeed25114ea09c6179768c3e6b830d8bd8f27987db116d3c0a3967ac23d81
6
+ metadata.gz: 285d6debe396c45d56abd71d15998bb414c877d74d6d792a6d2cd3531957bd97187cfd2e3fcde1a84aab842a3cf94a15029a66d0b4f3cab17832b80b5a3d2f47
7
+ data.tar.gz: 422c3c2721efe2b5ecb062f23cd65e7bc518f3733f2aa2f1859f3f9ea3615680610caaf967440da55f18e8803f640294678909a54378f1b5f5642b0ba461e1ac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3
4
+
5
+ No lexer changes — token output is identical to 0.1.2.
6
+
7
+ ### Added
8
+
9
+ - **`require 'rouge-ddot'` now works.** The gem shipped only
10
+ `lib/rouge/lexers/ddot.rb`, so requiring it by gem *name* raised
11
+ `LoadError: cannot load such file -- rouge-ddot`. Since Rouge does not
12
+ auto-discover third-party lexers, and `Bundler.require` (Jekyll's
13
+ `:jekyll_plugins` group, Rails initializers, …) requires gems by name,
14
+ hosts could not load the lexer the conventional way: adding it to a
15
+ `:jekyll_plugins` group *crashed the build*. Every host therefore had to
16
+ know the internal path and write `require 'rouge/lexers/ddot'` into a plugin
17
+ file of its own. A `lib/rouge-ddot.rb` entry point now requires the lexer,
18
+ so this is enough to highlight `[source,ddot.it]` blocks in Jekyll:
19
+
20
+ ```ruby
21
+ # Gemfile
22
+ group :jekyll_plugins do
23
+ gem 'rouge-ddot', '~> 0.1.3'
24
+ end
25
+ ```
26
+
27
+ `require 'rouge/lexers/ddot'` keeps working unchanged.
28
+
3
29
  ## 0.1.2
4
30
 
5
31
  Brings the lexer in line with the ddot.it Parse and Highlight specifications.
data/README.md CHANGED
@@ -6,35 +6,53 @@ graph notation (https://ddot.it).
6
6
  ## Usage
7
7
 
8
8
  ```ruby
9
- require 'rouge'
10
- require 'rouge/lexers/ddot'
9
+ require 'rouge-ddot'
11
10
 
12
11
  Rouge::Lexers::Ddot.new.lex("Project Eagle ..started in.. 2024") do |tok, val|
13
12
  puts [tok.qualname, val].inspect
14
13
  end
15
14
  ```
16
15
 
16
+ Rouge does not auto-discover third-party lexers, so the gem has to be required
17
+ before a `ddot.it` block can be highlighted. Requiring it by name is enough
18
+ (since 0.1.3); `require 'rouge/lexers/ddot'` also works.
19
+
20
+ In **Jekyll**, put it in the `:jekyll_plugins` group and Bundler requires it at
21
+ startup — no `_plugins/` file needed:
22
+
23
+ ```ruby
24
+ # Gemfile
25
+ group :jekyll_plugins do
26
+ gem 'rouge-ddot', '~> 0.1.3'
27
+ end
28
+ ```
29
+
17
30
  In Asciidoctor with `:source-highlighter: rouge` set, `[source,ddot]` blocks
18
- are dispatched here automatically — no extra wiring per document.
31
+ are dispatched here automatically — no extra wiring per document. The lexer
32
+ registers under the tag `ddot`, with the aliases `ddotit` and `ddot.it`.
19
33
 
20
34
  ## Token mapping
21
35
 
22
36
  The lexer emits standard Rouge tokens; they map to the canonical ddot.it
23
37
  token vocabulary in [`../../ddot.it/test-data/tokens.md`](../../ddot.it/test-data/tokens.md):
24
38
 
25
- | Rouge | Canonical |
26
- |-----------------------------|-----------------|
27
- | `Name::Class` | `subject` |
28
- | `Name::Function` | `relation` |
29
- | `Literal::String::Symbol` | `object` |
30
- | `Operator` | `operator` |
31
- | `Keyword::Pseudo` | `command` |
32
- | `Comment::Preproc` | `meta-delim` |
33
- | `Comment::Hashbang` | `meta-operator` |
34
- | `Comment::Doc` | `meta-relation` |
35
- | `Comment::Special` | `meta-object` |
36
- | `Comment::Multiline` | `meta-text` |
37
- | `Comment::Single` | `disabled` |
39
+ | Rouge | Canonical |
40
+ |-----------------------------|------------------|
41
+ | `Name::Class` | `subject` |
42
+ | `Name::Function` | `relation` |
43
+ | `Literal::String::Symbol` | `object` |
44
+ | `Operator` | `doubledot` |
45
+ | `Keyword::Pseudo` | `command` |
46
+ | `Name::Attribute` | `command-param` |
47
+ | `Name::Label` | `block-end` |
48
+ | `Comment::Preproc` | `meta-delim` |
49
+ | `Punctuation` | `meta-separator` |
50
+ | `Comment::Hashbang` | `meta-doubledot` |
51
+ | `Comment::Doc` | `meta-relation` |
52
+ | `Comment::Special` | `meta-object` |
53
+ | `Comment::Multiline` | `meta-text` |
54
+ | `Comment::Single` | `excluded` |
55
+ | `Literal::String::Backtick` | `verbatim` |
38
56
 
39
57
  ## Conformance
40
58
 
@@ -57,9 +75,11 @@ lockstep.
57
75
  ```
58
76
  rouge/
59
77
  ├── lib/
78
+ │ ├── rouge-ddot.rb # entry point: require 'rouge-ddot'
60
79
  │ └── rouge/
61
80
  │ └── lexers/
62
81
  │ └── ddot.rb # the lexer
82
+ ├── CHANGELOG.md
63
83
  ├── README.md
64
84
  └── rouge-ddot.gemspec
65
85
  ```
data/lib/rouge-ddot.rb ADDED
@@ -0,0 +1,13 @@
1
+ # Entry point for `require 'rouge-ddot'` — the path Bundler takes when the gem
2
+ # is listed in a Jekyll `:jekyll_plugins` group, or under any other
3
+ # `Bundler.require`, which requires a gem by its *name*.
4
+ #
5
+ # Rouge does not auto-discover third-party lexers: a lexer is registered only
6
+ # when its file is loaded. Up to 0.1.2 the gem shipped `lib/rouge/lexers/ddot.rb`
7
+ # alone, so `require 'rouge-ddot'` raised LoadError and every host had to know
8
+ # the internal path and write `require 'rouge/lexers/ddot'` into a plugin file
9
+ # of its own. This file makes the conventional require work.
10
+ #
11
+ # `require_relative` rather than `require` so loading does not depend on this
12
+ # gem's lib directory being on `$LOAD_PATH`. The lexer requires 'rouge' itself.
13
+ require_relative 'rouge/lexers/ddot'
data/rouge-ddot.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'rouge-ddot'
5
- s.version = '0.1.2'
5
+ s.version = '0.1.3'
6
6
  s.summary = 'Rouge lexer for ddot.it'
7
7
  s.description = 'Syntax highlighter for the ddot.it knowledge graph notation. ' \
8
8
  'Plugs into Rouge so any tool that uses Rouge for source ' \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge-ddot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calpano
@@ -35,6 +35,7 @@ extra_rdoc_files: []
35
35
  files:
36
36
  - CHANGELOG.md
37
37
  - README.md
38
+ - lib/rouge-ddot.rb
38
39
  - lib/rouge/lexers/ddot.rb
39
40
  - rouge-ddot.gemspec
40
41
  homepage: https://ddot.it