Commit Graph

8 Commits (7413a55eaeae3589da2856f80d57a6a575763eaa)

Author SHA1 Message Date
Matt Miller 5481cf4ebc Fix minor code layout issues.
Reducing scroll spam from dzil by:

- Providing ABSTRACTs for all packages.
- Leaving VERSION vertical space where necessary.

Addresses #600 plus other annoyances in the process.
2014-08-20 14:45:33 -04:00
Matt Miller d0deb10c9e NumberStyle: default exponential to 'e'.
It's quite possible that this will never change, so o ahead and set the
efault so we don't need to specify it everywhere.
2014-08-06 14:06:27 -04:00
Rob Emery bc950678e3 Numberstyler: Datadriving number_style_regex 2014-07-30 22:09:36 +01:00
Matt Miller 2e8b6e4316 NumberStyle: allow for negative numbers.
By extension, this also permits negative exponents.

Also breaks a calculator test with a crazy expression where we can't
differentiate between subtrction and negative numbers.  Leaving it
broken for now, since the tokenizing is known broken, anyway.
2014-07-28 10:17:17 +08:00
Matt Miller cabd9c8c8a NumberStyle: add with_html method.
This also required some additional changes to how number_regex is
computed.  That was sort of overdue, anyway.

HTML styling is simply display styling plus super-scripted exponents, at
thispoint.
2014-07-28 09:24:40 +08:00
Matt Miller 1676300aed NumberStyler: improve number-matching regex.
The major change is matching the exponentials more carefully.  They only
count if they have <number>E<integer> otherwise they won't work.

Also include a suggested change from @mintsoft to better handle the
spacing of numbers and units in Conversions, by separating them using
our defined regexes.

All-in-all, much more resilient!
2014-07-28 08:17:49 +08:00
Matt Miller f4a7c0c857 NumberStyle: add rudimentary support for exponentials.
Also, minor updates to Conversions to make it work there.

NB: This is clearly not properly factored, yet! This is the first step
to get feedback and improvements from @mintsoft.

- Make number style stuff aware of how to deal with case-insensitive
  expoentials.
- Produce consistent output of such strings.

The display format was chosen to be consistent with the output for
Calculator.  Also, the parsing is not quite correct as you can't have a
mantissa in the exponent, but this won't catch that.

Should we also do "for_display" on the factors for consistency?

Any and all feedback or improvements are appreciated.

This also breaks the Calculator tests, but I will worry about fixing
those once everything stabilizes.
2014-07-27 20:58:05 +08:00
Matt Miller cd1d480294 NumberStyler: add proof-of-concept
Considering how all of this works, I'm not sure roles are quite the
right fit. It seems like we might just want a shared "Utility" package
or namespace to let us have access to some common library functions.

DDG::GoodieRole::NumberStyle is a particularly horrible name because
it's not even a role!

Also, the comments suck.

But such is the nature of a proof-of-concept.
2014-06-28 04:27:57 +08:00