Files
novelWriter/docs/source/_build/html/technical.html
T
2020-05-28 10:49:08 +02:00

146 lines
7.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Technical Information &#8212; novelWriter 0.6.1 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Exporting Projects" href="export.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="export.html" title="Exporting Projects"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">novelWriter 0.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="technical-information">
<h1>Technical Information<a class="headerlink" href="#technical-information" title="Permalink to this headline"></a></h1>
<p>This section contains details of how novelWriter stores and handles the project data.</p>
<div class="section" id="how-data-is-stored">
<h2>How Data is Stored<a class="headerlink" href="#how-data-is-stored" title="Permalink to this headline"></a></h2>
<p>All novelWriter files are written with utf-8 encoding.
Since Python automatically converts Unix line endings to Windows line endings on Windows systems, novelWriter does not make any adaptations to the formatting on Windows systems.</p>
<div class="section" id="main-project-file">
<h3>Main Project File<a class="headerlink" href="#main-project-file" title="Permalink to this headline"></a></h3>
<p>The project itself requires a dedicated folder for storing its files.
The main project file is stored as an XML file with the name <code class="docutils literal notranslate"><span class="pre">nwProject.nwx</span></code>.
This file contains all the meta data required for the project.
That includes project-specific settings.</p>
<p>If this file is lost or corrupted, the structure of the project is lost.
It is important to keep this file backed up, either through the built-in backup tool, or your own backup solution.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The novelWriter project folder is structured so that it can easily be added to a version control system like git.
If so, you may want to add a <cite>.gitignore</cite> file to exclude files with the extensions <cite>.bak</cite> and <cite>.json</cite>.</p>
</div>
<p>The project XML file is suitable for diff tools and version control, although a timesetamp is set in the meta section on line 2 each time the file is saved.</p>
</div>
<div class="section" id="project-documents">
<h3>Project Documents<a class="headerlink" href="#project-documents" title="Permalink to this headline"></a></h3>
<p>The project documents are saved in folders starting with <code class="docutils literal notranslate"><span class="pre">data_</span></code>.
Each document has a file handle taken from the first 13 characters of a SHA256 hash of the system time when the file was first created.
The documents are saved with a folder and filename derived from this hash.
If you wish to find the physical location of a file in the project, you can either look it up in the project XML file, or select <span class="menuselection">Document ‣ Show File Details</span> in the menu when having the document open.</p>
<p>The reason for this cryptic file naming is to avoid issues with file naming conventions and restrictions on different operating systems, and also to have a file name that does not depend on what the user names the files, or changes it to.
The file meta data in the tree view, except the file label, is only saved in the project XML file.</p>
<p>Each document file contains a plain text version of the text from the editor.
The file can in principle be edited in any text editor, and is suitable for diffing and version control if so desired.
Just make sure the file remains in utf-8 encoding, otherwise unicode chatracters may become mangled.</p>
<p>The first line contains some meta data starting with the characters “%%~”.
This line is mainly there to restore some information if it is lost from the project file, and the information may be helpful if you do open the file in an external editor as it contains the file label as the last entry.
The line can be deleted without any consequences to the rest of the content of the file.</p>
</div>
<div class="section" id="the-file-saving-process">
<h3>The File Saving Process<a class="headerlink" href="#the-file-saving-process" title="Permalink to this headline"></a></h3>
<p>When saving the project file, or any of the documents, the data is first saved to a temporary file.
If successful, the old data file is renamed with a <cite>.bak</cite> extension, and the temporary file becomes the new file.
This ensures that the previously saved data is only replaced when the new data has been successfully saved.
The <cite>.bak</cite> file will always contain the previous version of the file, although when auto-save is enabled, they may have the same content.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Technical Information</a><ul>
<li><a class="reference internal" href="#how-data-is-stored">How Data is Stored</a><ul>
<li><a class="reference internal" href="#main-project-file">Main Project File</a></li>
<li><a class="reference internal" href="#project-documents">Project Documents</a></li>
<li><a class="reference internal" href="#the-file-saving-process">The File Saving Process</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="export.html"
title="previous chapter">Exporting Projects</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/technical.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="export.html" title="Exporting Projects"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">novelWriter 0.6.1 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2018-2020, Veronica Berglyd Olsen.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.4.
</div>
</body>
</html>