Rule for matching and fixing hyphenated lines
class HyphenationRule extends BaseRule
(None) |
Strip the hyphenation character and join word on following line with current word.
fix : (c) -> # remember line/page separator oldSep = c.next('char') c.sub(c.cur('bword')).with( c.cur('bword').clone() # clone the current word .removeRight(1) # remove the '-'/'=' .join(c.next('bword')) # join the next word ) # Delete the next word c.del c.next('bword')
match : (c) -> c.cur('char').match("-|=") and c.next('char').match("\\n|\\f") and c.cur('bword') and c.cur('bword').length > 1