djot 0.0.5 → 0.0.7
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/.mdl_style.rb +4 -0
- data/.mdlrc +1 -0
- data/.rubocop.yml +14 -3
- data/.rubocop_todo.yml +7 -10
- data/CHANGELOG.md +45 -0
- data/Dockerfile +10 -0
- data/Gemfile +2 -0
- data/README.md +20 -5
- data/Rakefile +18 -17
- data/Steepfile +2 -0
- data/djot.gemspec +3 -3
- data/lib/djot/javascript.rb +96 -25
- data/lib/djot/pure.rb +4 -0
- data/lib/djot/version.rb +1 -1
- data/lib/djot.rb +8 -39
- data/manifest.scm +2 -0
- data/sig/djot.gen.rbs +32 -0
- data/sig/djot.rbs +6 -4
- metadata +19 -34
- data/lib/lua/djot/ast.lua +0 -642
- data/lib/lua/djot/attributes.lua +0 -273
- data/lib/lua/djot/block.lua +0 -807
- data/lib/lua/djot/emoji.lua +0 -1880
- data/lib/lua/djot/html.lua +0 -557
- data/lib/lua/djot/inline.lua +0 -641
- data/lib/lua/djot/match.lua +0 -75
- data/lib/lua/djot.lua +0 -107
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b05a8f0740be3ef7a6d70beef262278b751c2c2bf7b199831857a00ea1209b15
|
4
|
+
data.tar.gz: b4f037b12f3c5f96807b3b4b089df2f2b266b4e8b3cec58c4a96016b653fa143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c51a726fe392ac8085ea2014aab561bff1596d6f70b28583c8147fecfa2e5b8e10e70df8c0420d92cf8f997f9ac7a714c7ddab22707dccd51e14626516c9473
|
7
|
+
data.tar.gz: 1ef8cc01d4a8076d1763799d304a3b7bf67a383bdd1abe9ff3b47ddde419474175bcbf7310552be00c1bd95a2e50ef96abfc8dbe9f044e6b3c84daf202cba313
|
data/.mdl_style.rb
ADDED
data/.mdlrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
style ".mdl_style.rb"
|
data/.rubocop.yml
CHANGED
@@ -15,11 +15,22 @@ Style/StringLiteralsInInterpolation:
|
|
15
15
|
Layout/LineLength:
|
16
16
|
Max: 120
|
17
17
|
|
18
|
-
Style/Documentation:
|
19
|
-
Enabled: false
|
20
|
-
|
21
18
|
Style/FrozenStringLiteralComment:
|
22
19
|
EnforcedStyle: never
|
23
20
|
|
21
|
+
Style/DocumentDynamicEvalDefinition:
|
22
|
+
Enabled: true
|
23
|
+
Exclude:
|
24
|
+
- lib/djot/javascript.rb
|
25
|
+
|
26
|
+
Metrics/ClassLength:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Metrics/BlockLength:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Metrics/MethodLength:
|
33
|
+
Enabled: false
|
34
|
+
|
24
35
|
require:
|
25
36
|
- rubocop-rake
|
data/.rubocop_todo.yml
CHANGED
@@ -1,18 +1,15 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2023-
|
3
|
+
# on 2023-05-25 12:41:00 UTC using RuboCop version 1.50.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 2
|
10
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
11
|
-
# AllowedMethods: refine
|
12
|
-
Metrics/BlockLength:
|
13
|
-
Max: 37
|
14
|
-
|
15
9
|
# Offense count: 1
|
16
|
-
# Configuration parameters:
|
17
|
-
|
18
|
-
|
10
|
+
# Configuration parameters: AllowedConstants.
|
11
|
+
Style/Documentation:
|
12
|
+
Exclude:
|
13
|
+
- 'spec/**/*'
|
14
|
+
- 'test/**/*'
|
15
|
+
- 'lib/djot/pure.rb'
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,51 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [0.0.7] - 2023-05-25
|
6
|
+
|
7
|
+
### Removed
|
8
|
+
|
9
|
+
* References to Lua implementation (djot.lua)
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
* Update djot.js to v0.2.1.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
* `Djot.render_html` to accept `warn` option
|
18
|
+
* Remove `Djot.render_matches`
|
19
|
+
* `Djot.render_ast` to accept `source_positions` option
|
20
|
+
* `Djot::JavaScript` to accept `source_positions` option
|
21
|
+
|
22
|
+
### Added
|
23
|
+
|
24
|
+
* Sckelton `Djot::Pure` module for pure Ruby implementation
|
25
|
+
|
26
|
+
## [0.0.6] - 2023-01-31
|
27
|
+
|
28
|
+
Note again that the default parser might be changed from djot.lua to djot.js in future version.
|
29
|
+
|
30
|
+
### Added
|
31
|
+
|
32
|
+
* `Djot::Lua` module, which contains ex-`Djot.render_*` methods.
|
33
|
+
Now `Djot.render_*` methods are pointers to `Djot::Lua.render_*` (default is not changed for this release).
|
34
|
+
* Option `warn` for `Djot::JavaScript.parse`.
|
35
|
+
* `Djot::JavaScript.parse_events` method.
|
36
|
+
* Option `warn` for `Djot::JavaScript.render_html`.
|
37
|
+
(Option `overrides` are not yet supported.)
|
38
|
+
* Option `warn` and `smart_punctuation_map` for `Djot::JavaScript.to_pandoc`.
|
39
|
+
(Please caution that `warn` options has not yet tested.)
|
40
|
+
* Option `warn` for `Djot::JavaScript.from_pandoc`.
|
41
|
+
(Please caution that `warn` options has not yet tested.)
|
42
|
+
|
43
|
+
### Changed
|
44
|
+
|
45
|
+
* JavaScript runtime has changed from ExecJS to MiniRacer, for passing Ruby proc to JavaScript runtime.
|
46
|
+
See also [rails/execjs#71 > Custom configuration of runtime](https://github.com/rails/execjs/issues/71).
|
47
|
+
* `Djot::JavaScript::VERSION` and `Djot::JavaScript::PATH` is deprecated.
|
48
|
+
Use `Djot::JavaScript.version` and `Djot::JavaScript.path` instead.
|
49
|
+
|
5
50
|
## [0.0.5] - 2023-01-21
|
6
51
|
|
7
52
|
Note that the default parser might be changed from djot.lua to djot.js in future version.
|
data/Dockerfile
ADDED
data/Gemfile
CHANGED
@@ -2,9 +2,11 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
+
gem "mdl", "~> 0.12.0"
|
5
6
|
gem "rake", "~> 13.0"
|
6
7
|
gem "rdoc", "~> 6.4"
|
7
8
|
gem "rubocop", "~> 1.21"
|
8
9
|
gem "rubocop-rake", "~> 0.6.0"
|
9
10
|
gem "steep", "~> 1.1"
|
10
11
|
gem "test-unit", "~> 3.0"
|
12
|
+
gem "typeprof", "~> 0.21.4"
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Djot
|
2
2
|
|
3
|
-
[Djot](https://djot.net/) parser for Ruby, using original JavaScript ([jdm/djot.js](https://github.com/jgm/djot.js))
|
3
|
+
[Djot](https://djot.net/) parser for Ruby, using original JavaScript ([jdm/djot.js](https://github.com/jgm/djot.js)) implementation.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -20,7 +20,23 @@ gem install djot
|
|
20
20
|
|
21
21
|
```ruby
|
22
22
|
require 'djot'
|
23
|
+
|
23
24
|
Djot.render_html('This is *djot*')
|
25
|
+
#=> "<p>This is <strong>djot</strong></p>\n"
|
26
|
+
|
27
|
+
Djot::JavaScript.parse("- `hello", warn: ->(w) { p w })
|
28
|
+
#=>
|
29
|
+
# {"tag"=>"doc",
|
30
|
+
# "references"=>{},
|
31
|
+
# "footnotes"=>{},
|
32
|
+
# "children"=>
|
33
|
+
# [{"tag"=>"bullet_list",
|
34
|
+
# "tight"=>true,
|
35
|
+
# "style"=>"-",
|
36
|
+
# "children"=>[{"tag"=>"list_item", "children"=>[{"tag"=>"para", "children"=>[{"tag"=>"str", "text"=>"hello"}]}]}]}]}
|
37
|
+
#
|
38
|
+
# stdout:
|
39
|
+
# {"message"=>"Unclosed verbatim", "offset"=>7}
|
24
40
|
```
|
25
41
|
|
26
42
|
## Development
|
@@ -39,8 +55,8 @@ and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
39
55
|
|
40
56
|
### TODO
|
41
57
|
|
42
|
-
* Use [Attach global Ruby functions to your JavaScript context](https://github.com/rubyjs/mini_racer#attach-global-ruby-functions-to-your-javascript-context) for the functions' options which accepts lambda expressions.
|
43
58
|
* Create document class (and more) for idiomatic control in Ruby.
|
59
|
+
* Write parser in pure Ruby.
|
44
60
|
|
45
61
|
## Contributing
|
46
62
|
|
@@ -52,9 +68,8 @@ to the [code of conduct](CODE_OF_CONDUCT.md).
|
|
52
68
|
|
53
69
|
## Acknowledgement
|
54
70
|
|
55
|
-
As mentioned earlier, this library only calls the original JavaScript
|
56
|
-
|
57
|
-
This gem also uses [rails/execjs](https://github.com/rails/execjs) and [ruby-lua](https://github.com/glejeune/ruby-lua) to call JavaScript and Lua source codes respectibly.
|
71
|
+
As mentioned earlier, this library only calls the original JavaScript implementation; the important work is done in that library.
|
72
|
+
This gem also uses [MiniRacer](https://github.com/rubyjs/mini_racer) to call JavaScript source code.
|
58
73
|
|
59
74
|
## License
|
60
75
|
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ require "rubocop/rake_task"
|
|
11
11
|
|
12
12
|
RuboCop::RakeTask.new
|
13
13
|
|
14
|
-
task default: %i[
|
14
|
+
task default: %i[copy_js test rubocop sig mdl]
|
15
15
|
|
16
16
|
desc "Copy JavaScript files"
|
17
17
|
task copy_js: "lib/js/djot.js"
|
@@ -30,22 +30,6 @@ end
|
|
30
30
|
|
31
31
|
directory "lib/js"
|
32
32
|
|
33
|
-
desc "Copy Lua files"
|
34
|
-
task copy: "lib/lua/djot" do
|
35
|
-
license = File.read("vendor/djot/LICENSE")
|
36
|
-
(["vendor/djot/djot.lua"] + Dir["vendor/djot/djot/*.lua"]).each do |file|
|
37
|
-
File.write(file.sub(%r{vendor/djot}, "lib/lua"), <<~END_LUA)
|
38
|
-
#{File.read(file)}
|
39
|
-
|
40
|
-
--[[
|
41
|
-
#{license}
|
42
|
-
]]
|
43
|
-
END_LUA
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
directory "lib/lua/djot"
|
48
|
-
|
49
33
|
require "rdoc/task"
|
50
34
|
|
51
35
|
RDoc::Task.new do |rdoc|
|
@@ -53,3 +37,20 @@ RDoc::Task.new do |rdoc|
|
|
53
37
|
rdoc.main = readme
|
54
38
|
rdoc.rdoc_files.include(readme, "lib/**/*.rb")
|
55
39
|
end
|
40
|
+
|
41
|
+
desc "Lint Markdown files"
|
42
|
+
task "mdl" do
|
43
|
+
sh "bundle exec mdl CHANGELOG.md README.md"
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Type check"
|
47
|
+
task tc: :sig do
|
48
|
+
sh "bundle exec steep check"
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Update generated RBS"
|
52
|
+
task sig: "sig/djot.gen.rbs"
|
53
|
+
|
54
|
+
file "sig/djot.gen.rbs" => ["sig/djot.rbs", *Dir["lib/**/*.rb"]] do |t|
|
55
|
+
sh "bundle", "exec", "typeprof", "-o", t.name, *t.sources
|
56
|
+
end
|
data/Steepfile
CHANGED
data/djot.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.email = ["gemmaro.dev@gmail.com"]
|
8
8
|
|
9
9
|
spec.summary = "Djot parser"
|
10
|
-
spec.description = "djot gem provides parsing functions using original JavaScript
|
10
|
+
spec.description = "djot gem provides parsing functions using original JavaScript implementation"
|
11
11
|
spec.homepage = "https://gitlab.com/gemmaro/ruby-djot"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = ">= 2.6.0"
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
end
|
27
27
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
|
+
spec.rdoc_options << "--include" << "lib"
|
29
30
|
|
30
|
-
spec.add_dependency "
|
31
|
-
spec.add_dependency "ruby-lua", "~> 0.4"
|
31
|
+
spec.add_dependency "mini_racer", "~> 0.6.3"
|
32
32
|
end
|
data/lib/djot/javascript.rb
CHANGED
@@ -1,75 +1,146 @@
|
|
1
1
|
require "pathname"
|
2
|
-
require "
|
2
|
+
require "mini_racer"
|
3
3
|
|
4
4
|
module Djot
|
5
5
|
# Functionalities of djot.js
|
6
6
|
module JavaScript
|
7
|
-
|
7
|
+
def self.path # :nodoc:
|
8
|
+
@path ||= Pathname(__dir__ || (raise Error)) / ".." / "js" / "djot.js"
|
9
|
+
end
|
10
|
+
|
11
|
+
PATH = path # :nodoc:
|
8
12
|
|
9
|
-
|
13
|
+
deprecate_constant :PATH
|
14
|
+
|
15
|
+
def self.source # :nodoc:
|
10
16
|
@source ||= PATH.read
|
11
17
|
end
|
12
18
|
|
13
|
-
def self.context
|
14
|
-
@context
|
19
|
+
def self.context # :nodoc:
|
20
|
+
return @context if @context
|
21
|
+
|
22
|
+
context = MiniRacer::Context.new
|
23
|
+
context.eval("let args, result")
|
24
|
+
context.eval(source)
|
25
|
+
@context = context
|
15
26
|
end
|
16
27
|
|
17
28
|
# Correspond to +djot.parse+
|
18
29
|
# (https://github.com/jgm/djot.js#parsing-djot-to-an-ast)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
30
|
+
def self.parse(input, source_positions: nil, warn: nil)
|
31
|
+
args = [input]
|
32
|
+
options = {}
|
33
|
+
options["sourcePositions"] = source_positions if source_positions
|
34
|
+
args << options
|
35
|
+
context.eval("args = #{JSON.generate(args)}")
|
36
|
+
if warn
|
37
|
+
context.attach("warn", warn)
|
38
|
+
context.eval('args[1]["warn"] = warn')
|
39
|
+
end
|
40
|
+
context.eval("djot.parse.apply(this, args)")
|
23
41
|
end
|
24
42
|
|
25
|
-
#
|
43
|
+
# Correspond to +djot.parseEvents+
|
26
44
|
# (https://github.com/jgm/djot.js#parsing-djot-to-a-stream-of-events)
|
45
|
+
def self.parse_events(input, warn: nil, &block)
|
46
|
+
context.eval("args = #{JSON.generate([input, {}])}")
|
47
|
+
if warn
|
48
|
+
context.attach("warn", warn)
|
49
|
+
context.eval('args[1]["warn"] = warn')
|
50
|
+
end
|
51
|
+
source = if block_given?
|
52
|
+
context.attach("fun", block)
|
53
|
+
<<~END_JAVASCRIPT
|
54
|
+
for (let event of djot.parseEvents(...args)) {
|
55
|
+
fun(event)
|
56
|
+
}
|
57
|
+
END_JAVASCRIPT
|
58
|
+
else
|
59
|
+
# TODO: Use enum_for
|
60
|
+
<<~END_JAVASCRIPT
|
61
|
+
events = []
|
62
|
+
for (let event of djot.parseEvents(...args)) {
|
63
|
+
events.push(event)
|
64
|
+
}
|
65
|
+
events
|
66
|
+
END_JAVASCRIPT
|
67
|
+
end
|
68
|
+
context.eval(source)
|
69
|
+
end
|
27
70
|
|
28
71
|
# Correspond to +djot.renderAST+
|
29
72
|
# (https://github.com/jgm/djot.js#pretty-printing-the-djot-ast)
|
30
|
-
def self.render_ast(doc)
|
31
|
-
|
73
|
+
def self.render_ast(doc, source_positions: false)
|
74
|
+
args = [doc]
|
75
|
+
args << { "sourcePositions" => source_positions } if source_positions
|
76
|
+
context.eval("djot.renderAST.apply(this, #{JSON.generate(args)})")
|
32
77
|
end
|
33
78
|
|
34
79
|
# Correspond to +djot.renderHTML+
|
35
80
|
# (https://github.com/jgm/djot.js#rendering-the-djot-ast-to-html)
|
36
81
|
#
|
37
|
-
# TODO: support +
|
38
|
-
def self.render_html(doc)
|
39
|
-
context.
|
82
|
+
# TODO: support +overrides+ option
|
83
|
+
def self.render_html(doc, warn: nil)
|
84
|
+
context.eval("args = #{JSON.generate([doc, {}])}")
|
85
|
+
if warn
|
86
|
+
context.attach("warn", warn)
|
87
|
+
context.eval('args[1]["warn"] = warn')
|
88
|
+
end
|
89
|
+
context.eval("djot.renderHTML.apply(this, args)")
|
40
90
|
end
|
41
91
|
|
42
92
|
# Correspond to +djot.renderDjot+
|
43
93
|
# (https://github.com/jgm/djot.js#rendering-djot)
|
44
|
-
#
|
45
|
-
# TODO: support options
|
46
94
|
def self.render_djot(doc, wrap_width: nil)
|
47
95
|
options = {}
|
48
96
|
options["wrapWidth"] = wrap_width if wrap_width
|
49
97
|
|
50
|
-
|
98
|
+
call("renderDjot", doc, options)
|
51
99
|
end
|
52
100
|
|
53
101
|
# Correspond to +djot.toPandoc+
|
54
102
|
# (https://github.com/jgm/djot.js#pandoc-interoperability)
|
55
103
|
#
|
56
|
-
#
|
57
|
-
|
58
|
-
|
104
|
+
# CAUTION: +warn+ option hasn't yet tested.
|
105
|
+
# There may be bugs.
|
106
|
+
def self.to_pandoc(doc, warn: nil, smart_punctuation_map: nil)
|
107
|
+
options = {}
|
108
|
+
options["smartPunctuationMap"] = smart_punctuation_map if smart_punctuation_map
|
109
|
+
context.eval("args = #{JSON.generate([doc, options])}")
|
110
|
+
if warn
|
111
|
+
context.attach("warn", warn)
|
112
|
+
context.eval('args[1]["warn"] = warn')
|
113
|
+
end
|
114
|
+
context.eval("djot.toPandoc.apply(this, args)")
|
59
115
|
end
|
60
116
|
|
61
117
|
# Correspond to +djot.fromPandoc+
|
62
118
|
# (https://github.com/jgm/djot.js#pandoc-interoperability)
|
63
119
|
#
|
64
|
-
#
|
65
|
-
def self.from_pandoc(pandoc)
|
66
|
-
context.
|
120
|
+
# CAUTION: +warn+ options hasn't yet tested.
|
121
|
+
def self.from_pandoc(pandoc, warn: nil)
|
122
|
+
context.eval("args = #{JSON.generate([pandoc, {}])}")
|
123
|
+
if warn
|
124
|
+
context.attach("warn", warn)
|
125
|
+
context.eval('args[1]["warn"] = warn')
|
126
|
+
end
|
127
|
+
context.eval("djot.fromPandoc.apply(this, args)")
|
67
128
|
end
|
68
129
|
|
69
130
|
# TODO: support filters
|
70
131
|
|
71
132
|
# Correspond to +djot.version+
|
72
133
|
# (https://github.com/jgm/djot.js#getting-the-version)
|
73
|
-
|
134
|
+
def self.version
|
135
|
+
@version ||= context.eval("djot.version")
|
136
|
+
end
|
137
|
+
|
138
|
+
VERSION = version # :nodoc:
|
139
|
+
|
140
|
+
deprecate_constant :VERSION
|
141
|
+
|
142
|
+
def self.call(name, *args) # :nodoc:
|
143
|
+
context.eval("djot.#{name}.apply(this, #{::JSON.generate(args)})")
|
144
|
+
end
|
74
145
|
end
|
75
146
|
end
|
data/lib/djot/pure.rb
ADDED
data/lib/djot/version.rb
CHANGED
data/lib/djot.rb
CHANGED
@@ -1,49 +1,18 @@
|
|
1
1
|
require_relative "djot/version"
|
2
2
|
require_relative "djot/javascript"
|
3
|
-
|
4
|
-
require "pathname"
|
3
|
+
require_relative "djot/pure"
|
5
4
|
|
5
|
+
# Provides Djot parsing functionalities.
|
6
|
+
# +Djot.*+ methods are pointing to JavaScript implementation now.
|
7
|
+
# See also Djot::JavaScript for ones pointing to JavaScript implementation.
|
6
8
|
module Djot
|
7
9
|
class Error < StandardError; end
|
8
10
|
|
9
|
-
|
10
|
-
|
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
|
-
|
30
|
-
ROOT = Pathname(__dir__) / "lua"
|
31
|
-
|
32
|
-
def self.render_html(input)
|
33
|
-
Dir.chdir(ROOT) do
|
34
|
-
LUA.djot_render_html(input)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.render_matches(input)
|
39
|
-
Dir.chdir(ROOT) do
|
40
|
-
LUA.djot_render_matches(input)
|
41
|
-
end
|
11
|
+
def self.render_html(doc, warn: nil)
|
12
|
+
JavaScript.render_html(doc, warn: warn)
|
42
13
|
end
|
43
14
|
|
44
|
-
def self.render_ast(input)
|
45
|
-
|
46
|
-
LUA.djot_render_ast(input)
|
47
|
-
end
|
15
|
+
def self.render_ast(input, source_positions: false)
|
16
|
+
JavaScript.render_ast(input, source_positions: source_positions)
|
48
17
|
end
|
49
18
|
end
|
data/manifest.scm
ADDED
data/sig/djot.gen.rbs
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# TypeProf 0.21.7
|
2
|
+
|
3
|
+
# Classes
|
4
|
+
module Djot
|
5
|
+
VERSION: String
|
6
|
+
|
7
|
+
def self.render_html: (untyped input) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
8
|
+
def self.render_matches: (untyped input) -> untyped
|
9
|
+
def self.render_ast: (untyped input) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
10
|
+
|
11
|
+
module JavaScript
|
12
|
+
PATH: Pathname
|
13
|
+
VERSION: (Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?
|
14
|
+
self.@path: Pathname
|
15
|
+
self.@version: (Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?
|
16
|
+
self.@context: MiniRacer::Context
|
17
|
+
self.@source: String
|
18
|
+
|
19
|
+
def self.path: -> Pathname
|
20
|
+
def self.source: -> String
|
21
|
+
def self.context: -> MiniRacer::Context?
|
22
|
+
def self.parse: (untyped input, ?source_positions: nil, ?warn: nil) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
23
|
+
def self.parse_events: (untyped input, ?warn: nil) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
24
|
+
def self.render_ast: (untyped doc) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
25
|
+
def self.render_html: (untyped doc, ?warn: nil) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
26
|
+
def self.render_djot: (untyped doc, ?wrap_width: nil) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
27
|
+
def self.to_pandoc: (untyped doc, ?warn: nil, ?smart_punctuation_map: nil) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
28
|
+
def self.from_pandoc: (untyped pandoc, ?warn: nil) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
29
|
+
def self.version: -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
30
|
+
def self.call: (String name, *Hash[String, untyped] args) -> ((Array[untyped] | Hash[untyped, untyped] | MiniRacer::JavaScriptFunction | Time)?)
|
31
|
+
end
|
32
|
+
end
|
data/sig/djot.rbs
CHANGED