Skip to content

Commit

Permalink
Merge pull request #713 from asciidoctor/712-null-attributes
Browse files Browse the repository at this point in the history
Allow null attributes
  • Loading branch information
ysb33r authored Jan 26, 2024
2 parents 01733d2 + 8b38a9b commit 34f2cf1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class AbstractImplementationEngineExtension
protected Collection<String> stringizeList(
Collection<Object> list,
boolean fromTaskOnly,
Function<AbstractImplementationEngineExtension,Collection<String>> other
Function<AbstractImplementationEngineExtension, Collection<String>> other
) {
if (!task || fromTaskOnly) {
stringize(list)
Expand Down Expand Up @@ -325,7 +325,7 @@ class AbstractImplementationEngineExtension
case Callable:
return item
default:
return { -> projectOperations.stringTools.stringize(item) } as Callable<String>
return { -> projectOperations.stringTools.stringizeOrNull(item) } as Callable<String>
}
}
}
Expand All @@ -346,7 +346,7 @@ class AbstractImplementationEngineExtension
case Callable:
return [key, item]
default:
return [key, { -> projectOperations.stringTools.stringize(item) } as Callable<String>]
return [key, { -> projectOperations.stringTools.stringizeOrNull(item) } as Callable<String>]
}
} as Map<String, Object>
}
Expand All @@ -356,6 +356,6 @@ class AbstractImplementationEngineExtension
}

private List<String> stringize(Collection<?> stringyThings) {
projectOperations.stringTools.stringize(stringyThings)
projectOperations.stringTools.stringizeDropNull(stringyThings)
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project_vcs = https://github.com/asciidoctor/asciidoctor-gradle-plugin.g
cglibVersion = 3.3.0
jsoupVersion = 1.17.2
spockVersion = 2.3-groovy-3.0
grolifantVersion = 2.2.3
grolifantVersion = 3.0.0
jacocoVersion = 0.8.6
codenarcVersion = 3.3.0
nodejsGradleVersion = 2.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ class AsciidoctorJSRunner {
arguments.addAll([DOCTYPE, doctype.get()])
}

arguments.addAll(attributes.collectMany { String key, String value ->
value ? [ATTR, "${key}=${value}".toString()] : [ATTR, key]
})
attributes.each { String key, String value ->
arguments.addAll(value ? [ATTR, "${key}=${value}".toString()] : [ATTR, key])
}
// Cannot use the better form of code as below, due to some Groovy incompatibility
// Therefore using the above code
// arguments.addAll(attributes.collectMany { String key, String value ->
// value ? [ATTR, "${key}=${value}".toString()] : [ATTR, key]
// })

arguments.addAll(requires.collectMany {
[REQUIRE, it]
Expand Down

0 comments on commit 34f2cf1

Please sign in to comment.