Hi,
I think you can do it with overwriting onbeforehyphenationhandler
.
As I still didn’t provided option to type own options in textarea, you have to modify code files (which will be overwritten with plugin update).
1. Open /wp-content/plugins/hyphenator/plugin.php
.
2. Go to lines 134-143.
3. Replace
if ( ! empty( $hyphenator_defaultlanguage ) )
$hyphenatorConfig['defaultlanguage'] = $hyphenator_defaultlanguage;
$hyphenatorExceptions = ( ! empty( $hyphenator_addexceptions ) ? "Hyphenator.addExceptions( '', '{$hyphenator_addexceptions}' );\n\t" : '' )
?>
<script type="text/javascript">
Hyphenator.config( <?php echo json_encode( $hyphenatorConfig ); ?> );
<?php echo $hyphenatorExceptions; ?>
Hyphenator.run();
</script>
with
if ( ! empty( $hyphenator_defaultlanguage ) )
$hyphenatorConfig['defaultlanguage'] = $hyphenator_defaultlanguage;
$hyphenatorConfig['onafterwordhyphenation'] = "function ( word ) {
if ( word.length > 0 && typeof word == 'string' ) {
var first_letter = word.substr( 0, 1 );
if ( ! isNaN( first_letter ) ) return word;
if ( first_letter == first_letter.toUpperCase() ) {
console.debug(word + ' : ' + first_letter + ' / ' + first_letter.toUpperCase());
word = word.replace( new RegExp( String.fromCharCode( 173 ), 'g' ), '' );
}
}
return word;
}";
$value_arr = array();
$replace_keys = array();
foreach ( $hyphenatorConfig as $key => &$value ) {
if ( strpos( $value, 'function (' ) === 0 || strpos( $value, 'function(' ) === 0 ) {
$value_arr[] = $value;
$value = '%' . $key . '%';
$replace_keys[] = '"' . $value . '"';
}
}
$json = json_encode( $hyphenatorConfig );
$json = str_replace( $replace_keys, $value_arr, $json );
$hyphenatorExceptions = ( ! empty( $hyphenator_addexceptions ) ? "Hyphenator.addExceptions( '', '{$hyphenator_addexceptions}' );\n\t" : '' )
?>
<script type="text/javascript">
Hyphenator.config( <?php echo $json; ?> );
<?php echo $hyphenatorExceptions; ?>
Hyphenator.run();
</script>
Greetings