Added new constants for document insert feature

This commit is contained in:
Veronica K. B. Olsen
2020-06-19 17:34:41 +02:00
parent 3bfe214682
commit 61856cec5b
3 changed files with 42 additions and 6 deletions
+6 -2
View File
@@ -1,10 +1,12 @@
# -*- coding: utf-8 -*-
from nw.constants.iso import isoLanguage, isoCountry
from nw.constants.constants import (
nwConst, nwRegEx, nwFiles, nwKeyWords, nwLabels, nwQuotes, nwUnicode
nwConst, nwRegEx, nwFiles, nwKeyWords, nwLabels, nwQuotes, nwUnicode,
nwInsertSymbols
)
from nw.constants.enum import (
nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType, nwOutline
nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType, nwOutline,
nwDocInsert
)
__all__ = [
@@ -17,10 +19,12 @@ __all__ = [
"nwLabels",
"nwQuotes",
"nwUnicode",
"nwInsertSymbols",
"nwAlert",
"nwDocAction",
"nwItemClass",
"nwItemLayout",
"nwItemType",
"nwOutline",
"nwDocInsert",
]
+23 -4
View File
@@ -25,7 +25,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from nw.constants.enum import nwItemClass, nwItemLayout, nwOutline
from nw.constants.enum import nwItemClass, nwItemLayout, nwOutline, nwDocInsert
class nwConst():
@@ -197,7 +197,7 @@ class nwQuotes():
# END Class nwQuotes
class nwUnicode:
"""Suppoted unicode character constants and translation maps for HTML.
"""Supported unicode character constants and translation maps for HTML.
"""
# Unicode Constants
@@ -229,10 +229,12 @@ class nwUnicode:
U_EMDASH = "\u2014" # Long dash
U_HELLIP = "\u2026" # Ellipsis
## Other
## Spaces
U_NBSP = "\u00a0" # Non-breaking space
U_THNSP = "\u2009" # Thin space
U_THNBSP = "\u202f" # Thin non-breaking space
## Symbols
U_CHECK = "\u2714" # Heavy check mark
U_MULT = "\u2715" # Multiplication x
@@ -275,10 +277,12 @@ class nwUnicode:
H_EMDASH = "&mdash;"
H_HELLIP = "&hellip;"
## Other
## Spaces
H_NBSP = "&nbsp;"
H_THNSP = "&thinsp;"
H_THNBSP = "&#8239;"
## Symbols
H_CHECK = "&#10004;"
H_MULT = "&#10005;"
@@ -293,3 +297,18 @@ class nwUnicode:
H_LTRIS = "&#9666;"
# END Class nwUnicode
class nwInsertSymbols():
SYMBOLS = {
nwDocInsert.NO_INSERT : "",
nwDocInsert.HARD_BREAK : " \n",
nwDocInsert.NB_SPACE : nwUnicode.U_NBSP,
nwDocInsert.THIN_SPACE : nwUnicode.U_THNSP,
nwDocInsert.THIN_NB_SPACE : nwUnicode.U_THNBSP,
nwDocInsert.SHORT_DASH : nwUnicode.U_ENDASH,
nwDocInsert.LONG_DASH : nwUnicode.U_EMDASH,
nwDocInsert.ELLIPSIS : nwUnicode.U_HELLIP,
}
# END Enum nwDocInsert
+13
View File
@@ -96,6 +96,19 @@ class nwDocAction(Enum):
# END Enum nwDocAction
class nwDocInsert(Enum):
NO_INSERT = 0
HARD_BREAK = 1
NB_SPACE = 2
THIN_SPACE = 3
THIN_NB_SPACE = 4
SHORT_DASH = 5
LONG_DASH = 6
ELLIPSIS = 7
# END Enum nwDocInsert
class nwAlert(Enum):
INFO = 0