tybenz / vimdeck

VIM as a presentation tool
MIT License
1.41k stars 57 forks source link

Possible fix for #29 (DOS newlines)- needs to be tested on Windows #30

Closed tybenz closed 9 years ago

tybenz commented 9 years ago

@pixelastic: Can you grab the branch dos-newlines and test this feature on Windows?

pixelastic commented 9 years ago

Thanks for the patch. I have no idea how to build and test the branch, though. I initially simply ran gem install vimdeck, but don't really know how to start to build and test your branch.

I had a quick look at your changes, and I don't think testing the OS running vimdeck is relevant here. Markdown files can have DOS or UNIX line-endings depending on the OS that wrote the file, not the OS that run vimdeck. I currently work on a Ubuntu laptop, but edit markdown files that where first generated on Windows.

Sure, I could simply change the DOS line-ending on my files to UNIX one, but this will just annoy my coworkers working on Windows.

I guess the safer solution would be to internally convert any DOS line-ending to UNIX one before running the conversion.

If you could point me to the right direction into building and locally testing vimdeck, I guess I could submit a PR that fixes my issue.

tybenz commented 9 years ago

This makes sense. I've removed the OS check from this PR. All of the regexes have been modified to check for both \r\n and \n, so it should cover it. I added an option to write to the slides with dos newlines (using -d). I can try to test on my windows machine, but I've got to blow the dust off and try to install vim/ruby on it.

If you want to test this branch, you just need to do the following:

  1. Clone the repo
  2. bundle install
  3. git checkout -b dos-newlines origin/dos-newlines
  4. VIMDECK_DEBUG=true bin/vimdeck <path/to/file/with/dos/newlines.md>
pixelastic commented 9 years ago

There is some improvement, but we're not quite there. Before, I only had one slide001.md file, now I have too many :).

slides.md

# Slide 1

- has some
- really important
- information

# Slide 2

Is less important
$ VIMDECK_DEBUG=true ./bin/vimdeck generate slides.md
$ ls ./presentation
script.vim  
slide001.md  
slide002.md  
slide003.md  
slide004.md

slide001 and slide003 contains only a title, while slide002 and slide004 contains the content.

Here is the markdown file I'm testing on (md5sum : 1525f2afb29c1d20dbe94b631afed12f)

tybenz commented 9 years ago

@pixelastic: Should be fixed now. You can pull the latest commits to this branch with git pull origin dos-newlines (provided you have dos-newlines checked out).

Let me know if it looks good and we can get this merged in.

pixelastic commented 9 years ago

Thanks a lot, this is working perfectly !

tybenz commented 9 years ago

Great! Glad it's finally fixed. I'll merge and push a new version to rubygems