mirror of
https://github.com/leoncvlt/loconotion.git
synced 2024-08-30 18:12:12 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
125203a580
@ -100,6 +100,9 @@ name = "Notion Test Site"
|
|||||||
# of the generated site, and loconotion will parse all sub-pages present on the page
|
# of the generated site, and loconotion will parse all sub-pages present on the page
|
||||||
page = "https://www.notion.so/Loconotion-Example-Page-03c403f4fdc94cc1b315b9469a8950ef"
|
page = "https://www.notion.so/Loconotion-Example-Page-03c403f4fdc94cc1b315b9469a8950ef"
|
||||||
|
|
||||||
|
# optionally apply notion's dark mode, remove the line below to use the default light mode
|
||||||
|
theme = "dark"
|
||||||
|
|
||||||
## Global Site Settings ##
|
## Global Site Settings ##
|
||||||
# this [site] table defines override settings for the whole site
|
# this [site] table defines override settings for the whole site
|
||||||
# later on we will see how to define settings for a single page
|
# later on we will see how to define settings for a single page
|
||||||
|
@ -34,6 +34,12 @@ div[role="button"]:not(.notion-record-icon):hover {
|
|||||||
padding-right: unset !important;
|
padding-right: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pull alias arrows back inline */
|
||||||
|
svg.alias {
|
||||||
|
display: inline-block !important;
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 960px) {
|
@media only screen and (max-width: 960px) {
|
||||||
/* normalizes banner / page title width */
|
/* normalizes banner / page title width */
|
||||||
.notion-scroller > div:not([class]),
|
.notion-scroller > div:not([class]),
|
||||||
|
@ -14,7 +14,7 @@ RUN apt-get install -y google-chrome-stable
|
|||||||
# RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
# RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||||
# RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
|
# RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
|
||||||
# Set up Chromedriver Environment variables
|
# Set up Chromedriver Environment variables
|
||||||
ENV CHROMEDRIVER_VERSION 85.0.4183.38
|
ENV CHROMEDRIVER_VERSION 87.0.4280.88
|
||||||
ENV CHROMEDRIVER_DIR /chromedriver
|
ENV CHROMEDRIVER_DIR /chromedriver
|
||||||
RUN mkdir $CHROMEDRIVER_DIR
|
RUN mkdir $CHROMEDRIVER_DIR
|
||||||
# Download and install Chromedriver
|
# Download and install Chromedriver
|
||||||
|
@ -264,6 +264,11 @@ class Parser:
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# light theme is on by default
|
||||||
|
# enable dark mode based on https://fruitionsite.com/ dark mode hack
|
||||||
|
if self.config.get('theme') == 'dark':
|
||||||
|
self.driver.execute_script("__console.environment.ThemeStore.setState({ mode: 'dark' });")
|
||||||
|
|
||||||
# scroll at the bottom of the notion-scroller element to load all elements
|
# scroll at the bottom of the notion-scroller element to load all elements
|
||||||
# continue once there are no changes in height after a timeout
|
# continue once there are no changes in height after a timeout
|
||||||
# don't do this if the page has a calendar databse on it or it will load forever
|
# don't do this if the page has a calendar databse on it or it will load forever
|
||||||
@ -345,6 +350,10 @@ class Parser:
|
|||||||
for vendors_css in soup.find_all("link", href=lambda x: x and "vendors~" in x):
|
for vendors_css in soup.find_all("link", href=lambda x: x and "vendors~" in x):
|
||||||
vendors_css.decompose()
|
vendors_css.decompose()
|
||||||
|
|
||||||
|
# collection selectors (List, Gallery, etc.) don't work, so remove them
|
||||||
|
for collection_selector in soup.findAll("div", {"class": "notion-collection-view-select"}):
|
||||||
|
collection_selector.decompose()
|
||||||
|
|
||||||
# clean up the default notion meta tags
|
# clean up the default notion meta tags
|
||||||
for tag in [
|
for tag in [
|
||||||
"description",
|
"description",
|
||||||
@ -466,8 +475,9 @@ class Parser:
|
|||||||
table_row_block_id = table_row["data-block-id"]
|
table_row_block_id = table_row["data-block-id"]
|
||||||
table_row_href = "/" + table_row_block_id.replace("-", "")
|
table_row_href = "/" + table_row_block_id.replace("-", "")
|
||||||
row_target_span = table_row.find("span")
|
row_target_span = table_row.find("span")
|
||||||
|
row_target_span["style"] = row_target_span["style"].replace("pointer-events: none;","")
|
||||||
row_link_wrapper = soup.new_tag(
|
row_link_wrapper = soup.new_tag(
|
||||||
"a", attrs={"href": table_row_href, "style": "cursor: pointer;"}
|
"a", attrs={"href": table_row_href, "style": "cursor: pointer; color: inherit; text-decoration: none; fill: inherit;"}
|
||||||
)
|
)
|
||||||
row_target_span.wrap(row_link_wrapper)
|
row_target_span.wrap(row_link_wrapper)
|
||||||
|
|
||||||
@ -557,8 +567,10 @@ class Parser:
|
|||||||
# find sub-pages and clean slugs / links
|
# find sub-pages and clean slugs / links
|
||||||
sub_pages = []
|
sub_pages = []
|
||||||
for a in soup.findAll("a"):
|
for a in soup.findAll("a"):
|
||||||
if a["href"].startswith("/"):
|
sub_page_href = a["href"]
|
||||||
|
if sub_page_href.startswith("/"):
|
||||||
sub_page_href = "https://www.notion.so" + a["href"]
|
sub_page_href = "https://www.notion.so" + a["href"]
|
||||||
|
if sub_page_href.startswith("https://www.notion.so/"):
|
||||||
# if the link is an anchor link,
|
# if the link is an anchor link,
|
||||||
# check if the page hasn't already been parsed
|
# check if the page hasn't already been parsed
|
||||||
if "#" in sub_page_href:
|
if "#" in sub_page_href:
|
||||||
|
Loading…
Reference in New Issue
Block a user