aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-04-07 22:35:28 +0200
committerKatharina Fey <kookie@spacekookie.de>2019-04-07 22:35:28 +0200
commitdb00c3e3886d8e132a97687a7db3a919f6c4b0b6 (patch)
tree2c5077265188b8d4c9eee981c0e0e93e78e0536b /plugins
parent6d208092bfe878cd3955590af264a3a08f98eb75 (diff)
Writing an article about allocations and stuff
Diffstat (limited to 'plugins')
-rw-r--r--plugins/read_time/read_time.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/plugins/read_time/read_time.py b/plugins/read_time/read_time.py
index 12065cf..14139a7 100644
--- a/plugins/read_time/read_time.py
+++ b/plugins/read_time/read_time.py
@@ -57,7 +57,23 @@ def calculate_wpm(text, data, language):
except LookupError:
wpm = data['default']['wpm']
- read_time = len(text.split(' ')) / wpm
+ # Split out "appendix" sections at the end
+ new_text = ""
+ skipping = False
+ for word in text.split(' '):
+ if '<skip>' in word:
+ skipping = True
+ print("Starting to skip")
+
+ if not skipping:
+ new_text += word + ' '
+ print("Word: ", word)
+
+ if '</skip>' in word:
+ skipping = False
+ print("Ending skipping")
+
+ read_time = len(new_text.split(' ')) / wpm
# Articles cannot take 0 minutes to read
if read_time == 0: