adityarathod / pyandoc

Python wrapper for Pandoc—the universal document converter.
https://pypi.python.org/pypi/pyandoc/
MIT License
213 stars 32 forks source link

Added bibliography support to pyandoc #6

Closed yoavram closed 11 years ago

yoavram commented 12 years ago

I wanted to use Pandoc for parsing Markdown files with citations. Pandoc supports that by giving a --bibliography=FILE command-line argument with a bibliography file (like .bib). See the Pandoc documentation for more details on that.

But pyandoc did not support that. So I changed it.

wcaleb commented 11 years ago

It would be great to have this added. Could the to_pdf method also be used or modified to handle output to EPUB?

yoavram commented 11 years ago

Output to EPUB is simpler than PDF because it does not require going through LaTeX. With Pandoc you simply give the output file extension "epub", so in Pyandoc it should work seamless. But as far as I can tell, it does not. For example of creating EPUB from MD in Pandoc see #22 in http://johnmacfarlane.net/pandoc/demos.html. From my experience this works nicely with citations (--bib) and with math as well. I will want one day to check why Pyandoc doesn't output EPUB but I can't tell you when that day will come - I still haven't integrated PDF output to my blog...

wcaleb commented 11 years ago

EPUB doesn't go through LaTeX, but the EPUB writer doesn't write to stdout---I think that's the issue and the way in which it is like PDF output.

On Tue, Nov 13, 2012 at 06:36:01AM -0800, Lincoln Mullen wrote:

Output to EPUB is simpler than PDF because it does not require going through LaTeX. With Pandoc you simply give the output file extension "epub", so in Pyandoc it should work seamless. But as far as I can tell, it does not. For example of creating EPUB from MD in Pandoc see #22 in http://johnmacfarlane.net/pandoc/demos.html. From my experience this works nicely with citations (--bib) and with math as well. I will want one day to check why Pyandoc doesn't output EPUB but I can't tell you when that day will come - I still haven't integrated PDF output to my blog...


Reply to this email directly or view it on GitHub: https://github.com/kennethreitz/pyandoc/pull/6#issuecomment-10328112

yoavram commented 11 years ago

Oh I see. You are right. So we can use to_pdf but give the output_filename something like "file.epub" and it works, it outputs an EPUB file (I just checked this). So "to_pdf" should be renamed "to_file" and that's it.

On Tue, Nov 13, 2012 at 4:51 PM, W. Caleb McDaniel <notifications@github.com

wrote:

EPUB doesn't go through LaTeX, but the EPUB doesn't write to stdout---I think that's the issue and the way in which it is like PDF output.

On Tue, Nov 13, 2012 at 06:36:01AM -0800, Lincoln Mullen wrote:

Output to EPUB is simpler than PDF because it does not require going through LaTeX. With Pandoc you simply give the output file extension "epub", so in Pyandoc it should work seamless. But as far as I can tell, it does not. For example of creating EPUB from MD in Pandoc see #22 in http://johnmacfarlane.net/pandoc/demos.html. From my experience this works nicely with citations (--bib) and with math as well. I will want one day to check why Pyandoc doesn't output EPUB but I can't tell you when that day will come - I still haven't integrated PDF output to my blog...


Reply to this email directly or view it on GitHub: https://github.com/kennethreitz/pyandoc/pull/6#issuecomment-10328112

— Reply to this email directly or view it on GitHubhttps://github.com/kennethreitz/pyandoc/pull/6#issuecomment-10328686.

yoavram commented 11 years ago

I changed to_pdf -> to_file so now there is support for EPUB like @wcaleb suggested.

kennethreitz commented 11 years ago

Why did you delete a bunch of files from my repository?

yoavram commented 11 years ago

I didn't. What do you mean?

wcaleb commented 11 years ago

@yoavram I think @kennethreitz is referring to df7865c, which "removed files related to original version."

If @yoavram limited the pull request to the core.py changes, would that make it possible to merge and get these new features into the pip package? Adding EPUB and PDF functionality is really useful.

yoavram commented 11 years ago

Oh I see. I'm very sorry it's my first pull request ever. How do I limit the request to core.py? On Nov 21, 2012 4:49 AM, "W. Caleb McDaniel" notifications@github.com wrote:

@yoavram https://github.com/yoavram I think @kennethreitzhttps://github.com/kennethreitzis referring to df7865chttps://github.com/yoavram/pyandoc/commit/df7865c6fbe6c80b92b7884b23a49280f085d432, which "removed files related to original version."

If @yoavram https://github.com/yoavram limited the pull request to the core.py changes, would that make it possible to merge and get these new features into the pip package? Adding EPUB and PDF functionality is really useful.

— Reply to this email directly or view it on GitHubhttps://github.com/kennethreitz/pyandoc/pull/6#issuecomment-10583655.

wcaleb commented 11 years ago

I haven't done this myself but it looks like you need to create a new branch that contains only the relevant commits using "cherry-pick."

http://stackoverflow.com/questions/5256021/send-a-pull-request-on-github-for-only-latest-commit http://blogs.law.harvard.edu/acts/2012/07/10/github-pull-request-for-just-one-commit/

yoavram commented 11 years ago

I'll have a look at it, thanks

acrymble commented 11 years ago

I'd like to see this moved into the main project as well, since Caleb is already using it in interesting ways and some stability is always great when using other people's tools.

yoavram commented 11 years ago

Yeah me too, I just didn't get the time to understand how to "cherry-pick" only the desired changes... If that is the correct term, I'm fluent with the pull-[edit-commmit]*-push workflow, but have never used pull requests and cherry pick etc. I will get to it soon I hope.

On Tue, Dec 4, 2012 at 10:05 AM, Adam Crymble notifications@github.comwrote:

I'd like to see this moved into the main project as well, since Caleb is already using it in interesting ways and some stability is always great when using other people's tools.

— Reply to this email directly or view it on GitHubhttps://github.com/kennethreitz/pyandoc/pull/6#issuecomment-10987656.

wcaleb commented 11 years ago

Another possibility other than cherry pick could be to create a branch off the original fork and then only make the changes you want to commit to that branch.

I also found this post that might help:

http://gun.io/blog/how-to-github-fork-branch-and-pull-request/

On Dec 4, 2012, at 2:14 AM, Yoav Ram notifications@github.com wrote:

Yeah me too, I just didn't get the time to understand how to "cherry-pick" only the desired changes... If that is the correct term, I'm fluent with the pull-[edit-commmit]*-push workflow, but have never used pull requests and cherry pick etc. I will get to it soon I hope.

On Tue, Dec 4, 2012 at 10:05 AM, Adam Crymble notifications@github.comwrote:

I'd like to see this moved into the main project as well, since Caleb is already using it in interesting ways and some stability is always great when using other people's tools.

— Reply to this email directly or view it on GitHubhttps://github.com/kennethreitz/pyandoc/pull/6#issuecomment-10987656.

— Reply to this email directly or view it on GitHub.

yoavram commented 11 years ago

I opened a new pull-request, so this one is obsolete.

@kennethreitz, sorry for the mess!

@wcaleb thanks for your support!