Hi,
Type and select the string "£" in an html document
Hit cmd-shift-& and choose "Convert to named entity"
expected: british pounds sterling symbol obtained: ampersand (&)
reference: http://www.w3.org/TR/WD-entities-961125
<!ENTITY pound CDATA "£" -- pound sterling sign -->
<!ENTITY amp CDATA "&" -- ampersand, U0026 ISOnum -->
If you are trying to get £ you first need to "Decode numeric entities" and then "Convert to named entity"
- Juan
On Nov 11, 2005, at 1:11 PM, Timothy Bates wrote:
Hi,
Type and select the string "£" in an html document
Hit cmd-shift-& and choose "Convert to named entity"
expected: british pounds sterling symbol obtained: ampersand (&)
reference: http://www.w3.org/TR/WD-entities-961125
<!ENTITY pound CDATA "£" -- pound sterling sign -->
<!ENTITY amp CDATA "&" -- ampersand, U0026 ISOnum -->
Merci for pointing out how it works, but I guess I can't see the value in a converter which can't see that it has a numeric as input and do the right thing. Amp is just wrong as an output. So: request for improvement: convert commands examine their input to respond intelligently to requests to return a named entity when given a raw character or an already encoded numeric.
Juan Carlos Anorga juananorga@gmail.com
If you are trying to get £ you first need to "Decode numeric entities" and then "Convert to named entity"
On Nov 11, 2005, at 1:11 PM, Timothy Bates wrote:
Doing "Convert to named entity" on "£" gives "&" when I want "£"
On 11/11/2005, at 22.46, Timothy Bates wrote:
Merci for pointing out how it works, but I guess I can't see the value in a converter which can't see that it has a numeric as input and do the right thing. Amp is just wrong as an output.
Then what if you wanted to convert a & to '&'?
-- Sune.
Then what if you wanted to convert a & to '&'?
-- Sune.
Hmm. "&" doesn't match any numeric or named entity, so ...
if the selection is "&" and the user chooses the command "convert to named entity" it should still be upconverted to &
A simple rule would be
if ( regexp("&.{3,4};", str) ) { //string looks like a valid numeric entity convertNumericToNamedEntity(str); else //string looks like plain text convertCharToNamedEntity(str); }
On 12/11/2005, at 9:04 AM, Sune Foldager wrote:
On 11/11/2005, at 22.46, Timothy Bates wrote:
Merci for pointing out how it works, but I guess I can't see the value in a converter which can't see that it has a numeric as input and do the right thing. Amp is just wrong as an output.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 12/11/2005, at 15.15, Timothy Bates wrote:
A simple rule would be [...]
Automation -> Run Command -> Edit Commands…
Then unfold the HTML bundle, and you can see the code for the existing command(s). Feel free to submit a patch :)
You can also just do: Automation -> Start Macro Recording Decode Numeric Entities Convert to Named Entities Automation -> Stop Macro Recording
Then save this macro and use it instead.