Update docs and add menu entries for special titles (#850)

* Update Introduction chapter
* Update User Interface chapter
* Update Novel Projects chapter
* Update Novel Structure chapter
* Update Exporting Projects chapter
* Drop the asterisk notation for unnumbered chapters
* Add menu entries and tests for Novel Title and Unnumbered Chapter block formats
This commit is contained in:
Veronica Berglyd Olsen
2021-08-15 23:30:11 +02:00
committed by GitHub
parent 669f013c96
commit 460b350d85
11 changed files with 203 additions and 183 deletions
+15 -15
View File
@@ -11,16 +11,16 @@ projects are structured is covered in :ref:`a_struct`.
In addition, the project can contain notes on the various plot elements, characters, locations, In addition, the project can contain notes on the various plot elements, characters, locations,
etc, that make up the story. These notes are organised in a set of category-specific top-level etc, that make up the story. These notes are organised in a set of category-specific top-level
folders referred to as "root" folders, and each entry can be tagged and cross-referenced from folders referred to as "root folders", and each entry can be tagged and cross-referenced from
within the novel documents and notes. These tags make it possible to inter-link documents, and within the novel documents and notes. These tags make it possible to inter-link documents, and
generate an overview of the entire novel project and how the various documents and plot elements generate an overview of the entire novel project and how the various documents and plot elements
are interconnected. The tag and reference syntax is covered in :ref:`a_proj` and :ref:`a_notes`. are interconnected. The tag and reference syntax is covered in :ref:`a_proj` and :ref:`a_notes`.
These additional features are not standard in markdown, but are available through special meta These features are available through special meta keywords described in :ref:`a_struct_tags`.
keywords described in :ref:`a_struct_tags`. Syntax highlighting is provided to make it easier to Syntax highlighting is provided to make it easier to verify that the markdown tags are used
verify that the markdown tags are used correctly. correctly.
An overview of the supported markdown syntax is covered in :ref:`a_ui`. An overview of the supported formatting syntax is covered in :ref:`a_ui`.
.. _a_intro_design: .. _a_intro_design:
@@ -34,32 +34,32 @@ at the same time provide a complete set of features needed for writing a novel.
.. note:: .. note::
novelWriter is not intended to be a full office type word processor. It doesn't support images, novelWriter is not intended to be a full office type word processor. It doesn't support images,
links, tables, and other complex structures and objects often needed for such documents. links, tables, and other complex structures and objects often needed for such documents.
Formatting is limited to headers, and bold, italicised and strikethrough text. Formatting is limited to headers, emphasis, text alignment, and a few other simple features.
.. tip:: .. tip::
If you do need to align information in rows and columns in your notes, you can achieve this with If you do need to align information in rows and columns in your notes, you can achieve this with
tabs and line breaks. The tab stop width can be specified in :guilabel:`Preferences`. tabs and line breaks. The tab stop width can be specified in :guilabel:`Preferences`.
The main window does not have a toolbar like many other applications do. This reduces clutter, and The main window does not have a toolbar like many other applications do. This reduces clutter, and
since the documents are formatted with markdown tags, is more or less redundant. However, all since the documents are formatted with style tags, is more or less redundant. However, all
formatting features supported are available through convenient keyboard shortcuts. They are also formatting features supported are available through convenient keyboard shortcuts. They are also
available in the main menu so you don't have to look up the syntax every time until you've available in the main menu so you don't have to look up formatting codes every time you need them,
memorised it. A full list of shortcuts can be found in the :ref:`a_kb` section. before you've memorised them. A full list of shortcuts can be found in the :ref:`a_kb` section.
In addition, novelWriter has a :guilabel:`Focus Mode` where all the user interface elements other In addition, novelWriter has a :guilabel:`Focus Mode` where all the user interface elements other
than the document editor itself are hidden away. than the document editor itself are hidden away.
The colour scheme of the user interface defaults to that of the host operating system. In addition, The colour scheme of the user interface defaults to that of the host operating system. Some other
other light and dark themes are provided, and can be enabled in :guilabel:`Preferences` from the light and dark colour themes are provided, and can be enabled in :guilabel:`Preferences` from the
:guilabel:`Tools` menu. A number of syntax highlighting themes are also available in :guilabel:`Tools` menu. A number of syntax highlighting themes are also available in
:guilabel:`Preferences`. A set of icon themes in colour and greyscale are also offered. The icons :guilabel:`Preferences`. A set of icon themes in colour and greyscale are also offered. The icons
are based on the Typicons_ icon set designed by Stephen Hutchings. are based on the Typicons_ icon set designed by Stephen Hutchings.
The main window is split in two, or optionally three, panels. The left-most panel contains the The main window is split in two, or optionally three, panels. The left-most panel contains the
project tree and all the documents in your project. The second panel is the document editor, and project tree and all the documents in your project. The second panel is the document editor. An
the optional third panel is a document viewer which can view any document in your project optional third panel is a document viewer which can view any document in your project independently
independently of the document editor. It is not intended as a preview window, although you can use of the document editor. It is not intended as a preview window, although you can use it for this,
it for this, but for viewing your notes next to your editor while you're writing. but for viewing your notes next to your editor while you're writing.
A second tab is also available on the main window. This is the :guilabel:`Outline` tab where the A second tab is also available on the main window. This is the :guilabel:`Outline` tab where the
entire novel structure can be displayed, with all the tags and references listed. Depending on how entire novel structure can be displayed, with all the tags and references listed. Depending on how
+5 -7
View File
@@ -23,10 +23,9 @@ a series of keywordreplace steps. They are all on the format ``%keyword%``.
``%ch%`` ``%ch%``
This will be replaced by a chapter number. The number is incremented by one each time the build This will be replaced by a chapter number. The number is incremented by one each time the build
tool sees a new heading of level two in a document with layout :guilabel:`Chapter`. If the tool sees a new heading of level two in a document, unless the heading formatting code has the
document has layout :guilabel:`Unnumbered`, the counter is *not* incremented. The latter is added ``!``. In the latter case, the counter is *not* incremented. This is useful for for
useful for for instance Prologue and Epilogue chapters. Adding an asterisk (``*``) in front of instance Prologue and Epilogue chapters.
the title text of a level two heading will also disable the chapter counter for that heading.
``%chw%`` ``%chw%``
Behaves like ``%ch%``, but the number is represented as a number word. Behaves like ``%ch%``, but the number is represented as a number word.
@@ -97,9 +96,8 @@ exclude the body text itself.
If you need to exclude specific documents from your exports, like draft documents or documents you If you need to exclude specific documents from your exports, like draft documents or documents you
want to take out of your manuscript, but don't want to delete, you can un-check the want to take out of your manuscript, but don't want to delete, you can un-check the
:guilabel:`Include when building project` option for each document in the project tree. An included :guilabel:`Include when building project` option for each document in the project tree. An included
document has a checkmark after the status icon in the :guilabel:`Flags` column. The document has a checkmark after in the third column of the project tree. The :guilabel:`Build Novel
:guilabel:`Build Novel Project` tool has a switch to ignore this flag if you need to collectively Project` tool has a switch to ignore this flag if you need to collectively override these settings.
override these settings.
.. _a_export_print: .. _a_export_print:
+59 -33
View File
@@ -16,29 +16,28 @@ The Project Tree
The main window contains a project tree in the left-most panel. It shows the entire structure of The main window contains a project tree in the left-most panel. It shows the entire structure of
the project. It has four columns: the project. It has four columns:
:guilabel:`Label` **Column 1**
The first column shows the item icon and its label. The labels can be edited from the The first column shows the item icon and its label. The labels can be edited from the
:guilabel:`Project` menu, or by pressing :kbd:`F2` or :kbd:`Ctrl`:kbd:`E`. The label is not the :guilabel:`Project` menu, or by pressing :kbd:`F2` or :kbd:`Ctrl`:kbd:`E`. The label is not the
same as the title you set inside the document, but it will appear in the header above the same as the title you set inside the document, but it will appear in the header above the
document text itself. document text itself.
:guilabel:`Words` **Column 2**
The second column shows the word count of the document, or the sum of words of the child items The second column shows the word count of the document, or the sum of words of the child items
if it is a folder. If the counts seem incorrect, they can be updated by rebuilding the project for folders. If the counts seem incorrect, they can be updated by rebuilding the project index
index from the :guilabel:`Tools` menu, or by pressing :kbd:`F9`. from the :guilabel:`Tools` menu, or by pressing :kbd:`F9`.
:guilabel:`Inc` **Column 3**
The third column indicates whether the document is included in the final project build or not. The third column indicates whether the document is included in the final project build or not.
You may want to filter out documents that you no longer want to keep in the final manuscript, You may want to filter out documents that you no longer want to keep in the final manuscript,
but want to keep in the project for reference. but want to keep in the project for reference.
:guilabel:`Flags` **Column 4**
The fourth column shows various meta data flags for the item. The first is an icon indicating The fourth column shows the user-defined status or importance labels you've assigned to each
the importance or status of the document. These are colour coded status levels that you control project item. By default, both the icon and the label text is shown, but you can turn off the
and define yourself. They can be changed in :guilabel:`Project Settings` from the text label from :guilabel:`Preferences`. If the text label is off, the text will instead appear
:guilabel:`Project` menu. The first character after the icon indicates the class of the item, in a tooltip when you hover your mouse over the icon. They status and importance values can be
that is ``N`` for **Novel**, ``C`` for **Character**, etc (see :ref:`a_struct_tags`). The changed in :guilabel:`Project Settings`.
characters after the dot indicate the document layout type (see :ref:`a_proj_roots`).
Right-clicking an item in the project tree will open a context menu under the cursor, displaying Right-clicking an item in the project tree will open a context menu under the cursor, displaying
a selection of actions that can be performed on the selected item. a selection of actions that can be performed on the selected item.
@@ -112,9 +111,9 @@ Editing and Viewing Documents
To edit a document, double-click it in the project tree, or press the :kbd:`Return` key while To edit a document, double-click it in the project tree, or press the :kbd:`Return` key while
having it selected. This will open the document in the document editor. The editor uses a having it selected. This will open the document in the document editor. The editor uses a
simplified markdown format. The format is described in the :ref:`a_ui_md` section below. The editor markdown-like syntax for some features, and a novelWriter-specific syntax for others. The syntax
has a maximise button (toggles the :guilabel:`Focus Mode`) and a close button in the top-right format is described in the :ref:`a_ui_md` section below. The editor has a maximise button (toggles
corner. the :guilabel:`Focus Mode`) and a close button in the top-right corner.
Any document in the project tree can also be viewed in parallel in a right hand side document Any document in the project tree can also be viewed in parallel in a right hand side document
viewer. To view a document, press :kbd:`Ctrl`:kbd:`R`, or select :guilabel:`View Document` in the viewer. To view a document, press :kbd:`Ctrl`:kbd:`R`, or select :guilabel:`View Document` in the
@@ -214,7 +213,8 @@ Markdown editor. It supports basic formatting like emphasis (italic), strong imp
and strikethrough text, as well as four levels of headings. and strikethrough text, as well as four levels of headings.
In addition to formatting codes, novelWriter allows for comments, a synopsis tag, and a set of In addition to formatting codes, novelWriter allows for comments, a synopsis tag, and a set of
keyword and value sets used for tags and references. keyword and value sets used for tags and references. There are also some codes that apply two whole
paragraphs. See :ref:`a_ui_md_text` below for more details.
.. _a_ui_md_head: .. _a_ui_md_head:
@@ -222,36 +222,43 @@ keyword and value sets used for tags and references.
Headings Headings
-------- --------
Four levels of headings are allowed. For documents of layout ``Note``, they are free to be used as Four levels of headings are allowed. For project notes they are free to be used as you see fit.
you see fit, but for all other layouts used for the novel text itself, they indicate the structural However, for novel documents they indicate the structural level of the novel. See
level of the novel. See :ref:`a_struct_heads` for more details. :ref:`a_struct_heads` for more details.
``# Title`` ``# Title Text``
Heading level one. If the document is a novel file, the header level indicates the start of a Heading level one. If the document is a novel file, the header level indicates the start of a
new partition. This heading level can also be used for the title page's novel title. new partition.
``## Title`` ``## Title Text``
Heading level two. If the document is a novel file, the header level indicates the start of a Heading level two. If the document is a novel file, the header level indicates the start of a
new chapter. Chapter numbers can be inserted automatically when exporting the manuscript. new chapter. Chapter numbers can be inserted automatically when exporting the manuscript.
``### Title`` ``### Title Text``
Heading level three. If the document is a novel file, the header level indicates the start of a Heading level three. If the document is a novel file, the header level indicates the start of a
new scene. Scene numbers or scene separators can be inserted automatically when exporting the new scene. Scene numbers or scene separators can be inserted automatically when exporting the
manuscript, so you can use the title field as a working title for your scenes if you wish. manuscript, so you can use the title field as a working title for your scenes if you wish.
``#### Title`` ``#### Title Text``
Heading level four. If the document is a novel file, the header level indicates the start of a Heading level four. If the document is a novel file, the header level indicates the start of a
new section. Section titles can be replaced by separators or removed when exporting the new section. Section titles can be replaced by separators or removed when exporting the
manuscript, so you can use the title field as a working title for your sections if you wish. manuscript, so you can use the title field as a working title for your sections if you wish.
.. note:: For header level one and two, adding a ``!`` modifies the behaviour of the heading slightly:
The space after the ``#`` characters is mandatory. The syntax highlighter will change colour and
font size when the heading is correctly formatted.
.. tip:: ``#! Title Text``
If you do use the automatic numbering feature for exports, you can tell the export tool to skip This tells the build tool that the level one heading is intended to be used for the novel's
assigning a number to a specific chapter by adding a ``*`` as the first character of the title main title, like for instance on the front page. When exporting, this will use a different
itself. See :ref:`a_struct_heads_unnum` for more details. styling and will exclude the title from for instance a Table of Contents in Libre Office.
``##! Title Text``
This tells the build tool to not assign a chapter number to this chapter title if automatic
chapter numbers are being used. Such titles are useful for a prologue for instance. See
:ref:`a_struct_heads_unnum` for more details.
.. note::
The space after the ``#`` or ``!`` characters is mandatory. The syntax highlighter will change
colour and font size when the heading is correctly formatted.
.. _a_ui_md_text: .. _a_ui_md_text:
@@ -281,13 +288,32 @@ background, depending on the selected theme.
it prevents the line wrapping algorithms from adding line breaks where it shouldn't. it prevents the line wrapping algorithms from adding line breaks where it shouldn't.
.. _a_ui_md_break:
Vertical Space and Page Breaks
------------------------------
Adding more than one line break between paragraphs will *not* increase the space between those
paragraphs when exporting the project. To add additional space between paragraphs, add the text
``[VSPACE]`` on a line of its own, and the build tool will insert a blank paragraph in its place.
If you need multiple blank paragraphs just add a number. For instance, writing ``[VSPACE:3]`` will
insert three blank paragraphs.
Normally, the build tool will insert a page break before all headers of level one and for all
headers of level two for novel documents, i.e. chapters, but not for project notes.
If you need to add a page break somewhere else, put the text ``[NEW PAGE]`` on a line by itself
before the text you wish to start on a new page.
.. _a_ui_md_align: .. _a_ui_md_align:
Paragraphs Alignment and Indentation Paragraphs Alignment and Indentation
------------------------------------ ------------------------------------
Aside from Title Page and Partition which by default have its text centred, all document layouts All documents have the text by default aligned to the left or justified, depending on your
have the text by default aligned to the left ot justified, depending on your Preferences. Preferences.
You can override the default text alignment on individual paragraphs by specifying alignment tags. You can override the default text alignment on individual paragraphs by specifying alignment tags.
These tags are double angle brackets. Either ``>>`` or ``<<``. You put them either before or after These tags are double angle brackets. Either ``>>`` or ``<<``. You put them either before or after
+5 -4
View File
@@ -194,9 +194,10 @@ Settings` dialog where the document label and various other settings can be chan
can also be opened again later from either the :guilabel:`Project` menu, selecting :guilabel:`Edit can also be opened again later from either the :guilabel:`Project` menu, selecting :guilabel:`Edit
Project Item`, or by pressing :kbd:`Ctrl`:kbd:`E` or :kbd:`F2` with the item selected. Project Item`, or by pressing :kbd:`Ctrl`:kbd:`E` or :kbd:`F2` with the item selected.
The layout of the document is also defined here. For Novel documents, the full list of layout The layout of the document is also defined here. The two options available are :guilabel:`Novel
options are available. For non-Novel documents, only :guilabel:`Note` is available. See Document` and :guilabel:`Project Note`. These behave slightly differently when the project is
:ref:`a_struct_layout` for more details. built. A project note is never treated as part of the novel, no matter where in the project it is
located. See :ref:`a_struct_layout` for more details.
You can also select whether the document is by default included when building the project. This You can also select whether the document is by default included when building the project. This
setting can be overridden in the :guilabel:`Build Novel Project` tool if you wish to include them setting can be overridden in the :guilabel:`Build Novel Project` tool if you wish to include them
@@ -214,7 +215,7 @@ of a document following a header. The word count, and change of words in the cur
displayed in the footer of any document open in the editor, and all stats are shown in the details displayed in the footer of any document open in the editor, and all stats are shown in the details
panel below the project tree for any document selected in the project or novel tree. panel below the project tree for any document selected in the project or novel tree.
The word counts are not updated in real time, but run in the background every five seconds for as The word counts are not updated in real time, but run in the background every few seconds for as
long as the document is being actively edited. long as the document is being actively edited.
A total project word count is displayed in the status bar. The total count depends on the sum of A total project word count is displayed in the status bar. The total count depends on the sum of
+47 -111
View File
@@ -31,9 +31,8 @@ The different header levels are interpreted as specific section types of the nov
way: way:
``# Header1`` ``# Header1``
Header level one signifies that the text refers to either the novel title or the name of a top Header level one signifies that the text refers to a top level partition. This is useful when
level partition. The latter is useful when you want to split the manuscript up into books, you want to split the manuscript up into books, parts, or acts.
parts, or acts.
``## Header2`` ``## Header2``
Header level two signifies a chapter level partition. Each time you want to start a new chapter, Header level two signifies a chapter level partition. Each time you want to start a new chapter,
@@ -60,26 +59,43 @@ way:
them in a draft manuscript. See the :ref:`a_export` page for more details. them in a draft manuscript. See the :ref:`a_export` page for more details.
.. _a_struct_heads_title:
Novel Title and Front Matter
----------------------------
It is recommended that you add a document at the very top of your project with the novel title as
the first line. You should modify the header format code with an ``!`` in order to render it as a
document title that is excluded from any automatic Table of Content in an exported document, like
so:
``#! My Novel``
The title is by default centred on the page. You can add more text to the page as you wish.
If you want an additional page inserted after the title page, starting on a fresh page, you can add
``[NEW PAGE]`` on a line by itself, and continue the text after it. This will insert a page break
when the project is exported.
.. _a_struct_heads_unnum: .. _a_struct_heads_unnum:
Unnumbered Chapter Headings Unnumbered Chapter Headings
--------------------------- ---------------------------
If you use layout types for your documents, the automatic numbering feature for your chapters is If you use the automatic numbering feature for your chapters, but you want to keep some special
controlled by whether you use the :guilabel:`Chapter` or :guilabel:`Unnumbered` layout type for chapters separate from this, you cam add a ``!`` to the header formatting code to tell the build
your document. However, if you have a different document layout where this isn't practical, you can tool to skip these chapters.
also switch off chapter numbering for a chapter by making the first character of the chapter title
an asterisk (``*``). Like so:
``## *Unnumbered Chapter Title`` ``##! Unnumbered Chapter Title``
The leading asterisk is only considered by the :guilabel:`Build Novel Project` tool, and will be There is a separate formatting feature for such chapters in the :guilabel:`Build Novel Project`
removed before the title is inserted at the location of the ``%title%`` label. See the tool as well. See the :ref:`a_export` page for more details.
:ref:`a_export` page for more details.
.. note:: .. Note::
If you need the first character of the title to be an actual asterisk, you must escape it: Previously, you could also disable the automatic numbering of a chapter by adding an ``*`` as
``\*``. the first character if the chapter title itself. This feature has been dropped in favour of the
current format. Please update your chapter headings if you've used this syntax.
.. _a_struct_tags: .. _a_struct_tags:
@@ -147,104 +163,24 @@ the index for a document is regenerated when it is saved, so this shouldn't norm
.. _a_struct_layout: .. _a_struct_layout:
Novel Document Layout Document Layout
===================== ===============
All documents in the project can have a layout format set. These layouts are important when the All documents in the project can have a layout format set. Previously, there were multiple layouts
project is exported as they indicate how to treat the content in terms of text formatting, available to change how the documents where formatted on export. These have now been reduced to
headings, and page breaks. The layout for each document is indicated as the last set of characters just two layouts: :guilabel:`Novel Document` and :guilabel:`Project Note`.
in the :guilabel:`Flags` column of the project tree.
Not all layout types are actually treated differently, they also help to indicate what each Novel documents can only live in the :guilabel:`Novel` root folder. You can also move them to
document is intended for in your project. The :guilabel:`Book` layout is a generic novel document :guilabel:`Outtakes` and :guilabel:`Trash` of course. Project notes can be added anywhere in the
layout that is formatted identically to :guilabel:`Chapter` and :guilabel:`Scene` layout documents, project.
but may help to indicate what each document does in your project.
You can for instance lay out your project using :guilabel:`Book` documents for each act, and then Depending on which icon theme you're using, the project tree can distinguish between the different
later split those into chapter or scene documents by using the :guilabel:`Split Document` tool. layouts and header levels of the documents to help indicate which are project notes and which are
Scenes can also be contained within :guilabel:`Chapter` type documents, but you lose the drag and novel documents containing a partition, chapter, or scene. If the icon theme you've selected
drop feature that comes with having them in separate documents if you organise them this way. doesn't show a difference, you can still see the layout description in the details panel below the
project tree.
Some layouts *do* have implications on how the project is exported. Documents with layout
:guilabel:`Title Page` and :guilabel:`Partition` have all headings and text centred, while the
:guilabel:`Unnumbered` layout disables the automatic chapter numbering feature for everything
contained within it. The latter is convenient for Prologue and Epilogue type chapters.
The above layout formats are only usable in the Novel root folder. Documents that are not a part of
the novel itself should have the :guilabel:`Note` layout. These documents are not getting any
special formatting, and it is possible to collectively filter them out during export. Notes can be
used anywhere in the project, also in the :guilabel:`Novel` root folder.
Below is an overview of all available layout formats.
:guilabel:`Title Page`
The title page layout. The title should be formatted as a heading level one. All text is centred
on export.
:guilabel:`Plain Page`
A plain page layout useful for instance for front matter pages. Heading levels are ignored for
this layout format, and so are formatting options like :guilabel:`Justify Text`. The page is
exported with a page break before it.
:guilabel:`Book`
This is the generic novel format that in principle can be used for all novel documents. Since
the internal structure of the novel is controlled by the heading levels, this layout will
produce the same result as a collection of :guilabel:`Partition`, :guilabel:`Chapter` and
:guilabel:`Scene` layout documents. However, it does not provide the functionality of the
:guilabel:`Unnumbered` layout format by default, but this can still be achieved by prefixing the
chapter title with an asterisk (``*``). See :ref:`a_struct_heads_unnum` for more details.
:guilabel:`Partition`
A partition can be used to split the novel into parts. Partition titles are indicated with a
level one heading. You can also add text and meta data to the page. The :guilabel:`Partition`
layout will in addition force a page break before the heading, and centre all content on the
page.
:guilabel:`Chapter`
Signifies the start of a new chapter. If the text itself is contained in scene documents, these
documents should only contain the title, comments, synopsis, and tag references for characters,
plot, etc. The heading for chapters should be level two. If you need an opening text, like a
quote or other leading text before the first scene, this is also where you'd want to add this
text.
:guilabel:`Unnumbered`
Same as :guilabel:`Chapter`, but when exporting the project, and automatic chapter numbering is
enabled, documents with this layout will not increment and apply a chapter number. It also has a
separate title formatting setting. This makes the layout suitable for Prologue and Epilogue type
chapters.
:guilabel:`Scene`
Used for scenes. This document should have a header of level three. Further sections can have
headers of level four, but there are no layout specifically for sections.
:guilabel:`Note`
A generic document that is optionally ignored when the novel project is exported. Use this
layout for descriptions of content in the supporting root folders. Notes can also be added to
the :guilabel:`Novel` root folder if you need to insert notes there. Note headers receive no
special formatting when building the project. They are always exported as-is.
.. note::
The layout granularity is entirely optional. In principle, you can write the entire novel in a
single document with layout :guilabel:`Book`. You can also have a single document per chapter if
that suits you better. The :guilabel:`Outline` will show your structure of chapters and scenes
regardless of how your documents are organised. So will the novel tree.
.. tip:: .. tip::
You can always start writing with a coarse layout with one or a few documents, and then later You can always start writing with a coarse setup with one or a few documents, and then later use
use the split tool to automatically split the documents into separate chapter and scene the split tool to automatically split the documents into separate chapter and scene documents.
documents. The split tool will try to select the correct layout for each of the new documents. You can split a document on any of the four header levels.
.. _a_struct_layout_auto:
Novel Layout Automation
-----------------------
When a document is saved from the document editor, novelWriter will check if the level of the first
header of the document matches the selected document layout. If the header level is inconsistent
with the layout, the layout will automatically be corrected if it can be unambiguously determined.
This means that for instance saving a document with header level three, when the layout is set to
:guilabel:`Chapter`, the layout will automatically be changed to :guilabel:`Scene`. If, however,
the layout was set to :guilabel:`Book`, no change will be made because the :guilabel:`Book` layout
is not associated with a specific header level.
+1 -3
View File
@@ -631,9 +631,7 @@ class Tokenizer():
# Chapter # Chapter
# Numbered or Unnumbered # Numbered or Unnumbered
if tToken[2].startswith("*"): if tToken[0] == self.T_UNNUM:
tTemp = self._formatHeading(self.fmtUnNum, tToken[2][1:].lstrip())
elif tToken[0] == self.T_UNNUM:
tTemp = self._formatHeading(self.fmtUnNum, tToken[2]) tTemp = self._formatHeading(self.fmtUnNum, tToken[2])
else: else:
self.numChapter += 1 self.numChapter += 1
+10 -8
View File
@@ -84,14 +84,16 @@ class nwDocAction(Enum):
BLOCK_H4 = 16 BLOCK_H4 = 16
BLOCK_COM = 17 BLOCK_COM = 17
BLOCK_TXT = 18 BLOCK_TXT = 18
REPL_SNG = 19 BLOCK_TTL = 19
REPL_DBL = 20 BLOCK_UNN = 20
RM_BREAKS = 21 REPL_SNG = 21
ALIGN_L = 22 REPL_DBL = 22
ALIGN_C = 23 RM_BREAKS = 23
ALIGN_R = 24 ALIGN_L = 24
INDENT_L = 25 ALIGN_C = 25
INDENT_R = 26 ALIGN_R = 26
INDENT_L = 27
INDENT_R = 28
# END Enum nwDocAction # END Enum nwDocAction
+16
View File
@@ -785,6 +785,10 @@ class GuiDocEditor(QTextEdit):
self._formatBlock(nwDocAction.BLOCK_COM) self._formatBlock(nwDocAction.BLOCK_COM)
elif theAction == nwDocAction.BLOCK_TXT: elif theAction == nwDocAction.BLOCK_TXT:
self._formatBlock(nwDocAction.BLOCK_TXT) self._formatBlock(nwDocAction.BLOCK_TXT)
elif theAction == nwDocAction.BLOCK_TTL:
self._formatBlock(nwDocAction.BLOCK_TTL)
elif theAction == nwDocAction.BLOCK_UNN:
self._formatBlock(nwDocAction.BLOCK_UNN)
elif theAction == nwDocAction.REPL_SNG: elif theAction == nwDocAction.REPL_SNG:
self._replaceQuotes("'", self._typSQOpen, self._typSQClose) self._replaceQuotes("'", self._typSQOpen, self._typSQClose)
elif theAction == nwDocAction.REPL_DBL: elif theAction == nwDocAction.REPL_DBL:
@@ -1593,6 +1597,12 @@ class GuiDocEditor(QTextEdit):
elif theText.startswith("#### "): elif theText.startswith("#### "):
newText = theText[5:] newText = theText[5:]
cOffset = 5 cOffset = 5
elif theText.startswith("#! "):
newText = theText[3:]
cOffset = 3
elif theText.startswith("##! "):
newText = theText[4:]
cOffset = 4
elif theText.startswith(">> "): elif theText.startswith(">> "):
newText = theText[3:] newText = theText[3:]
cOffset = 3 cOffset = 3
@@ -1635,6 +1645,12 @@ class GuiDocEditor(QTextEdit):
elif docAction == nwDocAction.BLOCK_H4: elif docAction == nwDocAction.BLOCK_H4:
theText = "#### "+newText theText = "#### "+newText
cOffset -= 5 cOffset -= 5
elif docAction == nwDocAction.BLOCK_TTL:
theText = "#! "+newText
cOffset -= 3
elif docAction == nwDocAction.BLOCK_UNN:
theText = "##! "+newText
cOffset -= 4
elif docAction == nwDocAction.ALIGN_L: elif docAction == nwDocAction.ALIGN_L:
theText = newText+" <<" theText = newText+" <<"
elif docAction == nwDocAction.ALIGN_C: elif docAction == nwDocAction.ALIGN_C:
+15
View File
@@ -849,6 +849,21 @@ class GuiMainMenu(QMenuBar):
# Format > Separator # Format > Separator
self.fmtMenu.addSeparator() self.fmtMenu.addSeparator()
# Format > Novel Title
self.aFmtTitle = QAction(self.tr("Novel Title"), self)
self.aFmtTitle.setStatusTip(self.tr("Change the block format to Novel Title"))
self.aFmtTitle.triggered.connect(lambda: self._docAction(nwDocAction.BLOCK_TTL))
self.fmtMenu.addAction(self.aFmtTitle)
# Format > Unnumbered Chapter
self.aFmtUnNum = QAction(self.tr("Unnumbered Chapter"), self)
self.aFmtUnNum.setStatusTip(self.tr("Change the block format to Unnumbered Chapter"))
self.aFmtUnNum.triggered.connect(lambda: self._docAction(nwDocAction.BLOCK_UNN))
self.fmtMenu.addAction(self.aFmtUnNum)
# Format > Separator
self.fmtMenu.addSeparator()
# Format > Align Left # Format > Align Left
self.aFmtAlignLeft = QAction(self.tr("Align Left"), self) self.aFmtAlignLeft = QAction(self.tr("Align Left"), self)
self.aFmtAlignLeft.setStatusTip(self.tr("Change the block alignment to left")) self.aFmtAlignLeft.setStatusTip(self.tr("Change the block alignment to left"))
+2 -2
View File
@@ -937,12 +937,12 @@ def testCoreToken_ProcessHeaders(mockGUI):
] ]
# H2: Unnumbered Chapter # H2: Unnumbered Chapter
theToken.theText = "## *Prologue\n" theToken.theText = "##! Prologue\n"
theToken.setUnNumberedFormat(r"U: %title%") theToken.setUnNumberedFormat(r"U: %title%")
theToken.tokenizeText() theToken.tokenizeText()
theToken.doHeaders() theToken.doHeaders()
assert theToken.theTokens == [ assert theToken.theTokens == [
(Tokenizer.T_HEAD2, 1, "U: Prologue", None, Tokenizer.A_PBB), (Tokenizer.T_UNNUM, 1, "U: Prologue", None, Tokenizer.A_PBB),
(Tokenizer.T_EMPTY, 1, "", None, Tokenizer.A_NONE), (Tokenizer.T_EMPTY, 1, "", None, Tokenizer.A_NONE),
] ]
+28
View File
@@ -888,6 +888,20 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, nwMinimal, ipsumTex
assert nwGUI.docEditor.getText() == "Title\n\n" assert nwGUI.docEditor.getText() == "Title\n\n"
assert nwGUI.docEditor.getCursorPosition() == 0 assert nwGUI.docEditor.getCursorPosition() == 0
# Strip Novel Title
assert nwGUI.docEditor.replaceText("#! Title\n\n") is True
assert nwGUI.docEditor.setCursorPosition(5) is True
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is True
assert nwGUI.docEditor.getText() == "Title\n\n"
assert nwGUI.docEditor.getCursorPosition() == 2
# Strip Unnumbered CHapter
assert nwGUI.docEditor.replaceText("##! Title\n\n") is True
assert nwGUI.docEditor.setCursorPosition(5) is True
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TXT) is True
assert nwGUI.docEditor.getText() == "Title\n\n"
assert nwGUI.docEditor.getCursorPosition() == 1
# Strip Text # Strip Text
assert nwGUI.docEditor.replaceText("Generic text\n\n") is True assert nwGUI.docEditor.replaceText("Generic text\n\n") is True
assert nwGUI.docEditor.setCursorPosition(5) is True assert nwGUI.docEditor.setCursorPosition(5) is True
@@ -1021,6 +1035,20 @@ def testGuiEditor_BlockFormatting(qtbot, monkeypatch, nwGUI, nwMinimal, ipsumTex
assert nwGUI.docEditor.getText() == "#### Some text\n\n" assert nwGUI.docEditor.getText() == "#### Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 10 assert nwGUI.docEditor.getCursorPosition() == 10
# Novel Title
assert nwGUI.docEditor.replaceText("Some text\n\n") is True
assert nwGUI.docEditor.setCursorPosition(5) is True
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_TTL) is True
assert nwGUI.docEditor.getText() == "#! Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 8
# Unnumbered Chapter
assert nwGUI.docEditor.replaceText("Some text\n\n") is True
assert nwGUI.docEditor.setCursorPosition(5) is True
assert nwGUI.docEditor._formatBlock(nwDocAction.BLOCK_UNN) is True
assert nwGUI.docEditor.getText() == "##! Some text\n\n"
assert nwGUI.docEditor.getCursorPosition() == 9
# Left Indent # Left Indent
assert nwGUI.docEditor.replaceText("Some text\n\n") is True assert nwGUI.docEditor.replaceText("Some text\n\n") is True
assert nwGUI.docEditor.setCursorPosition(5) is True assert nwGUI.docEditor.setCursorPosition(5) is True