Bibliography converter issue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bibliography converter issue

ysb33r
Given something like:

[bibliography]
- [[[prag]]] Andy Hunt & Dave Thomas. The Pragmatic Programmer:
  From Journeyman to Master. Addison-Wesley. 1999.


When running a converter over it, the sequence of the AST traversal is pretty much List, ListItem, Bibref. Whereas this is good for most cases, for LEanpub this will cause an issue as it requires the anchor to be on a line of it's own i.e we need to generate something that is roughly like below


{#prag}
* Andy Hunt & Dave Thomas. The Pragmatic Programmer:
  From Journeyman to Master. Addison-Wesley. 1999.


There is a good chance that the parent node did something the equivalent of '* ' + node.content.

My dilemma is how to solve this problem. I'm not sure whether Iit helps to traverse AST at this point to try to inject the necessary line above at that point.

Is there maybe a way of discovering that a list is a bibliography list, so that generation behaviour can be changed?

Reply | Threaded
Open this post in threaded view
|

Re: Bibliography converter issue

mojavelinux
Administrator
You can see in the DocBook 5 converter that the bibliography list must be handled in a special way:


The one thing that doesn't give you is the bibref for the entry. I've had it on my list to check for this when traversing blocks and promoting it to the list item node. Perhaps now is the time to follow up on an issue for it. See https://github.com/asciidoctor/asciidoctor/issues/1361

Until then, you can just extract the pattern (e.g., [[[prag]]]) from the start of the list item text to get at the id.

Cheers,

-Dan

On Wed, Jun 3, 2015 at 9:46 AM, ysb33r [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Given something like:

[bibliography]
- [[[prag]]] Andy Hunt & Dave Thomas. The Pragmatic Programmer:
  From Journeyman to Master. Addison-Wesley. 1999.


When running a converter over it, the sequence of the AST traversal is pretty much List, ListItem, Bibref. Whereas this is good for most cases, for LEanpub this will cause an issue as it requires the anchor to be on a line of it's own i.e we need to generate something that is roughly like below


{#prag}
* Andy Hunt & Dave Thomas. The Pragmatic Programmer:
  From Journeyman to Master. Addison-Wesley. 1999.


There is a good chance that the parent node did something the equivalent of '* ' + node.content.

My dilemma is how to solve this problem. I'm not sure whether Iit helps to traverse AST at this point to try to inject the necessary line above at that point.

Is there maybe a way of discovering that a list is a bibliography list, so that generation behaviour can be changed?




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Bibliography-converter-issue-tp3302.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Bibliography converter issue

ysb33r
Thanks. I see you raised https://github.com/asciidoctor/asciidoctor/issues/1361.

I have worked around it for now by checking whether the list or the section has style='bibliography' and then parsing much as you've mentioned.