[author mode][content completion] insert element with attribute value from controlled list
Posted: Tue Dec 10, 2019 8:58 pm
Hello folks,
I'm having my first go at customizing the content completion, so apologies up front for probably missing out on the obvious. I have read the content completion part of the online help, created a cc_config.xml file, and added its folder to the classpath. Messages in the info log show that the file is loaded ("start scanning file ... No problems found" on startup).
I'm working with a DTD which defines an integer element, and which has an attribute named base. @base can take a value from a controlled list (coincidentally "2", "8", "10", and "16"), or be absent (defaults to "10"). What I'd like to achieve minimally is that the content completion in author mode offers me to insert an integer element with @base set to one of the four controlled values, but without going to the attributes editor or pop-up. I.e. when pressing enter in author mode, I want to be presented with four options for inserting an integer element. Ideally, content completion would offer me four integer options: no attribute, @base=2, @base=8, and @base=16.
Is either the minimal or the ideal solution possible at all with the content completion system?
Also, there may be another disconnect relating to namespaces? As I'm working with a DTD, I would assume that everything happens in no namespace. As an experiment, I put the following in my cc_config.xml as the only content:
My hope was that whenever I insert an integer element, it would have @base=2. But nothing happens, i.e. an integer element with no attributes gets inserted by content completion.
Any hints appreciated.
I'm having my first go at customizing the content completion, so apologies up front for probably missing out on the obvious. I have read the content completion part of the online help, created a cc_config.xml file, and added its folder to the classpath. Messages in the info log show that the file is loaded ("start scanning file ... No problems found" on startup).
I'm working with a DTD which defines an integer element, and which has an attribute named base. @base can take a value from a controlled list (coincidentally "2", "8", "10", and "16"), or be absent (defaults to "10"). What I'd like to achieve minimally is that the content completion in author mode offers me to insert an integer element with @base set to one of the four controlled values, but without going to the attributes editor or pop-up. I.e. when pressing enter in author mode, I want to be presented with four options for inserting an integer element. Ideally, content completion would offer me four integer options: no attribute, @base=2, @base=8, and @base=16.
Is either the minimal or the ideal solution possible at all with the content completion system?
Also, there may be another disconnect relating to namespaces? As I'm working with a DTD, I would assume that everything happens in no namespace. As an experiment, I put the following in my cc_config.xml as the only content:
Code: Select all
<elementProposals insertElements="integer">
<insertAttribute name="base" value="2"/>
</elementProposals>
Any hints appreciated.