Login  Register

extensions in 1.5 - fixing asciidoc-bib

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

extensions in 1.5 - fixing asciidoc-bib

plane
Hi list,

With version 1.5.2 of asciidoctor, my plugin asciidoc-bib no longer works.  I had this working on 0.1.4 using a custom script, asciidoctor-bib, which hooked into asciidoctor.

Reading about the new extensions mechanism, it appears I should be doing the following:

1. write the plugin as a simple class:

class AsciidoctorBibExtension < Asciidoctor::Extensions::Preprocessor
  def process reader, lines
...
  end
end

2. register the plugin with asciidoctor, using something like:

Asciidoctor::Extensions.register do
  preprocessor AsciidoctorBibExtension
end

(I'm assuming I can do this as a post-install step when someone installs my gem?)

3. use the plugin with:

> asciidoctor -r asciidoc-bib document.adoc

(I'm not sure if I need to do something to get the right name for the -r option, or is it simply the registered ruby gem?)

Is the above approximately right?    

In my version for asciidoc, the processing is done in two passes, and asciidoc-bib is an executable which takes some options to change the style and other details of how the references and bibliography are created.  In my version for 0.1.4 I had these options passed to my custom script.  Is it possible to pass options from the command-line in a similar style using the form?

> asciidoctor -r asciidoc-bib MY-OPTIONS ASCIIDOCTOR-OPTIONS document.adoc

Or do I need to do something else to include options for my plugin?

Sorry if I missed any documentation which covers this.  I've looked at the extensions page of the user-manual, which does not cover how the user runs this from a CLI, and I've also looked at the extensions-lab examples, which also did not answer my questions.

  thanks for any help,

       Peter.

Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: extensions in 1.5 - fixing asciidoc-bib

mojavelinux
Administrator
Peter,

There were several changes to the extensions API that affected your project. I described the changes in the following pull request:


* Change Preprocessor#process method arguments to document, reader
* Read lines from reader in Preprocessor#process method
* Push lines back onto reader after processing and return reader in Preprocessor#process method
* Remove argument to Extensions.register block

I verified that it works once these changes are applied.

Formal, updated documentation for the extensions API is still something I need to complete. Right now, the best reference for the extensions API is the extensions lab. You can find several examples of Preprocessor extensions there.


Cheers,

-Dan

On Sun, Dec 21, 2014 at 6:23 AM, plane [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi list,

With version 1.5.2 of asciidoctor, my plugin asciidoc-bib no longer works.  I had this working on 0.1.4 using a custom script, asciidoctor-bib, which hooked into asciidoctor.

Reading about the new extensions mechanism, it appears I should be doing the following:

1. write the plugin as a simple class:

class AsciidoctorBibExtension < Asciidoctor::Extensions::Preprocessor
  def process reader, lines
...
  end
end

2. register the plugin with asciidoctor, using something like:

Asciidoctor::Extensions.register do
  preprocessor AsciidoctorBibExtension
end

(I'm assuming I can do this as a post-install step when someone installs my gem?)

3. use the plugin with:

> asciidoctor -r asciidoc-bib document.adoc

(I'm not sure if I need to do something to get the right name for the -r option, or is it simply the registered ruby gem?)

Is the above approximately right?    

In my version for asciidoc, the processing is done in two passes, and asciidoc-bib is an executable which takes some options to change the style and other details of how the references and bibliography are created.  In my version for 0.1.4 I had these options passed to my custom script.  Is it possible to pass options from the command-line in a similar style using the form?

> asciidoctor -r asciidoc-bib MY-OPTIONS ASCIIDOCTOR-OPTIONS document.adoc

Or do I need to do something else to include options for my plugin?

Sorry if I missed any documentation which covers this.  I've looked at the extensions page of the user-manual, which does not cover how the user runs this from a CLI, and I've also looked at the extensions-lab examples, which also did not answer my questions.

  thanks for any help,

       Peter.




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/extensions-in-1-5-fixing-asciidoc-bib-tp2602.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--