From 5bc997a926697e4ba120605a0f865284b5fbb27f Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Wed, 07 Nov 2018 08:55:47 +0000
Subject: [PATCH] Renamed dec to prefix and added provisional dec formatter
---
aoi_gen/Variable.py | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/aoi_gen/Variable.py b/aoi_gen/Variable.py
index 52968be..8b5c7f7 100644
--- a/aoi_gen/Variable.py
+++ b/aoi_gen/Variable.py
@@ -35,7 +35,7 @@
if formatting is None:
formatting = self.formatting
formatter = FormatterFactory.get_formatter(formatting)
- if formatting == "str":
+ if formatting == "str" or formatting == "string":
return formatter.toFormat(self.value)
elif glyph is None and unit is None:
return ("${}$").format(formatter.toFormat(self.value))
@@ -72,14 +72,16 @@
type = spl[0]
arglist = spl[1:]
- if type == "sci":
+ if type == "sci" or type == "scientific":
return SciFloatFormatter(arglist)
- elif type == "str":
+ elif type == "str" or type == "string":
return StringFormatter()
- elif type == "eng":
+ elif type == "eng" or type == "engineering":
return EngFloatFormatter(arglist)
- elif type == "dec":
- return DecFloatFormatter(arglist)
+ elif type == "prefix":
+ return PrefixFloatFormatter(arglist)
+ elif type == "dec" or type == "decimal":
+ return EngFloatFormatter(arglist) #fallback to engineering
else:
return None
@@ -178,7 +180,7 @@
return float(man)
-class DecFloatFormatter(EngFloatFormatter):
+class PrefixFloatFormatter(EngFloatFormatter):
def __init__(self, formatparameters):
if len(formatparameters) != 1:
raise Exceptions.WrongParameters("Dec format accept only one argument")
--
Gitblit v1.8.0