asciidoc_converter 1.0.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 +7 -0
- data/.gitignore +37 -0
- data/.rubocop.yml +23 -0
- data/CHANGELOG.adoc +14 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +160 -0
- data/LICENSE +22 -0
- data/README.adoc +67 -0
- data/Rakefile +11 -0
- data/asciidoc_converter.gemspec +28 -0
- data/bridgetown.automation.rb +57 -0
- data/lib/asciidoc_converter/asciidoc.rb +35 -0
- data/lib/asciidoc_converter/version.rb +5 -0
- data/lib/asciidoc_converter.rb +30 -0
- data/lib/asciidoc_front_matter_loader.rb +50 -0
- data/package.json +16 -0
- metadata +82 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8ad369949fcd5b204cbd6cf26ae2b77dded9d7799de30f9e8b84eddebea56c86
|
|
4
|
+
data.tar.gz: 7d3c785146ce5e5fbfd4fab37944796da4a25f04c90b918dce1ffb05e0a11f94
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d585aee80e38c22d4626d9475f5497c850635867812c814c2c4628e545cf83cfca0c15d71a86d2f65e4838f80ad0b060656a5381df05b04a51bd18fcfce65890
|
|
7
|
+
data.tar.gz: bf65b1eae1238307cd1c95a96a62c1ed7cbd4abaaad8a2548fd87bf031ce55aeb4775d95fcd4b1f0dfc7a9d4d0126289ba3d35ea9b42e8d1fe91bb791ed58072
|
data/.gitignore
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/vendor
|
|
2
|
+
/.bundle/
|
|
3
|
+
/.yardoc
|
|
4
|
+
/_yardoc/
|
|
5
|
+
/coverage/
|
|
6
|
+
/doc/
|
|
7
|
+
/pkg/
|
|
8
|
+
/spec/reports/
|
|
9
|
+
/tmp/
|
|
10
|
+
*.bundle
|
|
11
|
+
*.so
|
|
12
|
+
*.o
|
|
13
|
+
*.a
|
|
14
|
+
mkmf.log
|
|
15
|
+
*.gem
|
|
16
|
+
.bundle
|
|
17
|
+
|
|
18
|
+
# Node
|
|
19
|
+
node_modules
|
|
20
|
+
.npm
|
|
21
|
+
.node_repl_history
|
|
22
|
+
|
|
23
|
+
# Yarn
|
|
24
|
+
yarn-error.log
|
|
25
|
+
yarn-debug.log*
|
|
26
|
+
.pnp/
|
|
27
|
+
.pnp.js
|
|
28
|
+
|
|
29
|
+
# Yarn Integrity file
|
|
30
|
+
.yarn-integrity
|
|
31
|
+
|
|
32
|
+
test/dest
|
|
33
|
+
.bridgetown-metadata
|
|
34
|
+
.bridgetown-cache
|
|
35
|
+
.bridgetown-webpack
|
|
36
|
+
|
|
37
|
+
.env
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require: rubocop-bridgetown
|
|
2
|
+
|
|
3
|
+
inherit_gem:
|
|
4
|
+
rubocop-bridgetown: .rubocop.yml
|
|
5
|
+
|
|
6
|
+
AllCops:
|
|
7
|
+
TargetRubyVersion: 3.3
|
|
8
|
+
|
|
9
|
+
Exclude:
|
|
10
|
+
- .gitignore
|
|
11
|
+
- .rubocop.yml
|
|
12
|
+
- "*.gemspec"
|
|
13
|
+
|
|
14
|
+
- Gemfile.lock
|
|
15
|
+
- CHANGELOG.md
|
|
16
|
+
- LICENSE.txt
|
|
17
|
+
- README.md
|
|
18
|
+
- Rakefile
|
|
19
|
+
- bridgetown.automation.rb
|
|
20
|
+
|
|
21
|
+
- script/**/*
|
|
22
|
+
- test/fixtures/**/*
|
|
23
|
+
- vendor/**/*
|
data/CHANGELOG.adoc
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
= Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog],
|
|
6
|
+
and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Versioning].
|
|
7
|
+
|
|
8
|
+
== [Unreleased]
|
|
9
|
+
|
|
10
|
+
- ...
|
|
11
|
+
|
|
12
|
+
== [1.0.0] - 2026-07-18
|
|
13
|
+
|
|
14
|
+
- First version
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
asciidoc_converter (1.0.0)
|
|
5
|
+
asciidoctor (>= 2.0)
|
|
6
|
+
bridgetown (>= 2.2)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.9.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
13
|
+
amazing_print (1.8.1)
|
|
14
|
+
asciidoctor (2.0.26)
|
|
15
|
+
base64 (0.3.0)
|
|
16
|
+
bigdecimal (4.1.2)
|
|
17
|
+
bridgetown (2.2.2)
|
|
18
|
+
bridgetown-builder (= 2.2.2)
|
|
19
|
+
bridgetown-core (= 2.2.2)
|
|
20
|
+
bridgetown-foundation (= 2.2.2)
|
|
21
|
+
bridgetown-paginate (= 2.2.2)
|
|
22
|
+
bridgetown-builder (2.2.2)
|
|
23
|
+
bridgetown-core (= 2.2.2)
|
|
24
|
+
bridgetown-core (2.2.2)
|
|
25
|
+
addressable (~> 2.4)
|
|
26
|
+
amazing_print (~> 1.2)
|
|
27
|
+
base64 (>= 0.3)
|
|
28
|
+
bigdecimal (>= 3.2)
|
|
29
|
+
bridgetown-foundation (= 2.2.2)
|
|
30
|
+
csv (~> 3.2)
|
|
31
|
+
erubi (~> 1.9)
|
|
32
|
+
faraday (~> 2.0)
|
|
33
|
+
faraday-follow_redirects (~> 0.5)
|
|
34
|
+
freyia (>= 0.5)
|
|
35
|
+
i18n (~> 1.0)
|
|
36
|
+
irb (>= 1.14)
|
|
37
|
+
kramdown (~> 2.1)
|
|
38
|
+
kramdown-parser-gfm (~> 1.0)
|
|
39
|
+
liquid (>= 5.0, < 5.5)
|
|
40
|
+
listen (~> 3.0)
|
|
41
|
+
rack (>= 3.0)
|
|
42
|
+
rackup (~> 2.0)
|
|
43
|
+
rake (>= 13.0)
|
|
44
|
+
roda (~> 3.46)
|
|
45
|
+
rouge (>= 3.0, < 5.0)
|
|
46
|
+
samovar (= 2.4.1)
|
|
47
|
+
securerandom (~> 0.4)
|
|
48
|
+
serbea (>= 2.4.1)
|
|
49
|
+
signalize (~> 1.3)
|
|
50
|
+
streamlined (>= 0.6.0)
|
|
51
|
+
tilt (~> 2.0)
|
|
52
|
+
zeitwerk (>= 2.7.3)
|
|
53
|
+
bridgetown-foundation (2.2.2)
|
|
54
|
+
dry-inflector (>= 1.0)
|
|
55
|
+
hash_with_dot_access (~> 2.0)
|
|
56
|
+
inclusive (~> 1.0)
|
|
57
|
+
zeitwerk (~> 2.5)
|
|
58
|
+
bridgetown-paginate (2.2.2)
|
|
59
|
+
bridgetown-core (= 2.2.2)
|
|
60
|
+
concurrent-ruby (1.3.7)
|
|
61
|
+
console (1.37.0)
|
|
62
|
+
fiber-annotation
|
|
63
|
+
fiber-local (~> 1.1)
|
|
64
|
+
json
|
|
65
|
+
csv (3.3.5)
|
|
66
|
+
dry-inflector (1.3.1)
|
|
67
|
+
erb (6.0.5)
|
|
68
|
+
erubi (1.13.1)
|
|
69
|
+
faraday (2.14.3)
|
|
70
|
+
faraday-net_http (>= 2.0, < 3.5)
|
|
71
|
+
json
|
|
72
|
+
logger
|
|
73
|
+
faraday-follow_redirects (0.5.0)
|
|
74
|
+
faraday (>= 1, < 3)
|
|
75
|
+
faraday-net_http (3.4.4)
|
|
76
|
+
net-http (~> 0.5)
|
|
77
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
78
|
+
fiber-annotation (0.2.0)
|
|
79
|
+
fiber-local (1.1.0)
|
|
80
|
+
fiber-storage
|
|
81
|
+
fiber-storage (1.0.1)
|
|
82
|
+
freyia (0.6.2)
|
|
83
|
+
hash_with_dot_access (2.2.0)
|
|
84
|
+
i18n (1.15.2)
|
|
85
|
+
concurrent-ruby (~> 1.0)
|
|
86
|
+
inclusive (1.1.0)
|
|
87
|
+
io-console (0.8.2)
|
|
88
|
+
irb (1.18.0)
|
|
89
|
+
pp (>= 0.6.0)
|
|
90
|
+
prism (>= 1.3.0)
|
|
91
|
+
rdoc (>= 4.0.0)
|
|
92
|
+
reline (>= 0.4.2)
|
|
93
|
+
json (2.21.1)
|
|
94
|
+
kramdown (2.5.2)
|
|
95
|
+
rexml (>= 3.4.4)
|
|
96
|
+
kramdown-parser-gfm (1.1.0)
|
|
97
|
+
kramdown (~> 2.0)
|
|
98
|
+
liquid (5.4.0)
|
|
99
|
+
listen (3.10.0)
|
|
100
|
+
logger
|
|
101
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
102
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
103
|
+
logger (1.7.0)
|
|
104
|
+
mapping (1.1.3)
|
|
105
|
+
net-http (0.9.1)
|
|
106
|
+
uri (>= 0.11.1)
|
|
107
|
+
pp (0.6.4)
|
|
108
|
+
prettyprint
|
|
109
|
+
prettyprint (0.2.0)
|
|
110
|
+
prism (1.9.0)
|
|
111
|
+
public_suffix (7.0.5)
|
|
112
|
+
rack (3.2.6)
|
|
113
|
+
rackup (2.3.1)
|
|
114
|
+
rack (>= 3)
|
|
115
|
+
rake (13.4.2)
|
|
116
|
+
rb-fsevent (0.11.2)
|
|
117
|
+
rb-inotify (0.11.1)
|
|
118
|
+
ffi (~> 1.0)
|
|
119
|
+
rbs (4.0.3)
|
|
120
|
+
logger
|
|
121
|
+
prism (>= 1.6.0)
|
|
122
|
+
tsort
|
|
123
|
+
rdoc (8.0.0)
|
|
124
|
+
erb
|
|
125
|
+
prism (>= 1.6.0)
|
|
126
|
+
rbs (>= 4.0.0)
|
|
127
|
+
tsort
|
|
128
|
+
reline (0.6.3)
|
|
129
|
+
io-console (~> 0.5)
|
|
130
|
+
rexml (3.4.4)
|
|
131
|
+
roda (3.106.0)
|
|
132
|
+
rack
|
|
133
|
+
rouge (4.7.0)
|
|
134
|
+
samovar (2.4.1)
|
|
135
|
+
console (~> 1.0)
|
|
136
|
+
mapping (~> 1.0)
|
|
137
|
+
securerandom (0.4.1)
|
|
138
|
+
serbea (2.4.1)
|
|
139
|
+
erubi (>= 1.13)
|
|
140
|
+
tilt (>= 2.6)
|
|
141
|
+
signalize (1.3.1)
|
|
142
|
+
concurrent-ruby (~> 1.2)
|
|
143
|
+
streamlined (0.6.2)
|
|
144
|
+
serbea (>= 2.1)
|
|
145
|
+
zeitwerk (~> 2.5)
|
|
146
|
+
tilt (2.8.0)
|
|
147
|
+
tsort (0.2.0)
|
|
148
|
+
uri (1.1.1)
|
|
149
|
+
zeitwerk (2.8.2)
|
|
150
|
+
|
|
151
|
+
PLATFORMS
|
|
152
|
+
x86_64-linux-gnu
|
|
153
|
+
|
|
154
|
+
DEPENDENCIES
|
|
155
|
+
asciidoc_converter!
|
|
156
|
+
asciidoctor (~> 2.0)
|
|
157
|
+
bridgetown (~> 2.2)
|
|
158
|
+
|
|
159
|
+
BUNDLED WITH
|
|
160
|
+
4.0.16
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.adoc
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
= Sample plugin for Bridgetown
|
|
2
|
+
|
|
3
|
+
_NOTE: This isn't a real plugin! Copy this sample code and use it to create your own Ruby gem! https://www.bridgetownrb.com/docs/plugins[Help guide here…]_ 😃
|
|
4
|
+
|
|
5
|
+
_You can run_ `bridgetown plugins new` _to easily set up a customized version of this starter repo._
|
|
6
|
+
|
|
7
|
+
A Bridgetown plugin to [fill in the blank]…
|
|
8
|
+
|
|
9
|
+
== Installation
|
|
10
|
+
|
|
11
|
+
Run this command to add this plugin to your site's Gemfile:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
bundle add asciidoc_converter
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then add the initializer to your configuration in `config/initializers.rb`:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
init :asciidoc_converter
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or if there's a `bridgetown.automation.rb` automation script, you can run that instead for guided setup:
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
bin/bridgetown apply https://github.com/SarahRogue81/asciidoc_converter
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
== Usage
|
|
30
|
+
|
|
31
|
+
The plugin will…
|
|
32
|
+
|
|
33
|
+
=== Optional configuration options
|
|
34
|
+
|
|
35
|
+
The plugin will automatically use any of the following metadata variables if they are present in your site's `_data/site_metadata.yml` file.
|
|
36
|
+
|
|
37
|
+
…
|
|
38
|
+
|
|
39
|
+
== Testing
|
|
40
|
+
|
|
41
|
+
* Run `bundle exec rake test` to run the test suite
|
|
42
|
+
* Or run `script/cibuild` to validate with Rubocop and Minitest together.
|
|
43
|
+
|
|
44
|
+
== Contributing
|
|
45
|
+
|
|
46
|
+
1. Fork it (https://github.com/SarahRogue/asciidoc_converter/fork)
|
|
47
|
+
2. Clone the fork using `git clone` to your local development machine.
|
|
48
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
|
49
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
|
50
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
|
51
|
+
6. Create a new Pull Request
|
|
52
|
+
|
|
53
|
+
'''
|
|
54
|
+
|
|
55
|
+
== Releasing (you can delete this section in your own plugin repo)
|
|
56
|
+
|
|
57
|
+
To release a new version of the plugin, simply bump up the version number in both `version.rb` and
|
|
58
|
+
`package.json`, and then run `script/release`. This will require you to have a registered account
|
|
59
|
+
with both the https://rubygems.org[RubyGems.org] and https://www.npmjs.com[NPM] registries.
|
|
60
|
+
You can optionally remove the `package.json` and `frontend` folder if you don't need to package frontend
|
|
61
|
+
assets for Webpack.
|
|
62
|
+
|
|
63
|
+
If you run into any problems or need further guidance, please check out our https://www.bridgetownrb.com/docs/community[Bridgetown community resources]
|
|
64
|
+
where friendly folks are standing by to help you build and release your plugin or theme.
|
|
65
|
+
|
|
66
|
+
*NOTE:* make sure you add the `bridgetown-plugin` https://github.com/topics/bridgetown-plugin[topic] to your
|
|
67
|
+
plugin's GitHub repo so the plugin or theme will show up on https://www.bridgetownrb.com/plugins[Bridgetown's official Plugin Directory]! (There may be a day or so delay before you see it appear.)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/asciidoc_converter/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "asciidoc_converter"
|
|
7
|
+
spec.version = AsciiDocConverter::VERSION
|
|
8
|
+
spec.author = "Sarah Rogue"
|
|
9
|
+
spec.email = "emo-girl@sarah-rogue.me"
|
|
10
|
+
spec.summary = "AsciiDoc Front Matter reader and Converter for Bridgetown"
|
|
11
|
+
spec.description = "Integrates advanced AsciiDoc processing into Bridgetown projects."
|
|
12
|
+
spec.homepage = "https://github.com/SarahRogue81/asciidoc_converter"
|
|
13
|
+
spec.license = "MIT"
|
|
14
|
+
|
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|frontend)/!) }
|
|
16
|
+
spec.test_files = spec.files.grep(%r!^test/!)
|
|
17
|
+
spec.require_paths = ["lib"]
|
|
18
|
+
# Uncomment this if you wish to supply a companion NPM package and/or command features:
|
|
19
|
+
# spec.metadata = {
|
|
20
|
+
# "npm_add" => "asciidoc_converter@#{AsciiDocConverter::VERSION}",
|
|
21
|
+
# "bridgetown_features" => "true"
|
|
22
|
+
# }
|
|
23
|
+
|
|
24
|
+
spec.required_ruby_version = ">= 3.3"
|
|
25
|
+
|
|
26
|
+
spec.add_dependency "asciidoctor", ">= 2.0"
|
|
27
|
+
spec.add_dependency "bridgetown", ">= 2.2"
|
|
28
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# If your plugin requires a lot of steps to get set up, consider writing an automation to help guide users.
|
|
2
|
+
# You could set up and configure all sorts of things, for example:
|
|
3
|
+
#
|
|
4
|
+
# add_gem "my_plugin"
|
|
5
|
+
#
|
|
6
|
+
# add_npm_for_gem "my_plugin"
|
|
7
|
+
#
|
|
8
|
+
# run "bundle add some_other_gem"
|
|
9
|
+
#
|
|
10
|
+
# apply "#{__dir__}/additional.automation.rb"
|
|
11
|
+
#
|
|
12
|
+
# add_initializer :my_plugin do
|
|
13
|
+
# <<~RUBY
|
|
14
|
+
# do
|
|
15
|
+
# some_config_key 12345
|
|
16
|
+
# end
|
|
17
|
+
# RUBY
|
|
18
|
+
# end
|
|
19
|
+
#
|
|
20
|
+
# create_builder "my_nifty_builder.rb" do
|
|
21
|
+
# <<~RUBY
|
|
22
|
+
# class MyNeatBuilder < SiteBuilder
|
|
23
|
+
# def build
|
|
24
|
+
# puts MyPlugin.hello
|
|
25
|
+
# end
|
|
26
|
+
# end
|
|
27
|
+
# RUBY
|
|
28
|
+
# end
|
|
29
|
+
#
|
|
30
|
+
# javascript_import do
|
|
31
|
+
# <<~JS
|
|
32
|
+
# import { MyPlugin } from "my_plugin"
|
|
33
|
+
# JS
|
|
34
|
+
# end
|
|
35
|
+
#
|
|
36
|
+
# javascript_import 'import "my_plugin/frontend/styles/index.css"'
|
|
37
|
+
#
|
|
38
|
+
# create_file "src/_data/plugin_data.yml" do
|
|
39
|
+
# <<~YAML
|
|
40
|
+
# data:
|
|
41
|
+
# goes: here
|
|
42
|
+
# YAML
|
|
43
|
+
# end
|
|
44
|
+
#
|
|
45
|
+
# color = ask("What's your favorite color?")
|
|
46
|
+
#
|
|
47
|
+
# ruby_configure :favorite_color do
|
|
48
|
+
# <<~RUBY
|
|
49
|
+
# favorite_color "#{color}"
|
|
50
|
+
# YAML
|
|
51
|
+
# end
|
|
52
|
+
#
|
|
53
|
+
# To learn more, read the Automations documentation:
|
|
54
|
+
# * https://www.bridgetownrb.com/docs/automations
|
|
55
|
+
# and the API-level documentation:
|
|
56
|
+
# * Freyia Automations: https://www.rubydoc.info/gems/freyia/Freyia/Automations
|
|
57
|
+
# * Bridgetown Automations: https://api.bridgetownrb.com/Bridgetown/Commands/Actions.html
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require "asciidoctor"
|
|
2
|
+
|
|
3
|
+
module AsciiDocConverter
|
|
4
|
+
class AsciiDoc < Bridgetown::Converter
|
|
5
|
+
# Set priority so it handles files before the Identity converter catches them
|
|
6
|
+
priority :high
|
|
7
|
+
|
|
8
|
+
# Tell Bridgetown to process these source extensions
|
|
9
|
+
def matches(ext, _convertible = nil)
|
|
10
|
+
ext =~ /^\.(adoc|asciidoc)$/i
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Output everything into static HTML files
|
|
14
|
+
def output_ext(ext)
|
|
15
|
+
".html"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# The conversion pipeline handoff
|
|
19
|
+
def convert(content, convertible = nil)
|
|
20
|
+
# Setup modern rendering options matching your workspace style
|
|
21
|
+
options = {
|
|
22
|
+
safe: :safe,
|
|
23
|
+
attributes: {
|
|
24
|
+
"icons" => "font",
|
|
25
|
+
"sectanchors" => true,
|
|
26
|
+
"source-highlighter" => "rouge", # Integrates with Bridgetown's default highlighters
|
|
27
|
+
"imagesdir" => "/images@" # trailing @ makes this a soft default, overridable by an in-document :imagesdir:
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Render the AsciiDoc content string to safe HTML5
|
|
32
|
+
Asciidoctor.convert(content, options)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bridgetown"
|
|
4
|
+
require "asciidoc_converter/asciidoc"
|
|
5
|
+
require "asciidoc_front_matter_loader"
|
|
6
|
+
|
|
7
|
+
# @param config [Bridgetown::Configuration::ConfigurationDSL]
|
|
8
|
+
Bridgetown.initializer :asciidoc_converter do |config|
|
|
9
|
+
# Add code here which will run when a site includes
|
|
10
|
+
# `init :asciidoc_converter`
|
|
11
|
+
# in its configuration
|
|
12
|
+
|
|
13
|
+
# Add default configuration data:
|
|
14
|
+
# config.asciidoc_converter ||= {}
|
|
15
|
+
# config.asciidoc_converter.my_setting ||= 123
|
|
16
|
+
|
|
17
|
+
# Register your builder:
|
|
18
|
+
# config.builder AsciiDocConverter::Builder
|
|
19
|
+
config.converter AsciiDocConverter::AsciiDoc
|
|
20
|
+
|
|
21
|
+
# You can optionally supply a source manifest:
|
|
22
|
+
# config.source_manifest(
|
|
23
|
+
# origin: AsciiDocConverter,
|
|
24
|
+
# components: File.expand_path("../components", __dir__),
|
|
25
|
+
# layouts: File.expand_path("../layouts", __dir__),
|
|
26
|
+
# content: File.expand_path("../content", __dir__)
|
|
27
|
+
# )
|
|
28
|
+
|
|
29
|
+
AsciiDocFrontMatterLoader.register!
|
|
30
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require "asciidoctor"
|
|
2
|
+
|
|
3
|
+
class AsciiDocFrontMatterLoader < Bridgetown::FrontMatter::Loaders::Base
|
|
4
|
+
def self.register!
|
|
5
|
+
Bridgetown::FrontMatter::Loaders.register(self)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# Tell Bridgetown to intercept .adoc and .asciidoc files before standard parsing
|
|
9
|
+
def self.header?(file)
|
|
10
|
+
File.extname(file) =~ /^\.(adoc|asciidoc)$/i
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def read(file_contents, file_path: "")
|
|
14
|
+
return nil unless self.class.header?(file_path)
|
|
15
|
+
|
|
16
|
+
# Use Asciidoctor to parse only the header for performance
|
|
17
|
+
doc = Asciidoctor.load(file_contents, parse_header_only: true)
|
|
18
|
+
|
|
19
|
+
# Map native AsciiDoc attributes into Bridgetown's data structure
|
|
20
|
+
front_matter = {
|
|
21
|
+
"title" => doc.doctitle,
|
|
22
|
+
"description" => doc.attributes["description"],
|
|
23
|
+
"image" => doc.attributes["image"],
|
|
24
|
+
"author" => doc.attributes["author"],
|
|
25
|
+
"lang" => doc.attributes["lang"],
|
|
26
|
+
"categories" => doc.attributes["categories"],
|
|
27
|
+
"category" => doc.attributes["category"],
|
|
28
|
+
"date" => doc.attributes["date"],
|
|
29
|
+
"id" => doc.attributes["id"],
|
|
30
|
+
"layout" => doc.attributes["layout"] || "post",
|
|
31
|
+
"paginate" => doc.attributes["paginate"],
|
|
32
|
+
"permalink" => doc.attributes["permalink"],
|
|
33
|
+
"published" => doc.attributes["published"],
|
|
34
|
+
"sitemap_change_frequency" => doc.attributes["sitemap_change_frequency"],
|
|
35
|
+
"sitemap_priority" => doc.attributes["sitemap_priority"],
|
|
36
|
+
"slug" => doc.attributes["slug"],
|
|
37
|
+
"tag" => doc.attributes["tag"],
|
|
38
|
+
"tags" => doc.attributes["tags"],
|
|
39
|
+
"template_engine" => doc.attributes["template_engine"],
|
|
40
|
+
"willamette" => doc.attributes["willamette"],
|
|
41
|
+
"willamette.article_classes" => doc.attributes["willamette.article_classes"]
|
|
42
|
+
}.compact
|
|
43
|
+
|
|
44
|
+
Bridgetown::FrontMatter::Loaders::Result.new(
|
|
45
|
+
content: file_contents,
|
|
46
|
+
front_matter: front_matter,
|
|
47
|
+
line_count: file_contents.lines.size
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
end
|
data/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "asciidoc_converter",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "frontend/javascript/index.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/SarahRogue81/asciidoc_converter.git"
|
|
8
|
+
},
|
|
9
|
+
"author": "Sarah Rogue <emo-girl@sarah-rogue.me>",
|
|
10
|
+
"homepage": "https://sarah-rogue.me",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"private": false,
|
|
13
|
+
"files": [
|
|
14
|
+
"frontend"
|
|
15
|
+
]
|
|
16
|
+
}
|
metadata
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: asciidoc_converter
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Sarah Rogue
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: asciidoctor
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: bridgetown
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.2'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.2'
|
|
40
|
+
description: Integrates advanced AsciiDoc processing into Bridgetown projects.
|
|
41
|
+
email: emo-girl@sarah-rogue.me
|
|
42
|
+
executables: []
|
|
43
|
+
extensions: []
|
|
44
|
+
extra_rdoc_files: []
|
|
45
|
+
files:
|
|
46
|
+
- ".gitignore"
|
|
47
|
+
- ".rubocop.yml"
|
|
48
|
+
- CHANGELOG.adoc
|
|
49
|
+
- Gemfile
|
|
50
|
+
- Gemfile.lock
|
|
51
|
+
- LICENSE
|
|
52
|
+
- README.adoc
|
|
53
|
+
- Rakefile
|
|
54
|
+
- asciidoc_converter.gemspec
|
|
55
|
+
- bridgetown.automation.rb
|
|
56
|
+
- lib/asciidoc_converter.rb
|
|
57
|
+
- lib/asciidoc_converter/asciidoc.rb
|
|
58
|
+
- lib/asciidoc_converter/version.rb
|
|
59
|
+
- lib/asciidoc_front_matter_loader.rb
|
|
60
|
+
- package.json
|
|
61
|
+
homepage: https://github.com/SarahRogue81/asciidoc_converter
|
|
62
|
+
licenses:
|
|
63
|
+
- MIT
|
|
64
|
+
metadata: {}
|
|
65
|
+
rdoc_options: []
|
|
66
|
+
require_paths:
|
|
67
|
+
- lib
|
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '3.3'
|
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
requirements: []
|
|
79
|
+
rubygems_version: 4.0.16
|
|
80
|
+
specification_version: 4
|
|
81
|
+
summary: AsciiDoc Front Matter reader and Converter for Bridgetown
|
|
82
|
+
test_files: []
|