-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(asciidoctor): basic asciidoc plugin #100
Conversation
The asciidoc plugin uses AsciidoctorJ from the Asciidoctor project to bring Asciidoc rendering to Perun. ROOM FOR IMPROVEMENT AsciidoctorJ has plenty of extension options, like including other Asciidoctor libraries (like 'asciidoctor-diagram') and including gems. Also attributes can be set, determining how the HTML is rendered. These Asciidoctor features make it flexible and powerful but these features need to be enabled still. Another potential improvement is the linking of Asciidoc containers (JRuby containers) to pods to prevent initialization. This will require further changes in the perun.clj file related to the pod dispatch. This ticket is related to issue 49 on GitHub: hashobject#49
It is getting there. Basic tests are included. |
This is relatively easy, right now you have: (pod/with-call-in @pod (io.perun.contrib.asciidoctor/parse-asciidoc ~ad-files ~(merge +asciidoctor-defaults+ options))) what you can do is make that (pod/with-call-in @pod (def container (new-container ~options))) Then you can pass that defined container to the Also here's a snippet where something similar is done. |
Image rendering works, although they now get dropped in the root folder. |
@martinklepsch I started working on linking the asciidoctor-container to the pod, but I guess I'm having issues with the namespaces. I'd like to leave the |
@martinklepsch I committed my current work in progress, so you can have a look: nicorikken@6b53756 |
Metadata parsing is almost complete, only need to fix the existing tests. I'll commit it later today. |
Will there be multiple pods handling the Asciidoctor fileset? Or will the files be parsed concurrently? Otherwise the asciidoctor container could also be defined in the |
All the previous checkmarks are checked! 🎉 I can still improve on the metadata, and ensure that the title is included. Also I'd like to align the keywords with the SPEC.md file for compatibility with other parts of Perun. |
I've now got the metadata working properly (I had to strip the frontmatter before handing it over to the |
Very close now, only image handling left. |
The image generation using the `asciidoctor-diagram` library can use the `imagesoutdir` attribute to determine where the final images will end up. Otherwise they will end up at the directory from which the task is called. The `imagesdir` should match the `imagesoutdir` to some extent, to ensure the final HTML will refer to the correct files. _But how to get this working in Boot...?_ Multiple solutions exist to get to the image output directory https://github.com/asciidoctor/asciidoctor-diagram#image-output-location |
I'm also working on an improved version of the YAML frontmatter strip action, to properly handle files without frontmatter. When those test run, I'll commit it, and only the image handling seems left. |
Got the tests working (apparently map destructuring in the |
Regarding the image generation, I should be able to set the |
I was trying to get the path from the Asciidoctor file being processed by the Boot Fileset methods
|
I'm getting there. Just fixed a but in merging maps (forgot to provide a function to TODO
|
Now that I have fixed controlling the output directory, I could also set it to the |
I did spend some more evenings to clean up and get images working. I found out that my render is somehow broken. Pages are rendered, committed to the fileset, but not synced to the target dir. This concerns the HTML renders, also for Markdown. Unless I get it working again, debugging Asciidictor fileset handling is impossible. |
Did you include |
No I did not. Thanks for mentioning, I'll give it another go very soon, hopefully this PR is now actually in a working state. |
Alright, back on track. Somehow the image is currently ending up in the |
@bhagany thanks for taking my implementation issues and improving the general ecosystem! |
Just a heads up, my progress stalled due to a new laptop and a temporary project. I'd like to get something up and running before Fosdem, so perhaps I'll split the PR to ignore the asciidoctor diagram extension for now. Or I'll generate them, but dump them in a fixed directory for now. |
@nicorikken glad to hear you're still in-progress on this, I think this feature is a great addition to Perun. I don't really know much about asciidoctor, but I like your idea of splitting the PR. I don't know if you saw, but #132 changes the way content-parsing tasks are written. It should work for asciidoctor, but I haven't actually tried to make it work. Feel free to ping me here or on the Clojurians Slack if that gets merged and you run into issues. Thanks for continuing to work on this! |
Picked this project up again. As it has gotten terribly behind on master, and I gained much more Clojure experience since my last few commits, I'll restart from master. I'm glad the Pandoc converter has made its way into the project, as I can expect the abstractions to be more stable and sensible. E.g. I'll be using the generic YAML parser. Also I like the hardcoded set of markdown extension as a pattern. I'll probably do the same, rather then increasing complexity by making it more dynamic. Also I'll ignore the asciidoctor-diagram for now then, to further lower complexity. |
Sounds like a solid approach to me. Thanks again for working on this, and I look forward to getting this merged! |
I just finished setting out the basic task structure: 62f409a...nicorikken:asciidoctor-plugin-redo |
I just finished the basic implementation: nicorikken@99283e5 |
Just added some basic tests. They do however not fail when loading wrong content to test against, so perhaps I'm testing it wrong. Either way, the new PR can be found here: #183 |
After this basic task is merged, I'd like to extend it by syncing the Asciidoctor attributes and Perun meta. This would be something like: ;; For asciidoctor, YAML meta and Asciidoctor attributes to resulting meta
{:meta (->> meta
(merge yaml-metadata)
meta->attr
(fn [attr] (.getAttributes (.getHeader (.readDocumenStructure container file-content {:attributes attr}))))
attr->meta)}
;; For asciidoctor*, YAML meta and Asciidoctor attributes used in converting, not added to resulting meta
(->> meta
(merge yaml-metadata)
meta->attr
(process-asciidoctor file-content {:attributes attr})) |
Reading about the YAML frontmatter handling in the Asciidoctor user manual, the section on the handling by Awestruct shows an increased complexity, as the precedence of attributes can be changed by adding an |
@nicorikken Is this PR still relevant, after merging the other one? |
No, although I'll probably come back to these comments for implementing metadata and asciidoctor-diagram. But I can do so while this is closed. Let's keep it clean. |
I spent the last few days rebuilding my blog, and as a result I now have a working solution for metadata extraction, and am working on getting a limited image-generation in place. Expect an asciidoctor PR soon. |
Great to hear! Waiting on your PR
… On Aug 17, 2017, at 10:45 PM, Nico Rikken ***@***.***> wrote:
I spent the last few days rebuilding my blog, and as a result I now have a working solution for metadata extraction, and am working on getting a limited image-generation in place. Expect an asciidoctor PR soon.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The asciidoc plugin uses AsciidoctorJ from the Asciidoctor project
to bring Asciidoc rendering to Perun.
This ticket is related to issue 49 on GitHub:
#49
Left to do:
asciidoctor-diagram
). In particular, how to handle the resulting image files? Help desired! Images are now generated on root, will have to be handled properlyasciidoctor-diagram
handled properly, to make sure they end up in the end result, and at the right place. Help desired!