diff --git a/docs/FileFormatSpec-1.5.fodt b/docs/FileFormatSpec-1.5.fodt index 892c8659..37169408 100644 --- a/docs/FileFormatSpec-1.5.fodt +++ b/docs/FileFormatSpec-1.5.fodt @@ -1,10 +1,10 @@ - Veronica Olsen2022-11-05T18:25:44.8874731592022-11-17T10:07:56.114449354Veronica OlsenPT3H36M22S34LibreOffice/7.0.4.2$Linux_X86_64 LibreOffice_project/00$Build-2 + Veronica Olsen2022-11-05T18:25:44.8874731592022-11-27T16:59:09.712224049Veronica OlsenPT3H37M58S40LibreOffice/7.0.4.2$Linux_X86_64 LibreOffice_project/00$Build-2 - 166007 + 0 0 26555 20394 @@ -13,12 +13,12 @@ view2 - 13430 - 174449 + 10569 + 2925 0 - 166007 + 0 26554 - 186399 + 20392 0 1 false @@ -85,7 +85,7 @@ true true - 327557 + 421923 true false @@ -1007,183 +1007,201 @@ - + + + + - + + + + + + + + + - + + + + + - + + + + + + + - + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - - + + - - - - - - - + - + - + + + + - + + + + + + + + + + + + + + + + - + - + + + + - + - + - - + + - + + + + + + + + + + - + + + + + + + + + + + + + - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + - - + + + - - + + + + + + + + + + + @@ -1207,47 +1225,53 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + @@ -1268,829 +1292,828 @@ - 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 is the text representation of the Python None value, and must be used in those cases. - 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 + 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 is the text representation of the Python None value, and must be used in those cases. + 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 - 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. + 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. - + - timeStamp + timeStamp - 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 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 and can be ommitted from the XML. - Attributes + 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 and can be 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 for to keep track of temporary files and associate cross-project settings with different 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 for to keep track of temporary files and associate cross-project settings with different 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 a single author of the project. This value can be repeated for multiple authors. + 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> - <author>Jay Doh</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 settings is controlled from the Build Novel Project tool. + The language used when building the manuscript. The settings 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 the 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 the 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. + 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. - + - 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 /> + <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 - 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 anre stored as key/value nodes with additional data attributes. - 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 anre stored as key/value nodes with additional data attributes. + 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. These must be unique for each entry. For importance labels it must consist of an “i” followed by six hexadecimal numbers. + The lookup key. For status labels, it must consist of an “s” followed by six hexadecimal numbers. These must be unique for each entry. For importance labels it must consist of an “i” followed by six hexadecimal numbers. - + - 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 structure. The attribute with the order number is not used when processing the data. It is mainly 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 structure. The attribute with the order number is not used when processing the data. It is mainly 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 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 in order to ensure correct statistics. + The number of words in total for all document nodes 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 in order to ensure correct statistics. - + - notesWords + notesWords - No + No - The number of words in total for all document nodes 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 in order to ensure correct statistics. + The number of words in total for all document nodes 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 in order 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, this handle corresponds to its filename. It is therefore important that these match. 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”. - 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 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. - 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, this handle corresponds to its filename. It is therefore important that these match. 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”. + 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 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. + 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. + The 13 value hexadecimal string that represents the item in the project. This is the primary identifier of a project item, and is required. - + - 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 primarily 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 primarily 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. + 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. - + - 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 is collected primarily by the indexer class. 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 is collected primarily by the indexer class. 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. + Whether the tree node in the project tree was expanded or collapsed during the last session. Applies to all item types. - + - 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 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 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/_static/fileformatspec15.pdf b/docs/source/_static/fileformatspec15.pdf index 1c36fd70..f4ca345d 100644 Binary files a/docs/source/_static/fileformatspec15.pdf and b/docs/source/_static/fileformatspec15.pdf differ