Skip to content

Commit 87f8bfa

Browse files
committed
use flexdown v2
1 parent 105f71f commit 87f8bfa

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pcweb/pages/gallery/apps.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pcweb.flexdown import xd2 as xd
99
from pcweb.pages.gallery import gallery
1010
from pcweb.templates.gallery_app_page import gallery_app_page
11+
import copy
1112

1213
GALLERY_APP_SOURCES = [
1314
("templates/", "docs/getting-started/open-source-templates/"),
@@ -20,9 +21,9 @@ def load_all_gallery_apps():
2021
for folder, _ in GALLERY_APP_SOURCES:
2122
paths = flexdown.utils.get_flexdown_files(folder)
2223
for path in reversed(sorted(paths)):
23-
document = flexdown.parse_file(path)
24+
document = flexdown.Document.from_file(path) # This has metadata
2425
document.metadata["title"] = document.metadata.get("title", "Untitled").replace("_", " ").title()
25-
clean_path = path.replace(".md", "/")
26+
clean_path = str(path).replace(".md", "/")
2627
gallery_apps[(clean_path, folder)] = document
2728
return gallery_apps
2829

pcweb/pages/gallery/gallery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def get_templatey_apps(paths):
1212
"""Method to parse each markdown file and return the data from the file"""
1313
gallery_apps = {}
1414
for path in reversed(sorted(paths)):
15-
document = flexdown.parse_file(path)
16-
path = path.replace(".md", "/")
17-
gallery_apps[path] = document
15+
document = flexdown.Document.from_file(path) # This has metadata
16+
key = str(path).replace(".md", "/")
17+
gallery_apps[key] = document
1818
return gallery_apps
1919

2020
paths = flexdown.utils.get_flexdown_files(REFLEX_BUILD_TEMPLATES_PATH)

0 commit comments

Comments
 (0)