djot 0.0.3 → 0.0.4

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/lib/djot/version.rb +1 -1
  4. data/lib/djot.rb +32 -24
  5. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 246e5b1ff3bdae43cf9f021b92d600b495742c164a30e59a423bf915d01ee747
4
- data.tar.gz: 42eedc5b5a5639d42494083452698d97a3e4792a715760ef1577bcb04c2ac90b
3
+ metadata.gz: 3b5e4bf7bfcbf96726e592396d5c84f15e60b5feaf68e3dc237c51859ded29e8
4
+ data.tar.gz: a09d34a0c0f9995f305f234efcf90def768df063b462f543ac1964d854aac5fe
5
5
  SHA512:
6
- metadata.gz: a3cf2ca085b9fa257f9eacfde9f25e16c8f46fe20a2821ab0c9aeea090c4dd7f39d5cc4f20e8fa216d848b534f953678abbbe853febbbe98e78cc275df33be94
7
- data.tar.gz: 16b9d9e7147894014b3e8fe4b830a03cc483de55b100a944c9f401d16c5f5e7406774a7806150e971faf829a2dbb7d0a65097c40648645540c6d017604beaa59
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Djot
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
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.tap do |lua|
10
- lua.eval(<<~END_LUA)
11
- function djot_parser(input)
12
- local parser = require("djot").Parser:new(input)
13
- parser:parse()
14
- return parser
15
- end
16
-
17
- function djot_render_html(input)
18
- return djot_parser(input):render_html()
19
- end
20
-
21
- function djot_render_matches(input)
22
- return djot_parser(input):render_matches()
23
- end
24
-
25
- function djot_render_ast(input)
26
- return djot_parser(input):render_ast()
27
- end
28
- END_LUA
29
- end
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
- LUA.djot_render_html(input)
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
- LUA.djot_render_matches(input)
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
- LUA.djot_render_ast(input)
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.3
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: 2022-09-25 00:00:00.000000000 Z
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.7
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: []