diff --git a/bundles/loconotion.js b/bundles/loconotion.js index 3216e56..af56fb7 100644 --- a/bundles/loconotion.js +++ b/bundles/loconotion.js @@ -1,3 +1,4 @@ +// re-implement toggle blocks const showToggle = (content, arrow) => { arrow.style.transform = "rotateZ(180deg)"; content.style.display = "block"; @@ -26,6 +27,8 @@ for (let i = 0; i < toggleButtons.length; i++) { } } +// sets all iframes' parent container opacity to 1 +// originally notion has a callback to do that on iframe loaded const pendingIframes = document.getElementsByTagName("iframe"); for (let i = 0; i < pendingIframes.length; i++) { pendingIframes.item(i).parentElement.style.opacity = 1; @@ -59,12 +62,15 @@ for (let i = 0; i < pendingIframes.length; i++) { // pendingIframe.appendChild(iframe); // } +// hide search box on inline databases +// couldn't find a reliable way to do this in css const collectionSearchBoxes = document.getElementsByClassName("collectionSearch"); for (let i = 0; i < collectionSearchBoxes.length; i++) { const collectionSearchBox = collectionSearchBoxes.item(i).parentElement; collectionSearchBox.style.display = "none"; } +// re-implement anchor links const anchorLinks = document.querySelectorAll("a.loconotion-anchor-link"); for (let i = 0; i < anchorLinks.length; i++) { const anchorLink = anchorLinks.item(i); diff --git a/loconotion/__main__.py b/loconotion/__main__.py index a665145..2ce16f5 100644 --- a/loconotion/__main__.py +++ b/loconotion/__main__.py @@ -39,6 +39,11 @@ def main(): action="store_true", help="Delete all previously cached files for the site before generating it", ) + argparser.add_argument( + "--clean-style", + action="store_true", + help="Delete only previously cached .css files for the site before generating it", + ) argparser.add_argument( "--non-headless", action="store_true", diff --git a/loconotion/notionparser.py b/loconotion/notionparser.py index f8d1942..f052a3c 100644 --- a/loconotion/notionparser.py +++ b/loconotion/notionparser.py @@ -61,6 +61,13 @@ class Parser: log.info(f"Removing previously cached files in '{self.dist_folder}'") except OSError as e: log.error(f"Cannot remove '{self.dist_folder}': {e}") + elif self.args.get("clean_style", False): + try: + log.info(f"Removing previously cached style files in '{self.dist_folder}'") + for style_file in glob.glob(str(self.dist_folder / "*.css")): + os.remove(style_file) + except OSError as e: + log.error(f"Cannot remove syle files in '{self.dist_folder}': {e}") # create the output folder if necessary self.dist_folder.mkdir(parents=True, exist_ok=True) diff --git a/pyproject.toml b/pyproject.toml index 6017b2d..c15fd1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "loconotion" version = "0.1.0" -description = "" +description = "Generate static websites from Notion.so pages" authors = ["Leonardo Cavaletti "] [tool.poetry.dependencies]