sam
(Sam Saffron)
20. Juli 2015 um 23:56
1
New Release - Firmware Version 1.02.06 for My Book World Edition I & II (1/4/2011)
Is rendered as:
The magic shanaigens should only happen if there is a space between it and other words… EG:
Sam and a 1/4 should get quarter magic
Sam was born 1/4/2001 should get no quarter magic.
1 „Gefällt mir“
I believe this is a default SmartyPants implementation, not our implementation. So the bug might be upstream for existing Ruby code…
The fix is clearly to convince the entire world to using proper (iso 8601) dates. Everything else is just stopgapping.
riking
(Kane York)
21. Juli 2015 um 02:39
4
Yes, but I daresay there will be more topics about April 1st…
3 „Gefällt mir“
sam
(Sam Saffron)
22. Juli 2015 um 06:42
5
Raised:
opened 06:39AM - 22 Jul 15 UTC
closed 01:27PM - 22 Jul 15 UTC
why all the hate for the 1 of April :smile:
```
[11] pry(main)> Redcarpet::Ren… der::SmartyPants.render("1/4 a year ago on 1/4/2010 something happened")
=> "¼ a year ago on ¼/2010 something happened"
```
should be
```
=> "¼ a year ago on 1/4/2010 something happened"
```
there should be a bypass if the char after the fraction is `/` which is punctuation but not in that context
the bug is here:
return 0;
}
// Converts 1/2, 1/4, 3/4
static size_t
smartypants_cb__number(struct buf *ob, struct smartypants_data *smrt, uint8_t previous_char, const uint8_t *text, size_t size)
{
if (fraction_boundary(previous_char) && size >= 3) {
if (text[0] == '1' && text[1] == '/' && text[2] == '2') {
if (size == 3 || fraction_boundary(text[3])) {
BUFPUTSL(ob, "½");
return 2;
}
}
if (text[0] == '1' && text[1] == '/' && text[2] == '4') {
if (size == 3 || fraction_boundary(text[3]) ||
(size >= 5 && tolower(text[3]) == 't' && tolower(text[4]) == 'h')) {
BUFPUTSL(ob, "¼");
return 2;
}
In particular word boundary is defined as: isspace(c) || ispunct(c); , ispunct includes /
1 „Gefällt mir“
Yeah, because David/Gene/Edward does seem like a word break to me. You could specialize it to numbers and say a slash between numbers is not a word break.
sam
(Sam Saffron)
22. Juli 2015 um 06:55
7
fixed via
master ← SamSaffron:master
merged 01:27PM - 22 Jul 15 UTC
special handling for 1/4/2000 in smartypants
waiting for it to be accepted
we are carrying a lot of GEM around for this 1 c file out of the 20 it ships
VIDEO
2 „Gefällt mir“
sam
(Sam Saffron)
16. September 2015 um 07:03
8
Change is accepted, waiting on a stable release
2 „Gefällt mir“
sam
(Sam Saffron)
24. September 2015 um 03:39
9
This is now fixed per:
committed 03:37AM - 24 Sep 15 UTC
PERF: cache fancy_title in topics table
New pure ruby implementation is far mor… e flexible and easier to amend.
We no longer ship the Redcarpet gem, we have a pure Ruby implementation of title prettify that is included in our code base.
Before:
After:
We no longer have to wait months for title prettify fixes.
8 „Gefällt mir“