#EXTRA_DIST = BUGS HISTORY LICENSE aclocal.m4 debian/
-SUBDIRS = src test ocaml
+SUBDIRS = src test ocaml textomml
CLEANFILES = core
bin_SCRIPTS = editex-config
STRIP = @STRIP@
VERSION = @VERSION@
-SUBDIRS = src test ocaml
+SUBDIRS = src test ocaml textomml
CLEANFILES = core
bin_SCRIPTS = editex-config
left-open (0|1) #IMPLIED>
<!ELEMENT cursor EMPTY>
-<!ATTLIST %TML.common.attrib; val CDATA #REQUIRED>
+<!ATTLIST
+ %TML.common.attrib;
+ val CDATA #REQUIRED
+ visible (0|1) #REQUIRED>
Makefile
src/Makefile
test/Makefile
+ textomml/Makefile
+ textomml/config.dirs
ocaml/Makefile
editex-config
])
<entry name="underbrace" pattern="#1" limits="1"/>
<entry name="cases" pattern="#1" table="1"/>
- <!-- MACRO for testing -->
- <entry name="red" pattern="{"/>
- <entry name="green" pattern="#1\over"/>
- <entry name="duedelim" pattern="#1\over\over#2"/>
-
</dictionary>
editor->lexer->drop(alt != 0);
}
+extern "C" int
+c_mathml_editor_cursor_hide(Editor* editor)
+{
+ assert(editor);
+ return editor->parser->hideCursor();
+}
+
+extern "C" int
+c_mathml_editor_cursor_show(Editor* editor)
+{
+ assert(editor);
+ return editor->parser->showCursor();
+}
+
extern "C" char*
c_mathml_editor_get_tex(const Editor* editor)
{
assert(editor);
DOM::Document res = editor->tml_tex->apply(editor->parser->document());
- DOM::Element root = res.get_documentElement();
- return strdup(std::string(root.get_nodeValue()).c_str());
+ assert(res);
+ res.normalize();
+ assert(res.get_firstChild() && res.get_firstChild().get_nodeName() == "#text");
+ return strdup(std::string(res.get_firstChild().get_nodeValue()).c_str());
}
extern "C" void
void c_mathml_editor_reset(Editor*);
void c_mathml_editor_push(Editor*, char);
void c_mathml_editor_drop(Editor*, int);
+int c_mathml_editor_cursor_hide(Editor*);
+int c_mathml_editor_cursor_show(Editor*);
char* c_mathml_editor_get_tex(const Editor*);
GdomeDocument* c_mathml_editor_get_tml(const Editor*);
GdomeDocument* c_mathml_editor_get_mml(const Editor*);
external drop : editor:t -> alt:bool -> unit
= "ml_mathml_editor_drop"
+external cursor_hide : editor:t -> unit
+ = "ml_mathml_cursor_hide"
+
+external cursor_show : editor:t -> unit
+ = "ml_mathml_cursor_show"
+
external get_tex : editor:t -> string
= "ml_mathml_editor_get_tex"
let drop = I_mathml_editor.drop
;;
+let cursor_hide = I_mathml_editor.cursor_hide
+;;
+
+let cursor_show = I_mathml_editor.cursor_show
+;;
+
let get_tex = I_mathml_editor.get_tex
;;
CAMLreturn(Val_unit);
}
+value
+ml_mathml_editor_cursor_hide(value v)
+{
+ CAMLparam1(v);
+ ml_Editor* editor = Editor_val(v);
+ CAMLreturn(Val_bool(c_mathml_editor_cursor_hide(editor->c_editor)));
+}
+
+value
+ml_mathml_editor_cursor_show(value v)
+{
+ CAMLparam1(v);
+ ml_Editor* editor = Editor_val(v);
+ CAMLreturn(Val_bool(c_mathml_editor_cursor_show(editor->c_editor)));
+}
+
value
ml_mathml_editor_get_tex(value v)
{
AMathMLFactory(class ALogger& l) : logger(l) { };
virtual ~AMathMLFactory() { };
- virtual void reset(void) = 0;
virtual void documentModified(class TDocument&) = 0;
virtual DOM::Document document(void) const = 0;
#include "APushParser.hh"
#include "AMathMLFactory.hh"
-void
-APushParser::reset()
-{
- if (factory) factory->reset();
-}
-
bool
APushParser::freeze()
{
APushParser(class ALogger& l, class AMathMLFactory& f) : logger(l), factory(&f), freeze_level(0) { };
virtual ~APushParser() { };
- virtual void reset(void);
+ virtual void reset(void) = 0;
virtual void push(const class TToken&) = 0;
virtual std::string drop(void) = 0;
virtual void setCursorHint(const std::string&) = 0;
+ virtual bool hideCursor(void) = 0;
+ virtual bool showCursor(void) = 0;
virtual bool freeze(void);
virtual bool thaw(void);
CMathMLFactoryXSLT::CMathMLFactoryXSLT(ALogger& l, const DOMX::XSLTStylesheet& s)
: AMathMLFactory(l), style(s)
-{
- reset();
-}
-
-void
-CMathMLFactoryXSLT::reset()
{
DOM::DOMImplementation di;
DOM::DocumentType dt;
void
CMathMLFactoryXSLT::documentModified(TDocument& doc)
{
- if (TNode dirty = doc.dirtyNode())
- {
- std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > dirtyId;
- if (result.get_documentElement().hasAttribute("xref"))
- dirtyId.push_back(std::make_pair(DOM::GdomeString("id"),
- DOM::GdomeString("'" + std::string(dirty["id"]) + "'")));
- DOM::Document res = style.apply(doc.document(), dirtyId);
- assert(res);
- style.save(doc.document(), stdout);
-
- DOM::Element root = res.get_documentElement();
- assert(root);
- assert(root.hasAttribute("xref"));
+ cout << "passo di qui" << endl;
+ std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > dirtyId;
+ if (TNode dirty = doc.dirtyNode())
+ if (result.get_documentElement().hasAttribute("xref"))
+ dirtyId.push_back(std::make_pair(DOM::GdomeString("id"),
+ DOM::GdomeString("'" + std::string(dirty["id"]) + "'")));
+ DOM::Document res = style.apply(doc.document(), dirtyId);
+ assert(res);
+ style.save(doc.document(), stdout);
- if (result.get_documentElement().hasAttribute("xref"))
- {
- bool ok = subst(result.get_documentElement(), root.getAttribute("xref"), result.importNode(root, true));
- assert(ok);
- }
- else
- result.replaceChild(result.importNode(root, true), result.get_documentElement());
-
- style.save(result, stdout);
+ DOM::Element root = res.get_documentElement();
+ assert(root);
+ assert(root.hasAttribute("xref"));
- doc.clearDirty();
+ if (result.get_documentElement().hasAttribute("xref"))
+ {
+ bool ok = subst(result.get_documentElement(), root.getAttribute("xref"), result.importNode(root, true));
+ assert(ok);
}
+ else
+ result.replaceChild(result.importNode(root, true), result.get_documentElement());
+
+ style.save(result, stdout);
+
+ doc.clearDirty();
}
bool
public:
CMathMLFactoryXSLT(class ALogger&, const class GdomeSmartDOMExt::XSLTStylesheet&);
- virtual void reset(void);
virtual void documentModified(class TDocument&);
virtual GdomeSmartDOM::Document document(void) const { return result; };
CMathMLFactoryXSLTDiff::CMathMLFactoryXSLTDiff(ALogger& l, const DOMX::XSLTStylesheet& s)
: AMathMLFactory(l), style(s)
-{
- reset();
-}
-
-void
-CMathMLFactoryXSLTDiff::reset()
{
DOM::DOMImplementation di;
DOM::DocumentType dt;
void
CMathMLFactoryXSLTDiff::documentModified(TDocument& doc)
{
- if (TNode dirty = doc.dirtyNode())
- {
- std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > dirtyId;
- if (false && result.get_documentElement().hasAttribute("xref"))
- dirtyId.push_back(std::make_pair(DOM::GdomeString("id"),
- DOM::GdomeString("'" + std::string(dirty["id"]) + "'")));
- DOM::Document res = style.apply(doc.document(), dirtyId);
- assert(res);
- //cout << "*** THE DIRTY FRAGMENT HAS ID = " << std::string(dirty["id"]) << endl;
- //style.save(doc.document(), stdout);
- cout << "*** THE CURRENT DOCUMENT:" << endl;
- if (result) style.save(result, stdout);
- cout << "*** THE NEW DOCUMENT:" << endl;
- style.save(res, stdout);
- cout << "*** THE DIFF:" << endl;
- DOMX::Diff diff = DOMX::Diff::diff(result, res);
- style.save(diff.document(), stdout);
- diff.patch();
#if 0
- DOM::Element root = res.get_documentElement();
- assert(root);
- assert(root.hasAttribute("xref"));
- if (result.get_documentElement().hasAttribute("xref"))
- {
- bool ok = subst(result.get_documentElement(), root.getAttribute("xref"), result.importNode(root, true));
- assert(ok);
- }
- else
- result = res;
+ std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > dirtyId;
+ if (TNode dirty = doc.dirtyNode())
+ if (false && result.get_documentElement().hasAttribute("xref"))
+ dirtyId.push_back(std::make_pair(DOM::GdomeString("id"),
+ DOM::GdomeString("'" + std::string(dirty["id"]) + "'")));
#endif
- //style.save(result, stdout);
+ DOM::Document res = style.apply(doc.document());
+ assert(res);
+ //cout << "*** THE DIRTY FRAGMENT HAS ID = " << std::string(dirty["id"]) << endl;
+ //style.save(doc.document(), stdout);
+ cout << "*** THE CURRENT DOCUMENT:" << endl;
+ if (result) style.save(result, stdout);
+ cout << "*** THE NEW DOCUMENT:" << endl;
+ style.save(res, stdout);
+ cout << "*** THE DIFF:" << endl;
+ DOMX::Diff diff = DOMX::Diff::diff(result, res);
+ style.save(diff.document(), stdout);
+ diff.patch();
- doc.clearDirty();
- }
+ doc.clearDirty();
}
bool
public:
CMathMLFactoryXSLTDiff(class ALogger&, const DOMX::XSLTStylesheet&);
- virtual void reset(void);
virtual void documentModified(class TDocument&);
virtual DOM::Document document(void) const { return result; };
-#ifndef __TPushLexer_hh__
+#ifndef __LPushLexer_hh__
#define __LPushLexer_hh__
#include <string>
et.removeEventListener("DOMSubtreeModified", *this, false);
}
+void
+TDocument::reset()
+{
+ DOM::Element root = doc.createElementNS(TML_NS_URI, "tml:tex");
+ root.setAttributeNS(XMLNS_NS_URI, "xmlns:tml", TML_NS_URI);
+ doc.replaceChild(root, doc.get_documentElement());
+ clearDirty();
+}
+
void
TDocument::serialize(const char* filename) const
{
unsigned d1 = nodeDepth(n1);
unsigned d2 = nodeDepth(n2);
- cout << "finding common ancestor " << d1 << " " << d2 << endl;
+ // cout << "finding common ancestor " << d1 << " " << d2 << endl;
while (d1 < d2)
{
DOM::MutationEvent me(ev);
assert(me);
+#if 0
if (dirty)
cout << "TDocument::handleEvent DIRTY BEFORE = " << dirty.getAttribute("id") << endl;
else
cout << "TDocument::handleEvent DIRTY BEFORE = (nil)" << endl;
+#endif
if (DOM::Node node = me.get_target())
if (dirty)
else
assert(0);
+#if 0
cout << "TDocument::handleEvent target = " << DOM::Node(me.get_target()).get_nodeName() << " DIRTY AFTER = "
<< dirty.getAttribute("id") << " ME = " << DOM::Node(me.get_target()).get_nodeName() << endl;
-
+#endif
}
TDocument(void);
~TDocument();
+ void reset(void);
TNode create(const std::string&, unsigned = 0) const;
TNode createG(unsigned id = 0) const { return create("g", id); };
TNode createC(const std::string&, unsigned = 0) const;
TPushParser::TPushParser(ALogger& l, const TDictionary& d) : APushParser(l), dictionary(d)
{
- reset();
+ init();
}
TPushParser::TPushParser(ALogger& l, AMathMLFactory& f, const TDictionary& d) : APushParser(l, f), dictionary(d)
{
- reset();
+ init();
}
TPushParser::~TPushParser()
{
}
+void
+TPushParser::init()
+{
+ cursor = doc.create("cursor");
+ cursor["visible"] = "1";
+ hiddenCursor = 0;
+ reset();
+}
+
void
TPushParser::reset()
{
- APushParser::reset();
+ cout << "passo di qui dentro pushparser " << factory << endl;
nextId = 1;
- cursor = doc.create("cursor");
- cursor["id"] = "I0";
- doc.clearDirty();
+ if (cursor.parent()) cursor.remove();
+ doc.reset();
doc.root().append(cursor);
+ if (factory) factory->documentModified(doc);
}
std::string
}
}
+bool
+TPushParser::hideCursor()
+{
+ if (hiddenCursor++ == 0)
+ {
+ cursor["visible"] = "0";
+ if (factory && doc.dirtyNode() && !frozen()) factory->documentModified(doc);
+ return true;
+ }
+ else
+ return false;
+}
+
+bool
+TPushParser::showCursor()
+{
+ if (hiddenCursor > 0 && --hiddenCursor == 0)
+ {
+ cursor["visible"] = "1";
+ if (factory && doc.dirtyNode() && !frozen()) factory->documentModified(doc);
+ return true;
+ }
+ else
+ return false;
+}
+
bool
TPushParser::thaw()
{
virtual void push(const TToken&);
virtual std::string drop(void);
virtual void setCursorHint(const std::string&);
+ virtual bool hideCursor(void);
+ virtual bool showCursor(void);
virtual bool thaw(void);
DOM::Document document(void) const { return doc.document().cloneNode(true); }
private:
+ void init(void);
+
std::string PRIME(void) const;
bool isPrimes(const TNode&) const;
unsigned nextId;
TDocument doc;
TNode cursor;
+ unsigned hiddenCursor;
const class TDictionary& dictionary;
};
return res;
}
+void
+TTokenizer::reset()
+{
+ assert(0);
+}
+
void
TTokenizer::push(const TToken& token)
{
std::vector<TToken> tokenize(const std::string&);
private:
+ virtual void reset(void);
virtual void push(const TToken&);
virtual std::string drop(void);
virtual void setCursorHint(const std::string&) { };
+ virtual bool hideCursor(void) { return false; };
+ virtual bool showCursor(void) { return false; };
std::list<TToken> tokens;
};
Makefile
Makefile.in
editor
-test
struct Context
{
- Context(const std::string& s, TPushLexer& l, TPushParser& p) : buffer(s), i(0), lexer(l), parser(p) { };
+ Context(const std::string& s, TPushLexer& l, TPushParser& p, DOMX::XSLTStylesheet& ts)
+ : buffer(s), i(0), lexer(l), parser(p), texStyle(ts) { };
void send(void)
{
unsigned i;
TPushLexer& lexer;
TPushParser& parser;
+ DOMX::XSLTStylesheet& texStyle;
};
+extern "C" void
+edit_output_tex(Context* data)
+{
+ assert(data);
+ DOM::Document res = data->texStyle.apply(data->parser.document());
+#if 0
+ res.normalize();
+ DOM::Node c = res.get_firstChild();
+ if (c) cout << "HEY, there is a child! " << c.get_nodeName() << " " << c.get_nodeValue() << endl;
+#endif
+ data->texStyle.save(res, stdout);
+}
+
extern "C" int
edit_timeout(Context* data)
{
GUI_thaw();
}
+extern "C" void
+edit_reset_tex(Context* context)
+{
+ assert(context != NULL);
+ GUI_freeze();
+ context->lexer.reset();
+ context->parser.reset();
+ GUI_thaw();
+}
+
void
main(int argc, char* argv[])
{
logger.info("loading the stylesheet...");
DOM::DOMImplementation di;
- DOM::Document docStyle = di.createDocumentFromURI("./xsl/tml-mmlp.xsl");
- DOMX::XSLTStylesheet style(docStyle);
+ DOM::Document mmlStyleDoc = di.createDocumentFromURI("./xsl/tml-mmlp.xsl");
+ DOMX::XSLTStylesheet mmlStyle(mmlStyleDoc);
+
+ DOM::Document texStyleDoc = di.createDocumentFromURI("./xsl/tml-tex.xsl");
+ DOMX::XSLTStylesheet texStyle(texStyleDoc);
- CMathMLFactoryXSLTDiff factory(logger, style);
+ CMathMLFactoryXSLTDiff factory(logger, mmlStyle);
TPushParser parser(logger, factory, dictionary);
TPushLexer lexer(logger, parser);
style.save(result, stdout);
#endif
- Context context("", lexer, parser);
+ Context context("", lexer, parser, texStyle);
GUI_init(&argc, &argv, "mathmleditor", 500, 600, &context);
GUI_load_document(gdome_cast_doc(static_cast<GdomeNode*>(factory.document())));
static void file_open(GtkWidget*, gpointer);
static void file_re_open(GtkWidget*, gpointer);
static void file_close(GtkWidget*, gpointer);
+static void file_output_tex(GtkWidget*, gpointer);
static void options_font_manager(GtkWidget*, FontManagerId);
static void options_set_font_size(GtkWidget*, gpointer);
static void options_change_font_size(GtkWidget*, gboolean);
static void edit_delete_selection(GtkWidget*, gpointer);
static void edit_select_parent(GtkWidget*, gpointer);
static void edit_reset_selection(GtkWidget*, gpointer);
+static void edit_reset(GtkWidget*, gpointer);
static void edit_insert(GtkWidget*, gpointer);
static void help_about(GtkWidget*, gpointer);
{ "/File/_Open...", "<control>O", file_open, 0, NULL },
{ "/File/_Reopen", NULL, file_re_open, 0, NULL },
{ "/File/_Close", "<control>W", file_close, 0, NULL },
+ { "/File/Output _TeX", NULL, file_output_tex, 0, NULL },
{ "/File/sep1", NULL, NULL, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_main_quit, 0, NULL },
{ "/Edit/Delete Selection", NULL, edit_delete_selection, 0, NULL },
{ "/Edit/Select Parent", NULL, edit_select_parent, 0, NULL },
{ "/Edit/sep1", NULL, NULL, 0, "<Separator>" },
+ { "/Edit/_Reset", NULL, edit_reset, 0, NULL },
{ "/Edit/Insert...", "<control>I", edit_insert, 0, NULL },
{ "/_Options", NULL, NULL, 0, "<Branch>" },
gtk_widget_show (fs);
}
+static void
+file_output_tex(GtkWidget* widget, gpointer data)
+{
+ g_assert(context != NULL);
+ edit_output_tex(context);
+}
+
static void
options_font_manager(GtkWidget* widget, FontManagerId id)
{
}
}
+static void
+edit_reset(GtkWidget* widget, gpointer data)
+{
+ g_assert(context != NULL);
+ edit_reset_tex(context);
+}
+
static void
insert_tex(GtkWidget* widget, GtkEntry* entry)
{
--- /dev/null
+.deps
+.libs
+Makefile
+Makefile.in
+textomml
+config.dirs
--- /dev/null
+
+bin_PROGRAMS = textomml
+
+textomml_SOURCES = main.cc
+
+LDADDS = \
+ $(GMETADOM_LIBS) \
+ $(GDOMEXSLT_LIBS) \
+ $(top_builddir)/src/.libs/libeditex.a
+
+textomml_LDADD = $(LDADDS)
+
+INCLUDES = \
+ $(GMETADOM_CFLAGS) \
+ $(GDOMEXSLT_CFLAGS) \
+ -I$(top_srcdir)/src
+
--- /dev/null
+#define PKGDATADIR "@prefix@/share/@PACKAGE@"
--- /dev/null
+
+#include <getopt.h>
+
+#include <fstream>
+
+#include "dom.hh"
+#include "TPushParser.hh"
+#include "TPushLexer.hh"
+#include "TDictionary.hh"
+#include "CLoggerConsole.hh"
+#include "CMathMLFactoryXSLT.hh"
+#include "CMathMLFactoryXSLTDiff.hh"
+#include "AMathMLConsumer.hh"
+
+#include "config.dirs"
+
+enum CommandLineOptionId {
+ OPTION_VERSION = 256,
+ OPTION_HELP,
+ OPTION_VERBOSE,
+ OPTION_DICTIONARY,
+ OPTION_TML_XSLT,
+ OPTION_XSLT
+};
+
+static std::string tml_xslt = PKGDATADIR"/tml-mmlp.xsl";
+static std::string dictionary = PKGDATADIR"/dictionary-tex.xml";
+static bool xslt = true;
+
+static bool
+parseBoolean(const char* s, bool& res)
+{
+ assert(s != NULL);
+ if (!strcmp(s, "yes")) {
+ res = true;
+ return true;
+ } else if (!strcmp(s, "no")) {
+ res = false;
+ return true;
+ }
+
+ return false;
+}
+
+static void
+printVersion()
+{
+ std::cout << "TeX to MathML converter " << VERSION << " - Luca Padovani (C) 2003" << std::endl
+ << "This program is covered by the GNU Lesser General Public Licence" << std::endl;
+}
+
+static void
+printHelp()
+{
+ static char* helpMsg = "\
+Usage: textomml [options] file\n\n\
+ -V, --version Output version information\n\
+ -h, --help This small usage guide\n\
+ -v, --verbose[=0-3] Display messages\n\
+ --dictionary=<path> Full path of the dictionary\n\
+ --tml-xslt=<path> Full path of the XSLT stylesheet\n\
+ --xslt[=yes|no] Enable/disable XSLT transformation (default='yes')\n\
+";
+
+ std::cout << helpMsg << std::endl;
+ exit(0);
+}
+
+static void
+parseError(const char* option)
+{
+ assert(option != NULL);
+ std::cerr << "error while parsing option `" << option << "'" << std::endl << std::endl;
+ printHelp();
+}
+
+void
+main(int argc, char* argv[])
+{
+ CLoggerConsole logger;
+
+ while (TRUE) {
+ int option_index = 0;
+ static struct option long_options[] =
+ {
+ { "version", no_argument, NULL, OPTION_VERSION },
+ { "help", no_argument, NULL, OPTION_HELP },
+ { "verbose", optional_argument, NULL, OPTION_VERBOSE },
+ { "dictionary", required_argument, NULL, OPTION_DICTIONARY },
+ { "tml-xslt", required_argument, NULL, OPTION_TML_XSLT },
+ { "xslt", optional_argument, NULL, OPTION_XSLT },
+
+ { NULL, no_argument, NULL, 0 }
+ };
+
+ int c = getopt_long(argc, argv, "Vhv::", long_options, &option_index);
+
+ if (c == -1) break;
+
+ switch (c) {
+ case OPTION_VERSION:
+ case 'V':
+ printVersion();
+ break;
+
+ case OPTION_HELP:
+ case 'h':
+ printHelp();
+ break;
+
+ case OPTION_VERBOSE:
+ case 'v':
+ if (optarg == NULL) logger.verbosity(ALogger::Warning);
+ else logger.verbosity(ALogger::Level(*optarg - '0'));
+ break;
+
+ case OPTION_DICTIONARY:
+ dictionary = optarg;
+ break;
+
+ case OPTION_TML_XSLT:
+ tml_xslt = optarg;
+ break;
+
+ case OPTION_XSLT:
+ if (optarg == NULL) printHelp();
+ else if (!parseBoolean(optarg, xslt)) parseError("xslt");
+ break;
+
+ case '?':
+ break;
+
+ default:
+ std::cerr << "*** getopt returned `" << c << "' value" << std::endl;
+ break;
+ }
+ }
+
+ TDictionary dict(logger);
+ logger.info("loading dictionary: `" + dictionary + "'");
+ dict.load("dictionary-test.xml");
+
+ logger.info("loading stylesheet: `" + tml_xslt + "'");
+ DOM::DOMImplementation di;
+ DOM::Document docStyle = di.createDocumentFromURI("./xsl/tml-mmlp.xsl");
+ DOMX::XSLTStylesheet style(docStyle);
+
+ CMathMLFactoryXSLT factory(logger, style);
+ TPushParser parser(logger, factory, dict);
+ TPushLexer lexer(logger, parser);
+
+ if (optind < argc)
+ {
+ ifstream file(argv[optind]);
+ if (!file)
+ {
+ std::cerr << "can't open input file `" << argv[optind] << "'" << std::endl;
+ exit(1);
+ }
+
+ parser.freeze();
+ char ch;
+ while (file.get(ch)) lexer.push(ch);
+ parser.thaw();
+ }
+ else
+ printHelp();
+}
</xsl:choose>
</xsl:template>
- <xsl:template match="tml:cursor">
+ <xsl:template match="tml:cursor[@visible='1']">
<xsl:param name="annotation" select="/.."/>
<xsl:choose>
<xsl:when test="$annotation">
</xsl:choose>
</xsl:template>
+ <xsl:template match="tml:cursor[not(@visible) or @visible='0']">
+ </xsl:template>
+
<xsl:template match="tml:sb[@under='1'][*[1]/tml:sp[@over='1']]">
<m:munderover>
<xsl:if test="@id">
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="*[1]"/>
- <xsl:if test="tml:g/tml:cursor">
+ <xsl:if test="tml:g/tml:cursor[@visible='1']">
<m:msub>
<m:mtext mathcolor="#808080">}</m:mtext>
<m:mtext><xsl:value-of select="@name"/></m:mtext>
<xsl:template match="tml:i">
<xsl:choose>
- <xsl:when test="@name">\<xsl:value-of select="@name"/><xsl:value-of select="' '"/></xsl:when>
+ <xsl:when test="@name">\<xsl:value-of select="@name"/>
+ <xsl:if test="parent::tml:g and following-sibling::tml:i"><xsl:value-of select="' '"/></xsl:if>
+ </xsl:when>
<xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
<xsl:otherwise>{\it <xsl:value-of select="@val"/>}</xsl:otherwise>
</xsl:choose>
<xsl:template match="tml:n">
<xsl:choose>
- <xsl:when test="@name">\<xsl:value-of select="@name"/><xsl:value-of select="' '"/></xsl:when>
+ <xsl:when test="@name">\<xsl:value-of select="@name"/>
+ <xsl:if test="parent::tml:g and following-sibling::tml:n"><xsl:value-of select="' '"/></xsl:if>
+ </xsl:when>
<xsl:when test="string-length(@val)=1"><xsl:value-of select="@val"/></xsl:when>
<xsl:otherwise>{\rm <xsl:value-of select="@val"/>}</xsl:otherwise>
</xsl:choose>