Skip to content

Commit dccd1eb

Browse files
committed
Pass version as asciidoc attribute
1 parent e37a30f commit dccd1eb

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

grails-docs/src/main/groovy/grails/doc/DocPublisher.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,14 @@ class DocPublisher {
306306
sourceRepo: sourceRepo,
307307
]
308308

309+
if(engine instanceof AsciiDocEngine) {
310+
// pass attributes to asciidoc
311+
((AsciiDocEngine)engine).attributes.putAll(
312+
version: version
313+
)
314+
}
315+
316+
309317
// Build the user guide sections first.
310318
def template = templateEngine.createTemplate(new File("${docResources}/style/guideItem.html").newReader(encoding))
311319
def sectionTemplate = templateEngine.createTemplate(new File("${docResources}/style/section.html").newReader(encoding))

grails-docs/src/main/groovy/grails/doc/asciidoc/AsciiDocEngine.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ import org.asciidoctor.Asciidoctor;
1414
@InheritConstructors
1515
class AsciiDocEngine extends DocEngine {
1616
Asciidoctor asciidoctor = create();
17-
17+
Map attributes = [
18+
'imagesdir': '../img',
19+
'source-highlighter':'coderay',
20+
'icons':'font'
21+
]
1822
@Override
1923
String render(String content, RenderContext context) {
2024
asciidoctor.convert(content,
2125
new OptionsBuilder()
2226
.headerFooter(false)
2327
.attributes(
24-
'imagesdir': '../img',
25-
'source-highlighter':'coderay',
26-
'icons':'font'
28+
attributes
2729
)
2830
.get()
2931
)

0 commit comments

Comments
 (0)