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
+2 -2
View File
@@ -937,12 +937,12 @@ def testCoreToken_ProcessHeaders(mockGUI):
]
# H2: Unnumbered Chapter
theToken.theText = "## *Prologue\n"
theToken.theText = "##! Prologue\n"
theToken.setUnNumberedFormat(r"U: %title%")
theToken.tokenizeText()
theToken.doHeaders()
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),
]
+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.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
assert nwGUI.docEditor.replaceText("Generic text\n\n") 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.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
assert nwGUI.docEditor.replaceText("Some text\n\n") is True
assert nwGUI.docEditor.setCursorPosition(5) is True