Add line break shortcode support
This commit is contained in:
@@ -522,13 +522,18 @@ def testGuiMainMenu_Insert(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockRnd
|
||||
nwGUI.mainMenu.aInsShort.activate(QAction.ActionEvent.Trigger)
|
||||
assert nwGUI.docEditor.getText() == "Stuff\n%Short: \n"
|
||||
|
||||
# Insert Break or Space
|
||||
# =====================
|
||||
# Breaks and Vertical Space
|
||||
# =========================
|
||||
|
||||
nwGUI.docEditor.setPlainText("### Stuff\n")
|
||||
nwGUI.mainMenu.aInsNewPage.activate(QAction.ActionEvent.Trigger)
|
||||
assert nwGUI.docEditor.getText() == "[newpage]\n### Stuff\n"
|
||||
|
||||
nwGUI.docEditor.setPlainText("Line OneLine Two\n")
|
||||
nwGUI.docEditor.setCursorPosition(8)
|
||||
nwGUI.mainMenu.aInsLineBreak.activate(QAction.ActionEvent.Trigger)
|
||||
assert nwGUI.docEditor.getText() == "Line One[br]Line Two\n"
|
||||
|
||||
nwGUI.docEditor.setPlainText("### Stuff\n")
|
||||
nwGUI.mainMenu.aInsVSpaceS.activate(QAction.ActionEvent.Trigger)
|
||||
assert nwGUI.docEditor.getText() == "[vspace]\n### Stuff\n"
|
||||
|
||||
@@ -47,6 +47,7 @@ def testTextCounting_preProcessText():
|
||||
"[vspace:3]\n\n"
|
||||
"[New Page]\n\n"
|
||||
"[footnote:abcd]\n\n"
|
||||
"[br]\n\n"
|
||||
"Dashes\u2013and even longer\u2014dashes.\n\n"
|
||||
)
|
||||
|
||||
@@ -60,7 +61,7 @@ def testTextCounting_preProcessText():
|
||||
"#### Heading Four",
|
||||
"", "", "",
|
||||
"A paragraph.", "",
|
||||
"", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "",
|
||||
"Dashes and even longer dashes.", ""
|
||||
]
|
||||
|
||||
@@ -68,7 +69,7 @@ def testTextCounting_preProcessText():
|
||||
assert preProcessText(text, keepHeaders=False) == [
|
||||
"", "", "",
|
||||
"A paragraph.", "",
|
||||
"", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "",
|
||||
"Dashes and even longer dashes.", ""
|
||||
]
|
||||
|
||||
|
||||
@@ -198,6 +198,17 @@ def testTextPatterns_ShortcodesPlain():
|
||||
|
||||
assert allMatches(regEx, "one [x]two[/x] three") == []
|
||||
|
||||
# Line Break Substitution
|
||||
# =======================
|
||||
regEx = REGEX_PATTERNS.lineBreak
|
||||
|
||||
assert regEx.sub("\n", "one[br]two") == "one\ntwo"
|
||||
assert regEx.sub("\n", "one[br]\ntwo") == "one\ntwo"
|
||||
assert regEx.sub("\n", "one[br]\n\ntwo") == "one\n\ntwo"
|
||||
assert regEx.sub("\n", "one[BR]two") == "one\ntwo"
|
||||
assert regEx.sub("\n", "one[BR]\ntwo") == "one\ntwo"
|
||||
assert regEx.sub("\n", "one[BR]\n\ntwo") == "one\n\ntwo"
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testTextPatterns_ShortcodesValue():
|
||||
|
||||
Reference in New Issue
Block a user