diff --git a/docs/FileFormatSpec-1.5.fodt b/docs/FileFormatSpec-1.5.fodt index 67ceb247..a57c8627 100644 --- a/docs/FileFormatSpec-1.5.fodt +++ b/docs/FileFormatSpec-1.5.fodt @@ -1,29 +1,31 @@ - - Veronica Olsen2022-11-05T18:25:44.8874731592023-02-09T13:03:44.196703858Veronica OlsenPT3H48M55S42LibreOffice/7.0.4.2$Linux_X86_64 LibreOffice_project/00$Build-2 + + Veronica Olsen2022-11-05T18:25:44.8874731592023-06-03T18:35:47.268848685Veronica OlsenPT4H19S53LibreOffice/7.4.5.1$Linux_X86_64 LibreOffice_project/40$Build-1 - 9825 + 0 0 - 35909 - 19657 + 35645 + 20394 true false view2 - 23216 - 176844 + 15145 + 7216 0 - 9825 - 35907 - 29480 + 0 + 35643 + 20392 0 1 false 140 false + false + false false @@ -47,12 +49,14 @@ false true false + false false false true true true false + false false false false @@ -70,6 +74,7 @@ 0 1 true + false high-resolution true @@ -79,16 +84,18 @@ false true false + false true true false true true - 695346 + 805029 true false + true true 0 @@ -98,12 +105,15 @@ true false true + 0 false false false false true + false false + false false false @@ -137,26 +147,26 @@ - + + - - - + + - + - + - + @@ -167,7 +177,7 @@ - + @@ -176,15 +186,15 @@ - + - + - + @@ -238,53 +248,57 @@ + + + + - + - + - + - + - + - + - + - + - + - + @@ -355,6 +369,15 @@ + + + + + + + + + @@ -536,13 +559,9 @@ - - - - - - - + + + @@ -1012,202 +1031,229 @@ - + + - + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + + - - + + - - + + - - + + + - - + + - - + + - - + + - + - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + + + + + + + + + + + + - - + + - + + + + + + + - - - - - - - - + + + + + + + + - + - + - - - - - - - + + + + + + + - - - - - - + + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1240,66 +1286,130 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - + @@ -1310,829 +1420,845 @@ - novelWriter - Project File Format 1.5 Specification - - This document covers the file format specification for the 1.5 file format for novelWriter project files. See the documentation1 - See: https://novelwriter.readthedocs.io/ for a full description of the app’s functionality. - The target audience of this document is developers who intend to write a tool or script that generates valid novelWriter project files from data from other applications, or for templating purposes. - Note that flags are generally written out as yes/no values, but also true/false and on/off are understood by the application. The None value that occasionally occurs in actual project files is the text representation of the Python None value, and indicates that there is no value set. + novelWriter + Project File Format 1.5 Specification + + This document covers the file format specification for the 1.5 file format for novelWriter project files. See the documentation1 + See: https://docs.novelwriter.io for a full description of the app’s functionality. The file format was intrioduced in Release 2.0. + The target audience of this document is developers who intend to write a tool or script that generates valid novelWriter project files from data from other applications, or for templating purposes. + Note that flags are generally written out as yes/no values, but also true/false and on/off are understood by the application. The None value that occasionally occurs in actual project files is the text representation of the Python None value, and indicates that there is no value set. + Revisions + + + From Release 2.1 Beta 1: Removed the titleFormat node from settings. + + XML Root - Tag: novelWriterXML - The root tag of a novelWriter project file must be named “novelWriterXML”. This value is case sensitive. The fileVersion attribute must also be set to the appropriate format version in order to be parsed correctly. - Attributes + Tag: novelWriterXML + The root tag of a novelWriter project file must be named “novelWriterXML”. This value is case sensitive. The fileVersion attribute must also be set to the appropriate format version in order to be parsed correctly. + Attributes - Name + Name - Required + Required - Description + Description - + - appVersion + appVersion - No + No - A string representation of the novelWriter version used to write the file. The value is not required, but is used to report to the user when the file format is converted. + A string representation of the novelWriter version used to write the file. The value is not required, but is used to report to the user when the file format is converted. - - - hexVersion + + + hexVersion - No + No - A hex representation of the novelWriter version used to write the file. The value is used to check if the project is opened by a lower version than was used to write it, which issues a warning. Defaults to 0x0. + A hex representation of the novelWriter version used to write the file. The value is used to check if the project is opened by a lower version than was used to write it, which issues a warning. Defaults to 0x0. - - - fileVersion + + + fileVersion - Yes + Yes - The file format version used when writing the project file. This determines how the file is parsed, so it is important that it is set correctly. Valid values are “1.0”, “1.1”, “1.2”, “1.3”, “1.4”, and “1.5”. + The file format version used when writing the project file. This determines how the file is parsed, so it is important that it is set correctly. Valid values are “1.0”, “1.1”, “1.2”, “1.3”, “1.4”, and “1.5”. - - - timeStamp + + + fileRevision - - No + + No - - The ISO 8601 timestamp of when the file was saved. This information is not used by the parser, and is purely for debugging. + + The revision of the file format used for non-breaking changes. This is an interger value. + + + + + timeStamp + + + No + + + The ISO 8601 timestamp of when the file was saved. This information is not used by the parser, and is purely for debugging. - Example - <novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" - fileVersion="1.5" timeStamp="2022-11-05 17:46:51"> - - Project Node - Tag: project - The project section is a level one node under the root. It stores the primary settings for the project. The only required values are the id attribute and the name value. All other entries are set to default values during parsing if ommitted from the XML. - Attributes + Example + <novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" + fileVersion="1.5" fileRevision="1" + timeStamp="2022-11-05 17:46:51"> + Project Node + Tag: project + The project section is a level one node under the root. It stores the primary settings for the project. The only required values are the id attribute and the name value. All other entries are set to default values during parsing if ommitted from the XML. + Attributes - Name + Name - Required + Required - Description + Description - + - id + id - Yes + Yes - A UUID that is unique for the project and does not change during the lifetime of the project. It is used by novelWriter to keep track of temporary files and to associate cross-project settings with specific projects without relying on the project name. + A UUID that is unique for the project and does not change during the lifetime of the project. It is used by novelWriter to keep track of temporary files and to associate cross-project settings with specific projects without relying on the project name. - - - saveCount + + + saveCount - No + No - A number representing the number of times the project file has been written as a result of user interaction with the application. + A number representing the number of times the project file has been written as a result of user interaction with the application. - - - autoCount + + + autoCount - No + No - A number representing the number of times the project file has been written as a result of internal timed automatic operations of the application. + A number representing the number of times the project file has been written as a result of internal timed automatic operations of the application. - + - editTime + editTime - No + No - A number representing the accumulated time in seconds the project has been open. + A number representing the accumulated time in seconds the project has been open. - Values + Values - Name + Name - Required + Required - Description + Description - + - name + name - Yes + Yes - The name the user has given to the project. + The name the user has given to the project. - - - title + + + title - No + No - The title the user has given to the project, which may differ from the project name. The value is used in some places in the user interface, and can be added to manuscript builds. + The title the user has given to the project, which may differ from the project name. The value is used in some places in the user interface, and can be added to manuscript builds. - - - author + + + author - No + No - The name of the novel author or authors. The value is used in some places in the user interface, and can be added to manuscript builds. + The name of the novel author or authors. The value is used in some places in the user interface, and can be added to manuscript builds. - Example - <project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" - saveCount="5" autoCount="10" editTime="1000"> - <name>Sample Project</name> - <title>Sample Project</title> - <author>Jane Smith</author> - </project> - - Settings Node - Tag: settings - The settings section is a level one node under the root. It stores the various runtime values for the project, and the settings available from the Project Settings panel. None of these settings are required, and if missing, will be set to default values. The entire settings section can thus be ommitted. - Attributes - None - Values + Example + <project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" + saveCount="5" autoCount="10" editTime="1000"> + <name>Sample Project</name> + <title>Sample Project</title> + <author>Jane Smith</author> + </project> + + Settings Node + Tag: settings + The settings section is a level one node under the root. It stores the various runtime values for the project, and the settings available from the Project Settings panel. None of these settings are required, and if missing, will be set to default values. The entire settings section can thus be ommitted. + Attributes + None + Values - Name + Name - Required + Required - Description + Description - + - doBackup + doBackup - No + No - User-controlled setting for whether or not to run backup when the project is closed. + User-controlled setting for whether or not to run backup when the project is closed. - + - language + language - No + No - The language used when building the manuscript. The setting is controlled from the Build Novel Project tool. + The language used when building the manuscript. The setting is controlled from the Build Novel Project tool. - + - spellChecking + spellChecking - No + No - The spell checking language to use for this project if it differs from the default spell checking language for the application. - - Attribute auto: A flag determining whether the spell checking is automatic or not. + The spell checking language to use for this project if it differs from the default spell checking language for the application. + + Attribute auto: A flag determining whether the spell checking is automatic or not. - + - lastHandle + lastHandle - No + No - An auto-generated list of the last documents open in the editor and viewer, and which novel root folder was last viewed in the Novel Tree and Outline View. These are saved as key/value pairs. See separate section for how they are stored as XML. + An auto-generated list of the last documents open in the editor and viewer, and which novel root folder was last viewed in the Novel Tree and Outline View. These are saved as key/value pairs. See separate section for how they are stored as XML. - + - autoReplace + autoReplace - No + No - The entries of the auto-replace feature available from Project Settings. These are saved as key/value pairs. See separate section for how they are stored as XML. + The entries of the auto-replace feature available from Project Settings. These are saved as key/value pairs. See separate section for how they are stored as XML. - + - titleFormat + titleFormat - - No + + No - - The formatting specifications set by the user in the Build Novel Project tool for formatting headers in the manuscript. These are saved as key/value pairs. See separate section for how they are stored as XML. + + Removed in Revision 1. - + - status + status - No + No - The status labels as defined by the user in Project Settings. These are saved as special key/value pars. See separate section for how they are stored as XML. + The status labels as defined by the user in Project Settings. These are saved as special key/value pars. See separate section for how they are stored as XML. - + - importance + importance - No + No - The importance labels as defined by the user in Project Settings. These are saved as special key/value pars. See separate section for how they are stored as XML. + The importance labels as defined by the user in Project Settings. These are saved as special key/value pars. See separate section for how they are stored as XML. - Example - <settings> - <doBackup>yes</doBackup> - <language>en_GB</language> - <spellChecking auto="yes">en_GB</spellChecking> - <lastHandle /> - <autoReplace /> - <titleFormat /> - <status /> - <importance /> - </settings> - - Key/Value Nodes - The key/value nodes are used for lastHandle, autoReplace and titleFormat settings. The lookup key is stored as an attribute, and the value is the text of the node. - Attributes + Example + <settings> + <doBackup>yes</doBackup> + <language>en_GB</language> + <spellChecking auto="yes">en_GB</spellChecking> + <lastHandle /> + <autoReplace /> + <status /> + <importance /> + </settings> + + Key/Value Nodes + The key/value nodes are used for lastHandle, autoReplace and titleFormat settings. The lookup key is stored as an attribute, and the value is the text of the node. + Attributes - Name + Name - Required + Required - Description + Description - + - key + key - Yes + Yes - The lookup key. + The lookup key. - Example - <lastHandle> - <entry key="editor">636b6aa9b697b</entry> - <entry key="viewer">636b6aa9b697b</entry> - <entry key="novelTree">7031beac91f75</entry> - <entry key="outline">7031beac91f75</entry> - </lastHandle> - Status/Importance Key/Value Nodes - The status and importance settings are stored as key/value nodes with additional data attributes. The label of the status or importance setting is saved as the node text value. - Attributes + Example + <lastHandle> + <entry key="editor">636b6aa9b697b</entry> + <entry key="viewer">636b6aa9b697b</entry> + <entry key="novelTree">7031beac91f75</entry> + <entry key="outline">7031beac91f75</entry> + </lastHandle> + Status/Importance Key/Value Nodes + The status and importance settings are stored as key/value nodes with additional data attributes. The label of the status or importance setting is saved as the node text value. + Attributes - Name + Name - Required + Required - Description + Description - + - key + key - Yes + Yes - The lookup key. For status labels, it must consist of an “s” followed by six hexadecimal numbers. For importance labels it must consist of an “i” followed by six hexadecimal numbers. Each key string must be unique. Internally, they are random numbers, but also sequential values are valid. + The lookup key. For status labels, it must consist of an “s” followed by six hexadecimal numbers. For importance labels it must consist of an “i” followed by six hexadecimal numbers. Each key string must be unique. Internally, they are random numbers, but also sequential values are valid. - - - count + + + count - No + No - A record of the number of times each label is used in the project content. + A record of the number of times each label is used in the project content. - - - red + + + red - Yes + Yes - A number between 0 and 255 representing the red component of the label colour. + A number between 0 and 255 representing the red component of the label colour. - + - green + green - Yes + Yes - A number between 0 and 255 representing the green component of the label colour. + A number between 0 and 255 representing the green component of the label colour. - + - blue + blue - Yes + Yes - A number between 0 and 255 representing the blue component of the label colour. + A number between 0 and 255 representing the blue component of the label colour. - Example - <status> - <entry key="sf12341" count="4" - red="100" green="100" blue="100">New</entry> - <entry key="sd51c5b" count="0" - red="193" green="129" blue="0">Draft</entry> - <entry key="s78ea90" count="1" - red="58" green="180" blue="58">Finished</entry> - </status> - <importance> - <entry key="ia857f0" count="5" - red="100" green="100" blue="100">None</entry> - <entry key="icfb3a5" count="2" - red="0" green="122" blue="188">Minor</entry> - <entry key="i2d7a54" count="2" - red="21" green="0" blue="180">Major</entry> - </importance> - - Content Node - Tag: content - The content section is a level one node under the root. It stores all the project items of the project. The items are stored in the order in which they appear in the project tree, so altering the order will affect the project structure. The attribute with the order number is not used when processing the data. It is written to the XML for debugging purposes. - Attributes + Example + <status> + <entry key="sf12341" count="4" + red="100" green="100" blue="100">New</entry> + <entry key="sd51c5b" count="0" + red="193" green="129" blue="0">Draft</entry> + <entry key="s78ea90" count="1" + red="58" green="180" blue="58">Finished</entry> + </status> + <importance> + <entry key="ia857f0" count="5" + red="100" green="100" blue="100">None</entry> + <entry key="icfb3a5" count="2" + red="0" green="122" blue="188">Minor</entry> + <entry key="i2d7a54" count="2" + red="21" green="0" blue="180">Major</entry> + </importance> + + Content Node + Tag: content + The content section is a level one node under the root. It stores all the project items of the project. The items are stored in the order in which they appear in the project tree, so altering the order will affect the project structure. The attribute with the order number is not used when processing the data. It is written to the XML for debugging purposes. + Attributes - Name + Name - Required + Required - Description + Description - - - items + + + items - No + No - The number of project items in the content section. + The number of project items in the content section. - - - novelWords + + + novelWords - No + No - The number of words in total for all document nodes with layout DOCUMENT. The value defaults to 0, but this number forms the basis of computing writing statistics during a session, so the number should be properly set to ensure correct statistics. + The number of words in total for all document nodes with layout DOCUMENT. The value defaults to 0, but this number forms the basis of computing writing statistics during a session, so the number should be properly set to ensure correct statistics. - + - notesWords + notesWords - No + No - The number of words in total for all document nodes with layout NOTE. The value defaults to 0, but this number forms the basis of computing writing statistics during a session, so the number should be properly set to ensure correct statistics. + The number of words in total for all document nodes with layout NOTE. The value defaults to 0, but this number forms the basis of computing writing statistics during a session, so the number should be properly set to ensure correct statistics. - Values + Values - Name + Name - Required + Required - Description + Description - + - item + item - No + No - A node representing a project item. + A node representing a project item. - Example - <content items="27" novelWords="954" notesWords="409"> - <item handle="7031beac91f75" parent="None" root="7031beac91f75" - order="0" type="ROOT" class="NOVEL"> - <meta expanded="yes"/> - <name status="sc24b8f" import="ia857f0">Novel</name> - </item> - ... - </content> - Item Nodes - The item nodes make up the actual project content of the project. Each node represents either a root folder, a regular folder, or a document. Each node has a type, class and layout setting that determine its category. Each item is given a handle that is a random hexadecimal string of length 13. - For the items that are document files, the handle corresponds to its expected filename. It is therefore important that they match in generated projects. Each document node is expected to correspond to a file in the contents folder of the project named “content/7031beac91f75.nwd” for the item handle “7031beac91f75”. If there is no such file, the document item is assumed to contain no text, and a file is created when the user tries to save text to it. - Each item node has a meta data node and a name node. The meta data node contains only collected information, and is thus not strictly required. However, an accurate word count and setting the correct icon in the project tree depend on these values. These values are set by the indexer class, so rebuilding the index should restore the data. - The name node contains the primary user defined settings for an item, and is required for the entry to be valid. - - Attributes + Example + <content items="27" novelWords="954" notesWords="409"> + <item handle="7031beac91f75" parent="None" root="7031beac91f75" + order="0" type="ROOT" class="NOVEL"> + <meta expanded="yes"/> + <name status="sc24b8f" import="ia857f0">Novel</name> + </item> + ... + </content> + Item Nodes + The item nodes make up the actual project content of the project. Each node represents either a root folder, a regular folder, or a document. Each node has a type, class and layout setting that determine its category. Each item is given a handle that is a random hexadecimal string of length 13. + For the items that are document files, the handle corresponds to its expected filename. It is therefore important that they match in generated projects. Each document node is expected to correspond to a file in the contents folder of the project named “content/7031beac91f75.nwd” for the item handle “7031beac91f75”. If there is no such file, the document item is assumed to contain no text, and a file is created when the user tries to save text to it. + Each item node has a meta data node and a name node. The meta data node contains only collected information, and is thus not strictly required. However, an accurate word count and setting the correct icon in the project tree depend on these values. These values are set by the indexer class, so rebuilding the index should restore the data. + The name node contains the primary user defined settings for an item, and is required for the entry to be valid. + + Attributes - Name + Name - Required + Required - Description + Description - + - handle + handle - Yes + Yes - The 13 value hexadecimal string that represents the item in the project. This is the primary identifier of a project item, and is required. It must be unique withing a project. Internally, it is generated as a random value, but it can also be sequential. + The 13 value hexadecimal string that represents the item in the project. This is the primary identifier of a project item, and is required. It must be unique withing a project. Internally, it is generated as a random value, but it can also be sequential. - - - parent + + + parent - - Yes + + Yes - - The handle of the parent item in the tree. This value should only be None for root folders. All other items must have a parent handle set. If the parent handle is None for an item that isn’t a root folder, the item will be treated as orphaned during project loading. + + The handle of the parent item in the tree. This value should only be None for root folders. All other items must have a parent handle set. If the parent handle is None for an item that isn’t a root folder, the item will be treated as orphaned during project loading. - - - root + + + root - - No + + No - - The handle of the top of its hierarchy of parent items. That is, the root folder which it ultimately sits under. If the attribute is not set, it will be computed during loading. It is saved to the XML file for efficiency reasons. + + The handle of the top of its hierarchy of parent items. That is, the root folder which it ultimately sits under. If the attribute is not set, it will be computed during loading. It is saved to the XML file for efficiency reasons. - - - order + + + order - - No + + No - - The numerical order of the item under its parent item. This value is not used during the loading process as the physical item order in the content node is used instead. It is primarily saved to the XML for debugging purposes. + + The numerical order of the item under its parent item. This value is not used during the loading process as the physical item order in the content node is used instead. It is primarily saved to the XML for debugging purposes. - - - type + + + type - - Yes + + Yes - - The item type of the item node. Allowed values are ROOT, FOLDER and FILE. + + The item type of the item node. Allowed values are ROOT, FOLDER and FILE. - - - class + + + class - - Yes + + Yes - - The item class of the item node. There are a number of item classes available in the app, all corresponding to a specific type of root folder. Each item in a root folder should have the same class set as the root folder itself. The attribute is not strictly required for items that aren’t root folders as it will be automatically set to match during loading. Allowed values are NOVEL, PLOT, CHARACTER, WORLD, TIMELINE, OBJECT, ENTITY, CUSTOM, ARCHIVE and TRASH. + + The item class of the item node. There are a number of item classes available in the app, all corresponding to a specific type of root folder. Each item in a root folder should have the same class set as the root folder itself. The attribute is not strictly required for items that aren’t root folders as it will be automatically set to match during loading. Allowed values are NOVEL, PLOT, CHARACTER, WORLD, TIMELINE, OBJECT, ENTITY, CUSTOM, ARCHIVE and TRASH. - + - layout + layout - Yes + Yes - The item layout of the item node. Allowed values are DOCUMENT and NOTE. This is the attribute that determines if a FILE type item is a Novel Document or a Project Note. + The item layout of the item node. Allowed values are DOCUMENT and NOTE. This is the attribute that determines if a FILE type item is a Novel Document or a Project Note. - Values + Values - Name + Name - Required + Required - Description + Description - + - meta + meta - No + No - A node of meta data attributes for the item. + A node of meta data attributes for the item. - + - name + name - Yes + Yes - A node of user settings for the item. + A node of user settings for the item. - Meta Nodes - The meta data collected for the current item. This data either represents the item’s last state in the app, or consists of data collected by the indexer. It can be restored by rebuilding the index, so the data is not essential. - Attributes + Meta Nodes + The meta data collected for the current item. This data either represents the item’s last state in the app, or consists of data collected by the indexer. It can be restored by rebuilding the index, so the data is not essential. + Attributes - Name + Name - Required + Required - Description + Description - + - expanded + expanded - No + No - Whether the tree node in the project tree was expanded or collapsed during the last session. Applies to all item types, but is ignored for items without child items. + Whether the tree node in the project tree was expanded or collapsed during the last session. Applies to all item types, but is ignored for items without child items. - - - heading + + + heading - - No + + No - - The heading level of the first heading of the text of the item. Only applies to FILE item types. Allowed values are H0, H1, H2, H3, and H4. Other values are reset to H0. + + The heading level of the first heading of the text of the item. Only applies to FILE item types. Allowed values are H0, H1, H2, H3, and H4. Other values are reset to H0. - - - charCount + + + charCount - - No + + No - - The number of characters in the text of the item. Only applies to FILE item types. + + The number of characters in the text of the item. Only applies to FILE item types. - - - wordCount + + + wordCount - - No + + No - - The number of words in the text of the item. Only applies to FILE item types. + + The number of words in the text of the item. Only applies to FILE item types. - - - paraCount + + + paraCount - - No + + No - - The number of paragraphs in the text of the item. Only applies to FILE item types. + + The number of paragraphs in the text of the item. Only applies to FILE item types. - - - cursorPos + + + cursorPos - - No + + No - - The last cursor position in the text of the item from the last editing session. Only applies to FILE item types. The value is used to restore the cursor position when the document is opened in the editor. + + The last cursor position in the text of the item from the last editing session. Only applies to FILE item types. The value is used to restore the cursor position when the document is opened in the editor. - Name Nodes - The name node contains information about an item that is set by the user. Including its label, which is the text value of the node. This is the label that is displayed in the project tree. - Attributes + Name Nodes + The name node contains information about an item that is set by the user. Including its label, which is the text value of the node. This is the label that is displayed in the project tree. + Attributes - Name + Name - Required + Required - Description + Description - + - status + status - No + No - The ID of the status label that has been set for this item. Defaults to the first status item defined in the status section of the settings node. + The ID of the status label that has been set for this item. Defaults to the first status item defined in the status section of the settings node. - - - import + + + import - - No + + No - - The ID of the importance label that has been set for this item. Defaults to the first importance item defined in the importance section of the settings node. + + The ID of the importance label that has been set for this item. Defaults to the first importance item defined in the importance section of the settings node. - - - active + + + active - - No + + No - - The active/inactive status of the document. Only applies to FILE item types. + + The active/inactive status of the document. Only applies to FILE item types. - Example - <item handle="53b69b83cdafc" parent="7031beac91f75" root="7031beac91f75" - order="0" type="FILE" class="NOVEL" layout="DOCUMENT"> - <meta expanded="no" heading="H1" charCount="93" wordCount="19" - paraCount="2" cursorPos="119"/> - <name status="sc24b8f" import="ia857f0" active="yes">Title Page</name> - </item> + Example + <item handle="53b69b83cdafc" parent="7031beac91f75" root="7031beac91f75" + order="0" type="FILE" class="NOVEL" layout="DOCUMENT"> + <meta expanded="no" heading="H1" charCount="93" wordCount="19" + paraCount="2" cursorPos="119"/> + <name status="sc24b8f" import="ia857f0" active="yes">Title Page</name> + </item> \ No newline at end of file diff --git a/docs/source/fileformatspec15.pdf b/docs/source/fileformatspec15.pdf index b93a7bef..5115b5b1 100644 Binary files a/docs/source/fileformatspec15.pdf and b/docs/source/fileformatspec15.pdf differ diff --git a/novelwriter/core/projectxml.py b/novelwriter/core/projectxml.py index 42f4e582..416f0934 100644 --- a/novelwriter/core/projectxml.py +++ b/novelwriter/core/projectxml.py @@ -47,6 +47,7 @@ if TYPE_CHECKING: logger = logging.getLogger(__name__) FILE_VERSION = "1.5" # The current project file format version +FILE_REVISION = "1" # The current project file format revision HEX_VERSION = 0x0105 NUM_VERSION = { @@ -105,6 +106,8 @@ class ProjectXMLReader: the content item meta entry. It also moves meta data related to the project or the content into their respective section nodes as attributes. The id attribute was also added to the project. + + Rev 1: Drops the titleFormat section of settings. """ def __init__(self, path): @@ -112,6 +115,7 @@ class ProjectXMLReader: self._state = XMLReadState.NO_ACTION self._root = "" self._version = 0x0 + self._revision = 0 self._appVersion = "" self._hexVersion = 0x0 self._timeStamp = "" @@ -136,6 +140,11 @@ class ProjectXMLReader: """Return the project XML version number.""" return self._version + @property + def xmlRevision(self) -> int: + """Return the project XML revision number.""" + return self._revision + @property def appVersion(self) -> str: """Return the version number who wrote the file.""" @@ -196,6 +205,7 @@ class ProjectXMLReader: logger.debug("XML is '%s' version '%s'", self._root, fileVersion) + self._revision = checkInt(xRoot.attrib.get("fileRevision"), 0) self._appVersion = str(xRoot.attrib.get("appVersion", "")) self._hexVersion = hexToInt(xRoot.attrib.get("hexVersion", "")) self._timeStamp = str(xRoot.attrib.get("timeStamp", "")) @@ -490,10 +500,11 @@ class ProjectXMLWriter: logger.debug("Writing project XML") xRoot = ET.Element("novelWriterXML", attrib={ - "appVersion": str(__version__), - "hexVersion": str(__hexversion__), + "appVersion": str(__version__), + "hexVersion": str(__hexversion__), "fileVersion": FILE_VERSION, - "timeStamp": formatTimeStamp(saveTime), + "fileRevision": FILE_REVISION, + "timeStamp": formatTimeStamp(saveTime), }) # Save Project Meta diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index 6d04fd18..9094397b 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,6 +1,6 @@ - - + + Sample Project Sample Project Jane Smith @@ -20,13 +20,6 @@ E D - - %title% - Chapter %chw%: %title% - %title% - Scene %ch%.%sc%: %title% - - New Notes @@ -65,7 +58,7 @@ Chapter One - + Making a Scene diff --git a/tests/files/nwProject-1.5.nwx b/tests/files/nwProject-1.5.nwx index 8952b63b..1965de73 100644 --- a/tests/files/nwProject-1.5.nwx +++ b/tests/files/nwProject-1.5.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -20,13 +20,6 @@ E D - - %title% - Chapter %chw%: %title% - %title% - Scene %ch%.%sc%: %title% - - New Notes diff --git a/tests/lipsum/nwProject.nwx b/tests/lipsum/nwProject.nwx index 0a4a69e5..d789716c 100644 --- a/tests/lipsum/nwProject.nwx +++ b/tests/lipsum/nwProject.nwx @@ -1,6 +1,6 @@ - - + + Lorem Ipsum Lorem Ipsum lipsum.com @@ -19,13 +19,6 @@ Replace Text 1 Replace Text 2 - - %title% - Chapter %ch%: %title% - %title% - * * * - - New Note @@ -45,7 +38,7 @@ Novel - + Lorem Ipsum @@ -125,4 +118,4 @@ Ancient Europe - \ No newline at end of file + diff --git a/tests/reference/coreProject_NewFileFolder_nwProject.nwx b/tests/reference/coreProject_NewFileFolder_nwProject.nwx index c80520fa..6fd70fb2 100644 --- a/tests/reference/coreProject_NewFileFolder_nwProject.nwx +++ b/tests/reference/coreProject_NewFileFolder_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -16,13 +16,6 @@ None - - %title% - %title% - %title% - * * * - - New Note diff --git a/tests/reference/coreProject_NewRoot_nwProject.nwx b/tests/reference/coreProject_NewRoot_nwProject.nwx index c94ce28e..057e3742 100644 --- a/tests/reference/coreProject_NewRoot_nwProject.nwx +++ b/tests/reference/coreProject_NewRoot_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -16,13 +16,6 @@ None - - %title% - %title% - %title% - * * * - - New Note diff --git a/tests/reference/coreTools_NewCustomA_nwProject.nwx b/tests/reference/coreTools_NewCustomA_nwProject.nwx index 84419675..3abeea1a 100644 --- a/tests/reference/coreTools_NewCustomA_nwProject.nwx +++ b/tests/reference/coreTools_NewCustomA_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -16,13 +16,6 @@ None - - %title% - %title% - %title% - * * * - - New Note diff --git a/tests/reference/coreTools_NewCustomB_nwProject.nwx b/tests/reference/coreTools_NewCustomB_nwProject.nwx index 53e23cd8..a433a3b1 100644 --- a/tests/reference/coreTools_NewCustomB_nwProject.nwx +++ b/tests/reference/coreTools_NewCustomB_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Custom Test Novel @@ -16,13 +16,6 @@ None - - %title% - %title% - %title% - * * * - - New Note diff --git a/tests/reference/coreTools_NewMinimal_nwProject.nwx b/tests/reference/coreTools_NewMinimal_nwProject.nwx index 04ad571c..23a377f5 100644 --- a/tests/reference/coreTools_NewMinimal_nwProject.nwx +++ b/tests/reference/coreTools_NewMinimal_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Project @@ -16,13 +16,6 @@ None - - %title% - %title% - %title% - * * * - - New Note diff --git a/tests/reference/guiEditor_Main_Final_nwProject.nwx b/tests/reference/guiEditor_Main_Final_nwProject.nwx index c5c3b367..104080e9 100644 --- a/tests/reference/guiEditor_Main_Final_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Final_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -16,13 +16,6 @@ None - - %title% - %title% - %title% - * * * - - New Note diff --git a/tests/reference/guiEditor_Main_Initial_nwProject.nwx b/tests/reference/guiEditor_Main_Initial_nwProject.nwx index 4d758791..e266f65f 100644 --- a/tests/reference/guiEditor_Main_Initial_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Initial_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project New Novel @@ -16,13 +16,6 @@ None - - %title% - %title% - %title% - * * * - - New Note diff --git a/tests/reference/projectXML_ReadLegacy10.nwx b/tests/reference/projectXML_ReadLegacy10.nwx index edcab5b4..9d04ef44 100644 --- a/tests/reference/projectXML_ReadLegacy10.nwx +++ b/tests/reference/projectXML_ReadLegacy10.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -20,13 +20,6 @@ E D - - %title% - Chapter %ch%: %title% - %title% - Scene %ch%.%sc%: %title% - - New Notes diff --git a/tests/reference/projectXML_ReadLegacy11.nwx b/tests/reference/projectXML_ReadLegacy11.nwx index fcc987ef..50924c78 100644 --- a/tests/reference/projectXML_ReadLegacy11.nwx +++ b/tests/reference/projectXML_ReadLegacy11.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -20,13 +20,6 @@ E D - - %title% - Chapter %ch%: %title% - %title% - Scene %ch%.%sc%: %title% - - New Notes diff --git a/tests/reference/projectXML_ReadLegacy12.nwx b/tests/reference/projectXML_ReadLegacy12.nwx index b44e9acf..7d36e380 100644 --- a/tests/reference/projectXML_ReadLegacy12.nwx +++ b/tests/reference/projectXML_ReadLegacy12.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -20,13 +20,6 @@ E D - - %title% - Chapter %chw%: %title% - %title% - Scene %ch%.%sc%: %title% - - New Notes diff --git a/tests/reference/projectXML_ReadLegacy13.nwx b/tests/reference/projectXML_ReadLegacy13.nwx index 06fc3145..c75aa97c 100644 --- a/tests/reference/projectXML_ReadLegacy13.nwx +++ b/tests/reference/projectXML_ReadLegacy13.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -20,13 +20,6 @@ E D - - %title% - Chapter %chw%: %title% - %title% - Scene %ch%.%sc%: %title% - - New Notes diff --git a/tests/reference/projectXML_ReadLegacy14.nwx b/tests/reference/projectXML_ReadLegacy14.nwx index e40e3a07..aef603dd 100644 --- a/tests/reference/projectXML_ReadLegacy14.nwx +++ b/tests/reference/projectXML_ReadLegacy14.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -20,13 +20,6 @@ E D - - %title% - Chapter %chw%: %title% - %title% - Scene %ch%.%sc%: %title% - - New Notes