This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tapestry-5-site-builder.git
commit 5f529d7e05e51d8e90d353b2210946ead0edd859 Author: Volker Lamp <[email protected]> AuthorDate: Sun Jul 7 19:46:12 2024 +0200 Take version info from Asciidoc attribute primarily. --- lib/javadoc-processor.js | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/javadoc-processor.js b/lib/javadoc-processor.js index 005b6e0..bfcf785 100644 --- a/lib/javadoc-processor.js +++ b/lib/javadoc-processor.js @@ -1,24 +1,31 @@ /* -= Processor for the javadoc: macro -Generates a hyperlink to a Javadoc page. += Processor for the `javadoc:` macro + +Generates a hyperlink to a Javadoc page. + +The version partial of the url can be configured throug +* a custom Asciidoc attribute named `javadoc-version` +* a macro attribute named `version` + +Implementation based on the example https://docs.asciidoctor.org/asciidoctor.js/latest/extend/extensions/inline-macro-processor/ + == Usage javadoc:<className>#<memberName>[<attributes>] -where +where: * className is a fully qualified class name * memberName (optional) is the name of a member of that class -* attributes is a comma-separated list of key-value pairs (key=value) +* attributes (optional) is a comma-separated list of key-value pairs (key=value) -supported attributes +Supported attributes: version:: the version partial of the url -label:: the label to - -== Example -javadoc:org.apache.tapestry5.SymbolConstants#APPLICATION_CATALOG[version=5.3.7] +label:: the label to use -based on the example https://docs.asciidoctor.org/asciidoctor.js/latest/extend/extensions/inline-macro-processor/ +== Examples +* javadoc:org.apache.tapestry5.ioc.services.TapestryIOCModule +* javadoc:org.apache.tapestry5.SymbolConstants#APPLICATION_CATALOG[version=5.3.7] */ @@ -42,9 +49,16 @@ module.exports = function (registry) { var simpleClassName = className.slice(target.lastIndexOf('.') + 1); + /* var version = attrs.version == undefined ? 'current' : attrs.version; + */ + var version = parent.document.getAttribute('javadoc-version') == undefined + ? attrs.version == undefined + ? 'current' + : attrs.version + : parent.document.getAttribute('javadoc-version') var memberSuffix = memberName == undefined ? ''
