Skip to content

Commit

Permalink
dev: drawings folder as dotfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Linbreux committed May 27, 2024
1 parent b7c0a10 commit 19d68c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/wikmd/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
HOMEPAGE_DEFAULT = "homepage.md"
HOMEPAGE_TITLE_DEFAULT = "homepage"
IMAGES_ROUTE_DEFAULT = "img"
DRAWINGS_ROUTE_DEFAULT = ".drawings"

HIDE_FOLDER_IN_WIKI = []

Expand Down Expand Up @@ -89,6 +90,7 @@ def __init__(self):
self.homepage = os.getenv("HOMEPAGE") or yaml_config.get("homepage", HOMEPAGE_DEFAULT)
self.homepage_title = os.getenv("HOMEPAGE_TITLE") or yaml_config.get("homepage_title", HOMEPAGE_TITLE_DEFAULT)
self.images_route = os.getenv("IMAGES_ROUTE") or yaml_config.get("images_route", IMAGES_ROUTE_DEFAULT)
self.drawings_route = DRAWINGS_ROUTE_DEFAULT

self.hide_folder_in_wiki = os.getenv("HIDE_FOLDER_IN_WIKI") or yaml_config.get("hide_folder_in_wiki", HIDE_FOLDER_IN_WIKI)

Expand Down
3 changes: 2 additions & 1 deletion src/wikmd/plugins/draw/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def __init__(self, flask_app: Flask, config: WikmdConfig, web_dep):
self.config = config
self.this_location = os.path.dirname(__file__)
self.web_dep = web_dep
self.drawings_folder = os.path.join(self.config.wiki_directory, "drawings")
self.drawings_folder = os.path.join(self.config.wiki_directory, config.drawings_route)

if not os.path.exists(self.drawings_folder):
os.mkdir(self.drawings_folder)

Expand Down
2 changes: 1 addition & 1 deletion src/wikmd/wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

UPLOAD_FOLDER_PATH = pathify(cfg.wiki_directory, cfg.images_route)
GIT_FOLDER_PATH = pathify(cfg.wiki_directory, '.git')
DRAWING_FOLDER_PATH = pathify(cfg.wiki_directory, 'drawings')
DRAWING_FOLDER_PATH = pathify(cfg.wiki_directory, cfg.drawings_route)
HIDDEN_FOLDER_PATH_LIST = [pathify(cfg.wiki_directory, hidden_folder) for hidden_folder in cfg.hide_folder_in_wiki]
HOMEPAGE_PATH = pathify(cfg.wiki_directory, cfg.homepage)
HIDDEN_PATHS = tuple([UPLOAD_FOLDER_PATH, GIT_FOLDER_PATH, DRAWING_FOLDER_PATH, HOMEPAGE_PATH] + HIDDEN_FOLDER_PATH_LIST)
Expand Down

0 comments on commit 19d68c0

Please sign in to comment.