ep_readability
Advanced tools
Comparing version 0.0.10 to 0.0.11
{ | ||
"name": "ep_readability", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Calculates the Flesch readability index in Etherpad, client based.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -1,2 +0,2 @@ | ||
# Click to calculate the Flesch readability factor | ||
# Click button to calculate the Flesch readability factor | ||
There'll be a button. Push it. | ||
@@ -7,8 +7,17 @@ | ||
Numeric values detail the readability: | ||
* Negative numbers or near "0" indicate texts which are very difficult to read. | ||
* Numbers near "100" indicate very easy texts. | ||
a) Negative numbers or near "0" indicate texts which are very difficult to read. | ||
Calculating is triggered by entering !, ?, RETURN or BACKSPACE. Or by pushing the button. | ||
b) Numbers near "100" indicate very easy texts. | ||
# Readability | ||
Calculating is triggered by entering !, ?, RETURN or BACKSPACE. Or by pushing the button. | ||
* -1000: Dissertation | ||
* 10: Officialese | ||
* 20: AmbitiousNewspaper | ||
* 35: AverageNewspaper | ||
* 50: YellowPress | ||
* 60: SalesLetter | ||
* 80: Slogan | ||
* 90: Comic | ||
@@ -19,3 +28,3 @@ # Install | ||
Alternatively, browse to `http://yourEtherpadliteInstan.ce/admin/plugins`, search for `ep_readability` and click install. | ||
Alternatively, browse to `http://yourEtherpadliteInstan.ce/admin/plugins`, search for `readability` and click install. | ||
@@ -32,2 +41,2 @@ After restarting the server, the plugin takes effect. | ||
https://github.com/DaveChild/Text-Statistics | ||
`https://github.com/DaveChild/Text-Statistics` |
@@ -11,9 +11,10 @@ // ---------------------------------------------------------------------------- | ||
exports.cleanText = function(text) { | ||
//console.log(text); | ||
// 1. Remove HTML entities @TODO add more entities | ||
// 2. Remove Etherpad spans, headings (style plugin) and formatting | ||
// 3. Get an Etherpad paragraph, add dot if no terminator or comma is at the end | ||
text = text.replace(/ /gm,' '); | ||
// @TODO replace the divs by a more simple paragraph placeholder delimiter | ||
text = text.replace(/( )+/gm,' '); | ||
text = text.replace(/<(?!div|\/div)[^>]*>/gm,'').replace(/<\/(?!div)>/gm,''); | ||
text = text.replace(/<div[^>]*>([^<]+[^:,!?.-])<\/div>/gm, "$1."); | ||
text = text.replace(/<div[^>]*>([^<]+[^:, !?.-])\s*<\/div>/gm, "$1."); | ||
@@ -20,0 +21,0 @@ // This is not Etherpad specific: |
@@ -48,2 +48,7 @@ var readab = require('../static/js/readability_button.js'); | ||
test.equal(result, readab.cleanText(text)); | ||
text = '<div id="magicdomid2" class=""><span class="author-a-z65zjckdup0xdseeity">Bedingungsloses Grundeinkommen und Mindestlohn </span></div><div id="magicdomid3" class=""><span class="author-a-z65zjckdup0xdseeity"> </span></div><div id="magicdomid4" class=""><span class="author-a-z65zjckdup0xdseeity">Wir Piraten setzen uns für die Einführung eines bedingungslosen Grundeinkommens ein, das die Ziele des „Rechts auf sichere Existenz und gesellschaftlicher Teilhabe“ aus unserem Parteiprogramm erfüllt. Es soll: </span></div>'; | ||
result = 'Bedingungsloses Grundeinkommen und Mindestlohn. Wir Piraten setzen uns für die Einführung eines bedingungslosen Grundeinkommens ein das die Ziele des Rechts auf sichere Existenz und gesellschaftlicher Teilhabe aus unserem Parteiprogramm erfüllt. Es soll'; | ||
test.equal(result, readab.cleanText(text)); | ||
test.done(); | ||
@@ -50,0 +55,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24956
357
39