-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO: add QuickJS-specific class override here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
%x( | ||
var platform, engine, framework, ioModule; | ||
if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') { | ||
var runtime = moduleConfig.runtime; | ||
platform = runtime.platform; | ||
engine = runtime.engine; | ||
framework = runtime.framework; | ||
ioModule = runtime.ioModule; | ||
} | ||
ioModule = ioModule || 'quickjs'; | ||
platform = platform || 'quickjs'; | ||
engine = engine || ''; | ||
framework = framework || '') | ||
|
||
JAVASCRIPT_IO_MODULE = %x(ioModule) | ||
JAVASCRIPT_PLATFORM = %x(platform) | ||
JAVASCRIPT_ENGINE = %x(engine) | ||
JAVASCRIPT_FRAMEWORK = %x(framework) | ||
|
||
require 'asciidoctor/js/opal_ext/quickjs/file' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class File | ||
|
||
def self.read(path) | ||
%x{ | ||
const body = std.loadFile(path); | ||
if (body === null) { | ||
console.log(`unable to loadFile:"${path}" from:"${os.getcwd()[0]}" realpath:"${os.realpath(path)[0]}"`); | ||
} | ||
return body || ''; | ||
} | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* global Asciidoctor */ | ||
import Asciidoctor from '../../build/asciidoctor-quickjs.js' | ||
const asciidoctor = Asciidoctor() | ||
|
||
const data = '= asciidoctor.js, AsciiDoc in JavaScript\n' + | ||
'Doc Writer <docwriter@example.com>\n\n' + | ||
'Asciidoctor and Opal come together to bring\n' + | ||
'http://asciidoc.org[AsciiDoc] to the browser!.\n\n' + | ||
'== Technologies\n\n' + | ||
'* AsciiDoc\n' + | ||
'* Asciidoctor\n' + | ||
'* Opal\n\n' + | ||
'NOTE: That\'s all she wrote!!!\n\n' + | ||
'include::spec/fixtures/include.adoc[]' | ||
|
||
const options = { safe: 0, header_footer: true, attributes: { stylesheet: "spec/fixtures/css/simple.css", showtitle: true } } | ||
const html = asciidoctor.convert(data, options) | ||
console.log(html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* global Asciidoctor, ASCIIDOCTOR_JS_VERSION */ | ||
import * as std from 'std'; | ||
import * as os from 'os'; | ||
|
||
//{{opalCode}} | ||
|
||
const __path__ = { | ||
separator: os.platform == "win32" ? '\\' : '/', | ||
split(path) { return path.split(this.separator); }, | ||
join(compo) { return compo.join(this.separator); }, | ||
basename(path) { return this.join(this.split(path).slice(0,-1)); }, | ||
dirname(path) { return this.split(path).pop(); }, | ||
}; | ||
const __asciidoctorDistDir__ = os.realpath(scriptArgs[0])[0].match(os.platform == "win32" ? /.*\\/ : /.*\//); | ||
|
||
export default function (moduleConfig) { | ||
//{{asciidoctorCode}} | ||
|
||
//{{asciidoctorAPI}} | ||
|
||
//{{asciidoctorVersion}} | ||
|
||
/** | ||
* Get Asciidoctor.js version number. | ||
* | ||
* @memberof Asciidoctor | ||
* @returns {string} - returns the version number of Asciidoctor.js. | ||
*/ | ||
Asciidoctor.prototype.getVersion = function () { | ||
return ASCIIDOCTOR_JS_VERSION | ||
} | ||
return Opal.Asciidoctor | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters