Releases: asciidoctor/asciidoctor.js
v1.5.5-5
This release is based on Asciidoctor 1.5.5 and Opal 0.11.0.dev (integration).
Changelog
Includes everything from 1.5.5-4 and more!
Breaking changes
- Change casing of URI to Uri in functions
// Before
// doc.getIconURI('note');
// doc.getMediaURI('target');
// doc.getImageURI('target.jpg');
// After
doc.getIconUri('note');
doc.getMediaUri('target');
doc.getImageUri('target.jpg');
- Core API:
getAttributes
function now returns a JSON object (rather than an Opal.hash)
// Before
// var author = doc.getAttributes()['$[]']('author');
// After
var author = doc.getAttributes()['author'];
Improvements
- Upgrade to Opal 0.11.0.dev (integration)
- Core API: Attributes can now be defined in JSON format
// Before
// var options = { attributes: [ 'icons=font', 'sectnums=true' ] };
// After
var options = { attributes: { icons: 'font', sectnums: true } };
var doc = asciidoctor.load('= Test', options);
- Core API: Add alias
getDocumentTitle
togetDoctitle
function - Core API: Add alias
getRevisionDate
togetRevdate
function - Core API:
Asciidoctor.convert
andAsciidoctor.load
functions can be used with a Node.jsBuffer
// load from a Buffer
var doc = asciidoctor.load(fs.readFileSync('test.adoc'));
// convert from a Buffer
var html = asciidoctor.convert(fs.readFileSync('test.adoc'));
- Core API:
findBy
method
var doc = asciidoctor.loadFile('document.adoc');
// Using a function
var quoteBlocks = doc.findBy(function (b) { return b.getStyle() === 'quote'; });
// Using a selector
var sectionBlocks = doc.findBy({'context': 'section'});
// Using both a selector and a function
var abstractSectionBlocks = doc.findBy({'context': 'section'}, function (b) { return b.getTitle() === 'Second Section'; });
- Extensions API: register a block extension
Opal.Asciidoctor.$$scope.Extensions.register(function () {
this.block(function () {
var self = this;
self.named('shout');
self.onContext('paragraph');
self.process(function (parent, reader) {
var lines = reader.$lines().map(function (l) { return l.toUpperCase(); });
return self.createBlock(parent, 'paragraph', lines);
});
});
});
- Extensions API: register an inline macro
Opal.Asciidoctor.$$scope.Extensions.register(function () {
this.inlineMacro('smiley', function () {
var self = this;
self.process(function (parent, target) {
var text;
if (target == 'happy') {
text = ':D';
} else if (target == 'wink') {
text = ';)';
} else {
text = ':)';
}
return self.createInline(parent, 'quoted', text, { 'type': 'strong' }).convert();
});
});
});
Infrastructure
- Allow to skip to clean task with
SKIP_CLEAN
environment variable - Build against Asciidoctor core master
- Allow to build against a specific release with
ASCIIDOCTOR_CORE_VERSION
environment variable
- Allow to build against a specific release with
Release Meta
Released on: 2017-04-03
Released by: @Mogztter
v1.5.5-4
This release is based on Asciidoctor 1.5.5 and Opal 0.10.1.
Changelog
Includes everything from 1.5.5-3 and more!
Breaking changes
- Dobook backend has been moved to a dedicated repository and is no longer bundled with Asciidoctor.js core.
- Extensions has been moved to the
extensions
directory in thedist
folder. - Asciidoctor.js now includes extensions API by default and Opal will be automatically loaded. (meaning the
asciidoctor.js
file includes everything you need!) - Asciidoctor.js is now available as a Universal Module Definition
- Asciidoctor.js runtime environment can be configured.
As a result the instantiation of Asciidoctor.js is now consistent across JavaScript environments:
- Browser
<script src="node_modules/asciidoctor.js/dist/asciidoctor.min.js"></script>
var asciidoctor = Asciidoctor(); // available in the global scope
var content = '...';
var html = asciidoctor.convert(content);
console.log(html);
- Node
var Asciidoctor = require('asciidoctor.js');
var asciidoctor = Asciidoctor();
var content = '...';
var html = asciidoctor.convert(content);
console.log(html);
- Require.js (AMD)
<script data-main="scripts/main" src="scripts/require.js"></script>
define(['asciidoctor'], function(asciidoctor) {
var content = '...';
var html = asciidoctor.convert(content);
console.log(html);
});
Infrastructure
- Adds a Karma runner for Require.js
Release Meta
Released on: 2016-11-19
Released by: @Mogztter
v1.5.5-3
This release is based on Asciidoctor 1.5.5 and Opal 0.10.1.
Changelog
Includes everything from 1.5.5-2 and more!
Improvements
- Upgrade to Opal 0.10.1
- Upgrade to Asciidoctor 1.5.5
- Create a wrapper API
// Plain JSON object for options
var options = {safe: 'unsafe', attributes: ['showtitle', 'stylesheet=custom.css']};
// Method names are camel case (and without dollar sign)
var doc = Asciidoctor.load(content, options);
var footnotes = doc.getFootnotes();
var doctype = doc.getDoctype();
var lang = doc.getAttribute('lang');
var html = doc.convert();
- New features on Node.js
- Automatically load Opal's
nodejs
andpathname
modules. You no longer have to manually callOpal.load('nodejs')
andOpal.load('pathname')
when running on Node.js - Improve the path resolution of the default stylesheet
- Automatically load Opal's
- Initial support for template backends
- Convert an AsciiDoc content to a Reveal.js presentation using Asciidoctor Reveal.js
Infrastructure
- Extract reusable build modules to the Bestikk organization
- Compile Ruby code to JavaScript using Opal: bestikk-opal-compiler
- Download and install JDK Early Access Releases: bestikk-jdk-ea
- Do common file operations: bestikk-fs
- Uglify JavaScript files with Google Closure Compiler: bestikk-uglify
- Log to the console (with colors!): bestikk-log
Release Meta
Released on: 2016-10-22
Released by: @Mogztter
v1.5.5-2
This release is based on Asciidoctor 1.5.4 and Opal 0.10.1.
Changelog
Breaking changes
Opal 0.9 renamed the following properties on Hash object (#152):
keys
to$$keys
map
to$$map
smap
to$$smap
As mentioned in the Asciidoctor.js 1.5.3 changelog, you should not use Opal's internal properties.
Instead you should $attr method (available in the Asciidoctor public API):
var doc = Asciidoctor.$load('== Test');
// var value = doc.attributes.smap['doctitle'];
var value = doc.$attr('doctitle');
Improvements
- Upgrade to Opal 0.10.1
- Compile Asciidoctor LaTex to JavaScript
- New features on Node.js
Asciidoctor.$load_file
andAsciidoctor.$convert_file
methods are workingstylesheet
andstylesdir
attributes are supportedto_dir
andto_file
options are supported
Infrastructure
- Compile Asciidoctor to JavaScript in JavaScript (ie. Ruby/Rake/Bundler are no longer needed to build Asciidoctor.js)
- Asciidoctor.js build is now only using
npm
:
- Asciidoctor.js build is now only using
npm install
npm run build
Release Meta
Released on: 2016-08-24
Released by: @Mogztter
v1.5.4
This release is based on Asciidoctor 1.5.4 and Opal 0.9.0.beta2.
Changelog
Improvements
- Manual
require
has been removed - Extensions are now automatically required (
Opal.require
is no longer necessary) - Gzip version of Asciidoctor.js are not included in the
dist
folder - Made some progress on Node.js IO (hopefully includes from URI will soon be available in Node.js environment)
Infrastructure
- Fully automated release with npm (toward a 100% JavaScript build!)
- Switch to npm (task runner) and remove Grunt for the build
- Reduce the # of development dependencies
- Rewrite Rake tasks in JavaScript
- Replace Uglify by Google Closure Compiler to minify JavaScript
Release Meta
Released on: 2016-01-31
Released by: @Mogztter
v1.5.3
This release is based on Asciidoctor 1.5.3 and Opal 0.9.0.beta2.
Changelog
Breaking changes
Opal 0.8 renames map
to smap
on Hash
object.
map
and smap
are Opal's internal properties and you should use Hash.fetch method instead:
// var value = attributes.map['doctitle']
var value = attributes.$fetch['doctitle'];
var value = attributes['$[]']('doctitle'); // alternative syntax
Improvements
-
Simpler syntax to declare Asciidoctor options with
Opal.hash
// var options = Opal.hash2(['doctype', 'attributes'], {doctype: 'inline', attributes: ['showtitle']}); var options = Opal.hash({doctype: 'inline', attributes: ['showtitle']});
-
Remove Opal overrides/extensions from Asciidoctor.js (now directly integrated in Opal)
Release Meta
Released on: 2016-01-07
Released by: @Mogztter
v1.5.2
Update version in bower.json and package.json
v1.5.1
Upgrade bower.json and package.json to 1.5.1
v1.5.0
Merge pull request #49 from anthonny/docbook-backend Docbook backend
v1.5.0 Preview 7
- Upgrade to Opal 0.6.2 and Asciidoctor 1.5.0.preview.7
- Remove ERB converter templates in favor of built-in converter
- Enable includes
- Add hack to make version compliant with semantic versioning
- Fix numerous regular expression compatibility bugs