mintyml-jekyll 0.1.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/convert-mintyml/index.js +23 -0
- data/convert-mintyml/package.json +7 -0
- data/lib/mintyml-jekyll/mintyml-converter.rb +42 -0
- data/lib/mintyml-jekyll/render-mintyml.rb +15 -0
- data/lib/mintyml-jekyll.rb +2 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 05c8d5a69d7403654325cf6e27e2381e0c66aaecc729f1a39147bcb05c102fda
|
4
|
+
data.tar.gz: 8f60b3ca48b8cd44526cae8b984b4901dcc6e5e2edfd9f3ab76563214aed86db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f37bac0c07875ed12b519e96da570f2e6f2256dee45736578c65ad1f1d6cdd0c3ad2c20d722872bf7f1b1aee2f3be7ec5a5d4d9a704d338631d01d739461ec7
|
7
|
+
data.tar.gz: 8ebe4df291af2e4c772eec0c6ae7db18572e248efdc65eeaaacce59ae7ea87a1880562902225370d53e9476d17ad6af977495ee08102d7c27341ac9d74d47050
|
@@ -0,0 +1,23 @@
|
|
1
|
+
const { MintymlConverter } = require('mintyml')
|
2
|
+
const consumers = require('node:stream/consumers')
|
3
|
+
|
4
|
+
async function throwIfTruthy(x) {
|
5
|
+
const e = await x
|
6
|
+
if (e) {
|
7
|
+
throw e
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
async function main() {
|
12
|
+
let stdin = process.stdin.setEncoding('utf8')
|
13
|
+
const converter = new MintymlConverter({ completePage: false, indent: 2 })
|
14
|
+
const src = await consumers.text(stdin)
|
15
|
+
const out = await converter.convert(src)
|
16
|
+
await new Promise(ok => process.stdout.write(out, ok)).then(throwIfTruthy)
|
17
|
+
await new Promise(ok => process.stdout.end(ok))
|
18
|
+
}
|
19
|
+
|
20
|
+
main().catch(e => {
|
21
|
+
console.error(e.message ?? e)
|
22
|
+
process.exitCode = 1
|
23
|
+
})
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
class MintymlConverter < Converter
|
5
|
+
self.highlighter_prefix "<[raw##["
|
6
|
+
self.highlighter_suffix "]##]>"
|
7
|
+
@node_initialized = false
|
8
|
+
|
9
|
+
def source_root
|
10
|
+
return @source_root if @source_root
|
11
|
+
@source_root = File.join(__dir__, '../../convert-mintyml')
|
12
|
+
end
|
13
|
+
|
14
|
+
def matches(ext)
|
15
|
+
ext =~ /^\.(mty|minty|mintyml)$/i
|
16
|
+
end
|
17
|
+
|
18
|
+
def output_ext(ext)
|
19
|
+
".html"
|
20
|
+
end
|
21
|
+
|
22
|
+
def convert(content)
|
23
|
+
if !@node_initialized
|
24
|
+
Open3.capture2(
|
25
|
+
"npm install",
|
26
|
+
chdir: source_root,
|
27
|
+
)
|
28
|
+
@node_initialized = true
|
29
|
+
end
|
30
|
+
out, err, status = Open3.capture3(
|
31
|
+
"node .",
|
32
|
+
stdin_data: content,
|
33
|
+
chdir: source_root,
|
34
|
+
)
|
35
|
+
puts "mintyml: #{err}" if err.length > 0
|
36
|
+
raise err if status != 0
|
37
|
+
out
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class RenderMintyml < Liquid::Block
|
3
|
+
def initialize(tag_name, markup, tokens)
|
4
|
+
super
|
5
|
+
@args = markup.split(' to ').map { |s| s.strip }
|
6
|
+
end
|
7
|
+
|
8
|
+
def render(context)
|
9
|
+
converter = context.registers[:site].find_converter_instance(Jekyll::MintymlConverter)
|
10
|
+
converter.convert(super)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Liquid::Template.register_tag('render_mintyml', Jekyll::RenderMintyml)
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mintyml-jekyll
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Spencer Young
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-05-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.6'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.6'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
description: Write pages in MinTyML, a minimalist alternative syntax for HTML.
|
34
|
+
email:
|
35
|
+
- spencerwyoung@outlook.com
|
36
|
+
executables: []
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- convert-mintyml/index.js
|
41
|
+
- convert-mintyml/package.json
|
42
|
+
- lib/mintyml-jekyll.rb
|
43
|
+
- lib/mintyml-jekyll/mintyml-converter.rb
|
44
|
+
- lib/mintyml-jekyll/render-mintyml.rb
|
45
|
+
homepage: https://github.com/youngspe/mintyml-jekyll
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubygems_version: 3.3.5
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: MinTyML support for Jekyll.
|
68
|
+
test_files: []
|