Skip to content

Commit 85bbb23

Browse files
committed
Support "from" prop in pages' items
1 parent 903fbee commit 85bbb23

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

File renamed without changes.

livemark.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ links:
2424
path: https://discord.com/channels/695635777199145130/695635777199145133
2525
pages:
2626
items:
27-
- name: Introduction
28-
path: index
27+
- path: index
28+
name: Introduction
2929
- name: Getting Started
3030
items:
3131
- path: pages/getting-started/installation
@@ -35,6 +35,7 @@ pages:
3535
- path: pages/getting-started/building-website
3636
- path: pages/getting-started/troubleshooting
3737
- path: pages/getting-started/contributing
38+
from: CONTRIBUTING.md
3839
- name: Guides and Tutorials
3940
items:
4041
- path: pages/guides-and-tutorials/data-journalism

livemark/document.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Document:
2020
2121
"""
2222

23-
def __init__(self, source, *, target=None, format=None, project=None):
23+
def __init__(self, source, *, target=None, format=None, project=None, path=None):
2424

2525
# Infer target
2626
if not target:
@@ -41,6 +41,7 @@ def __init__(self, source, *, target=None, format=None, project=None):
4141
self.__target = target
4242
self.__format = format
4343
self.__project = project
44+
self.__path = path
4445
self.__plugins = None
4546
self.__config = None
4647
self.__preface = None
@@ -162,7 +163,7 @@ def path(self):
162163
Returns:
163164
str: path
164165
"""
165-
return helpers.with_format(self.source, "")
166+
return self.__path or helpers.with_format(self.source, "")
166167

167168
@property
168169
def title(self):

livemark/plugins/pages/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def flatten_items(self):
6969
def process_project(project):
7070
items = project.config.get("pages", {}).get("items", [])
7171
for item in helpers.flatten_items(items, "items"):
72-
source = helpers.with_format(item["path"], "md")
72+
source = item.get("from", helpers.with_format(item["path"], "md"))
7373
target = helpers.with_format(item["path"], project.format)
74-
document = Document(source, target=target, project=project)
74+
document = Document(source, target=target, project=project, path=item["path"])
7575
project.documents.append(document)
7676

7777
def process_markup(self, markup):

0 commit comments

Comments
 (0)