From 61856cec5b60f2813c3e32015ef3ebeebc8e80a5 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:34:41 +0200 Subject: [PATCH] Added new constants for document insert feature --- nw/constants/__init__.py | 8 ++++++-- nw/constants/constants.py | 27 +++++++++++++++++++++++---- nw/constants/enum.py | 13 +++++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/nw/constants/__init__.py b/nw/constants/__init__.py index 57761e42..0e90354a 100644 --- a/nw/constants/__init__.py +++ b/nw/constants/__init__.py @@ -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", ] diff --git a/nw/constants/constants.py b/nw/constants/constants.py index 90e49dfe..1ff5da4f 100644 --- a/nw/constants/constants.py +++ b/nw/constants/constants.py @@ -25,7 +25,7 @@ along with this program. If not, see . """ -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 = "—" H_HELLIP = "…" - ## Other + ## Spaces H_NBSP = " " H_THNSP = " " H_THNBSP = " " + + ## Symbols H_CHECK = "✔" H_MULT = "✕" @@ -293,3 +297,18 @@ class nwUnicode: H_LTRIS = "◂" # 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 diff --git a/nw/constants/enum.py b/nw/constants/enum.py index 1f90a928..84f8d4f5 100644 --- a/nw/constants/enum.py +++ b/nw/constants/enum.py @@ -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