Commit Graph

2500 Commits (53317244bcb2bcf487fba4754ff92b2b89827423)

Author SHA1 Message Date
Rob Emery 2330a9c9d6 DatesRole: Fixing tests and regexes for 01 June 2014 format 2014-08-09 22:16:20 +01:00
Rob Emery 6babd30249 DatesRole: New centralised role for matching and parsing dates 2014-08-09 19:36:46 +01:00
moollaza 874be8d5d6 Add Text::UpsideDown to dist.ini 2014-08-08 15:45:10 +00:00
moollaza 13bd64bc88 simplify FlipText Goodie using Text::UpsideDown, allows better handling of unicode/utf8 2014-08-08 15:39:42 +00:00
Jag Talon 8231b25d23 Merge pull request #569 from duckduckgo/mintsoft/conversion_calcs
Normalizing Number Handling.
2014-08-07 12:02:24 -04:00
Matt Miller a9548a2c31 00-roles.t: switch Test::Most to Test::More.
Test::More is guaranteed to be installed everywhere already.. and we
don't need anything extra from Test::Most, so just switch it back.
2014-08-07 11:29:50 -04:00
Matt Miller 9e14be1a87 NumberStyler: add testing.
This is a port of the previous tests for these functions, updated for
its new status as a role.  I can be convinced that this is not the best
way to do this, but it seems well-enough to me.
2014-08-06 21:14:33 -04:00
Matt Miller d23e695d36 NumberStyle: use match count for commify.
THis makes it easier for the casual reader to understand.  Thanks to
@jagtalon for the suggestion.
2014-08-06 16:53:19 -04:00
Rob Emery bc5983b497 Merge branch 'mintsoft/conversion_calcs' of github.com:duckduckgo/zeroclickinfo-goodies into mintsoft/conversion_calcs 2014-08-06 19:19:21 +01:00
Rob Emery 0adb50b6fe Conversions: fixing bug with "convert 1 cm to 2 mm" 2014-08-06 19:18:54 +01:00
Matt Miller f909cfcd28 NumberStyle: add comment for with_html.
A bit of description as to what it is doing.
2014-08-06 14:08:46 -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 93fc908a99 Merge branch 'master' into mintsoft/conversion_calcs 2014-08-01 23:37:02 +01:00
Rob Emery 4bbe139964 Merge branch 'mintsoft/conversion_calcs' of github.com:duckduckgo/zeroclickinfo-goodies into mintsoft/conversion_calcs
Conflicts:
	lib/DDG/GoodieRole/NumberStyle.pm
2014-08-01 23:35:39 +01:00
Rob Emery 13f6af99e8 Merge pull request #570 from duckduckgo/jag/encode
Lowercase/Uppercase: Encode the query before injecting to HTML.
2014-08-01 20:06:01 +01:00
jagtalon 86a1e4feed Lowercase/Uppercase: Encode the query before injecting to HTML.
Can cause XSS badness.
2014-08-01 18:36:47 +00:00
Jag Talon 7e1bf5ccdb Merge pull request #560 from duckduckgo/zaahir/lowercase-uppercase-styling
Zaahir/lowercase uppercase styling
2014-08-01 14:28:43 -04:00
Jag Talon 984b7524ee Merge pull request #565 from mwmiller/fat_binary
Binary: expand to converting 64-bit decimal integers.
2014-08-01 13:31:16 -04:00
Jag Talon 335420da8e Merge pull request #568 from duckduckgo/mintsoft/calc_style_fixes
Calculator: uses the correct classes
2014-08-01 13:23:23 -04:00
Jag Talon d715e897f7 Merge pull request #561 from wilkox/average_temperature_bug
Average IA requires at least two numbers to trigger
2014-08-01 12:29:59 -04:00
Jag Talon 7e3dfc5047 Merge pull request #390 from syst3mw0rm/master
Goodie : Weekdays between two dates
2014-08-01 12:23:50 -04:00
Matt Miller 688fcdf8e8 Merge branch 'master' into mintsoft/conversion_calcs
Conflicts:
	t/Conversions.t
