On 10/25/2012 10:51 PM, Stefan Seefeld wrote:
On 10/07/2012 07:41 AM, Hussein Shafie wrote:
We have implemented your RFE. It'll be part of v5.4.1 (to be released in
about one month).
Here is another idea of a tool I would find most useful: as I'm
transcribing text into DocBook that contains many small inline
mathematical expressions, it would be great to have a simple macro /
command that would "wrap" simple text as an inlineequation with embedded
math, and immediately invoke the mathml equation parser on it. I think
that would be extremely convenient.
I'm not sure that many users would be interested in having such macro.
In fact, you are expected to write such macros yourself. However, in the
case of the macro you describe, this is impossible because command
mml.parseTextAsMathML is not documented.
Therefore, please find attached to this email a simple implementation of
the macro you have described.
In order to use it:
[1] Copy attached file 0docbook5.xxe to the addon/ subdirectory of the
user preferences directory.
(If you have already customized the DocBook 5 configuration, then add
the macro to your existing customization.)
----------------------------------
XXE user preferences directory is:
$HOME/.xxe5/ on Linux.
$HOME/Library/Application Support/XMLmind/XMLEditor5/ on the Mac.
%APPDATA%\XMLmind\XMLEditor5\ on Windows XP, Vista and 7.
Example: C:\Documents and Settings\john\Application
Data\XMLmind\XMLEditor5\ on Windows XP.
C:\Users\john\AppData\Roaming\XMLmind\XMLEditor5\ on Windows Vista and 7.
If you cannot see the "Application Data" directory using Microsoft
Windows File Manager, turn on Tools>Folder Options>View>File and
Folders>Show hidden files and folders.
----------------------------------
[2] Clear the quick start cache, then restart XXE. See
http://www.xmlmind.com/xmleditor/_distrib/doc/help/advancedOptions.html#cacheOptions
[3] Open a DocBook 5 document. Type, for example, "2+2". Select "2+2"
from the left to the right (limitation of the simple implementation).
Press F4.
---
PS: It is not possible to bind this macro to a keyboard shortcut simply
by using the "Add Keyboard Shortcut" dialog box (see
http://www.xmlmind.com/xmleditor/_distrib/doc/help/com.xmlmind.xmleditapp.kit.part.AddKeyboardShortcutDialog.html)
because this macro depends on an element template.
<?xml version='1.0' encoding='UTF-8'?>
<configuration name="DocBook v5+" mimeType="application/x-docbook-5+xml"
icon="xxe-config:common/mime_types/docbook.png"
xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:html="http://www.w3.org/1999/xhtml">
<include location="docbook5-config:docbook5.xxe"/>
<binding>
<keyPressed code="F4" />
<command name="db5.selectionToInlineequation" />
</binding>
<command name="db5.selectionToInlineequation">
<macro>
<sequence>
<command name="copyChars" parameter="[separateNodes]" />
<command name="formatTextAs"
parameter="#template({http://docbook.org/ns/docbook}inlineequation,S2IE.math)" />
<command name="paste" parameter="to %_" />
<!-- This will work only if you select text from
the left to the right. -->
<command name="moveDotTo" parameter="previousChar" />
<command name="mml.parseTextAsMathML" />
</sequence>
</macro>
</command>
<elementTemplate name="S2IE.math" selectable="false">
<inlineequation xmlns="http://docbook.org/ns/docbook">
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML"
display="inline"><m:mi>{$lines}</m:mi></m:math>
</inlineequation>
</elementTemplate>
</configuration>
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support