Skip to content
Snippets Groups Projects
Commit 82f36bf4 authored by Vanessa Stehr's avatar Vanessa Stehr
Browse files

Show warning in case the base unit is missing from a node

parent 1f88045d
No related branches found
No related tags found
Loading
...@@ -50,6 +50,9 @@ def _nodeToLatex(node: list): ...@@ -50,6 +50,9 @@ def _nodeToLatex(node: list):
latexString += r'{\color{red}\mathrm{'+node[1]+r'}}' latexString += r'{\color{red}\mathrm{'+node[1]+r'}}'
if node[2]: if node[2]:
latexString += r'^' + node[2] latexString += r'^' + node[2]
if node[1] == "":
latexString = r'{\color{red}'+latexString+r'}'
return latexString return latexString
def _parseDsi(dsiString: str): def _parseDsi(dsiString: str):
...@@ -139,6 +142,13 @@ def _parseFractionlessDsi(dsiString:str): ...@@ -139,6 +142,13 @@ def _parseFractionlessDsi(dsiString:str):
except IndexError: except IndexError:
item = '' item = ''
warnings.warn(f"The identifier \"{tuple[1]}\" does not match any D-SI units!", RuntimeWarning) warnings.warn(f"The identifier \"{tuple[1]}\" does not match any D-SI units!", RuntimeWarning)
elif tuple[1] == '':
itemStr = ""
if tuple[0] != "":
itemStr = itemStr + "\\" + tuple[0]
if tuple[2] != "":
itemStr = itemStr + r"\tothe{" + tuple[2] + r"}"
warnings.warn(f"This unit seems to be missing the base unit! \"{itemStr}\"", RuntimeWarning)
nodes.append(tuple) nodes.append(tuple)
if len(items) == 0: break if len(items) == 0: break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment