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"
- &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."
- &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.
<p>This function is available since PMD 6.38.0.</p>"
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 `&lt;b&gt;` 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.
<p>This function is available since PMD 6.44.0.</p>"
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.
<p>This function is available since PMD 6.44.0.</p>"
since: 6.44.0
notes: *not_ctx_dependent
examples:
- code: "//b[pmd:endLine(.) == pmd:beginLine(.)]"

View File

@ -50,6 +50,10 @@
<dl>
<dd>{{ fun.description | render_markdown }}</dd>
{% if fun.since %}
<dt>Since</dt>
<dd>PMD {{ fun.since }}</dd>
{% endif %}
<dt>Remarks</dt>
<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,
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`:
</rule>
```
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`.