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 +4 -4
- data/CHANGELOG.md +26 -0
- data/README.md +36 -16
- data/lib/rouge-ddot.rb +13 -0
- data/rouge-ddot.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a99cbaae721a52151bcfff4eb8d656c88aade697eab78160a3841f8274c0041e
|
|
4
|
+
data.tar.gz: adda0083411ae5755d34944ca3a194947b95827f73af93b8c55094a7660df8cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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` | `
|
|
31
|
-
| `Keyword::Pseudo` | `command`
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `Comment::
|
|
35
|
-
| `
|
|
36
|
-
| `Comment::
|
|
37
|
-
| `Comment::
|
|
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.
|
|
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.
|
|
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
|