asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
285 stars 120 forks source link

Inject an attribute to indicate that a specific language set is being converted #411

Closed ysb33r closed 5 years ago

ysb33r commented 5 years ago

When a multi-language conversion is in place, inject ~{gradle-language}~ {lang} attribute when the specific language source set is being processed.

mojavelinux commented 5 years ago

I would recommend "lang". It's a reserved attribute in AsciiDoc for this purpose that will set the xml:lang on the html tag. (Otherwise, it's just informational).

ysb33r commented 5 years ago

@mojavelinux In that case, maybe I should inject it as lang@

mojavelinux commented 5 years ago

I suppose, though you'd have a strong case here for not having this one be mutable. What's the use case for changing the document language inside of a folder for that language? Though, it certainly wouldn't hurt to allow it.

Btw, here's where it gets used currently: https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/converter/html5.rb#L100-L101

We also talk about it here: https://asciidoctor.org/docs/user-manual/#customizing-labels

ysb33r commented 5 years ago

I suppose, though you'd have a strong case here for not having this one be mutable

I agree with you, but for consistency(*) I'll append @.

(*) The convention is that for any Asciidoctor attribute that the Gradle plugin injects which were not explicitely specified by the user, @ will be appended.

mojavelinux commented 5 years ago

:+1:

ysb33r commented 5 years ago

Will be in 3.0.0-alpha.4