Assets 4

This release is based on Asciidoctor 1.5.8 and Opal 0.11.99.dev (6703d8d).

Changelog

Bug fixes

  • Allow the name of the extension to be null/undefined (#591)
  • AbstractNode.getId should return undefined if the node id is Opal.nil (#593)
  • Include trailing slash on Windows path (#594)
  • Preserve built-in object methods Function, Error... (#594)

Improvements

  • Upgrade Opal to version 0.11.1.dev@6703d8d (#594)
  • Upgrade Asciidoctor to version 1.5.8 0c35ace
  • Map Processor#resolvesAttributes method in the API (#578)
asciidoctor.Extensions.create(function () {
  this.blockMacro(function () {
    this.named('attribute')
    this.resolvesAttributes('1:value')
    this.process((parent, target, attrs) => {
      parent.getDocument().setAttribute(target, attrs['value'])
    })
  })
})
  • Map Document#setHeaderAttribute method in the API (#579)
asciidoctor.Extensions.create(function () {
  this.blockMacro(function () {
    this.named('header_attribute')
    this.resolvesAttributes('1:value')
    this.process((parent, target, attrs) => {
      parent.getDocument().setHeaderAttribute(target, attrs['value'])
    })
  })
})
  • Map Processor#createList method in the API (#580)
asciidoctor.Extensions.register('test', function () {
  this.block(function () {
    this.named('test')
    this.onContext('paragraph')
    this.process((parent) => {
      parent.append(this.createList(parent, 'ulist'))
    })
  })
})
  • Map Processor#createListItem method in the API (#588)
asciidoctor.Extensions.register('test', function () {
  this.block(function () {
    this.named('test')
    this.onContext('paragraph')
    this.process((parent) => {
      const list = this.createList(parent, 'ulist')
      list.append(this.createListItem(list, 'foo'))
      list.append(this.createListItem(list, 'bar'))
      list.append(this.createListItem(list))
      parent.append(list)
    })
  })
})
  • Map Document#getAuthors method in the API (#581)
const input = `= Getting Real: The Smarter, Faster, Easier Way to Build a Successful Web Application
David Heinemeier Hansson <david@37signals.com>

Getting Real details the business, design, programming, and marketing principles of 37signals.`
const doc = asciidoctor.load(input)
const author = doc.getAuthors()[0]
console.log(author.getEmail()) // 'david@37signals.com'
console.log(author.getName()) // 'David Heinemeier Hansson'
console.log(author.getFirstName()) // 'David'
console.log(author.getMiddleName()) // 'Heinemeier'
console.log(author.getLastName()) // 'Hansson'
console.log(author.getInitials()) // 'DHH'
  • Processor#createImageBlock should set title and caption if title attribute is set (#582)
  • Use Asciidoctor.StopIteration exception to stop iteration in findBy (#585)
let stop = false
const result = doc.findBy((candidate) =>  {
  if (stop) {
    throw new asciidoctor.StopIteration()
  }
  if (candidate.getContext() === 'paragraph') {
    if (candidate.getParent().getContext() === 'sidebar') {
      stop = true
    }
    return true
  }
})
  • Use skip and skip_children to skip iteration in findBy (#586)
const result = doc.findBy((candidate) => {
  const ctx = candidate.getContext()
  if (ctx === 'example') {
    return 'skip'
  } else if (ctx === 'paragraph') {
    return true
  }
})
const result = doc.findBy((candidate) => {
  if (candidate.getContext() === 'example') {
    return 'skip_children'
  }
})
  • Map AbstractBlock#hasTitle method in the API (#592)
console.log(doc.getBlocks()[0].hasTitle) // true or false
  • Introduce DSL method to mark document processor as preferred (#587)
const SelfSigningTreeProcessor = asciidoctor.Extensions.createTreeProcessor('SelfSigningTreeProcessor', {
  process: function (document) {
    document.append(this.createBlock(document, 'paragraph', 'SelfSigningTreeProcessor', {}))
  }
})
asciidoctor.Extensions.register(function () {
  this.treeProcessor(function () {
    const self = this
    self.process(function (doc) {
      doc.append(self.createBlock(doc, 'paragraph', 'd', {}))
    })
  })
  this.treeProcessor(function () {
    const self = this
    self.prefer()
    self.process(function (doc) {
      doc.append(self.createBlock(doc, 'paragraph', 'c', {}))
    })
  })
  this.prefer('tree_processor', asciidoctor.Extensions.newTreeProcessor('AwesomeTreeProcessor', {
    process: function (doc) {
      doc.append(this.createBlock(doc, 'paragraph', 'b', {}))
    }
  }))
  this.prefer('tree_processor', asciidoctor.Extensions.newTreeProcessor({
    process: function (doc) {
      doc.append(this.createBlock(doc, 'paragraph', 'a', {}))
    }
  }))
  this.prefer('tree_processor', SelfSigningTreeProcessor)
})

As a result, prepend function is now deprecated

  • Map Converter.Factory#register method in the API (#600)
asciidoctor.ConverterFactory.register(new DummyConverter(), ['dummy'])
  • Map AbstractNode#getNodeName method in the API (#599)
console.log(doc.getBlocks()[0].getNodeName()) // 'quote', 'image', 'ulist'...
  • Map BlockMacroProcessor#getName, InlineMacroProcessor#getName and BlockProcessor#getName methods in the API (#598)
const registry = asciidoctor.Extensions.create()
const shoutBlockProcessor = asciidoctor.Extensions.newBlockProcessor('ShoutBlockProcessor', {
  process: function (parent, reader) {
    const lines = reader.getLines().map((l) => l.toUpperCase())
    return this.createBlock(parent, 'paragraph', lines)
  }
})
console.log(shoutBlockProcessor.getName()) // undefined
registry.block('shout', shoutBlockProcessor)
console.log(shoutBlockProcessor.getName()) // 'shout'
  • Map the built-in Html5Converter in the API (#601)
asciidoctor.Html5Converter.$new() // instantiate the default HTML5 converter
  • Map Document#getIndexTerms, Document#getRefs, Document#getIds, Document#getLinks and Document#getImages methods in the API (#603)
const doc = asciidoctor.load(input, {'catalog_assets': true})
doc.convert()  // available only once the document has been converted
const linksCatalog = doc.getLinks()
const doc = asciidoctor.load(input, {catalog_assets: true})
const imagesCatalog = doc.getImages()
const doc = asciidoctor.load(input)
const refsCatalog = doc.getRefs()
const doc = asciidoctor.load(input)
const idsCatalog = doc.getIds()
const doc = asciidoctor.load(input)
doc.convert() // available only once the document has been converted
const indexTermsCatalog = doc.getIndexTerms()

📖 API documentation

Infrastructure

  • Remove sudo:false as recommended by Travis (#604)

Released on: 2018-11-25
Released by: @Mogztter
Published by: Travis

@Mogztter Mogztter released this Nov 25, 2018

Assets 2

⚠️ This version has been unpublished from npmjs.

There was an issue during the release process and, as result, the package published on npmjs was empty. Please use version 1.5.9 📦

@Mogztter Mogztter released this Oct 30, 2018 · 54 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.7.1 and Opal 0.11.99.dev (e2167f4b).

What's new and noteworthy...

In this release, we added initial support for GraalVM. If you want to embed Asciidoctor.js in a JVM-based application with GraalVM, please read the dedicated section in the User Manual.

A complete set of API is available to take full advantage of the new logging system introduced in Asciidoctor 1.5.7. Everything you need to know about the new Logging API is described in the User Manual:

Changelog

Includes everything from 1.5.7-rc.1 and more!

Bug fixes

  • Processor could hang when parsing overlapping passthrough in monospaced text (#542) thanks @mojavelinux

Improvements

  • Update to Opal 0.11.1.dev@3c8d93e (#511)
  • Produce a GraalVM compatible version of Asciidoctor.js (#559)
  • Add a Logger API (#553)
const defaultLogger = asciidoctor.LoggerManager.getLogger();
console.log(defaultLogger.getLevel()); // 2
console.log(defaultLogger.getProgramName()); // asciidoctor
console.log(defaultLogger.getMaxSeverity()); // 2

defaultLogger.setProgramName('asciidoctor.js');
console.log(defaultLogger.getProgramName()); // asciidoctor.js

defaultLogger.setLevel(3);
console.log(defaultLogger.getLevel()); // 3
  • Add a LoggerManager API (#553)
defaultLogger.setFormatter(asciidoctor.LoggerManager.newFormatter('JsonFormatter', {
  call: function (severity, time, programName, message) {
    const text = message['text'];
    return JSON.stringify({
      programName: programName,
      message: text,
      severity: severity
    }) + '\n';
  }
});
  • Add a Logger API (#557)
asciidoctor.LoggerManager.setLogger(asciidoctor.LoggerManager.newLogger('AsyncFileLogger', {
  postConstruct: function () {
    this.writer = fs.createWriteStream(logFile, {
      flags: 'a'
    });
  },
  add: function (severity, _, message) {
    const log = this.formatter.call(severity, new Date(), this.progname, message);
    this.writer.write(log);
  }
}));
const doc = asciidoctor.load(source);
console.log(doc.hasBlocks());
parent.append(this.createBlock(parent, 'paragraph', 'this was only a test'));
  • Map AbstractBlock#numeral, AbstractBlock#getNumeral, AbstractBlock#setNumeral in the API (#548)
 const appendix = doc.getBlocks()[0];
console.log(appendix.getNumeral()) // A

appendix.setNumeral('B');
console.log(appendix.getNumeral()); // B
  • Map NullLogger class (#554)
  • Improve createInline function and extension initialization (#555)
  • Use simpler mechanism to convert from Opal hash to JavaScript object (#537) thanks @mojavelinux

📖 API documentation

Infrastructure

  • The User Manual is now published with Antora on Netlify
    • Improve the Getting Started section (#513)
    • Document each extension points (#519)
    • Document how to apply a theme (#520)
    • Document how to use the new Logging system introduced in Asciidoctor 1.5.7 (#551)
    • Document how to use Asciidoctor.js with GraalVM (#566)
  • Switch back to npm and remove yarn.lock (#494)
  • Run npm audit fix to fix security issues (74c22c1)
  • Replace async module with Promise in npm tasks (#560)

Release Meta

Released on: 2018-10-30
Released by: @Mogztter
Published by: Travis

Pre-release

@Mogztter Mogztter released this Jul 8, 2018 · 93 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.7.1 and Opal 0.11.1.dev (3c8d93e).

Changelog

Breaking changes

  • Asciidoctor.js now requires Node 8.11+ and npm 5+

Bug fixes

Improvements

  • Update to Opal 0.11.1.dev@3c8d93e (#511)
  • 🎉 Opal now uses Object.defineProperty for methods and props opal/opal#1821. It should fix infinite loop when using for (let prop in obj) on Opal objects
  • Experimental Extension API: Allow class and class instance to be registered as (#412)
// Create an include processor class called StaticIncludeProcessor
const registry = asciidoctor.Extensions.create();
registry.includeProcessor(asciidoctor.Extensions.createIncludeProcessor('StaticIncludeProcessor', {
  process: (doc, reader, target, attrs) => {
    reader.pushInclude(['included content'], target, target, 1, attrs);
  }
}));
// Also available:
// - asciidoctor.Extensions.createDocinfoProcessor
// - asciidoctor.Extensions.createBlockProcessor
// - asciidoctor.Extensions.createInlineMacroProcessor
// - asciidoctor.Extensions.createBlockMacroProcessor
// - asciidoctor.Extensions.createTreeProcessor
// - asciidoctor.Extensions.createPreprocessor
// - asciidoctor.Extensions.createPostprocessor
// Create and instantiate an include processor class called StaticIncludeProcessor
const registry = asciidoctor.Extensions.create();
registry.includeProcessor(asciidoctor.Extensions.newIncludeProcessor('StaticIncludeProcessor', {
  process: function (doc, reader, target, attrs) {
    reader.pushInclude(['included content'], target, target, 1, attrs);
  }
}));
// Also available:
// - asciidoctor.Extensions.newDocinfoProcessor
// - asciidoctor.Extensions.newBlockProcessor
// - asciidoctor.Extensions.newInlineMacroProcessor
// - asciidoctor.Extensions.newBlockMacroProcessor
// - asciidoctor.Extensions.newTreeProcessor
// - asciidoctor.Extensions.newPreprocessor
// - asciidoctor.Extensions.newPostprocessor
// Create an include processor class with:
// - an overloaded constructor "initialize" to store the variable "value"
// - a "postConstruct" function to define the variable "bar" once the processor has been instantiated
const registry = asciidoctor.Extensions.create();
let includeProcessor = asciidoctor.Extensions.createIncludeProcessor('StaticIncludeProcessor', {
  initialize: function (value) {
    this.value = value;
    this.super();
  },
  postConstruct: function () {
    this.bar = 'bar';
  },
  process: function (doc, reader, target, attrs) {
    // In this example, this.value equals "foo" and this.bar equals "bar"
    reader.pushInclude([this.value + this.bar], target, target, 1, attrs);
  }
});
let includeProcessorInstance = includeProcessor.$new('foo'); // "initialize" function will be called with value "foo"
registry.includeProcessor(includeProcessorInstance);

📖 API documentation

Infrastructure

  • The tests suite has been restructured to be faster and easier to debug (#506)
    • npm run test:node will run the tests suite against Node.js
    • npm run test:browser will run the tests suite against Chrome
    • npm run test:nashorn will run the tests suite against Nashorn
  • Add jsDeliver badge on the README (#509)
  • cdnjs now contains the latest version of Asciidoctor.js: https://cdnjs.com/libraries/asciidoctor.js/1.5.7-beta.1

Release Meta

Released on: 2018-07-08
Released by: @Mogztter
Published by: Travis

Pre-release

@Mogztter Mogztter released this May 10, 2018 · 103 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.7.1 and Opal 0.11.1.dev (3d856c4).

Changelog

Breaking changes

  • Attributes passed to process method of an extension are now converted to JavaScript object (#477)
registry.inlineMacro(function () {
  const self = this;
  self.named('emoji');

  self.process(function (parent, target, attrs) {
    // const sizeAttr = attrs['$[]']('size');
    const sizeAttr = attrs.size;
  });
});

NOTE: If you are using IE11, you will need to add a polyfill on Proxy.

Bug fixes

  • Escaped pipes are now interpreted in tables (#482) thanks @mlind
|===
|`-a\|-b`|Options cannot be used together
|===

Improvements

  • Update to Opal 0.11.1.dev@3d856c4 (#486)
  • ⚡️ Performance improvement up to 10% thanks to the Regex cache in Opal
  • Core API: Map Section getters and setters methods (#500)
const source = `= Title

== First section`;
const doc = asciidoctor.load(source);
console.log(doc.hasSections()); // true
console.log(doc.getSections().length); // 1
const firstSection = doc.getSections()[0];
console.log(firstSection.getIndex()); // 0
console.log(firstSection.getTitle()); // First section
console.log(firstSection.getSectionName()); // section
// ...
  • Extension API: Add a prepend function to prepend document extension (#492)
registry.preprocessor(function () {
  const self = this;
  self.prepend();
  self.process(function (doc, reader) {
    // ...
  });
});

📖 API documentation

Infrastructure

  • Run the examples task on AppVeyor (#495)
  • Upgrade dev dependencies
    • asciidoctor-docbook.js to 1.5.6-rc1 (#488)
    • puppeteer to 1.3.0 (#487)
    • bestikk-uglify to 0.2.2 (#496)
    • documentation to 6.3.2 (#497)
    • eslint to 4.19.1 (#498)
    • ... (#498)
  • Build against Asciidoctor (core) 1.5.7.1

Release Meta

Released on: 2018-05-10
Released by: @Mogztter
Published by: @Mogztter

@Mogztter Mogztter released this Apr 17, 2018 · 121 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.6.2 and Opal 0.11.1.dev (ceda559).

As a reminder, Asciidoctor.js now provides different builds for different JS environments:

Environment File
Browser dist/browser/asciidoctor.js
Node/Electron dist/node/asciidoctor.js
Nashorn dist/nashorn/asciidoctor.js
UMD dist/umd/asciidoctor.js

For backward compatibility, dist/asciidoctor.js and dist/asciidoctor.min.js are still available.

Changelog

Includes everything from 1.5.6-rc.1 and more!

Bug fixes

  • Fix failure when retrieving extension groups when none have been defined (#434)
  • Fix Extensions#unregister when names are passed as array (#469)

Improvements

  • Include directive is now working on http and https URI in a Node.js environment (#472)
const opts = {
  safe: 'safe',
  attributes: {'allow-uri-read': true}
};
const html = asciidoctor.convert('include::https://raw.com/document.adoc[tag=intro]', opts);
  • Update to Opal 0.11.1.dev@ceda559 (#472)
  • Return undefined if the subtitle is Opal.nil (#473)
  • Core API: Map AbstractNode#getParent (#461)
const doc = asciidoctor.load('= Document Title\n\ncontent', options);
console.log(doc.getParent()); // undefined
console.log(doc.getBlocks()[0].getParent()) // the parent doc
  • Core API: Map substitution methods on AbstractBlock (#462)
const source = '----\nverbatim <1>\n----\n<1> verbatim text';
const listingBlock = asciidoctor.load(source).findBy({ context: 'listing' })[0];

// getSubstitutions
console.log(listingBlock.getSubstitutions()); // ['specialcharacters', 'callouts']

// hasSubstitution
console.log(listingBlock.hasSubstitution('callouts')); // true
console.log(listingBlock.hasSubstitution('macros')); // false

// removeSubstitution
listingBlock.removeSubstitution('callouts'); 
console.log(listingBlock.hasSubstitution('callouts')); // false
const source = '----\nverbatim <1>\n----\n<1> verbatim text';
const listingBlock = asciidoctor.load(source).findBy({ context: 'listing' })[0];
console.log(listingBlock.getSubstitutions()); // ['specialcharacters', 'callouts']
  • Extension API: Map method to register block on multiple contexts (#465)
asciidoctor.Extensions.register(function () {
  this.block(function () {
    this.named('cloak');
    this.onContexts('paragraph', 'literal');
    this.process((parent, reader, attrs) => {
      return this.createBlock(parent, 'paragraph', 'cloaked: ' + Opal.hash_get(attrs, 'cloaked-context'));
    });
  });
});

📖 API documentation

Release Meta

Released on: 2018-04-17
Released by: @Mogztter
Published by: Travis!

Pre-release

@Mogztter Mogztter released this Mar 22, 2018 · 133 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.6.2 and Opal 0.11.1.dev (fc20415).

The most notable improvement in this release is that the logic for resolving the path of an include directive is now overridden in Asciidoctor.js in order to properly resolve the path of an include directive in the browser environment.

We're also happy to report that Asciidoctor.js now provides different builds for different JS environments:

Environment File
Browser dist/browser/asciidoctor.js
Node/Electron dist/node/asciidoctor.js
Nashorn dist/nashorn/asciidoctor.js
UMD dist/umd/asciidoctor.js

For backward compatibility, dist/asciidoctor.js and dist/asciidoctor.min.js are still available.

Next stop 1.5.6 🎉

Changelog

Bug fixes

  • Preserve read error reason in File.read (#434)
  • AbstractNode.isAttribute now returns true or false (#432)
  • AbstractBlock.getTitle now returns undefined if the title is not set (#429)

Improvements

  • Upgrade to Opal 0.11.1.dev@fc20415 (#384)
  • Properly resolve the path of an include directive in the browser environment (#441)
  • Use escape code in regular expressions instead of raw glyphs (#395)
  • Allow class or class instance to be registered as an extension (#453)
  • Core API: Add AbstractNode.hasAttribute (#431)
doc.hasAttribute('sectnums'); // true or false
  • Core API: Add Reader.getString (#443)
const doc = asciidoctor.load('line one\nline two\nline three', { parse: false });
console.log(doc.getReader().getString()); // line one\nline two\nline three
  • Core API: Retrieve a converter instance from the converter factory (#451)
const converter = asciidoctor.Converter.Factory.getDefault(false).create('html5');
const para = asciidoctor.load('text').getBlocks()[0];
console.log(converter.convert(para)); // <p>text</p>
  • Extension API: Add Processor.createImageBlock (#442)
this.blockMacro(function () {
  this.named('img');
  this.process((parent, target) => {
    return this.createImageBlock(parent, { target: target + '.png' });
  });
});
  • Extension API: Add Extensions.getGroups, Extensions.unregisterAll and Extensions.unregister (also available on a Registry) (#450)
const registry = asciidoctor.Extensions.create();
// ...
const groups = registry.getGroups();
registry.unregister('test');
registry.unregisterAll();

📖 API documentation

Infrastructure

  • Provide each implementation as a file (#425)
  • Add a build:quick task for a fast feedback loop while coding on the API (#449)
  • Allow ASCIIDOCTOR_CORE_VERSION to reference a fork (#439)
ASCIIDOCTOR_CORE_VERSION=mojavelinux/asciidoctor#v1.5.6.x
  • Refactor benchmark scripts (#421)
  • Update link to opalrb website in the README (#422). Thanks @1602
  • Upgrade development dependencies (#419, #414, #415, #416, #417)
  • Use yarn to speed up build on CI (#418)

Release Meta

Released on: 2018-03-22
Released by: @Mogztter
Published by: Travis!

Pre-release

@Mogztter Mogztter released this Jan 28, 2018 · 178 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.6.1 and Opal 0.11.0.dev (integration).

Changelog

Bug fixes

  • ReferenceError: "plaform" is not defined with Nashorn (#390). Thanks @jmini

Improvements

  • Implement Dir.pwd in Nashorn (#392)
  • Add a stub to support URI (#398)
  • Core API: Add List.getItems and ListItem.getText (#401). Thanks @mojavelinux
  • Core API: Add Block.getSourceLines and Block.getSource (#402). Thanks @mojavelinux
  • Core API: Set document title and title to undefined if not set (#403). Thanks @mojavelinux

📖 API documentation

Infrastructure

  • Convert README to Markdown before publishing package to npmjs (#411). Thanks @mojavelinux

Release Meta

Released on: 2017-01-28
Released by: @Mogztter
Published by: Travis!

Pre-release

@Mogztter Mogztter released this Oct 8, 2017 · 197 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.6.1 and Opal 0.11.0.dev (integration).

Changelog

Bug fixes

  • Processor fails to convert document containing a certain sequence of characters (#367). Thanks @mojavelinux
  • Document.getBaseDir always returns "undefined" (#380)
  • Opal.const_get_qualified does not resolve ThreadSafe.Cache (#370)

Improvements

  • Core API: Add AbstractBlock.getCaptionedTitle (#349)
const doc = asciidoctor.load(`= The Dangerous Documentation Chronicles: Based on True Events
:title: The Actual Dangerous Documentation Chronicles`);
console.log(doc.getCaptionedTitle()); // The Actual Dangerous Documentation Chronicles
  • Core API: Add Asciidoctor.getCoreVersion (#362)
const version = asciidoctor.getCoreVersion(); // Asciidoctor core (Ruby) version
  • Core API: Add Asciidoctor.getVersion (#362)
const version = asciidoctor.getVersion(); // Asciidoctor.js version
  • Extensions API: Add Extensions.unregisterAll to unregister all statically-registered extension groups
  • Move xmlhttprequest as a dev dependency (#387)

📖 API documentation

Release Meta

Released on: 2017-10-08
Released by: @Mogztter
Published by: Travis!

@Mogztter Mogztter released this Oct 8, 2017 · 209 commits to master since this release

Assets 4

This release is based on Asciidoctor 1.5.5 and Opal 0.11.0.dev (integration).

Changelog

Includes everything from 1.5.5-5 and more!

Improvements

Release Meta

Released on: 2017-10-08
Released by: @Mogztter
Published by: Travis!