[wp-trac] [WordPress Trac] #30966: Let's make word count better (master ticket)

WordPress Trac noreply at wordpress.org
Fri Jan 16 09:51:47 UTC 2015


#30966: Let's make word count better (master ticket)
--------------------------+-------------------------
 Reporter:  avryl         |       Owner:  avryl
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.2
Component:  Editor        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  javascript
--------------------------+-------------------------
Changes (by avryl):

 * keywords:  needs-patch => has-patch
 * milestone:  Future Release => 4.2


Comment:

 In patch above:

 Word count will update at various input events, and is debounced with 500
 ms. Need to make sure this isn't too intensive. We can even debounce with
 1 s; the word count doesn't really need to update until after you stopped
 typing.

 It now excludes a lot more... Common punctuation and symbols are excluded
 by unicode blocks. I might add a few more blocks later. Previously a
 single dash or € mark or other common symbol somewhere would be counted as
 a word. We obviously can't exclude all the punctuation/symbols from all
 alphabets (so ranges in different blocks), but we can exclude the most
 common ones and blocks that are not alphabets. Maybe we could localise a
 supplement? So a translation could exclude more unicode ranges. Just a
 thought.

 Added a small selection of characters that are "contracting": the
 apostrophe and hyphen. Maybe I missed some. All other characters to be
 excluded are "expanding". Previously word/word or word—word would be
 counted as one word. For most it doesn't really matter which category
 they're in, but from what I see there are only a few "contracting".

 Shortcodes are now also excluded.

 wordCounter now only does one things, and that's count words. :) Now you
 can easily use it somewhere else.

 I added a few really simple tests.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30966#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list