78. Load and Convert Files
To parse a file into an Asciidoctor::Document object:
doc = Asciidoctor.load_file 'mysample.adoc'
You can get information about the document:
puts doc.doctitle
puts doc.attributes
More than likely, you will want to convert the document. To convert a file containing AsciiDoc markup to HTML 5, use:
Asciidoctor.convert_file 'mysample.adoc'
The command will output to the file mysample.html in the same directory.
You can convert the file to DocBook 5.0 by setting the :backend option to 'docbook':
Asciidoctor.convert_file 'mysample.adoc', backend: 'docbook'
The command will output to the file mysample.xml in the same directory. If you’re on Linux, you can view the file using Yelp.