Commit Graph

2239 Commits (16fde70158ba9c79cdba7e698f309d60d45b28c3)

Author SHA1 Message Date
Rob Emery 16fde70158 Merge pull request #588 from gdrooid/patch-1
Anagram: Fix XSS
2014-08-15 12:54:05 +01:00
Dani 1c52504734 Update Anagram.pm 2014-08-15 01:59:44 +02:00
Dani 85bdae6591 Anagram: Fix XSS
Sorry... I messed up this one too. Please, test it before merging -- I'm in the US (wooo!) and I have a very crappy laptop.
2014-08-15 00:36:11 +02:00
Rob Emery 3eb97e456e Merge pull request #585 from mwmiller/bangalator
Calculator: fix bangful query result. Ping @jagtalon
2014-08-13 13:21:50 +01:00
Matt Miller 4d28815513 Calculator: remove ! from trigger regex.
There appears to be no value in this beingincluded and it makes things
evaluate incorrectly, so we'll just remove it.
2014-08-12 15:00:05 -04:00
Matt Miller 2553c532f9 Calculator: guard against empty string as non-result.
Eval of '! + 1' returns an empty string, so we'll make it less likely
for that to happen (by not initializing tmp_result to an empty string)
and guard against it if it still does.

Of course, this shouldn't trigger on '! + 1', so that still needs to be
resolved.
2014-08-12 14:35:44 -04:00
Caine Tighe 8ee8e7957d Merge pull request #583 from duckduckgo/caine/md5-xss
DDG::Goodie::MD5: Prevent XSS by encoding HTML entities.
2014-08-12 10:41:51 -04:00
Caine Tighe bc920e33a0 DDG::Goodie::MD5: Prevent XSS by encoding HTML entities. 2014-08-12 10:35:27 -04: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
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