ep_readability
Advanced tools
Comparing version 0.0.16 to 0.0.17
{ | ||
"name": "ep_readability", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Calculates the Flesch readability index in Etherpad, client based.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -44,2 +44,24 @@ # Click button to calculate the Flesch readability index | ||
# TODO | ||
## Options to fine tune the counting process | ||
The plugin interprets a line break (paragraph) as the end of a sentence. If text is copied into the pad, the line breaks may be incorrect and manual adjustment may be necessary. | ||
Problematic text, counted as two sentences: | ||
1. All participants | ||
2. are expected to be awake. | ||
Corrected text, counted as one sentence: | ||
1. All participants are expected to be awake. | ||
2. | ||
## Links and numbers | ||
Rethink the current solution | ||
### Regex | ||
The internal work is based on a regex orgy. Which could be rewritten, maybe using DOM for additional capabilities like highlighting long words and sentences. | ||
# License | ||
@@ -46,0 +68,0 @@ MIT |
@@ -20,3 +20,3 @@ // ---------------------------------------------------------------------------- | ||
text = text.replace(/( )+/gm,' ') | ||
.replace(/(https?|ftp):[\w\.\/\?&=-]+/gm, 'link') | ||
.replace(/(https?|ftp|file):[\w\.\/\?&=\-\_\:]+/gm, 'link') | ||
.replace(/<(?!div|\/div)[^>]*>/gm,'').replace(/<\/(?!div)>/gm,'') | ||
@@ -23,0 +23,0 @@ .replace(/<div[^>]*>([^<]+[^:, !?.-])\s*<\/div>/gm, "$1."); |
@@ -71,4 +71,7 @@ var readab = require('../static/js/readability_button.js'); | ||
test.equal(result, readab.cleanText(text)); | ||
var text = '<div id="magicdomid27" class=""><span class="author-a-z65zjckdup0xdseeity">Vortrag (</span><span class="author-a-z65zjckdup0xdseeity url"><a href="http://wiki.piratenpartei.de/Datei:Aaa_Bbb.jpg)">http://wiki.piratenpartei.de/Datei:Aaa_Bbb.jpg)</a></span></div>'; | ||
var result = 'Vortrag link.'; | ||
test.equal(result, readab.cleanText(text)); | ||
test.done(); | ||
} | ||
27882
393
74