ContentQualityConfiguration

Type: Object

Configuration for Content Quality to be used in the content-quality-configuration configuration variable. Typically you only need to set the chunkIsContentQuery to ignore some of the elements which do not contain contents. And/or set the baseIETFLanguageQuery and nodeIETFLanguageQuery if you don't use the xml:lang attribute for languages or have you own default fallback language.

Properties

baseIETFLanguageQuery

Type: XPathTest

An XPathTest which must return the base language string for a chunk in IETF BCP-47 format. This can be gotten either from an node, ancestor node or a default language fallback. Defaults to (ancestor-or-self::*[@xml:lang][1]/@xml:lang, "en-US")[1].

XQuery

(: Fixed language :)
"en-US"

XQuery

(: Custom language attribute using underscores :)
(ancestor-or-self::*[@language][1]/@language/replace(., "_", "-"), "en-US")[1]

XQuery

(: Custom language attribute with mapping :)
(ancestor-or-self::*[@language][1]/editorName:getLang(@language), "en-US")[1]

JavaScript

// Register custom language mapping function
registerCustomXPathFunction('editorName:getLang', [ 'xs:string?' ], 'xs:string?', function (dynamicContext, language) {
    return mapLanguageToIETF(language) || null;
});

checkTimeout

Type: Number

The timeout in milliseconds used for debouncing backend requests on content mutations. Defaults to 200.

chunkBorderQuery

Type: XPathTest

An XPathTest that determines if a node is a chunk. Defaults to fonto:block-layout(.) or fonto:is-removed(.) or fonto:closed(.).

chunkIsContentQuery

Type: XPathTest

An XPathTest that determines if the chunk should be annotated. Defaults to fonto:block-layout(.) and not(fonto:closed(.)) and not(fonto:is-removed(.)).

XQuery

(: Ignore some elements, for example in DITA do not process the data element and anything in a map :)
not(self::data) and not(/map) and fonto:block-layout(.) and not(fonto:closed(.)) and not(fonto:is-removed(.))

isEnabledOnLoad

Type: Boolean

Indicates if Content Quality should be active on load. Defaults to false.

nodeIETFLanguageQuery

Type: XPathTest

An XPathTest which can return an IETF BCP-47 language code of a specific node, if any. This should NOT look at ancestors or default languages. Defaults to @Q{http://www.w3.org/XML/1998/namespace}lang.

XQuery

(: Custom language attribute with mapping :) @language => editorName:getLang()

semanticAttributes

Type: Array<SemanticAttribute>

An array containing attributes which should trigger a recheck of a node when the attribute value changes. For example, language tag(s) or concept URIs. Defaults to [ { attributeName: 'lang', attributeNamespace: 'http://www.w3.org/XML/1998/namespace' } ]

JavaScript

// If you have attributes which could impact the annotation results, you can specify them. For example in DITA
// when you use the `xref` element and have an annotator which checks validity (for example obsolete entities),
// you can specify the `href` attribute to be a semantic attribute.
[
    { attributeName: 'lang', attributeNamespace: 'http://www.w3.org/XML/1998/namespace' },
    { attributeName: 'href', elementQuery: 'self::xref' }
]