Updated: Comment #N

Problem/Motivation

The word count currently drops some (natural language) punctuation characters and then counts what is left.
With HTML being a very popular case, the word count is a crazy amount more than the real content words.

We have started to mask HTML, but it's experimental and will be rebuilt from scratch cleanly / pluggable as learned from that try.

Thus, we need a quickfix.

Proposed resolution

Extend the current word count function tmgmt_word_count() with a html strip_tags().

The side effect is that it also drops attributes (like alt= and title=) that need translation. But our masking is also a bit limited with those cases.

This should be the default, but with the possibility to disable. Use a variable like
if (variable_get('tmgmt_word_count_html', TRUE)) { ...

Remaining tasks

Document limitations clearly.

User interface changes

-

API changes

New setting tmgmt_word_count_html

CommentFileSizeAuthor
#1 2173071-fiter_html_word_count-1.patch2.01 KBblueminds

Comments

blueminds’s picture

Status: Active » Needs review
StatusFileSize
new2.01 KB

Please see the patch

miro_dietiker’s picture

Title: Filter HTML in word count » Add tests: Filter HTML in word count
Status: Needs review » Fixed
Issue tags: +Needs tests

Perfect, including test coverage. :-)
Fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.