diff options
Diffstat (limited to 'plugins/read_time/read_time.py')
-rw-r--r-- | plugins/read_time/read_time.py | 18 |
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: |