Giter Club home page Giter Club logo

typus's People

Contributors

byashimov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

typus's Issues

Hyphens, dashes and spaces: some improvements and a bug

Here are some things that could probably be improved.

  1. According to [1, appx. 15; 2], in Russian em dash requires narrow spaces around it, not normal ones. That would probably work for English as well. Although traditional rules of English [3] require no spaces around em dashes, [4] states that it is a matter of style and that “AP Stylebook”, for example, recommends putting full-width spaces around em dashes.

    So I suggest using narrow non-breaking spaces before em dashes and thin spaces after in both English and Russian.

  2. Number ranges should be typeset with en dashes instead of em dashes.

    Em dashed number ranges are usually seen in Russian [1, sec. 6.1.5] since Russian typography has no tradition of using en dashes whatsoever, but there’s hardly any point in following that. En dashes look better with numbers [5].

  3. Phone numbers should be typeset with hyphens and/or spaces, not en dashes [1, sec. 6.1.6; 6]. That’s really just formatting needed for readability, dashes make no sense here.

  4. Now this one is just a bug, I guess.

    I noticed that expr_ranges does not replace hyphens with dashes if the range is followed by a math operator, which makes sense. The regular expression, however, forbids only math operators preceded by a non-zero number of spaces.

    Therefore, 1-2 = 4 becomes 1−2 = 4, but 1-2=4 becomes 1—2=4.

    And all the test cases have spaces before math operators, which, it seems, is why it was left unnoticed.

I could probably fix all that and send a PR. What do you think?

References

  1. Мильчин, Чельцова. Справочник издателя и автора. 3-е издание.

  2. https://ru.wikipedia.org/wiki/Неразрывный_пробел#Правила_применения_в_наборе

  3. https://en.oxforddictionaries.com/grammar/dash-and-em-dash

  4. https://apvschicago.com/2011/05/em-dashes-and-ellipses-closed-or-spaced.html

  5. https://www.artlebedev.ru/kovodstvo/sections/158/

  6. https://www.artlebedev.ru/kovodstvo/sections/91/

ModuleNotFoundError upon `en_typus` import

I noticed an error when trying to import en_typus:

>>> from typus import en_typus
...
ModuleNotFoundError: No module named 'typus.processors'

That probably happens because passing packages=['typus'] to setuptools.setup does not make setuptools recursively search for child packages inside the typus package and therefore include anything besides the typus itself. That results in typus.processors not being included in the installation:

→ ls venv/lib/python3.7/site-packages/typus
__init__.py __pycache__ chars.py    core.py     utils.py

The solution would be to either include the processors package explicitly by setting packages=['typus', 'typus.processors'] or to use the setuptools.find_packages function and include everything but tests: packages=find_packages(exclude=('tests',)).

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.