Added safety check for 'slug' parameter in [site] table

This commit is contained in:
Leonardo Cavaletti 2020-05-17 13:15:52 +01:00
parent 74a16b8a17
commit dbff4e0ddb
2 changed files with 7 additions and 4 deletions

View File

@ -130,6 +130,12 @@ class Parser():
def get_page_config(self, token):
# starts by grabbing the gobal site configuration table, if exists
site_config = self.config.get("site", {})
# check if there's anything wrong with the site config
if (site_config.get("slug", None)):
log.error("'slug' parameter has no effect in the [site] table, and should only present in page tables.")
del site_config['slug']
# find a table in the configuration file whose key contains the passed token string
matching_page_config = [value for key, value in self.config.items() if key.lower() in token]
if (matching_page_config):

View File

@ -25,7 +25,4 @@ page = "https://www.notion.so/A-Notion-Page-03c403f4fdc94cc1b315b9469a8950ef"
[[d2fa06f244e64f66880bb0491f58223d.meta]]
name = "description"
content = "A fullscreen list database page"
[d2fa06f244e64f66880bb] #list page
slug = "list"
content = "A fullscreen list database page"