Cleanup doc

This commit is contained in:
Clément Fournier
2022-03-22 19:34:13 +01:00
parent f7442094a4
commit 463f68faca
3 changed files with 20 additions and 12 deletions

View File

@ -13,6 +13,7 @@ aliases:
description: "Any element node" description: "Any element node"
- &needs_typenode "The context node must be a {% jdoc jast::TypeNode %}" - &needs_typenode "The context node must be a {% jdoc jast::TypeNode %}"
- &not_ctx_dependent "The function is not context-dependent, but takes a node as its first parameter." - &not_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: langs:
- name: "Any language" - name: "Any language"
@ -21,11 +22,12 @@ langs:
- name: fileName - name: fileName
returnType: "xs:string" returnType: "xs:string"
shortDescription: "Returns the simple name of the current file" shortDescription: "Returns the simple name of the current file"
description: "Returns the current simple filename without path but including the extension. description: |
This can be used to write rules that check filename naming conventions. Returns the current simple file name, without path but including the extension.
This can be used to write rules that check file naming conventions.
<p>This function is available since PMD 6.38.0.</p>" since: 6.38.0
notes: "The function can be called on any node." notes: *needs_node_ctx
examples: examples:
- code: "//b[pmd:fileName() = 'Foo.xml']" - code: "//b[pmd:fileName() = 'Foo.xml']"
outcome: "Matches any `&lt;b&gt;` tags in files called `Foo.xml`." outcome: "Matches any `&lt;b&gt;` tags in files called `Foo.xml`."
@ -35,10 +37,11 @@ langs:
parameters: parameters:
- *node_param - *node_param
shortDescription: "Returns the begin line of the given node" shortDescription: "Returns the begin line of the given node"
description: "Returns the begin line of the given node in the source text. description: |
Line numbers are 1-based. Returns the line where the node starts in the source file.
Line numbers are 1-based.
<p>This function is available since PMD 6.44.0.</p>" since: 6.44.0
notes: *not_ctx_dependent notes: *not_ctx_dependent
examples: examples:
- code: "//b[pmd:beginLine(.) > 5]" - code: "//b[pmd:beginLine(.) > 5]"
@ -49,10 +52,11 @@ langs:
parameters: parameters:
- *node_param - *node_param
shortDescription: "Returns the end line of the given node" shortDescription: "Returns the end line of the given node"
description: "Returns the end line of the given node in the source text. description: |
Line numbers are 1-based. Returns the line where the node ends in the source file.
Line numbers are 1-based.
<p>This function is available since PMD 6.44.0.</p>" since: 6.44.0
notes: *not_ctx_dependent notes: *not_ctx_dependent
examples: examples:
- code: "//b[pmd:endLine(.) == pmd:beginLine(.)]" - code: "//b[pmd:endLine(.) == pmd:beginLine(.)]"

View File

@ -50,6 +50,10 @@
<dl> <dl>
<dd>{{ fun.description | render_markdown }}</dd> <dd>{{ fun.description | render_markdown }}</dd>
{% if fun.since %}
<dt>Since</dt>
<dd>PMD {{ fun.since }}</dd>
{% endif %}
<dt>Remarks</dt> <dt>Remarks</dt>
<dd>{{ fun.notes | render_markdown }}</dd> <dd>{{ fun.notes | render_markdown }}</dd>

View File

@ -41,7 +41,7 @@ for more examples.
While other languages use {% jdoc core::lang.rule.XPathRule %} to create XPath rules, 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 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 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 DOM which is inconsistent with the XPath spec. Since `DomXPathRule` conforms to the
XPath spec, you can XPath spec, you can
@ -70,6 +70,6 @@ Here's an example declaration of a `DomXPathRule`:
</rule> </rule>
``` ```
The most important change is the `class` attribute, which doesn't point to `XPathRule` 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`. for more info about the differences with `XPathRule`.