+28
-4
@@ -30,8 +30,10 @@ import nw
|
||||
|
||||
from os import path, mkdir, rename, unlink
|
||||
|
||||
from nw.core.item import NWItem
|
||||
from nw.constants import nwAlert
|
||||
from nw.common import isHandle
|
||||
from nw.constants import nwItemLayout, nwItemClass
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -139,8 +141,18 @@ class NWDoc():
|
||||
docPath = path.join(self.theProject.projContent, docFile)
|
||||
docTemp = path.join(self.theProject.projContent, docFile+"~")
|
||||
|
||||
itemPath = self.theProject.projTree.getItemPath(self.docHandle)
|
||||
docMeta = "%%~ "+":".join(itemPath)+":"+self.theItem.itemName+"\n"
|
||||
if isinstance(self.theItem, NWItem):
|
||||
itemPath = self.theProject.projTree.getItemPath(self.docHandle)
|
||||
docMeta = (
|
||||
"%%~ {handlepath:s}:{itemclass:s}:{itemlayout:s}:{itemname:s}\n"
|
||||
).format(
|
||||
handlepath = ":".join(itemPath),
|
||||
itemclass = self.theItem.itemClass.name,
|
||||
itemlayout = self.theItem.itemLayout.name,
|
||||
itemname = self.theItem.itemName,
|
||||
)
|
||||
else:
|
||||
docMeta = ""
|
||||
|
||||
try:
|
||||
with open(docTemp, mode="w", encoding="utf8") as outFile:
|
||||
@@ -194,7 +206,7 @@ class NWDoc():
|
||||
"""
|
||||
if len(self.docMeta) < 14:
|
||||
# Not enough information
|
||||
return "", []
|
||||
return "", [], None, None
|
||||
|
||||
theMeta = self.docMeta
|
||||
|
||||
@@ -213,6 +225,18 @@ class NWDoc():
|
||||
else:
|
||||
break
|
||||
|
||||
return theMeta, thePath
|
||||
theClass = nwItemClass.NO_CLASS
|
||||
for aClass in nwItemClass:
|
||||
if theMeta.startswith(aClass.name):
|
||||
theClass = aClass
|
||||
theMeta = theMeta.lstrip(aClass.name+":")
|
||||
|
||||
theLayout = nwItemLayout.NO_LAYOUT
|
||||
for aLayout in nwItemLayout:
|
||||
if theMeta.startswith(aLayout.name):
|
||||
theLayout = aLayout
|
||||
theMeta = theMeta.lstrip(aLayout.name+":")
|
||||
|
||||
return theMeta, thePath, theClass, theLayout
|
||||
|
||||
# END Class NWDoc
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class NWIndex():
|
||||
|
||||
VALID_KEYS = set([
|
||||
VALID_KEYS = {
|
||||
nwKeyWords.TAG_KEY,
|
||||
nwKeyWords.PLOT_KEY,
|
||||
nwKeyWords.POV_KEY,
|
||||
@@ -51,7 +51,7 @@ class NWIndex():
|
||||
nwKeyWords.OBJECT_KEY,
|
||||
nwKeyWords.ENTITY_KEY,
|
||||
nwKeyWords.CUSTOM_KEY
|
||||
])
|
||||
}
|
||||
TAG_CLASS = {
|
||||
nwKeyWords.CHAR_KEY : nwItemClass.CHARACTER,
|
||||
nwKeyWords.POV_KEY : nwItemClass.CHARACTER,
|
||||
|
||||
+8
-8
@@ -45,7 +45,7 @@ class OptionState():
|
||||
|
||||
self.theState = {}
|
||||
self.validMap = {
|
||||
"GuiSession": set([
|
||||
"GuiSession": {
|
||||
"widthCol0",
|
||||
"widthCol1",
|
||||
"widthCol2",
|
||||
@@ -53,11 +53,11 @@ class OptionState():
|
||||
"sortOrder",
|
||||
"hideZeros",
|
||||
"hideNegative",
|
||||
]),
|
||||
"GuiDocSplit": set([
|
||||
},
|
||||
"GuiDocSplit": {
|
||||
"spLevel",
|
||||
]),
|
||||
"GuiBuildNovel": set([
|
||||
},
|
||||
"GuiBuildNovel": {
|
||||
"winWidth",
|
||||
"winHeight",
|
||||
"addNovel",
|
||||
@@ -72,12 +72,12 @@ class OptionState():
|
||||
"incComments",
|
||||
"incKeywords",
|
||||
"incBodyText",
|
||||
]),
|
||||
"GuiOutline": set([
|
||||
},
|
||||
"GuiOutline": {
|
||||
"headerOrder",
|
||||
"columnWidth",
|
||||
"columnHidden",
|
||||
]),
|
||||
},
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
+8
-3
@@ -1075,17 +1075,22 @@ class NWProject():
|
||||
# Look for meta data
|
||||
oName = ""
|
||||
if aDoc.openDocument(oHandle, showStatus=False, isOrphan=True):
|
||||
oName, oPath = aDoc.getMeta()
|
||||
oName, oPath, oClass, oLayout = aDoc.getMeta()
|
||||
|
||||
if oName == "":
|
||||
nOrph += 1
|
||||
oName = "Orphaned File %d" % nOrph
|
||||
|
||||
if oClass is None:
|
||||
oClass = nwItemClass.NO_CLASS
|
||||
if oLayout is None:
|
||||
oLayout = nwItemLayout.NO_LAYOUT
|
||||
|
||||
orphItem = NWItem(self)
|
||||
orphItem.setName(oName)
|
||||
orphItem.setType(nwItemType.FILE)
|
||||
orphItem.setClass(nwItemClass.NO_CLASS)
|
||||
orphItem.setLayout(nwItemLayout.NO_LAYOUT)
|
||||
orphItem.setClass(oClass)
|
||||
orphItem.setLayout(oLayout)
|
||||
self.projTree.append(oHandle, None, orphItem)
|
||||
|
||||
return
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 14298de4d9524:f7e2d9f330615:f6622b4617424:John Smith
|
||||
%%~ 14298de4d9524:f7e2d9f330615:f6622b4617424:CHARACTER:NOTE:John Smith
|
||||
# John Smith
|
||||
|
||||
@tag: John
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 53b69b83cdafc:7031beac91f75:Title Page
|
||||
%%~ 53b69b83cdafc:7031beac91f75:NOVEL:TITLE:Title Page
|
||||
# My Novel
|
||||
|
||||
**By Jane Doh**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 5eaea4e8cdee8:15c4492bd5107:Mars
|
||||
%%~ 5eaea4e8cdee8:15c4492bd5107:WORLD:NOTE:Mars
|
||||
# Mars
|
||||
|
||||
@tag: Mars
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 636b6aa9b697b:e7ded148d6e4a:7031beac91f75:Making a Scene
|
||||
%%~ 636b6aa9b697b:e7ded148d6e4a:7031beac91f75:NOVEL:SCENE:Making a Scene
|
||||
### Making a Scene
|
||||
|
||||
@pov: Jane
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 6a2d6d5f4f401:e7ded148d6e4a:7031beac91f75:Chapter One
|
||||
%%~ 6a2d6d5f4f401:e7ded148d6e4a:7031beac91f75:NOVEL:CHAPTER:Chapter One
|
||||
## So it Begins
|
||||
|
||||
@pov: Jane
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 88706ddc78b1b:e7ded148d6e4a:7031beac91f75:Chapter Two
|
||||
%%~ 88706ddc78b1b:e7ded148d6e4a:7031beac91f75:NOVEL:CHAPTER:Chapter Two
|
||||
## Where has John Gone?
|
||||
|
||||
@pov: Jane
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 96b68994dfa3d:e7ded148d6e4a:7031beac91f75:A Note on Structure
|
||||
%%~ 96b68994dfa3d:e7ded148d6e4a:7031beac91f75:NOVEL:NOTE:A Note on Structure
|
||||
# A Note on Structure
|
||||
|
||||
This file is just a note. You can save notes anywhere you like in the project tree. Notes can be filtered out when you export the project.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 974e400180a99:7031beac91f75:Page
|
||||
%%~ 974e400180a99:7031beac91f75:NOVEL:PAGE:Page
|
||||
This is a plain page with some text on it.
|
||||
|
||||
This file should receive no special formatting, but the text will always be left aligned and the content will always start on a fresh page when the project is exported.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ ae7339df26ded:e7ded148d6e4a:7031beac91f75:We Found John!
|
||||
%%~ ae7339df26ded:e7ded148d6e4a:7031beac91f75:NOVEL:SCENE:We Found John!
|
||||
### We Found John!
|
||||
|
||||
@pov: John
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ b3e74dbc1f584:15c4492bd5107:Earth
|
||||
%%~ b3e74dbc1f584:15c4492bd5107:WORLD:NOTE:Earth
|
||||
# Earth
|
||||
|
||||
@tag: Earth
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ b8136a5a774a0:98acd8c76c93a:Delete Me!
|
||||
%%~ b8136a5a774a0:98acd8c76c93a:NOVEL:SCENE:Delete Me!
|
||||
### Delete Me!
|
||||
|
||||
This scene is trash.
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ ba8a28a246524:e7ded148d6e4a:7031beac91f75:Interlude
|
||||
%%~ ba8a28a246524:e7ded148d6e4a:7031beac91f75:NOVEL:UNNUMBERED:Interlude
|
||||
## Interlude
|
||||
|
||||
% Notice that this is a file with the flag ‘N.Un’. The ‘N’ means it’s a novel file, and the ‘Un’ means it’s an unnumbered chapter. Unnumbered chapters can be treated separately from numbered chapters during export. Perfect for when you want to add an interlude, or for a prologue or epilogue.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ bb2c23b3c42cc:f7e2d9f330615:f6622b4617424:Jane Smith
|
||||
%%~ bb2c23b3c42cc:f7e2d9f330615:f6622b4617424:CHARACTER:NOTE:Jane Smith
|
||||
# Jane Smith
|
||||
|
||||
@tag: Jane
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ bc0cbd2a407f3:e7ded148d6e4a:7031beac91f75:Another Scene
|
||||
%%~ bc0cbd2a407f3:e7ded148d6e4a:7031beac91f75:NOVEL:SCENE:Another Scene
|
||||
### Another Scene
|
||||
|
||||
@pov: John
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ edca4be2fcaf8:7031beac91f75:Part 1
|
||||
%%~ edca4be2fcaf8:7031beac91f75:NOVEL:PARTITION:Part One
|
||||
# Part One
|
||||
|
||||
The first part.
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ f1471bef9f2ae:15c4492bd5107:Space
|
||||
%%~ f1471bef9f2ae:15c4492bd5107:WORLD:NOTE:Space
|
||||
# Space
|
||||
|
||||
@tag: Space
|
||||
|
||||
+10
-10
@@ -1,21 +1,21 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="0.8.0rc1" hexVersion="0x000800c1" fileVersion="1.1" timeStamp="2020-06-05 20:53:20">
|
||||
<novelWriterXML appVersion="0.9.0rc1" hexVersion="0x000900c1" fileVersion="1.1" timeStamp="2020-06-12 17:13:30">
|
||||
<project>
|
||||
<name>Sample Project</name>
|
||||
<title>Sample Project</title>
|
||||
<author>Jane Smith</author>
|
||||
<author>Jay Doh</author>
|
||||
<saveCount>273</saveCount>
|
||||
<autoCount>40</autoCount>
|
||||
<editTime>4125</editTime>
|
||||
<saveCount>280</saveCount>
|
||||
<autoCount>41</autoCount>
|
||||
<editTime>4312</editTime>
|
||||
</project>
|
||||
<settings>
|
||||
<doBackup>False</doBackup>
|
||||
<spellCheck>True</spellCheck>
|
||||
<autoOutline>True</autoOutline>
|
||||
<lastEdited>636b6aa9b697b</lastEdited>
|
||||
<lastEdited>bc0cbd2a407f3</lastEdited>
|
||||
<lastViewed>b3e74dbc1f584</lastViewed>
|
||||
<lastWordCount>914</lastWordCount>
|
||||
<lastWordCount>920</lastWordCount>
|
||||
<autoReplace>
|
||||
<A>B</A>
|
||||
<B>E</B>
|
||||
@@ -117,7 +117,7 @@
|
||||
<charCount>1199</charCount>
|
||||
<wordCount>216</wordCount>
|
||||
<paraCount>7</paraCount>
|
||||
<cursorPos>1266</cursorPos>
|
||||
<cursorPos>950</cursorPos>
|
||||
</item>
|
||||
<item handle="bc0cbd2a407f3" order="2" parent="e7ded148d6e4a">
|
||||
<name>Another Scene</name>
|
||||
@@ -274,9 +274,9 @@
|
||||
<status>New</status>
|
||||
<exported>True</exported>
|
||||
<layout>SCENE</layout>
|
||||
<charCount>0</charCount>
|
||||
<wordCount>0</wordCount>
|
||||
<paraCount>0</paraCount>
|
||||
<charCount>30</charCount>
|
||||
<wordCount>6</wordCount>
|
||||
<paraCount>1</paraCount>
|
||||
<cursorPos>36</cursorPos>
|
||||
</item>
|
||||
</content>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 0e17daca5f3e1:71ee45a3c0db9:New File
|
||||
%%~ 0e17daca5f3e1:71ee45a3c0db9:PLOT:NOTE:New File
|
||||
# Main Plot
|
||||
|
||||
@tag: MainPlot
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 1a6562590ef19:811786ad1ae74:New File
|
||||
%%~ 1a6562590ef19:811786ad1ae74:WORLD:NOTE:New File
|
||||
# Main Location
|
||||
|
||||
@tag: Home
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 31489056e0916:25fc0e7096fc6:73475cb40a568:New Scene
|
||||
%%~ 31489056e0916:25fc0e7096fc6:73475cb40a568:NOVEL:SCENE:New Scene
|
||||
# Novel
|
||||
|
||||
## Chapter
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 98010bd9270f9:44cb730c42048:New File
|
||||
%%~ 98010bd9270f9:44cb730c42048:CHARACTER:NOTE:New File
|
||||
# Jane Doe
|
||||
|
||||
@tag: Jane
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 73475cb40a568:b3643d0f92e32:Chapter One
|
||||
%%~ 73475cb40a568:b3643d0f92e32:NOVEL:SCENE:Chapter One
|
||||
## Chapter One
|
||||
|
||||
@pov: Bod
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 031b4af5197ec:0e17daca5f3e1:b3643d0f92e32:Scene One
|
||||
%%~ 031b4af5197ec:0e17daca5f3e1:b3643d0f92e32:NOVEL:SCENE:Scene One
|
||||
### Scene One
|
||||
|
||||
@pov: Bod
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 25fc0e7096fc6:811786ad1ae74:b3643d0f92e32:Chapter One
|
||||
%%~ 25fc0e7096fc6:811786ad1ae74:b3643d0f92e32:NOVEL:CHAPTER:Chapter One
|
||||
## Chapter One
|
||||
|
||||
@pov: Bod
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 2858dcd1057d3:0e17daca5f3e1:b3643d0f92e32:Scene Two
|
||||
%%~ 2858dcd1057d3:0e17daca5f3e1:b3643d0f92e32:NOVEL:SCENE:Scene Two
|
||||
### Scene Two
|
||||
|
||||
@pov: Bod
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 2fca346db6561:0e17daca5f3e1:b3643d0f92e32:Scene Two, Section Two
|
||||
%%~ 2fca346db6561:0e17daca5f3e1:b3643d0f92e32:NOVEL:SCENE:Scene Two, Section Two
|
||||
#### Scene Two, Section Two
|
||||
|
||||
Suspendisse potenti. Fusce tempus lorem nec laoreet suscipit. Fusce vulputate nisl ac diam tincidunt, nec malesuada quam pellentesque. Maecenas congue, tellus quis commodo rutrum, magna leo egestas arcu, quis suscipit ex risus id ligula. Suspendisse potenti. Morbi blandit lacus vitae laoreet vulputate. Donec vitae tellus eleifend, lobortis eros eu, tincidunt enim. Nullam et ullamcorper nisi. Vivamus tellus ex, lobortis quis rutrum ut, dapibus sit amet turpis. Phasellus pellentesque metus diam, commodo tristique ante commodo ac. Ut mollis ipsum nec diam blandit sollicitudin. Duis bibendum lacus nec commodo dapibus. Sed condimentum luctus ante, id ultricies urna varius nec. Nam convallis magna nec bibendum ultrices. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed auctor pharetra quam, vitae porta ex bibendum eu.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 31489056e0916:811786ad1ae74:b3643d0f92e32:Scene One
|
||||
%%~ 31489056e0916:811786ad1ae74:b3643d0f92e32:NOVEL:SCENE:Scene One
|
||||
### Scene One
|
||||
|
||||
@pov: Bod
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 41cfc0d1f2d12:0e17daca5f3e1:b3643d0f92e32:Scene One, Section Two
|
||||
%%~ 41cfc0d1f2d12:0e17daca5f3e1:b3643d0f92e32:NOVEL:SCENE:Scene One, Section Two
|
||||
#### Scene One, Section Two
|
||||
|
||||
Integer vel libero ipsum. Donec varius aliquam libero, sit amet commodo urna hendrerit non. Nullam quis erat mollis nunc viverra volutpat tincidunt in odio. Nam vitae quam sem. Aliquam suscipit nulla non lorem pharetra semper. Ut suscipit erat eu ligula accumsan ultrices. Phasellus nisl tellus, placerat sed laoreet id, consectetur nec dolor. Sed fringilla ipsum id dapibus posuere. Aenean finibus pharetra tincidunt. Ut molestie malesuada nulla, id posuere lorem tincidunt eu. Aliquam tempor eros a est vulputate, scelerisque pulvinar ipsum fermentum. In hac habitasse platea dictumst.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%%~ 98010bd9270f9:811786ad1ae74:b3643d0f92e32:Scene Two
|
||||
%%~ 98010bd9270f9:811786ad1ae74:b3643d0f92e32:NOVEL:SCENE:Scene Two
|
||||
### Scene Two
|
||||
|
||||
@pov: Bod
|
||||
|
||||
Reference in New Issue
Block a user