Skip to content

Instantly share code, notes, and snippets.

@berdosi
Created May 14, 2009 14:17
Show Gist options
  • Save berdosi/111674 to your computer and use it in GitHub Desktop.
Save berdosi/111674 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "richtypo",
author: { name: "Balint Erdosi" },
license: "GPL",
description: "Tipo- és ortográfiai korrekciókat végez a textareában kiválasztott szövegen",
takes: {"input": noun_arb_text},
execute: function richTypo(input) {
var str = input.html
.replace(/\.\.\./g,'…')
.replace(/--/g,'–')
.replace(/>/g, '>')
.replace(/</g, '&lt;');
var currentQM = '”';
while(str.indexOf('"') !== -1) {
str = str.replace('"',currentQM = (currentQM == '”') ? '„' : '”');
}
CmdUtils.setSelection(str);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment