djot 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/djot/version.rb +1 -1
- data/lib/djot.rb +32 -24
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b5e4bf7bfcbf96726e592396d5c84f15e60b5feaf68e3dc237c51859ded29e8
|
4
|
+
data.tar.gz: a09d34a0c0f9995f305f234efcf90def768df063b462f543ac1964d854aac5fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db1d7b2a3327e24ba5ac5d700c1b839700bd048942d7551720496c1a99760d89cf37a48de4940c01555d455504d3d75a490f5e73dc0ee86c5c2a7a4b65588320
|
7
|
+
data.tar.gz: 1b20652e1504191d5a6f7c4350c53d039923fd94e17bb667f6a0b86cb6f2ad2a2387118c18b861ce30821ab329bbd1512d599c04a663bda5c3ab2e8fd4323bb1
|
data/README.md
CHANGED
@@ -35,6 +35,10 @@ which will create a git tag for the version,
|
|
35
35
|
push git commits and the created tag,
|
36
36
|
and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
37
37
|
|
38
|
+
### TODO
|
39
|
+
|
40
|
+
* Use [djot.js](https://github.com/jgm/djot.js)
|
41
|
+
|
38
42
|
## Contributing
|
39
43
|
|
40
44
|
Bug reports and pull requests are welcome on [GitLab](https://gitlab.com/gemmaro/ruby-djot).
|
data/lib/djot/version.rb
CHANGED
data/lib/djot.rb
CHANGED
@@ -2,41 +2,49 @@
|
|
2
2
|
|
3
3
|
require_relative "djot/version"
|
4
4
|
require "language/lua"
|
5
|
+
require "pathname"
|
5
6
|
|
6
7
|
module Djot
|
7
8
|
class Error < StandardError; end
|
8
9
|
|
9
|
-
LUA = Language::Lua.new
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
10
|
+
LUA = Language::Lua.new
|
11
|
+
LUA.eval(<<~END_LUA)
|
12
|
+
function djot_parser(input)
|
13
|
+
local parser = require("djot").Parser:new(input)
|
14
|
+
parser:parse()
|
15
|
+
return parser
|
16
|
+
end
|
17
|
+
|
18
|
+
function djot_render_html(input)
|
19
|
+
return djot_parser(input):render_html()
|
20
|
+
end
|
21
|
+
|
22
|
+
function djot_render_matches(input)
|
23
|
+
return djot_parser(input):render_matches()
|
24
|
+
end
|
25
|
+
|
26
|
+
function djot_render_ast(input)
|
27
|
+
return djot_parser(input):render_ast()
|
28
|
+
end
|
29
|
+
END_LUA
|
30
|
+
|
31
|
+
ROOT = Pathname(__dir__) / "lua"
|
30
32
|
|
31
33
|
def self.render_html(input)
|
32
|
-
|
34
|
+
Dir.chdir(ROOT) do
|
35
|
+
LUA.djot_render_html(input)
|
36
|
+
end
|
33
37
|
end
|
34
38
|
|
35
39
|
def self.render_matches(input)
|
36
|
-
|
40
|
+
Dir.chdir(ROOT) do
|
41
|
+
LUA.djot_render_matches(input)
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
45
|
def self.render_ast(input)
|
40
|
-
|
46
|
+
Dir.chdir(ROOT) do
|
47
|
+
LUA.djot_render_ast(input)
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gemmaro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-lua
|
@@ -60,7 +60,7 @@ metadata:
|
|
60
60
|
source_code_uri: https://gitlab.com/gemmaro/ruby-djot
|
61
61
|
changelog_uri: https://gitlab.com/gemmaro/ruby-djot/blob/main/CHANGELOG.md
|
62
62
|
rubygems_mfa_required: 'true'
|
63
|
-
post_install_message:
|
63
|
+
post_install_message:
|
64
64
|
rdoc_options: []
|
65
65
|
require_paths:
|
66
66
|
- lib
|
@@ -75,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.3.
|
79
|
-
signing_key:
|
78
|
+
rubygems_version: 3.3.26
|
79
|
+
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Call Lua Djot
|
82
82
|
test_files: []
|