asciidoctor-katex
Advanced tools
Comparing version 0.3.2 to 0.4.0
@@ -17,3 +17,3 @@ (function (Opal) { | ||
Opal.const_set($nesting[0], 'VERSION', "0.3.2") | ||
Opal.const_set($nesting[0], 'VERSION', "0.4.0") | ||
})($nesting[0], $nesting) | ||
@@ -446,2 +446,46 @@ })($nesting[0], $nesting) | ||
/* Generated by Opal 0.11.99.dev */ | ||
Opal.modules["asciidoctor/katex/postprocessor"] = function(Opal) { | ||
var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy; | ||
Opal.add_stubs(['$==', '$skip?', '$sub', '$protected', '$!=', '$backend']); | ||
if ($$($nesting, 'RUBY_PLATFORM')['$==']("opal")) { | ||
} else { | ||
nil | ||
}; | ||
if ($$($nesting, 'RUBY_PLATFORM')['$==']("opal")) { | ||
} else { | ||
nil | ||
}; | ||
return (function($base, $parent_nesting) { | ||
var self = $module($base, 'Katex'); | ||
var $nesting = [self].concat($parent_nesting); | ||
(function($base, $super, $parent_nesting) { | ||
var self = $klass($base, $super, 'Postprocessor'); | ||
var $nesting = [self].concat($parent_nesting), $Postprocessor_process$1, $Postprocessor_skip$ques$2; | ||
Opal.def(self, '$process', $Postprocessor_process$1 = function $$process(document, output) { | ||
var self = this; | ||
if ($truthy(self['$skip?'](document))) { | ||
return output}; | ||
return output.$sub(/<script type="text\/x-mathjax-config">.*?<\/script>/m, "").$sub(/<script src=".*?\/MathJax\.js\?config=TeX-MML-AM_HTMLorMML"><\/script>/, ""); | ||
}, $Postprocessor_process$1.$$arity = 2); | ||
self.$protected(); | ||
return (Opal.def(self, '$skip?', $Postprocessor_skip$ques$2 = function(document) { | ||
var self = this; | ||
return document.$backend()['$!=']("html5") | ||
}, $Postprocessor_skip$ques$2.$$arity = 1), nil) && 'skip?'; | ||
})($nesting[0], $$$($$$($$($nesting, 'Asciidoctor'), 'Extensions'), 'Postprocessor'), $nesting) | ||
})($$($nesting, 'Asciidoctor'), $nesting); | ||
}; | ||
/* Generated by Opal 0.11.99.dev */ | ||
(function(Opal) { | ||
@@ -463,2 +507,3 @@ var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice; | ||
self.$require("asciidoctor/katex/treeprocessor"); | ||
self.$require("asciidoctor/katex/postprocessor"); | ||
if ($$($nesting, 'RUBY_PLATFORM')['$==']("opal")) { | ||
@@ -520,2 +565,9 @@ return nil | ||
/** | ||
* @return A new instance of `Asciidoctor::Katex::Postprocessor`. | ||
*/ | ||
function PostProcessor () { | ||
return resolveModule('Postprocessor').$new() | ||
} | ||
/** | ||
* @return {string} Version of this extension. | ||
@@ -541,3 +593,4 @@ */ | ||
} | ||
var processor = TreeProcessor(opts); | ||
var treeProcessor = TreeProcessor(opts) | ||
var postProcessor = PostProcessor() | ||
@@ -547,7 +600,9 @@ // global registry | ||
registry.register(function () { | ||
this.treeProcessor(processor) | ||
this.treeProcessor(treeProcessor) | ||
this.postprocessor(postProcessor) | ||
}) | ||
// custom registry | ||
} else if (typeof registry.block === 'function') { | ||
registry.treeProcessor(processor) | ||
registry.treeProcessor(treeProcessor) | ||
registry.postprocessor(postProcessor) | ||
} else { | ||
@@ -561,2 +616,3 @@ throw new TypeError('Invalid registry object') | ||
TreeProcessor: TreeProcessor, | ||
PostProcessor: PostProcessor, | ||
getVersion: getVersion, | ||
@@ -563,0 +619,0 @@ register: register, |
{ | ||
"name": "asciidoctor-katex", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "Asciidoctor extension that converts latexmath to HTML using KaTeX at build-time", | ||
@@ -5,0 +5,0 @@ "author": "Jakub Jirutka <jakub@jirutka.cz>", |
@@ -1,2 +0,7 @@ | ||
This project provides an [Asciidoctor](http://asciidoctor.org/) extension for converting block and inline [STEM](https://asciidoctor.org/docs/user-manual/#activating-stem-support) in TeX notation (latexmath) to HTML using [KaTeX](https://khan.github.io/KaTeX) library right during document conversion (instead of in browser on client-side). | ||
This project provides an [Asciidoctor](http://asciidoctor.org/) | ||
extension for converting block and inline | ||
[STEM](https://asciidoctor.org/docs/user-manual/#activating-stem-support) | ||
in TeX notation (latexmath) to HTML using | ||
[KaTeX](https://khan.github.io/KaTeX) library right during document | ||
conversion (instead of in browser on client-side). | ||
@@ -8,3 +13,4 @@ Requirements | ||
- [@asciidoctor/core](https://www.npmjs.com/package/@asciidoctor/core) >=2.0.0 <2.2.0 | ||
- [@asciidoctor/core](https://www.npmjs.com/package/@asciidoctor/core) >=2.0.0 | ||
<2.2.0 | ||
@@ -63,4 +69,8 @@ - [katex (module)](https://www.npmjs.com/package/katex) >=0.9.0 | ||
requireStemAttr | ||
Whether to require `stem` attribute to be defined (Asciidoctor’s standard behaviour). Set to `false` to process latexmath even when `stem` attribute is not defined. Default is `true`. | ||
Note that the default stem type hard-coded by Asciidoctor is `asciimath` (not `latexmath`), so `[stem]` block and `stem:[...]` macro will not be rendered anyway (only `[latexmath]` block and `latexmath:[...]` macro). | ||
Whether to require `stem` attribute to be defined (Asciidoctor’s | ||
standard behaviour). Set to `false` to process latexmath even when | ||
`stem` attribute is not defined. Default is `true`. | ||
Note that the default stem type hard-coded by Asciidoctor is `asciimath` | ||
(not `latexmath`), so `[stem]` block and `stem:[...]` macro will not be | ||
rendered anyway (only `[latexmath]` block and `latexmath:[...]` macro). | ||
@@ -73,2 +83,4 @@ katexOptions | ||
This project is licensed under [MIT License](http://opensource.org/licenses/MIT/). For the full text of the license, see the [LICENSE](LICENSE) file. | ||
This project is licensed under [MIT | ||
License](http://opensource.org/licenses/MIT/). For the full text of the | ||
license, see the [LICENSE](LICENSE) file. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33995
466
84