From 440899bc410306aa95431e2d315de5479a4ef0cb Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 20 Feb 2023 16:57:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B5=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pandoc_reader.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/pandoc_reader.py b/pandoc_reader.py index 877c48f..de248ac 100644 --- a/pandoc_reader.py +++ b/pandoc_reader.py @@ -6,7 +6,6 @@ import shutil import subprocess import bs4 -from mwc.counter import count_words_in_markdown from ruamel.yaml import YAML, constructor from pelican import signals @@ -131,12 +130,6 @@ class PandocReader(BaseReader): # Create table of contents and add to metadata metadata["toc"] = self.process_metadata("toc", toc) - if self.settings.get("CALCULATE_READING_TIME", []): - # Calculate reading time and add to metadata - metadata["reading_time"] = self.process_metadata( - "reading_time", self._calculate_reading_time(content) - ) - return output, metadata def _validate_fields(self, defaults_files, arguments, extensions): @@ -206,24 +199,6 @@ class PandocReader(BaseReader): return citations, table_of_contents - def _calculate_reading_time(self, content): - """Calculate time taken to read content.""" - reading_speed = self.settings.get("READING_SPEED", DEFAULT_READING_SPEED) - wordcount = count_words_in_markdown(content) - - time_unit = "minutes" - try: - reading_time = math.ceil(float(wordcount) / float(reading_speed)) - if reading_time == 1: - time_unit = "minute" - reading_time = "{} {}".format(str(reading_time), time_unit) - except ValueError as words_per_minute_nan: - raise ValueError( - "READING_SPEED setting must be a number." - ) from words_per_minute_nan - - return reading_time - def _process_metadata(self, pandoc_metadata): """Process Pandoc metadata and add it to Pelican.""" # Cycle through the metadata and process them