Installation
Add this line to your application’s Gemfile:
gem "coradoc"
And then execute:
bundle install
Or install it yourself as:
gem install coradoc
Setup
Clone the repository.
git clone https://github.com/metanorma/coradoc.git
Setup your environment in docker
make setup
Run the test suite
make test
Usage from command line
Converting a document
$ coradoc help convert
$ coradoc convert file.html -o file.adoc
Usage from Ruby
Parsing a document
To parse any AsciiDoc, we can use the following:
This interface will return the abstract syntax tree.
Converting a document
To convert any document of a supported format (right now: .html
, .adoc
, .docx
) to any supported
format (right now: .adoc
), you can execute:
The converters are chosen based on file extension, but you can select a converter manually like so:
Some converters may support additional options, which can likewise be passed as keyword arguments:
It is also possible to pass IO objects instead of filenames. By default, if an argument is not provided, it defaults to STDIN/STDOUT. Note that not all combinations of formats and converter options are supported in this mode.