Tool to HTML encode selected text

In a static HTML page, I have some text containing characters that need to be HTML encoded; it's actually html that will be displayed in a textarea.

Is there a tool in IDEA to do that encoding? At minimum it would replace <, >, & and " with their equivalent HTML entities. I cound't find one, but that seems surprising.

Thanks.

3 comments
Comment actions Permalink

Since there were no answers on this, I've filed a ferature request. It's here, though it's not really specific to the CFML plugin:
  http://youtrack.jetbrains.net/issue/CFML-149?projectKey=CFML

0
Comment actions Permalink

There are some script plugins for IDEA
I recommend PMIP - ruby plugin

here is sample script on PMIP

import com.intellij.openapi.editor.EditorModificationUtil

class StringToHtml < PMIPAction
  def run(event, context)
    current_editor = context.current_editor
    selected_text = current_editor.selection

# todo find (with help of google) library function and use it: something like java.htmlEncode or ruby.htmlEncode
    out_text = selected_text.upcase

    EditorModificationUtil.insertStringAtCaret(FileEditorManager.get_instance(context.project).selected_text_editor, out_text)
   
    result 'OK'
  end

end

bind 'ctrl 1', StringToHtml.new

0
Comment actions Permalink

Hmmm, that's a thought, I haven't looked at scripting IDEA at all (fairly new user). Still, this is completely basic functionality for an IDE that supports web stuff in a variety of languages. Not to be a wimp, but I shouldn't have to take the time to learn a scripting environment and write something to do it.

Thanks though, might still check it out, if for no other reason than getting my feet wet in ruby or python etc.

Dave

0

Please sign in to leave a comment.