GithubHelp home page GithubHelp logo

Comments (8)

epogrebnyak avatar epogrebnyak commented on August 22, 2024 3

Great, thanks, looks fixed. As a side comment the newlines after formatting the newlines are just \n, not \r\n\ but I think one can live with that.

from style-doc.

PhilipMay avatar PhilipMay commented on August 22, 2024 1

Hey @epogrebnyak
many thanks for reporting this. I will investigate it.

from style-doc.

epogrebnyak avatar epogrebnyak commented on August 22, 2024

Maybe not tested on Windows and \r\n not appreciated?

from style-doc.

PhilipMay avatar PhilipMay commented on August 22, 2024

I can confirm it. It is a windows \r\n newline issue.
I added a test for linux encoding:

def test_linux_line_separators(tmpdir):
tmp_file_name = os.path.join(tmpdir, "file.rst")
with open(tmp_file_name, "w") as f:
f.write("Main\n====\n")
os.system(f"style-doc --max_len 99 {tmpdir}")
with open(tmp_file_name, "r") as f:
content = f.readlines()
assert content[0] == "Main\n"
assert content[1] == "=" * 99 + "\n"

If you see a way how to fix it - feel free for a PR.

from style-doc.

PhilipMay avatar PhilipMay commented on August 22, 2024

It should be possible to read the file and convert all newlines to \n while reading it:
https://docs.python.org/3/library/functions.html#open

from style-doc.

epogrebnyak avatar epogrebnyak commented on August 22, 2024

Similarly to the test code, when new line is not specified, open() transforms any newlines to \n (universal newline), so for the PR I'll just try skipping the new line parameter in open().

from style-doc.

PhilipMay avatar PhilipMay commented on August 22, 2024

@epogrebnyak this is fixed - see fbf9974

from style-doc.

PhilipMay avatar PhilipMay commented on August 22, 2024

@epogrebnyak I made a new release on pypi. Can you please update the package and try it on your side?

from style-doc.

Related Issues (20)

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.