Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Wednesday, December 02, 2015

[Browsers] Inconsistent HTML Entities

I fancy that this is old hat to most of you, but I had thought HTML entities cut and dried: An ampersand, a word and a semicolon (reminds me a little of dBase III, actually.) It seems, however, that certain browsers are still unsure as to what constitutes an HTML entity, and where it should end.

One of the languages I use for server-side management uses the ampersand + word + semicolon format to mark where variables may be interpolated into the output stream. So it was with some surprise when it was pointed out to me by a colleague that &currentValue; was being rendered as ¤tValue;.

Being the inquisitive sort, I went to
dev.w3.org and downloaded all the HTML entity names. After a bit of fiddling about in jQuery, I had the list. After a bit more fiddling, this time in JScript, I ended up with an HTML file showing the entity name, the entity as rendered, and then what happens when you leave off the trailing semicolon and append some other text (in this case 'es'). This is where things get ... well ... unusual. Some HTML entites follow the standard. Others like ¤ and £ don't. You enter &poundage, expecting the browser to give &poundage only to have it give you £age. Weirdness abounds. Take · which actually renders as ¢erdotes!

So as to give you an idea of how it looks in your browser, I've put the file up in a
jsfiddle . Let me know how you get on and whether your browser is as compliant is it makes out.

Enjoy!


© Copyright Bruce M. Axtens, 2015

Friday, October 07, 2005

[MetaCard and Tcl] Blogs.mc

I got asked to describe the stack a little better. Here goes:
My blogs.mc stack has two text fields (fSource and fGenerated) and some buttons at the bottom (create_card, first, prev, next, last, render, preview, delete).

With some marked-up text in the fSource field, I click 'render' and the output of the Tcl script (HTML) is put into the fGenerated field (line 6 of the 'Render' script).

Then when I click on 'preview' the HTML in the fGenerated field gets dumped to a file and passed to Safari. The fGenerated field is modifiable so I can play with things to get what I want and then tweak the Tcl script appropriately afterwards.
About the same time I posted this to the MetaCard list:
On my blog, codeaholic.blogspot.com, I've posted an item about MetaCard (on OS X) using Tcl to more-or-less bypass the script size limit of the unregistered version of MetaCard.
Richard Gaskin wrote back, saying (in part):
since there is no MetaCard anymore anyway, and since Rev only offers a 30-day trial for the engine, I'm not sure how helpful the article will be.

At $99 for the low-end Rev license, is the pricing really so prohibitive?
Also Alejandro Tejada wrote
i do not see how this could get around the 10 lines limit, but Geoff Canyon wrote an extensive tutorial to manage longer scripts within the 10 lines limits.

This tutorial is still useful for developers that want to run longer scripts in their standalone applications.

I get it from Ken Ray's website within the RR v 1.1 docs (saved as a pdf file). i'm not sure if this tutorial is still available in any website.

You could ask directly to Geoff Canyon. Look for his website: inspiredlogic.com
I answered with
> i do not see how this could get around the
> 10 lines limit,

bad choice of words on my part. It doesn't so much get around it as it does acquiesce to the fact and try to use other tools to do what can't otherwise be done. Instead of using MetaCard's HTML mechanism or writin8g something in MetaTalk, I've farmed out the functionality to a Tcl script.

> but Geoff Canyon wrote an
> extensive tutorial to manage longer scripts
> within the 10 lines limits.

of this I was unaware. I have thought about doing something similar. What I usually end up doing however, when I need to hang more closely to MetaCard is to use AppleScript and 'do script' or 'evaluate' the things I need. I will nevertheless make enquiries now that I know better.