asciidoctor-latexmath 1.0.0.beta.2 → 1.0.0.pre.dev.1
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/lib/asciidoctor-latexmath/renderer.rb +4 -15
- data/lib/asciidoctor-latexmath/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76676b29d9c14de950508c4620ede617e51f5cc874ad9c16aa8ac9fe98726304
|
4
|
+
data.tar.gz: c361670b70f0db1ea1f1756698af831b94bd257186080bae157cfce6607b6e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70205787e5d7cf969ff5015afa71130f1e90b187da5103a0a6ca2c468edb6555e9fd539eb60b4fce7e5185880b79b0804fc152ae3b4e1b3a0998bb97957b52ea
|
7
|
+
data.tar.gz: 7f618f19aa454abf8c60790b0d0d666efbd902bf2757ca3e66617f745ee8b275ed7323630e1ba757ae726fd305cee2ff26496b267111e7d7e9b4da07691d3be8
|
@@ -11,7 +11,6 @@ require "shellwords"
|
|
11
11
|
require "digest"
|
12
12
|
require "pathname"
|
13
13
|
require "json"
|
14
|
-
require "cgi"
|
15
14
|
require "asciidoctor"
|
16
15
|
|
17
16
|
module Asciidoctor
|
@@ -57,16 +56,15 @@ module Asciidoctor
|
|
57
56
|
end
|
58
57
|
|
59
58
|
def render(equation:, display:, inline: false, id: nil, asciidoc_source: nil, source_location: nil)
|
60
|
-
|
61
|
-
basename = sanitize_basename(id) || auto_basename(normalized_equation)
|
59
|
+
basename = sanitize_basename(id) || auto_basename(equation)
|
62
60
|
inline_embed = inline && @inline_attribute
|
63
61
|
signature = cache_signature(
|
64
|
-
equation:
|
62
|
+
equation: equation,
|
65
63
|
display: display,
|
66
64
|
inline: inline,
|
67
65
|
inline_embed: inline_embed
|
68
66
|
)
|
69
|
-
equation_digest = Digest::SHA256.hexdigest(
|
67
|
+
equation_digest = Digest::SHA256.hexdigest(equation)
|
70
68
|
|
71
69
|
if @cache_enabled
|
72
70
|
if (cached = load_cached_render(basename, signature, equation_digest, inline_embed))
|
@@ -80,7 +78,7 @@ module Asciidoctor
|
|
80
78
|
tex_path = File.join(dir, "#{basename}.tex")
|
81
79
|
pdf_path = File.join(dir, "#{basename}.pdf")
|
82
80
|
|
83
|
-
latex_source = build_document(
|
81
|
+
latex_source = build_document(equation, display)
|
84
82
|
File.write(tex_path, latex_source)
|
85
83
|
begin
|
86
84
|
run_pdflatex(
|
@@ -512,15 +510,6 @@ module Asciidoctor
|
|
512
510
|
def latex_environment?(equation)
|
513
511
|
equation.match?(/\\begin\s*\{[^}]+\}/) && equation.match?(/\\end\s*\{[^}]+\}/)
|
514
512
|
end
|
515
|
-
|
516
|
-
def normalize_equation(equation)
|
517
|
-
return "" if equation.nil?
|
518
|
-
|
519
|
-
stripped = equation.to_s.strip
|
520
|
-
return "" if stripped.empty?
|
521
|
-
|
522
|
-
CGI.unescapeHTML(stripped).tr("\u00A0", " ")
|
523
|
-
end
|
524
513
|
end
|
525
514
|
end
|
526
515
|
end
|