jektex 0.0.5 → 0.0.8
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/README.md +68 -43
- data/lib/jektex/jektex.rb +113 -77
- data/lib/jektex/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9405c84a9c1c4d137d5f9fe152943a72613a52fb741ea8dc3074c64368257b77
|
4
|
+
data.tar.gz: fcf023964df85b84be1ebab055fd778f923a63e3857facc083e451370168b366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fda6a4eda19f919edc732da120ccfe2a20c520476465d53d79a98eb80087d94b438a84b863194009213781f5b15d180a5e7b22a6ca1eeb35e4bf3676da709c2
|
7
|
+
data.tar.gz: 7f3bd08cb26988e28c5ff910148404dcc0dee7f83478bbd04786aa5bf73ca5ea50fc93117e536c417549cb98f2192a27b20bdea99e598d3fcc15b49ef9b71208
|
data/README.md
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
+
[](https://rubygems.org/gems/jektex)
|
2
|
+
|
1
3
|
# Jektex
|
2
|
-
Jekyll plugin for blazing
|
3
|
-
Enjoy comfort of
|
4
|
+
A Jekyll plugin for blazing-fast server-side cached LaTeX rendering, with support for macros.
|
5
|
+
Enjoy the comfort of LaTeX and Markdown without cluttering your site with bloated JavaScript.
|
4
6
|
|
5
7
|
## Features
|
6
8
|
- Renders LaTeX formulas during Jekyll rendering
|
7
|
-
- Works without any
|
8
|
-
- Is faster than any other server
|
9
|
-
- Supports user
|
10
|
-
- Has I/O
|
11
|
-
-
|
12
|
-
- Is easy to setup
|
13
|
-
-
|
14
|
-
- Marks invalid
|
15
|
-
-
|
16
|
-
-
|
9
|
+
- Works without any client-side JavaScript
|
10
|
+
- Is faster than any other server-side Jekyll LaTeX renderer
|
11
|
+
- Supports user-defined global macros
|
12
|
+
- Has I/O-efficient caching system
|
13
|
+
- Dynamically informs about the number of expressions during rendering
|
14
|
+
- Is very easy to setup
|
15
|
+
- Doesn't interfere with Jekyll workflow and project structure
|
16
|
+
- Marks invalid expressions in document, printing its location during rendering
|
17
|
+
- Is highly configurable with sensible defaults
|
18
|
+
- Makes sure that cache does not contain expression rendered with outdated configuration
|
17
19
|
|
18
20
|
## Usage
|
19
21
|
|
20
|
-
|
22
|
+
Jektex supports both the built-in Kramdown math notation, and the newer LaTeX-only math notation.
|
23
|
+
|
24
|
+
### Kramdown notation
|
21
25
|
**Inline formula**
|
22
26
|
Put formula between two pairs of dolar signs (`$$`) inside of paragraph.
|
23
27
|
```latex
|
@@ -26,7 +30,7 @@ adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliq
|
|
26
30
|
```
|
27
31
|
|
28
32
|
**Display formula**
|
29
|
-
Put formula between two pairs of dolar sings (`$$`) and surround it
|
33
|
+
Put formula between two pairs of dolar sings (`$$`) and surround it with two empty lines.
|
30
34
|
```latex
|
31
35
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
32
36
|
incididunt ut labore et dolore magna aliqua.
|
@@ -42,54 +46,74 @@ display mode?
|
|
42
46
|
This is how [kramdown](https://kramdown.gettalong.org/)(Jekyll's markdown parser) works
|
43
47
|
so I decided to respect this convention. It makes this plugin more consistent and universal._
|
44
48
|
|
49
|
+
|
50
|
+
### LaTex math mode notation
|
51
|
+
**Inline formula**
|
52
|
+
Put formula between two escaped brackets `\(` `\)`.
|
53
|
+
Its position in the text does not matter.
|
54
|
+
```latex
|
55
|
+
Lorem ipsum dolor sit amet, consectetur \(e^{i\theta}=\cos(\theta)+i\sin(\theta)\)
|
56
|
+
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
57
|
+
```
|
58
|
+
|
59
|
+
**Display formula**
|
60
|
+
Put formula between two escaped square brackets `\[` `\]`.
|
61
|
+
Its position in the text does not matter.
|
62
|
+
```latex
|
63
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
64
|
+
incididunt ut labore et dolore magna aliqua.
|
65
|
+
|
66
|
+
\[ \left[ \frac{-\hbar^2}{2\mu}\nabla^2 + V(\mathbf{r},t)\right] \Psi(\mathbf{r},t) \]
|
67
|
+
|
68
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
|
69
|
+
ea commodo consequat.
|
70
|
+
```
|
71
|
+
|
45
72
|
### Config
|
46
|
-
Jektex si highly configurable
|
73
|
+
Jektex si highly configurable via your `_config.yml` file.
|
47
74
|
|
48
75
|
**Disabling cache**
|
49
|
-
You can disable caching with `disable_disk_cache = true` in `_config.yml`.
|
50
|
-
enabled by default.
|
76
|
+
You can disable caching with `disable_disk_cache = true` in `_config.yml`.
|
77
|
+
Caching is enabled by default.
|
78
|
+
You can find more information on [Jekyll's official website](https://jekyllrb.com/docs/configuration/options/).
|
51
79
|
|
52
80
|
**Setting cache location**
|
53
|
-
By default
|
54
|
-
deletion when you call `jekyll clean`.
|
55
|
-
|
56
|
-
`cache_dir` in `_config.yml`.
|
81
|
+
By default, Jektex cache will be saved in `.jekyll-cache` directory.
|
82
|
+
This results in its deletion when you call `jekyll clean`.
|
83
|
+
To prevent cache deletion or to change the cache location, you can specify `cache_dir` in `_config.yml`:
|
57
84
|
```yaml
|
58
85
|
# Jektex cache dir location
|
59
86
|
jektex:
|
60
87
|
cache_dir: ".jektex-cache"
|
61
88
|
```
|
62
89
|
|
63
|
-
**
|
64
|
-
By default
|
65
|
-
sometimes
|
66
|
-
|
67
|
-
You can use conventional wild cards using `*`. For example:
|
90
|
+
**Ignoring files**
|
91
|
+
By default, Jektex tries to render LaTeX in all files rendered by Jekyll.
|
92
|
+
This can sometimes be undesirable, for example when rendering an _RSS feed_ with excerpts containing LaTeX.
|
93
|
+
Jektex solves this by using the `ignore` option:
|
68
94
|
```yaml
|
69
95
|
# Jektex ignore files
|
70
96
|
jektex:
|
71
97
|
ignore: ["*.xml", "README.md", "_drafts/*" ]
|
72
98
|
```
|
73
99
|
|
74
|
-
|
75
|
-
in `_drafts` directory.
|
100
|
+
You can use conventional wild cards using `*`.
|
101
|
+
This example configuration ignores all `.xml` files, `README.md` and all files in the `_drafts` directory.
|
76
102
|
|
77
|
-
Another
|
78
|
-
post to `false`. For example:
|
103
|
+
Another way to ignore specific posts is setting the `jektex` attribute in front matter to `false`:
|
79
104
|
```yaml
|
80
105
|
---
|
81
|
-
|
106
|
+
ttle: "How Jektex works"
|
82
107
|
category: "Development"
|
83
108
|
jektex: false
|
84
109
|
layout: post
|
85
110
|
---
|
86
111
|
```
|
87
112
|
|
88
|
-
Setting `jektex` tag to `true` or not setting at all will result in
|
89
|
-
expressions in that post.
|
113
|
+
Setting `jektex` tag to `true` or not setting at all will result in Jektex rendering LaTeX expressions in that post.
|
90
114
|
|
91
|
-
**
|
92
|
-
You can define global macros
|
115
|
+
**Using macros**
|
116
|
+
You can define global macros:
|
93
117
|
```yaml
|
94
118
|
# Jektex macros
|
95
119
|
jektex:
|
@@ -97,9 +121,8 @@ jektex:
|
|
97
121
|
- ["\\Q", "\\mathbb{Q}"]
|
98
122
|
- ["\\C", "\\mathbb{C}"]
|
99
123
|
```
|
100
|
-
And yes you have to escape backlash(`\`) with another backlash.
|
101
|
-
[yaml
|
102
|
-
definition of a macro for change to take effect.
|
124
|
+
And yes, you have to escape the backlash (`\`) with another backlash.
|
125
|
+
This is due to the [yaml specification](https://yaml.org/).
|
103
126
|
|
104
127
|
**Complete examples**
|
105
128
|
Recommended config:
|
@@ -111,6 +134,7 @@ jektex:
|
|
111
134
|
- ["\\Q", "\\mathbb{Q}"]
|
112
135
|
- ["\\C", "\\mathbb{C}"]
|
113
136
|
```
|
137
|
+
|
114
138
|
Having no configuration is equivalent to this:
|
115
139
|
```yaml
|
116
140
|
jektex:
|
@@ -123,7 +147,7 @@ jektex:
|
|
123
147
|
This plugin is available as a [RubyGem](https://rubygems.org/gems/jektex).
|
124
148
|
|
125
149
|
**Using bundler**
|
126
|
-
Add
|
150
|
+
Add Jektex to your `Gemfile`:
|
127
151
|
```ruby
|
128
152
|
group :jekyll_plugins do
|
129
153
|
gem "jektex"
|
@@ -133,22 +157,23 @@ end
|
|
133
157
|
and run `bundle install`
|
134
158
|
|
135
159
|
**Without bundler**
|
136
|
-
|
160
|
+
Run `gem install jektex`
|
137
161
|
|
138
162
|
**After installation**
|
139
|
-
Add
|
163
|
+
Add Jektex to your plugin list in your `_config.yml` file
|
140
164
|
```yaml
|
141
165
|
plugins:
|
142
166
|
- jektex
|
143
167
|
```
|
144
168
|
|
145
|
-
and
|
169
|
+
and don't forget to add `katex.min.css` to you HTML head:
|
146
170
|
```html
|
147
171
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css" integrity="sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ" crossorigin="anonymous">
|
148
172
|
```
|
149
|
-
It is much better practice to download **css** file and load it as an asset from your server directly.
|
173
|
+
It is much better practice to download the [**css** file](https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css) and load it as an asset from your server directly.
|
150
174
|
You can find more information on [KaTeX's website](https://katex.org/docs/browser.html).
|
151
175
|
|
152
176
|
## Contributions and bug reports
|
153
177
|
Feel free to repost any bugs or even make feature request in [issues on official repository](https://github.com/yagarea/jektex/issues).
|
154
178
|
I am opened for pull requests as well.
|
179
|
+
|
data/lib/jektex/jektex.rb
CHANGED
@@ -7,146 +7,176 @@ PATH_TO_JS = File.join(__dir__, "/katex.min.js")
|
|
7
7
|
DEFAULT_CACHE_DIR = ".jekyll-cache"
|
8
8
|
CACHE_FILE = "jektex-cache.marshal"
|
9
9
|
KATEX = ExecJS.compile(open(PATH_TO_JS).read)
|
10
|
-
PARSE_ERROR_PLACEHOLDER = "<b style='color: red;'>PARSE ERROR</b>"
|
11
10
|
FRONT_MATTER_TAG = "jektex"
|
11
|
+
INDENT = " " * 13
|
12
|
+
|
12
13
|
$global_macros = Hash.new
|
14
|
+
$updated_global_macros = Array.new
|
15
|
+
|
13
16
|
$count_newly_generated_expressions = 0
|
17
|
+
|
14
18
|
$path_to_cache = File.join(DEFAULT_CACHE_DIR, CACHE_FILE)
|
15
19
|
$cache = nil
|
16
20
|
$disable_disk_cache = false
|
21
|
+
|
17
22
|
$ignored = Array.new
|
18
23
|
|
24
|
+
def get_list_of_updated_global_macros(current_macros, cached_global_macros)
|
25
|
+
return Array.new unless cached_global_macros || current_macros
|
26
|
+
return current_macros.keys unless cached_global_macros
|
27
|
+
return cached_global_macros.keys unless current_macros
|
28
|
+
|
29
|
+
macro_set = Set.new(cached_global_macros.keys + current_macros.keys)
|
30
|
+
macro_set.delete_if { |m| cached_global_macros[m] == current_macros[m] }
|
31
|
+
return macro_set.to_a
|
32
|
+
end
|
33
|
+
|
19
34
|
def is_ignored?(page)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
return
|
35
|
+
return true if page.data[FRONT_MATTER_TAG] == "false"
|
36
|
+
return $ignored.any? { |patern| File.fnmatch?(patern, page.relative_path, File::FNM_DOTMATCH) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def contains_updated_global_macro?(expression)
|
40
|
+
return $updated_global_macros.any? { |m| expression[m] }
|
26
41
|
end
|
27
42
|
|
28
|
-
def
|
43
|
+
def print_stats
|
44
|
+
print "#{INDENT}LaTeX: " \
|
45
|
+
"#{$count_newly_generated_expressions} expressions rendered " \
|
46
|
+
"(#{$cache.size} already cached)".ljust(72) + "\r"
|
47
|
+
$stdout.flush
|
48
|
+
end
|
49
|
+
|
50
|
+
#######################################################################################
|
51
|
+
# Render
|
52
|
+
|
53
|
+
def render_latex_notation(page)
|
29
54
|
# check if document is not set to be ignored
|
30
|
-
if page.data
|
31
|
-
|
32
|
-
|
55
|
+
return page.content if !page.data || is_ignored?(page)
|
56
|
+
# convert HTML entities back to characters
|
57
|
+
post = HTMLEntities.new.decode(page.content.to_s)
|
58
|
+
# render inline expressions
|
59
|
+
post = post.gsub(/(\\\()((.|\n)*?)(?<!\\)\\\)/) { |m| escape_method($1, $2, page.relative_path) }
|
60
|
+
# render display mode expressions
|
61
|
+
post = post.gsub(/(\\\[)((.|\n)*?)(?<!\\)\\\]/) { |m| escape_method($1, $2, page.relative_path) }
|
62
|
+
return post
|
63
|
+
end
|
33
64
|
|
65
|
+
def render_kramdown_notation(page)
|
66
|
+
# check if document is not set to be ignored
|
67
|
+
return page.output if !page.data || is_ignored?(page)
|
34
68
|
# convert HTML entities back to characters
|
35
69
|
post = HTMLEntities.new.decode(page.output.to_s)
|
36
70
|
# render inline expressions
|
37
|
-
post = post.gsub(/(\\\()((.|\n)*?)(?<!\\)\\\)/) { |m| escape_method($1, $2, page.
|
38
|
-
# render display expressions
|
39
|
-
post = post.gsub(/(\\\[)((.|\n)*?)(?<!\\)\\\]/) { |m| escape_method($1, $2, page.
|
71
|
+
post = post.gsub(/(\\\()((.|\n)*?)(?<!\\)\\\)/) { |m| escape_method($1, $2, page.relative_path) }
|
72
|
+
# render display mode expressions
|
73
|
+
post = post.gsub(/(\\\[)((.|\n)*?)(?<!\\)\\\]/) { |m| escape_method($1, $2, page.relative_path) }
|
40
74
|
return post
|
41
75
|
end
|
42
76
|
|
43
|
-
def escape_method( type,
|
44
|
-
|
45
|
-
|
46
|
-
# detect if expression is display view
|
47
|
-
case type.downcase
|
48
|
-
when /\(/
|
49
|
-
@display = false
|
50
|
-
else /\[/
|
51
|
-
@display = true
|
52
|
-
end
|
77
|
+
def escape_method( type, expression, doc_path )
|
78
|
+
# detect if expression is in display mode
|
79
|
+
is_in_display_mode = type.downcase =~ /\[/
|
53
80
|
|
54
81
|
# generate a hash from the math expression
|
55
|
-
|
82
|
+
expression_hash = Digest::SHA2.hexdigest(expression) + is_in_display_mode.to_s
|
56
83
|
|
57
84
|
# use it if it exists
|
58
|
-
if($cache.has_key?(
|
85
|
+
if($cache.has_key?(expression_hash) && !contains_updated_global_macro?(expression))
|
86
|
+
# check if expressin conains updated macro
|
59
87
|
$count_newly_generated_expressions += 1
|
60
88
|
print_stats
|
61
|
-
return $cache[
|
89
|
+
return $cache[expression_hash]
|
62
90
|
|
63
91
|
# else generate one and store it
|
64
92
|
else
|
65
93
|
# create the cache directory, if it doesn't exist
|
66
94
|
begin
|
67
95
|
# render using ExecJS
|
68
|
-
|
69
|
-
{displayMode:
|
96
|
+
result = KATEX.call("katex.renderToString", expression,
|
97
|
+
{ displayMode: is_in_display_mode,
|
98
|
+
macros: $global_macros
|
99
|
+
})
|
70
100
|
rescue SystemExit, Interrupt
|
71
101
|
# save cache to disk
|
72
102
|
File.open($path_to_cache, "w"){|to_file| Marshal.dump($cache, to_file)}
|
73
103
|
# this stops jekyll being immune to interrupts and kill command
|
74
104
|
raise
|
75
|
-
rescue
|
105
|
+
rescue ExecJS::ProgramError => pe
|
76
106
|
# catch parse error
|
77
|
-
puts "\e[31m
|
78
|
-
|
107
|
+
puts "\e[31m #{pe.message.gsub("ParseError: ", "")}\n\t#{doc_path}\e[0m"
|
108
|
+
# render expression with error highlighting enabled
|
109
|
+
return KATEX.call("katex.renderToString", expression,
|
110
|
+
{ displayMode: is_in_display_mode,
|
111
|
+
macros: $global_macros,
|
112
|
+
throwOnError: false
|
113
|
+
})
|
79
114
|
end
|
80
115
|
# save to cache
|
81
|
-
$cache[
|
116
|
+
$cache[expression_hash] = result
|
82
117
|
# update count of newly generated expressions
|
83
118
|
$count_newly_generated_expressions += 1
|
84
119
|
print_stats
|
85
|
-
return
|
120
|
+
return result
|
86
121
|
end
|
87
122
|
end
|
88
123
|
|
89
|
-
def print_stats
|
90
|
-
print " LaTeX: " +
|
91
|
-
($count_newly_generated_expressions).to_s +
|
92
|
-
" expressions rendered (" + $cache.size.to_s +
|
93
|
-
" already cached) \r"
|
94
|
-
$stdout.flush
|
95
|
-
end
|
96
|
-
|
97
124
|
Jekyll::Hooks.register :pages, :post_render do |page|
|
98
|
-
page.output =
|
125
|
+
page.output = render_kramdown_notation(page)
|
99
126
|
end
|
100
127
|
|
101
128
|
Jekyll::Hooks.register :documents, :post_render do |doc|
|
102
|
-
doc.output =
|
129
|
+
doc.output = render_kramdown_notation(doc)
|
130
|
+
end
|
131
|
+
|
132
|
+
Jekyll::Hooks.register :pages, :pre_render do |page|
|
133
|
+
page.content = render_latex_notation(page)
|
103
134
|
end
|
104
135
|
|
136
|
+
Jekyll::Hooks.register :documents, :pre_render do |doc|
|
137
|
+
doc.content = render_latex_notation(doc)
|
138
|
+
end
|
139
|
+
|
140
|
+
#######################################################################################
|
141
|
+
# SETTINGS AND INIT
|
142
|
+
|
105
143
|
Jekyll::Hooks.register :site, :after_init do |site|
|
106
|
-
if
|
107
|
-
|
108
|
-
|
144
|
+
# load jektex config from config file and if no config is defined make empty one
|
145
|
+
config = site.config["jektex"] || Hash.new
|
146
|
+
|
147
|
+
# check if there is defined custom cache location in config
|
148
|
+
$path_to_cache = File.join(config["cache_dir"].to_s, CACHE_FILE) if config.has_key?("cache_dir")
|
149
|
+
|
150
|
+
# load content of cache file if it exists
|
151
|
+
if File.exist?($path_to_cache)
|
152
|
+
$cache = File.open($path_to_cache, "r"){ |from_file| Marshal.load(from_file)}
|
109
153
|
else
|
110
|
-
|
111
|
-
config = site.config["jektex"]
|
154
|
+
$cache = Hash.new
|
112
155
|
end
|
156
|
+
|
157
|
+
# check if cache is disabled in config
|
158
|
+
$disable_disk_cache = site.config["disable_disk_cache"] if site.config.has_key?("disable_disk_cache")
|
159
|
+
|
113
160
|
# load macros
|
114
|
-
if config
|
161
|
+
if config.has_key?("macros")
|
115
162
|
for macro_definition in config["macros"]
|
116
163
|
$global_macros[macro_definition[0]] = macro_definition[1]
|
117
164
|
end
|
118
165
|
end
|
119
166
|
|
167
|
+
# make list of updated macros
|
168
|
+
$updated_global_macros = get_list_of_updated_global_macros($global_macros, $cache["cached_global_macros"])
|
120
169
|
# print macro information
|
121
|
-
if $global_macros.
|
122
|
-
puts "
|
170
|
+
if $global_macros.empty?
|
171
|
+
puts "#{INDENT}LaTeX: no macros loaded"
|
123
172
|
else
|
124
|
-
puts "
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
# check if there is defined custom cache location in config
|
129
|
-
if config["cache_dir"] != nil then
|
130
|
-
$path_to_cache = File.join(config["cache_dir"].to_s, CACHE_FILE)
|
173
|
+
puts "#{INDENT}LaTeX: #{$global_macros.size} macro" \
|
174
|
+
"#{$global_macros.size == 1 ? "" : "s"} loaded" +
|
175
|
+
($updated_global_macros.empty? ? "" : " (#{$updated_global_macros.size} updated)")
|
131
176
|
end
|
132
177
|
|
133
178
|
# load list of ignored files
|
134
|
-
|
135
|
-
$ignored = config["ignore"]
|
136
|
-
end
|
137
|
-
|
138
|
-
# load content of cache file if it exists
|
139
|
-
if(File.exist?($path_to_cache)) then
|
140
|
-
$cache = File.open($path_to_cache, "r"){|from_file| Marshal.load(from_file)}
|
141
|
-
else
|
142
|
-
$cache = Hash.new
|
143
|
-
end
|
144
|
-
|
145
|
-
# check if cache is disable in config
|
146
|
-
if site.config["disable_disk_cache"] != nil then
|
147
|
-
$disable_disk_cache = site.config["disable_disk_cache"]
|
148
|
-
end
|
149
|
-
|
179
|
+
$ignored = config["ignore"] if config.has_key?("ignore")
|
150
180
|
end
|
151
181
|
|
152
182
|
Jekyll::Hooks.register :site, :after_reset do
|
@@ -155,12 +185,18 @@ Jekyll::Hooks.register :site, :after_reset do
|
|
155
185
|
end
|
156
186
|
|
157
187
|
Jekyll::Hooks.register :site, :post_write do
|
188
|
+
# print stats once more to prevent them from being overwriten by error log
|
189
|
+
print_stats
|
158
190
|
# print new line to prevent overwriting previous output
|
159
191
|
print "\n"
|
160
192
|
# check if caching is enabled
|
161
|
-
if
|
193
|
+
if !$disable_disk_cache
|
194
|
+
# save global macros to cache
|
195
|
+
$cache["cached_global_macros"] = $global_macros
|
196
|
+
# create cache path
|
197
|
+
Pathname.new($path_to_cache).dirname.mkpath
|
162
198
|
# save cache to disk
|
163
|
-
Dir.mkdir(File.dirname($path_to_cache)) unless File.exists?(File.dirname($path_to_cache))
|
164
199
|
File.open($path_to_cache, "w"){|to_file| Marshal.dump($cache, to_file)}
|
165
200
|
end
|
166
201
|
end
|
202
|
+
|
data/lib/jektex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jektex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Černý
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -108,7 +108,7 @@ licenses:
|
|
108
108
|
- GPL-3.0-or-later
|
109
109
|
metadata:
|
110
110
|
bug_tracker_uri: https://github.com/yagarea/jektex/issues
|
111
|
-
documentation_uri: https://github.com/yagarea/jektex
|
111
|
+
documentation_uri: https://github.com/yagarea/jektex/blob/master/README.md
|
112
112
|
homepage_uri: https://github.com/yagarea/jektex
|
113
113
|
source_code_uri: https://github.com/yagarea/jektex
|
114
114
|
changelog_uri: https://github.com/yagarea/jektex/blob/master/changelog.md
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.3.
|
130
|
+
rubygems_version: 3.3.8
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Highly optimized latex rendering for Jekyll
|