Michael Santy wrote:
> I'm developing a plugin for a docbook-like schema. My first step in
> creating the customized editor is to implement text bolding. The schema
> I'm working with denotes bold text with:
>
> <EmphasizedText emphasisType="b">bolded text</EmphasizedText>
>
> where Docbook uses:
>
> <emphasis role="bold">bolded text</EmphasizedText>
>
> I adapted the code used in the Docbook plugin. However, the menu item
> is always greyed out. Can anyone please provide any guidance on where
> I'm going wrong.
>
> <command name="convertWithAttribute">
> <macro repeatable="true" undoable="true">
> <sequence>
> <choice>
> <command name="selectNode"
> parameter="self[implicitElement] %0" />
> <command name="convert"
> parameter="[implicitElement] %0" />
> </choice>
> <command name="putAttribute" parameter="%1 %2" />
> </sequence>
> </macro>
> </command>
>
> <menu label="Format">
> <item label="Toggle Bold" command="convertWithAttribute"
> parameter="EmphasizedText emphasisType b"/>
> </menu>
May be the name of the element is not just "EmphasizedText" but rather
"{some namespace}EmphasizedText" (let's call this non-standard notation:
James Clark's notation).
Excerpts of the configuration file for DocBook 5, RELAX NG based and
thus, namespace aware:
---
<command name="db5.convertWithAttribute">
<macro repeatable="true" undoable="true" label="Convert">
<sequence>
<choice>
<command name="selectNode"
parameter="self[implicitElement] %0" />
<command name="convert"
parameter="[implicitElement] %0" />
</choice>
<command name="putAttribute" parameter="%1 %2" />
</sequence>
</macro>
</command>
...
<item label="emphasis[bold]" command="db5.convertWithAttribute"
parameter="{http://docbook.org/ns/docbook}emphasis role bold" />
---
The important thing to remember here is that a command parameter is
always treated as a plain string and, for this reason, namespace
prefixes are meaningless in this context.
In practice, you always need to use James Clark's notation to denote
elements in command parameters.