2014-07-31 18:19:49 -04:00
Matt Miller 1ad7f82e06 NumberStyle: more hackiness for negative numbers.
Basically, we're only going to recognize negative numbers when they
appear at the beginning of an expression.  Otherwise we assume we don't
needs to deal with them.

I'm sure this causes other problems, but resovles the testing issues for
now.
2014-07-31 15:36:57 -04:00
Matt Miller 2cb8d921e3 NumberStyle: only allow negative numbers at start.
This allows for us to continue to style negative numbers, but to assume
that "embedded" `-` characters are atually operations.

It's quite an ugly hack.. and this whole quasi-state machine needs
revisited, but this gets everything working for now.
2014-07-31 15:27:56 -04:00
Rob Emery a44f641244 Conversions: Cleaning up a little 2014-07-30 22:46:41 +01:00
Rob Emery e9c8016621 Conversions: removing unnecessary + from guard regex 2014-07-30 22:13:52 +01:00
Rob Emery bc950678e3 Numberstyler: Datadriving number_style_regex 2014-07-30 22:09:36 +01:00
Rob Emery 94d89fbc86 Conversions: adding missing test for `$unit from $x $unit` style query 2014-07-30 22:00:20 +01:00
Rob Emery 17a15ebe1c Calculator: uses the correct classes 2014-07-30 19:43:54 +01:00
Jag Talon 1531acfaef Merge pull request #563 from duckduckgo/mintsoft/convert-fixes
Conversions: Fixing issue #552
2014-07-30 14:29:10 -04:00
Jag Talon ee55c1d254 Merge pull request #557 from duckduckgo/jag/unicode
UnicodeFuzzySearch: Add parenthesis around the function call.
2014-07-30 14:24:29 -04:00
Jag Talon ae10a6e689 Merge pull request #559 from PhantomGamers/master
Fix USPS URL
2014-07-30 14:21:42 -04:00
Zaahir Moolla f4641993c8 Update checklist with new links and code styleguide 2014-07-29 13:52:58 -04:00
Zaahir Moolla 74cdab6845 Bump font-size to 1.75em 2014-07-29 12:43:41 -04:00
Zaahir Moolla 65f08ee2bd Bump font-size to 1.75em 2014-07-29 12:43:30 -04:00
Matt Miller 24b149e97f Binary: expand to converting 64-bit decimal integers.
This uses Bit::Vector rather than presuming anything about the perl
support for 64-bit ints. This seems safer, even if it's a smidge slower.

This fixes issue #564 with test demonstrating such.
2014-07-29 09:02:30 +08: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 db7564d72a Conversions: do not encode entities on numbers.
This otherwise encodes the <sup> tags, rendering them impotent. This
might not be exactly the right solution, either.
2014-07-28 09:43:05 +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
jdorweiler 61b591652d removed featuretest 2014-07-27 11:51:26 -04:00
jdorweiler f4c7ce1f87 removed featuretest goodie 2014-07-27 11:49:59 -04:00
Matt Miller 65d6f76978 NumberStyle: tighten up check for exponentials.
Also, some adjustments to Calculator to allow its tests to pass.
Still clearly not properly factored, but at least everything "works"
for the moment.
2014-07-27 22:23:04 +08:00
Matt Miller 31f49268b8 Conversions: style the factors as well as the results
This may (or may not) give a nicer look and more clear understanding of
how the input was interpreted.

Looking for feedback from @mintsoft on whether or not this is actually
better.  (Take a look at the test changes in particular to see the
effects.)
2014-07-27 21:15:45 +08:00
David Wilkins ba1e191b73 Average trigger handles remainder 2014-07-27 21:00:46 +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
Rob Emery d7569e6d82 Conversions: Minor cleanup 2014-07-26 23:06:50 +01:00
Rob Emery eee3b51734 Merge remote-tracking branch mwmiller's 'style_role/style_role' into mintsoft/conversion_calcs
Conflicts:
	lib/DDG/Goodie/Calculator.pm
2014-07-26 22:52:49 +01:00
Rob Emery 6d7ef9b7f0 PublicDNS: style changes as suggested by @chrismorast 2014-07-26 22:37:30 +01:00
elebow d5f4039368 GimpCheatSheet: Add more spacing between sections. 2014-07-25 17:48:03 -04:00