HTML Entities

Posted by ericc on 2008-06-16 07:28
Forums: Komodo support | OS: Windows XP Pro

Hi

I use Komodo Edit, and I miss a simple and stupid feature (or I don't found it).

I am French (nobody is perfect ;-) ) so when I build web page I often need to use Latin characters as éèàç...
Of course, to be sure that this characters will be correctly displayed in browser, I need to translate them in HTML Entities (see : http://www.w3schools.com/tags/ref_entities.asp).

In some other editor, I just select the text,then press Ctrl+D and all characters are converted.
It's a kind of quick search & replace.

Is it possible to do the same in Komodo Edit or IDE ?
And how ?

Thanks in advance for your help

ericc

ericp
ActiveState Staff
Mon, 2008-06-16 10:10

As an example, I created a snippet in
Toolbox/Samples/Abbreviations/HTML called "é" (no quotes).
It contains the text "é". Then you can
do the expansion in any HTML file by typing "é"
followed by Ctrl+T (if you use the default set)
to replace it with the entity.

You can even bind this command to Ctrl+D by going
into [Preferences|Editor|Key Bindings], find the
command "Editor: Insert Abbreviation Snippet by Name",
adding the New Key Sequence Ctrl+D, and press "Add".

dafi | Mon, 2008-06-16 10:18

With MoreKomodo you can encode strings to entities and to numeric entities and can also decode from entitized to human strings

From menu item Code|Convert Selected Text

PS
I'm working to allow user to define its keybinding but the problem consist to starting with a predefined set

--
dafi
Enhance KomodoEdit with MoreKomodo

GroessterNehmer | Mon, 2008-07-07 15:25

Hi dafi

I have the same problem as ericc (not being French but the other one with the HTML entities) :-)

I tried your extension but it translates everything into HTML entities including the actual HTML tags like < p> gets & lt;p& gt;. Its kind of a hassle to select every text passage and use Convert Selected Text. Is there a way to make it leave everything inside brackets (including them) alone? Or could you have your extension run tidy over the file? Someone wrote a macro that would do just that but it doesn't work for me (probably a Mac OS related issue, see http://community.activestate.com/forum-topic/macro-to-reformat-files#com... ).

GroessterNehmer

dafi | Mon, 2008-07-07 21:36

The feature is intended to "convert" selection so isn't possible to exclude text if it is selected.

I don't want to use tidy or other external application.

If necessary I can modify this feature but how it must work?
How can I decide if "<" and ">" must be "entitized" or not?
Any idea is appreciate

--
dafi
Enhance KomodoEdit with MoreKomodo

GroessterNehmer | Thu, 2008-07-10 04:44

Thanks for your quick reply and your effort.

I don't know if this would bloat up your extension to much, but you could add an extra menu entry like "Convert File to HTML Entities". The easiest approach to this would probably be to leave everything inside "<" ">" alone and just convert everything else. I guess the brackets rarely appear in the text part of an HTML file. This approach would, of course, exclude text within HTML tags (like in a or img or embedded javascript) but it would be a good start. You could convert these too if you would include everything in " " in the HTML tags.

ericc | Mon, 2008-06-16 10:47

Thanks !!
MoreKomodo do exactly what I want !!

I didn't install it because it doesn't appear in the list of available extension in the community :
http://community.activestate.com/addons

As I am new to Komodo, this is the only place I go to found extension
May be you can post MoreKomodo here ?

Best regards

ericc

dafi | Mon, 2008-06-16 10:53

You can download MoreKomodo from

http://dafizilla.sourceforge.net/morekomodo

MoreKomodo and the others my bonsai Komodo extensions aren't hosted at http://community.activestate.com/addons

--
dafi
Enhance KomodoEdit with MoreKomodo

jeff.griffiths | Mon, 2008-07-07 15:44

Davide posted his extensions to this site about a week or so ago, so they should be easier to find now =)

--
JeffG
http://www.openkomodo.com/blogs/jeffg