Giter Club home page Giter Club logo

Comments (9)

byashimov avatar byashimov commented on June 17, 2024

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.

danaksim avatar danaksim commented on June 17, 2024

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:

__ _ _ _ _ _ djvu-_djview
That means that

(', - 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.

byashimov avatar byashimov commented on June 17, 2024

Okey, let's go step by step starting from the easiest.

  1. 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?
  2. Ranges. OK and done (not pushed yet)
  3. Mdash pair -- in progress.

from typus.

danaksim avatar danaksim commented on June 17, 2024

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.

byashimov avatar byashimov commented on June 17, 2024

Check this branch out :)

from typus.

danaksim avatar danaksim commented on June 17, 2024

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.

byashimov avatar byashimov commented on June 17, 2024

Bad copy issue. Thanks for your help. Have updated PR, please take a look once more.

from typus.

danaksim avatar danaksim commented on June 17, 2024

Yup, now it's fixed. Thanks. Guess that finishes this issue off, so feel free to close it anytime.

from typus.

byashimov avatar byashimov commented on June 17, 2024

Thanks for your help. I'll try release this features asap!

from typus.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.