Skip to content

Commit

Permalink
Conditionally add revnumber and gradle-project-group (asciidoctor#328,a…
Browse files Browse the repository at this point in the history
…sciidoctor#329)

- Only add revnumber when project.version is non-null.
- Only add gradle-project-group when project.group is non-null.
  • Loading branch information
ysb33r committed Apr 10, 2019
1 parent be94fcd commit eb75b49
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,20 @@ class AbstractAsciidoctorTask extends DefaultTask {
* @return A collection of default attributes.
*/
protected Map<String, Object> getTaskSpecificDefaultAttributes(File workingSourceDir) {
[
Map<String, Object> attrs = [
includedir: (Object) workingSourceDir.absolutePath,
revnumber : (Object) project.version,
'gradle-project-group' : (Object) project.group,
'gradle-project-name': (Object) project.name
]

if(project.version != null) {
attrs.put('revnumber', (Object) project.version)
}

if(project.group != null) {
attrs.put('gradle-project-group', (Object) project.group)
}

attrs
}

/** The default PatternSet that will be used if {@code sources} was never called
Expand Down

0 comments on commit eb75b49

Please sign in to comment.