Configuring Character and Word Counts
CUE can display a character / word count below story elements or fields in story elements:
The counts are constantly updated as the user types, so they are always correct. The counts are only displayed where they are configured to appear.
To add a count to a story element you need to add a
ui:count
element to the story element's type
definition. The ui:count
element must be inserted
as the child of the story-element-type
element:
<?xml version="1.0" encoding="UTF-8"?> <story-element-type xmlns="http://xmlns.escenic.com/2008/content-type" xmlns:ui="http://xmlns.escenic.com/2008/interface-hints" name="headline"> <ui:label>Headline</ui:label> <ui:icon>headline</ui:icon> <ui:priority>900</ui:priority> <ui:count show="true" for="total headlines"/> <field name="headline" type="basic" mime-type="text/plain"> <ui:title-field/> </field> <ui:style> .story-element-headline [contenteditable='true'] { font-size: 2.5em; } </ui:style> </story-element-type>
The show="true"
attribute causes counts to be
displayed below story elements of this type. If you set
show=false
, then the characters and words are
counted, but not displayed below the story elements. The
for="total headlines"
attribute causes the counts
to be added to storyline summaries that can be displayed on a
Metrics metadata panel:
Specifically, for="total headlines"
says that the
counts are to be added to summaries called total
and headlines
. For information about how
storyline count summaries are defined, see
Configuring a Metrics Panel.
When you add a count to a story element type in this way, all of the
text in the story element is counted: all of its text fields, and
any child story elements it contains. For some story element types,
you may not want to do this. For an image story element type, for
example, you might want to count the content of the
caption
field, but not the content of the
copyright
field. In this case, instead of adding
a ui:count
element to the whole
story-element-type
definition, you can just
insert it to the field definitions you are interested in:
<?xml version="1.0" encoding="UTF-8"?> <story-element-type xmlns="http://xmlns.escenic.com/2008/content-type" xmlns:ui="http://xmlns.escenic.com/2008/interface-hints" name="image"> ... <field name="caption" type="basic" mime-type="text/plain"> <ui:label>Caption</ui:label> <ui:count show="true" for="total body"/> </field> ... </story-element-type>