Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
HTML Frames, or the equivalent
I would like to have the content of a textpattern webpage be a second, embedded webpage. In the old days of the Wild West, we used frames. Is that still the only choice? If so, is there a texpatternish way to store the embedded page, or does it just go in a disk file on the server?
Specifically, I am creating content in LibreOffice, with a lot of mathematical equations. LibreOffice used to output HTML4 with the equations as images, but the latest ‘upgrade’ no longer offers that option. It does, however, output a full web page in HTML5. Rather than manually convert each equation to images, life would be easier if I could just embed the entire article into the textpattern blog.
Offline
Re: HTML Frames, or the equivalent
iframes could be used for that, it’s kind of what they are intended for – although I loathe iframes myself.
Offline
Re: HTML Frames, or the equivalent
philwareham wrote #280834:
iframes could be used for that, it’s kind of what they are intended for – although I loathe iframes myself.
If I use iframes directly, I will have to dump thousands of lines of LibreOffice HTML gobbledegook into the textpattern database. I suppose php could slurp the content out of a file instead. Is there some textpatternish way to get that done? Maybe there is already a Plugin that sucks in content from a file, or even better, a Textpattern File?
edit: I think I read the iframe documentation wrong. It looks like an upgrade to frame, and can still pull in an external URL, as well as using direct HTML.
edit^2: I gave it a shot. Looks terrible. The page ends up in a little box, and the index that normally sits on the right hand side is completely gone.
Last edited by skewray (2014-05-15 17:03:54)
Offline
Re: HTML Frames, or the equivalent
skewray wrote #280835:
I suppose php could slurp the content out of a file instead. Is there some textpatternish way to get that done? Maybe there is already a Plugin that sucks in content from a file, or even better, a Textpattern File?
smd_xml
or etc_query
plugins will let you extract whatever you want from a xml/html file.
Edit: otherwise, there are two latex rendering plugins, though I have not tested them.
Last edited by etc (2014-05-15 17:32:43)
Offline
Re: HTML Frames, or the equivalent
Here’s what I get for a formula if I save as flattened ODT (.fodt) file:
(Extra junk stripped out)
<draw:object>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<semantics>
<msqrt>
<msqrt>
<mrow>
<mi>tanh</mi>
<mrow>
<mo fence="true" stretchy="false">(</mo>
<mrow>
<mrow>
<mrow>
<mo stretchy="false">±</mo>
<mn>3</mn>
</mrow>
<mo stretchy="false">∼</mo>
<mn>5</mn>
</mrow>
</mrow>
<mo fence="true" stretchy="false">)</mo>
</mrow>
</mrow>
</msqrt>
</msqrt>
<annotation encoding="StarMath 5.0">sqrt{ sqrt{ tanh( +-3 sim 5 ) } } </annotation>
</semantics>
</math>
</draw:object><draw:image>
<office:binary-data>VkNMTVRGAQAxAAAAAAAAAAEAGwAAAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAWgLAABP
AgAAWQAAAJYAAQACAAAACQCLAAEAAgAAAP//gQABABAAAAAAAAAAAAAAAGcLAABOAgAAlQAB
AAQAAAAAAAAAlgABAAIAAAAJAIsAAQACAAAAHwCKAAEAPAAAAAMANgAAAAoAT3BlblN5bWJv
bAAApgEAAHYCAAD//wAAAAAFAAAAAAAAAP8DAAAAAAAAAAAA/wMAAAAAAIgAAQACAAAAAQCH
AAEABQAAAP////8AhgABAAQAAAAAAAAAcgACABoAAABjAAAAGAIAAAEAAAAaIuEAAAAAAP//
AQAaIowAAQAAAAAAiwABAAIAAAAfAIUAAQAFAAAAAAAAAAGEAAEABQAAAAAAAAAAigABADwA
AAADADYAAAAKAE9wZW5TeW1ib2wAAKYBAAB2AgAA//8AAAAABQAAAAAAAAD/AwAAAAAAAAAA
AP8DAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAAAAAAAGcAAQAQAAAAUQEA
ABQAAAD2CgAAIgAAAIwAAQAAAAAAiwABAAIAAAAfAIoAAQA8AAAAAwA2AAAACgBPcGVuU3lt
Ym9sAACmAQAAJwIAAP//AAAAAAUAAAAAAAAA/wMAAAAAAAAAAAD/AwAAAAAAiAABAAIAAAAB
AIcAAQAFAAAA/////wCGAAEABAAAAAAAAAByAAIAGgAAAGUBAAAEAgAAAQAAABoi4QAAAAAA
//8BABoijAABAAAAAACLAAEAAgAAAB8AhQABAAUAAAAAAAAAAYQAAQAFAAAAAAAAAACKAAEA
PAAAAAMANgAAAAoAT3BlblN5bWJvb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AIgAAQACAAAAAQCHAAEABQAAAP//
//8AhgABAAQAAAAAAAAAcgACABoAAAA3CAAA3AEAAAEAAAA8Ik8BAAAAAP//AQA8IowAAQAA
AAAAiwABAAIAAAAfAIoAAQBCAAAAAwA8AAAAEABMaWJlcmF0aW9uIFNlcmlmAAAAAAAApgEA
AAAAAwAAAAUAAAAAAAAA/wMAAAAAAAAAAAD/AwAAAAAAiAABAAIAAAABAIcAAQAFAAAA////
/wCGAAEABAAAAAAAAAByAAIAFwAAAIkJAADcAQAAAQA10wAAAAAA//8BADUAjAABAAAAAACL
AAEAAgAAAB8AigABADwAAAADADYAAAAKAE9wZW5TeW1ib2wAAAAAAACmAQAA//8AAAAABQAA
AAAAAAD/AwAAAAAAAAAAAP8DAAAAAACIAAEAAgAAAAEAhwABAAUAAAD/////AIYAAQAEAAAA
AAAAAHIAAgAaAAAAdwoAANwBAAABAAAAKQCPAAAAAAD//wEAKQCMAAEAAAAAAJUAAQAEAAAA
AAAAAJYAAQACAAAACQCMAAEAAAAAAA==
</office:binary-data>
</draw:image>
So it’s some XML (MathML) representing the formula plus the binary data that represents the final formula image.
You could do something with either one of those, but I’m guessing the latter would be easiest to parse and present on a web page. Lea Verou wrote up an interesting article about direct MathML rendering.
The HTML export I’m getting contains only MathML, so I don’t think that’d be a good way to go, unless I’m missing some option to include imagery.
Edit: MathJax looks like a really nice option. Just link to the MathJax .js file in your HTML, then include the <math> element and all descendants in your page, and it should render the formula nicely.
Edit #2: Here is my test formula MathML, copied out of an .fodt file and rendered on a page with MathJax enabled: Test (that looks way better in Chrome now than it did without MathJax.)
So you could easily reduce this into a) copy & paste the body of your .fodt file into a custom field and then parse with e.g. smd_xml or etc_query, or b) extract the MathML on your own and then paste into the body text of your article, or c) upload the .fodt file using the Files functionality and parse it using one of the plugins above or some straight PHP.
And none of these require an iframe, so that’s good.
Last edited by maruchan (2014-05-15 19:59:01)
Offline
Re: HTML Frames, or the equivalent
Re: MathML and MathJax
I have previously considered those options, and discarded them. I wish I could recall the reasons, but it has been a while. Probably some combination of poor rendering in antiquated browsers and an antipathy towards javascript. What I recently did was to cut and paste each equation’s MathML into LO Math, export as a PDF, crop with briss, and then use Imagemagick to convert to a JPG. Now if only I could automate that…
Offline
#7 2014-05-15 23:06:27
- ax
- Plugin Author
- From: Germany
- Registered: 2009-08-19
- Posts: 165
Re: HTML Frames, or the equivalent
There has been a suggestion in the forum how to generate an image with a formula by using Textile.
Offline
Re: HTML Frames, or the equivalent
How about an HTML Import ?
Offline
Re: HTML Frames, or the equivalent
joebaich wrote #280870:
How about an HTML Import ?
Wouldn’t the CSS of the parent alter the appearance of the imported content?
Offline