Comments (9)
Hi! I'll look at this closer on the weekends and fix this on my own. It's great to see people take care about this little things. I'll be glad if you could provide test case right here on the issue page: (source, expected) pairs.
Thanks for your report.
from typus.
Okay. I'll use symbol names as they are defined in typus.chars
plus βTHINSPβ for thin space.
test_mdash
So, most of the test_mdash
cases should remain the same assuming that MDASH_PAIR
becomes NNBSP + MDASH + THINSP
.
Except for one thing. As I have just surprisingly learned, em dash requires no preceding space if there is a comma:
(', - foo', f',{MDASH_PAIR}foo')
(', -- foo', f',{MDASH_PAIR}foo')
should be changed to
(', - foo', f',{MDASH_PAIR[1:]}foo')
(', -- foo', f',{MDASH_PAIR[1:]}foo')
test_ranges
Here MDASH
should be replaced with NDASH
in all test cases.
Also account for math operators without preceding spaces:
# Skips
# ... all the current skips
('2-3=4', '2-3=4'),
('2-3*4', '2-3*4'),
test_phones
With this one I'm not really sure what to suggest. Maybe the phone replaces should be disabled/removed altogether. It would be possible to apply some formatting to international 11-digit numbers, but with 7-digit ones, which are currently detected, there's nothing to do.
from typus.
Okey, let's go step by step starting from the easiest.
- Phones. There is no visual difference between hyphen and hyphen-minus. Even Artemy uses hyphen-minus on his phones page. So it seems like I can drop it out with no regret and 7-11 digits headache. What do you think about it?
- Ranges. OK and done (not pushed yet)
- Mdash pair -- in progress.
from typus.
Yes, keeping hyphen-minuses in phone numbers is exactly what I had in mind. I don't think they should be replaced with real hyphens (‐
).
from typus.
Check this branch out :)
from typus.
Looked it through. It seems that the no-space-before-math bug I was talking about is still there. Otherwise everything's great.
So, about the bug. I don't really understand what you did in e9b70a5.
In test_expressions
you basically added
# Doesn't affect math
(f'1{MDASH}2=4', f'1{MDASH}2=4')
and assured that it is skipped by expr_ranges
. But it is skipped because there is an em dash, not because there's a math operator after. Maybe em dashes are there by accident and you meant to use hyphens?
And in test_summary
you made sure that '3-3=0'
becomes '3−3=0'
, but the reason this thing gets skipped by expr_ranges
is not the math operator but the second number not being greater than the first.
As I see it, in the expr_ranges
method the third regex line of expr
should be changed from r'(?!{0}+{1}|{2})'
to r'(?!{0}*{1}|{2})'
, and that's it. Then you can test that expr_range
skips stuff like '1-2=4'
, which it will.
from typus.
Bad copy issue. Thanks for your help. Have updated PR, please take a look once more.
from typus.
Yup, now it's fixed. Thanks. Guess that finishes this issue off, so feel free to close it anytime.
from typus.
Thanks for your help. I'll try release this features asap!
from typus.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typus.