Excluding specific XML elements from word count in Vale

Post here questions and problems related to editing and publishing DITA content.
VincentV
Posts: 6
Joined: Fri Nov 22, 2024 9:59 am

Excluding specific XML elements from word count in Vale

Post by VincentV »

Hello,

I'm working on some Vale rules to use with the terminology plugin to check terminology and other style guidelines.
I'm wondering if there's a way to exclude certain elements (like uicontrol or xref) when counting words within a sentence (or to count them as a single word regardless of their length).

So far, I only have a rule that counts all words, no matter which elements they’re in:

Code: Select all

extends: occurrence
message: "sentence too long"
scope: sentence
level: suggestion
max: 25
token: \b(\w+)\b
Is this even possible to achieve with Vale or the terminology plugin?
Thank you.
adrian_sorop
Posts: 79
Joined: Wed Jun 22, 2016 2:48 pm

Re: Excluding specific XML elements from word count in Vale

Post by adrian_sorop »

Hi,

There isn’t a direct way to exclude elements when counting words within a sentence, nor to count them as a single word.
However, there might be a workaround: the Terminology Checker skips space-preserve elements. If your elements use a style such as white-space:pre, they won’t be scanned.

If you create an alternate style that marks xref, uicontrol, etc. as space-preserve, the Terminology Checker will skip these elements.
Here is the latest documentation regarding CSS styling:
https://www.oxygenxml.com/doc/versions/ ... tyles.html

Regards,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply