mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-21 05:12:27 +12:00
Fixes bug in new file format
This commit is contained in:
parent
465c387284
commit
e9fcb967f5
|
@ -494,13 +494,13 @@ def addPlotItem(root, mdl, parent=QModelIndex()):
|
||||||
|
|
||||||
def exportOutlineItem(root):
|
def exportOutlineItem(root):
|
||||||
"""
|
"""
|
||||||
Takes an outline item, and returns two lists:
|
Takes an outline item, and returns three lists:
|
||||||
1. of (`filename`, `content`), representing the whole tree of files to be written, in multimarkdown.
|
1. of (`filename`, `content`), representing the whole tree of files to be written, in multimarkdown.
|
||||||
3. of (`filename`, `filename`) listing files to be moved
|
2. of (`filename`, `filename`) listing files to be moved
|
||||||
2. of `filename`, representing files to be removed.
|
3. of `filename`, representing files to be removed.
|
||||||
|
|
||||||
@param root: OutlineItem
|
@param root: OutlineItem
|
||||||
@return: [(str, str)], [str]
|
@return: [(str, str)], [(str, str)], [str]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
|
@ -560,8 +560,10 @@ def outlineItemPath(item):
|
||||||
if not item.parent():
|
if not item.parent():
|
||||||
return ["outline"]
|
return ["outline"]
|
||||||
else:
|
else:
|
||||||
|
# Count the number of siblings for padding '0'
|
||||||
|
siblings = item.parent().childCount()
|
||||||
name = "{ID}-{name}{ext}".format(
|
name = "{ID}-{name}{ext}".format(
|
||||||
ID=item.row(),
|
ID=str(item.row()).zfill(len(str(siblings))),
|
||||||
name=slugify(item.title()),
|
name=slugify(item.title()),
|
||||||
ext="" if item.type() == "folder" else ".md" # ".{}".format(item.type()) # To have .txt, .t2t, .html, ...
|
ext="" if item.type() == "folder" else ".md" # ".{}".format(item.type()) # To have .txt, .t2t, .html, ...
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue