Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hello,
I'am new here. Maybe someone can help me. I have a process to generate dynamic content (sections, chapters, and so on) using a lot Asciidoctor files. I'm not using inlude macro to combine those files for a different reasons. The ouput is good but I face different problem with cross reference files. The process read a lot of files make some regex on the fly, put an [[ID]] at the begining of each content and then combine all the content in one file. I'm trying to use a custom converter to fix some issues with the xref macro because the files doesn't exists anymore. module AsciidoctorPdfExtensions def convert_inline_anchor node case node.type when :xref # if some conditions holds, rewrite target name node.target = <HASH_ID_BASED_ON_TARGET> # endif super else super end end end Asciidoctor::Pdf::Converter.prepend AsciidoctorPdfExtensions It seems that this is not enough and that I have to modify other variables. I found that perhaps the following lines node.attributes['refid'] = node.target node.attributes['path'] = nil solve the problem but I'm not sure. Is it possible to change the target name at that moment? Regards guido |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
You can study how the attributes for an xref are used here: If you manipulate these two attribute values (path and refid), then you can call `super` to allow the normal processing to continue. Best, -Dan On Wed, May 13, 2020 at 4:10 PM guidog [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hello, ... [show rest of quote] -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Perfect! I took it from there but I was not sure about it.
Thanks! |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
👍 On Wed, May 13, 2020 at 4:56 PM guidog [via Asciidoctor :: Discussion] <[hidden email]> wrote: Perfect! I took it from there but I was not sure about it. -- Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Free forum by Nabble | Edit this page |