mirror of
https://github.com/leoncvlt/loconotion.git
synced 2024-08-30 18:12:12 +00:00
Added --clean-style argument
This commit is contained in:
parent
7a8bad823a
commit
bc9cce4298
@ -1,3 +1,4 @@
|
|||||||
|
// re-implement toggle blocks
|
||||||
const showToggle = (content, arrow) => {
|
const showToggle = (content, arrow) => {
|
||||||
arrow.style.transform = "rotateZ(180deg)";
|
arrow.style.transform = "rotateZ(180deg)";
|
||||||
content.style.display = "block";
|
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");
|
const pendingIframes = document.getElementsByTagName("iframe");
|
||||||
for (let i = 0; i < pendingIframes.length; i++) {
|
for (let i = 0; i < pendingIframes.length; i++) {
|
||||||
pendingIframes.item(i).parentElement.style.opacity = 1;
|
pendingIframes.item(i).parentElement.style.opacity = 1;
|
||||||
@ -59,12 +62,15 @@ for (let i = 0; i < pendingIframes.length; i++) {
|
|||||||
// pendingIframe.appendChild(iframe);
|
// 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");
|
const collectionSearchBoxes = document.getElementsByClassName("collectionSearch");
|
||||||
for (let i = 0; i < collectionSearchBoxes.length; i++) {
|
for (let i = 0; i < collectionSearchBoxes.length; i++) {
|
||||||
const collectionSearchBox = collectionSearchBoxes.item(i).parentElement;
|
const collectionSearchBox = collectionSearchBoxes.item(i).parentElement;
|
||||||
collectionSearchBox.style.display = "none";
|
collectionSearchBox.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// re-implement anchor links
|
||||||
const anchorLinks = document.querySelectorAll("a.loconotion-anchor-link");
|
const anchorLinks = document.querySelectorAll("a.loconotion-anchor-link");
|
||||||
for (let i = 0; i < anchorLinks.length; i++) {
|
for (let i = 0; i < anchorLinks.length; i++) {
|
||||||
const anchorLink = anchorLinks.item(i);
|
const anchorLink = anchorLinks.item(i);
|
||||||
|
@ -39,6 +39,11 @@ def main():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Delete all previously cached files for the site before generating it",
|
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(
|
argparser.add_argument(
|
||||||
"--non-headless",
|
"--non-headless",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
@ -61,6 +61,13 @@ class Parser:
|
|||||||
log.info(f"Removing previously cached files in '{self.dist_folder}'")
|
log.info(f"Removing previously cached files in '{self.dist_folder}'")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
log.error(f"Cannot remove '{self.dist_folder}': {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
|
# create the output folder if necessary
|
||||||
self.dist_folder.mkdir(parents=True, exist_ok=True)
|
self.dist_folder.mkdir(parents=True, exist_ok=True)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "loconotion"
|
name = "loconotion"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = ""
|
description = "Generate static websites from Notion.so pages"
|
||||||
authors = ["Leonardo Cavaletti <impeto.blu@gmail.com>"]
|
authors = ["Leonardo Cavaletti <impeto.blu@gmail.com>"]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
|
Loading…
Reference in New Issue
Block a user