diff --git a/loconotion.css b/loconotion.css index ba4bd5f..0235963 100644 --- a/loconotion.css +++ b/loconotion.css @@ -23,7 +23,10 @@ div[role="button"]:not(.notion-record-icon):hover { } /* normalizes content width */ - .notion-page-content { + .notion-page-content, + .notion-page-content > .notion-collection_view-block, + .notion-page-content > .notion-collection_view-block > div, + .notion-page-content > .notion-collection_view-block > .notion-scroller > div { width: 100% !important; max-width: unset !important; padding-right: 0 !important; @@ -31,18 +34,18 @@ div[role="button"]:not(.notion-record-icon):hover { } /* add padding to banner, but not to image */ - .notion-scroller > div:first-child > div:last-child:not(.notion-collection_view_page-block) { + .notion-frame > .notion-scroller > div:first-child > div:last-child { padding-right: 2em !important; padding-left: 2em !important; } /* add padding to content */ - .notion-scroller > div:nth-child(2), - .notion-list-view, - .notion-gallery-view, - .notion-table-view, - .notion-board-view, - .notion-calendar-view { + .notion-scroller > .notion-page-content, + .notion-frame > .notion-scroller > .notion-scroller > .notion-list-view, + .notion-frame > .notion-scroller > .notion-scroller > .notion-gallery-view, + .notion-frame > .notion-scroller > .notion-scroller > .notion-table-view, + .notion-frame > .notion-scroller > .notion-scroller > .notion-board-view, + .notion-frame > .notion-scroller > .notion-scroller > .notion-calendar-view { padding-right: 2em !important; padding-left: 2em !important; } diff --git a/loconotion.py b/loconotion.py index f06c14b..45868f2 100644 --- a/loconotion.py +++ b/loconotion.py @@ -34,18 +34,22 @@ def setup_logger(name): log = setup_logger("loconotion-logger") -# class notion_page_loaded(object): -# """An expectation for checking that a notion page has loaded. -# """ -# def __call__(self, driver): -# notion_presence = len(driver.find_elements_by_class_name("notion-presence-container")) -# loading_spinners = len(driver.find_elements_by_class_name("loading-spinner")); -# # embed_ghosts = len(driver.find_elements_by_css_selector("div[embed-ghost]")); -# log.debug(f"Waiting for page content to load (presence container: {notion_presence}, loaders: {loading_spinners} )") -# if (notion_presence and not loading_spinners): -# return True -# else: -# return False +class notion_page_loaded(object): + """An expectation for checking that a notion page has loaded. + """ + def __init__(self, url): + self.url = url + + def __call__(self, driver): + notion_presence = len(driver.find_elements_by_class_name("notion-presence-container")) + collection_view_block = len(driver.find_elements_by_class_name("notion-collection_view_page-block")); + collection_search = len(driver.find_elements_by_class_name("collectionSearch")); + # embed_ghosts = len(driver.find_elements_by_css_selector("div[embed-ghost]")); + log.debug(f"Waiting for page content to load (presence container: {notion_presence}, loaders: {loading_spinners} )") + if (notion_presence and not loading_spinners): + return True + else: + return False class toggle_block_has_opened(object): """An expectation for checking that a notion toggle block has been opened. @@ -312,7 +316,7 @@ class Parser(): "site" : "div:not(.notion-code-block)", "navbar": ".notion-topbar div", "title" : ".notion-page-block > div, .notion-collection_view_page-block > div", - "h1" : ".notion-header-block div", + "h1" : ".notion-header-block div, notion-page-content > notion-collection_view-block > div:first-child div", "h2" : ".notion-sub_header-block div", "h3" : ".notion-sub_sub_header-block div", "body" : ".notion-app-inner", diff --git a/test_site.toml b/test_site.toml index 8b5d677..a522b70 100644 --- a/test_site.toml +++ b/test_site.toml @@ -21,7 +21,9 @@ page = "https://www.notion.so/A-Notion-Page-03c403f4fdc94cc1b315b9469a8950ef" # site: changes the font for the whole page (apart from code blocks) but the following settings override it # navbar: site breadcrumbs on the top-left of the page # title: page title (under the icon) - # h1 / h2 / h3: heading blocks + # h1: heading blocks, and inline databases' titles + # h2: sub-heading blocks + # h3: sub-sub-heading blocks # body: non-heading text on the page # code: text inside code blocks [site.fonts]