-
-
Save bbbco/20307 to your computer and use it in GitHub Desktop.
hyphenate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand( { | |
name: "hyphenated", | |
takes: {"phrase": noun_arb_text}, | |
author: { | |
name: "Brian D. Goad", | |
email: "[email protected]"}, | |
license: "MPL", | |
description: "Replaces the spaces in a phrase with a hyphen.", | |
_hyphenate: function(phrase) { | |
return phrase.text.replace( / /g, "-", i ); | |
}, | |
preview: function( pblock, phrase ) { | |
var msg = "Replaces the space in a phrase with a hyphen."; | |
msg += "<br />\" <i>"; | |
msg += this._hyphenate(phrase); | |
msg += "</i> \""; | |
pblock.innerHTML = msg; | |
}, | |
execute: function( phrase ){ | |
CmdUtils.setSelection( this._hyphenate(phrase) ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment