This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A sample XPath exptression: | |
| const xpath = "${xpath:'.//tps:fieldSet[@name='ChapterTitle']/@value',No_Title}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mathHandler = { | |
| // processElement handles the custom elements | |
| processElement: function (parent, node) { | |
| // node is the math equation as an XML. | |
| // We convert it to a plain string, | |
| // and we trim the extra whitespace. | |
| var txt = node.toXMLString().replace(/^\s+|\s+$/g, ''); | |
| // pass the equation text back to Typefi for processing, | |
| TYPEFI.story.text(txt); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TYPEFI.xml.Handlers['http://www.w3.org/1998/Math/MathML'] = mathHanlder; | |
| TYPEFI.xml.Handlers['http:/nothing.no/customName'] = simpleHanlder; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1. Create our own namespace under the global TYPEFI object. | |
| TYPEFI.mathml = {}; | |
| // ---------------------------------------------------------------------------- | |
| // 2. Define our constructor. | |
| TYPEFI.mathml.Handler = function() {}; | |
| // ---------------------------------------------------------------------------- | |
| // 3. Implement our object body on the prototype. Typically the following three |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| text(text) | |
| startElement(tag, attributes) | |
| endElement(tag) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #targetengine 'typefi' | |
| TYPEFI.Engine.run(new TYPEFI.Job({ | |
| 'indd': '~/Documents/workspace/Engine/test/tests/T43_mathml/Job/template.indd', | |
| 'cxml': '~/Documents/workspace/Engine/test/tests/T43_mathml/Job/content.cxml', | |
| 'folder': '~/Documents/workspace/Engine/test/tests/T43_mathml/Job/', | |
| 'scriptEvents': { | |
| 'documentStart': '~/Documents/workspace/Engine/test/tests/T43_mathml/Job/MathmlHandler.jsx' | |
| }, | |
| 'logToConsole': true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TYPEFI.xml.Handlers['http://www.w3.org/1998/Math/MathML'] = new TYPEFI.mathml.Handler(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <tps:content schemaVersion="3.2" | |
| xmlns:tps="http://www.typefi.com/ContentXML" | |
| xmlns:mml="http://www.w3.org/1998/Math/MathML" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://www.typefi.com/ContentXML | |
| http://www.typefi.com/TPS/content/3_2/ContentXML.xsd" | |
| whiteSpaceMode="strict"> | |
| <tps:section type="Chapter"> | |
| <tps:p type="Normal">Some MathML embedded in some Content XML.</tps:p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table style="width:700px"> | |
| <caption> | |
| <h2 class="wysiwyg-text-align-left"> | |
| To use the <em>Apply XSL transform</em> action, complete the following | |
| fields: | |
| </h2> | |
| </caption> | |
| <thead> | |
| <tr> | |
| <th class="wysiwyg-text-align-left" style="width:156px" scope="col"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <content> | |
| <fieldSet name="Title" value="The Meaning of Life" /> | |
| <fieldSet name="Author" value="Monty Python" /> | |
| <section type="Sketch"> | |
| <fieldSet name="ChapterTitle" value="The Miracle of Birth" /> | |
| <p>What is the meaning of life?</p> | |
| </section> | |
| </content> |