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
Asciidoctor/Include issue, when using Hugo shortcode #352
Comments
Ah, yes... Variables in include statements are not supported. Macros are matched with this regex: po4a/lib/Locale/Po4a/AsciiDoc.pm Lines 792 to 793 in 49eaae2
|
In fact, it should work if you remove the space characters around |
I'll try this, thanks |
This https://github.com/mquinson/po4a/blob/master/lib/Locale/Po4a/AsciiDoc.pm#L793 It seems that changing the macro regex to accept any character before
to
I tested it with all What do you think about this change? |
I have two oppositions:
Our parser must be facing plain asciidoc for translatable content. This is a task of internationalizing the content to use the features of asciidoc in order to split the content between template specific code and plain asciidoc. You could use asciidoc document attributes to do so: :hugolang: {{% lang %}}
include::shared/attributes/attributes-{hugolang}.adoc[] In fact the |
@mquinson What do you think? |
I never wrote one line of asciidoc in my life and would prefer if I can blindly trust someone here... If someone like @dbaio needs this asciidoc+hugo thing and is willing to contribute to it, why not? Hugo may be one of the templating solution among the mass, but it's not the less used one either. But again, if there is no user to contribute to that code, it may not happen (no matter how desirable): that's free software and we mostly fix the code we use and are familiar with. Please @dbaio jump into the code :) There is a slight challenge to ensure that the new features do not clutter too much the code, but I'm not familiar with this code at all, so it's hard for me to comment. If things go seriously wrong, you should consider doing a specific po4a formatter for asciidoc+hugo, alongside to the original formatter (starting by copying the file). But that should only be done in last resort, as the maintainance of the asciidoc parts will be doubled if you dupplicate the code. This is really not a good design for the long term, but that's maybe something to consider if code reusability gets hard. We already have 2 YAML parsers (one for the stand alone formatter and one for the front matter) and the main reason I think it's OK so is because this code is so simple and small. |
The The example with asciidoc document attributes can be a way out as well, thanks for the tip, although, in our project, we will need to change more than a thousand files to use it. |
About the I've opened PR #355 for review. |
I don't understand this remark. From a quick review of your project, you call I am not minding my own business, but it seems that Hugo is useless for your usecase, as you already have all the needed transclusion facility in asciidoctor. |
As for thousands of files, well it's just a simple |
The FreeBSD docs have two Hugo projects on it, website and documentation, and they use Asciidoctor, but it's all driven by Hugo. That script generates a pdf for the documentation articles/books; it's the only place we use asciidoctor standalone. While that issue with Hugo and Asciidoctor exists, we will need somewhere an if statement to change something between them. IMHO, this change won't harm po4a and the asciidoc format, but I will respect it if you don't want to mix Hugo format here. |
I tend to agree with the fact that we can support Hugo without cluttering too much the code (or at least I hope so), but I didn't read the code yet. I think that at the end of the day, that's @jnavila decision. He's the one who did most of the work on the Asciidoc formatter, so he decides. If we need to split the implementations, I'm confident that the BSD community will manage to maintain a fork of that formatter. Again, I'm not saying that we must fork the formatter, because I didn't read the patch. And I prefer if I don't have to, so that the bus factor of that project continues to grow :) Thanks for your time, guys. |
Source file.
PO file.
po4a version 0.66 and prior releases has the same issue.
-->
Includes without
{{% lang %}}
works fine; they are skipped.I'm reporting this so others can help, but the plan is to dig/debug po4a later.
https://docs.asciidoctor.org/asciidoc/latest/directives/include/
The text was updated successfully, but these errors were encountered: