diff --git a/docs/_data/xpath_funs.yml b/docs/_data/xpath_funs.yml index 8f76da9f9e..86041d65cc 100644 --- a/docs/_data/xpath_funs.yml +++ b/docs/_data/xpath_funs.yml @@ -13,6 +13,7 @@ aliases: description: "Any element node" - &needs_typenode "The context node must be a {% jdoc jast::TypeNode %}" - ¬_ctx_dependent "The function is not context-dependent, but takes a node as its first parameter." + - &needs_node_ctx "The requires the context node to be an element" langs: - name: "Any language" @@ -21,11 +22,12 @@ langs: - name: fileName returnType: "xs:string" shortDescription: "Returns the simple name of the current file" - description: "Returns the current simple filename without path but including the extension. - This can be used to write rules that check filename naming conventions. + description: | + Returns the current simple file name, without path but including the extension. + This can be used to write rules that check file naming conventions. -

This function is available since PMD 6.38.0.

" - notes: "The function can be called on any node." + since: 6.38.0 + notes: *needs_node_ctx examples: - code: "//b[pmd:fileName() = 'Foo.xml']" outcome: "Matches any `<b>` tags in files called `Foo.xml`." @@ -35,10 +37,11 @@ langs: parameters: - *node_param shortDescription: "Returns the begin line of the given node" - description: "Returns the begin line of the given node in the source text. - Line numbers are 1-based. + description: | + Returns the line where the node starts in the source file. + Line numbers are 1-based. -

This function is available since PMD 6.44.0.

" + since: 6.44.0 notes: *not_ctx_dependent examples: - code: "//b[pmd:beginLine(.) > 5]" @@ -49,10 +52,11 @@ langs: parameters: - *node_param shortDescription: "Returns the end line of the given node" - description: "Returns the end line of the given node in the source text. - Line numbers are 1-based. + description: | + Returns the line where the node ends in the source file. + Line numbers are 1-based. -

This function is available since PMD 6.44.0.

" + since: 6.44.0 notes: *not_ctx_dependent examples: - code: "//b[pmd:endLine(.) == pmd:beginLine(.)]" diff --git a/docs/_includes/custom/xpath_fun_doc.html b/docs/_includes/custom/xpath_fun_doc.html index 12a7781adf..555f1e2f01 100644 --- a/docs/_includes/custom/xpath_fun_doc.html +++ b/docs/_includes/custom/xpath_fun_doc.html @@ -50,6 +50,10 @@
{{ fun.description | render_markdown }}
+ {% if fun.since %} +
Since
+
PMD {{ fun.since }}
+ {% endif %}
Remarks
{{ fun.notes | render_markdown }}
diff --git a/docs/pages/pmd/languages/xml.md b/docs/pages/pmd/languages/xml.md index 5ac637165d..5774985f1b 100644 --- a/docs/pages/pmd/languages/xml.md +++ b/docs/pages/pmd/languages/xml.md @@ -41,7 +41,7 @@ for more examples. While other languages use {% jdoc core::lang.rule.XPathRule %} to create XPath rules, the use of this class is not recommended for XML languages. Instead, since 6.44.0, you -are advised to use {% xml::lang.xml.rule.DomXPathRule %}. This rule class interprets +are advised to use {% jdoc xml::lang.xml.rule.DomXPathRule %}. This rule class interprets XPath queries exactly as regular XPath, while `XPathRule` works on a wrapper for the DOM which is inconsistent with the XPath spec. Since `DomXPathRule` conforms to the XPath spec, you can @@ -70,6 +70,6 @@ Here's an example declaration of a `DomXPathRule`: ``` The most important change is the `class` attribute, which doesn't point to `XPathRule` -but to `DomXPathRule`. Please see the Javadoc for {% xml::lang.xml.rule.DomXPathRule %} +but to `DomXPathRule`. Please see the Javadoc for {% jdoc xml::lang.xml.rule.DomXPathRule %} for more info about the differences with `XPathRule`.