Giter Site home page Giter Site logo

larlequin / pandocacademic Goto Github PK

View Code? Open in Web Editor NEW
64.0 64.0 14.0 71 KB

A Sublime Text 2/3 plugin to handle Pandoc document (syntax) add functionnalities (bibliography, etc.) and convert them to other formats.

TeX 4.48% Python 83.20% HTML 12.31%

pandocacademic's People

Contributors

andreas-bok-sociomantic avatar dantonnoriega avatar erihe251 avatar jraygauthier avatar larlequin avatar scotartt avatar vehka avatar yyjhao 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

Watchers

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

pandocacademic's Issues

Where do the files output

Sorry, can't seem to find anything in the docs that tell us where the default output for a conversion goes - nor how to set that for ourselves. Thanks.

no output

I get the following error (in Linux), no matter which conversion-format is chosen, with the result of no file/nothing opened:

File "./sublime_plugin.py", line 356, in run_
File "./PandocConvertor.py", line 203, in run
File "./PandocConvertor.py", line 167, in buildCommand
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)

What does that mean?

How to add references?

Hi @larlequin,

Many thanks for PandocAcademic! I used the command provided to convert my document to PDF.

However, it does not convert my references.

My frontmatter contains the following:

---  
title: title...
abstract: abstract....
date: December 15, 2014
bibliography: /home/orschiro/Mendeley/library.bib
csl: APA6.csl
---  

In the end of my document I added #References.

My references are successfully added when using the following command in my Linux shell:

pandoc -S -o output.pdf --filter pandoc-citeproc document.md

Is there any way to customise the provided Pandoc command to use the --filter pandoc-citeproc option?

Thanks for your advice!

Robert

path issues

I've been having a struggle working out how subprocess is getting the $PATH for the pandoc and pdflatex executables. I've now symlinked pandoc and pdflatex to /usr/bin, but it feels like I shouldn't have to... Would it also be possible to have a setting to include paths which will be dropped into environ.os['PATH'']? This was users can specify where their pandoc executable is... mine is installed via cabal so in ~/.cabal/bin, and pdflatex is in some crazy place that texlive puts it. They're on my bash PATH, but not seen by subprocess.

cannot convert to pdf/beamer

It successfully converts to .html or .docx, but shows no response when attempting to convert to pdf or beamer.

I checked the 'PandocConverter.py' file, but could not find any module dealing with 'convert to pdf' functionality.

Could you confirm that??

Unable to find pandoc executable when using on Mac OS (brew)

Hi,
I have pandoc installed via brew install pandoc on MacOS Sierra.
When I try to execute the PDF conversion, I will get this error:
image

It seems that it cannot find the pandoc and xdg-open executable, here is the stacktrace from the Sublime

error: Unable to execute Pandoc.                                    

Details: [Errno 2] No such file or directory: 'pandoc'
Unable to convert the file! Please check your options
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 812, in run_
    return self.run(edit, **args)
  File "PandocConvertor in /Users/maddis/Library/Application Support/Sublime Text 3/Installed Packages/Pandoc Academic.sublime-package", line 217, in run
  File "./python3.3/subprocess.py", line 523, in call
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1448, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open'

pandoc is available in the PATH when using the terminal. Also the equivalent to using xdg-open on MacOS is the open command, maybe there could be a switch statement based on the OS.

ValueError

Launched Sublime3 for a non-pandoc related project (PHP) and noticed the following error in the console.

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 444, in is_enabled_
    raise ValueError("is_enabled must return a bool", self)
ValueError: ('is_enabled must return a bool', <Pandoc Academic.Table_pandoc.PandocTableCommand object at 0x109972550>)

Title of TOC is always "Contents"

I'm created a PDF with markdown. I need a TOC so i used <!-- [[TOC]] -->.

The title of the TOC is always "Contents", which is pretty bad, if the documents content is another language.

How can i change the title of the table of contents, without editing code?

Table won't render

I've tried to render your sample table without success. When I highlight the data and try to select Tools --> Pandoc Academic --> Pandoc Table, the Pandoc Table option is greyed out. Thoughts?

Package is not working on Mac 10.13.6

The problem seems to be related to xdg-open that is not a native mac command. I attach here under the consol log

Unable to convert the file! Please check your options Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1066, in run_ return self.run(edit, **args) File "/Users/serg/Library/Application Support/Sublime Text 3/Installed Packages/Pandoc Academic.sublime-package/PandocConvertor.py", line 217, in run File "./python3.3/subprocess.py", line 523, in call File "./python3.3/subprocess.py", line 819, in __init__ File "./python3.3/subprocess.py", line 1448, in _execute_child FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open' Unable to convert the file! Please check your options Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1066, in run_ return self.run(edit, **args) File "/Users/serg/Library/Application Support/Sublime Text 3/Installed Packages/Pandoc Academic.sublime-package/PandocConvertor.py", line 217, in run File "./python3.3/subprocess.py", line 523, in call File "./python3.3/subprocess.py", line 819, in __init__ File "./python3.3/subprocess.py", line 1448, in _execute_child FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open'

Sublime text 3 compatibility

Have you considered what it would take to make the plugin ST3 compatible? This is one of the few remaining plugins that prevent me from upgrading Sublime text. I might have some time to help, but I don't know much at all about the ST innards...

html comment highlighting leaks

I use html comments heavily on my pandoc documents. The syntax highlighting for them breaks when there's two of them in the same row:

test

In the example above, the whole line gets highlighted as a comment.

Error converting to docx/html

I've installed PandocAcademic via Sublime Text Packages. When i create a new file and save it as ebook.pandoc and then click on Tools/Pandoc Convert/Convert to docx i have this error in the console:

Traceback (most recent call last):
  File ".\sublime_plugin.py", line 356, in run_
  File ".\PandocConvertor.py", line 145, in run
  File ".\PandocConvertor.py", line 129, in buildCommand
  File ".\PandocConvertor.py", line 101, in opt
  File ".\PandocConvertor.py", line 71, in template
  File ".\PandocConvertor.py", line 40, in getTemplatePath
Exception: reference.docx file not found!

I have the same issue with convert to html.

Thanks.

Some images are not shown in html

If I convert the markdown using pandoc from the command line all the images are there, but using the conversion of pandoc academic some get lost.

This is the url of a image I can view
file:///home/leonardo/Dropbox/LabBiologia/LOF/figs/LaBio05_molec.png

And this is the url of a image I can not
file:///home/leonardo/Dropbox/LabBiologia/LOF//home/leonardo/Dropbox/LabBiologia/LOF/figs/LaBio06_filo.png

template not found

Hi
I've installed the plug-in on Sublime 3, under linux (ubuntu 16.04).

When I try to convert to any format, I get the following error:Traceback (most recent call last):

  File "/opt/sublime_text/sublime_plugin.py", line 1066, in run_
    return self.run(edit, **args)
  File "/home/ilafin01/.config/sublime-text-3/Installed Packages/Pandoc Academic.sublime-package/PandocConvertor.py", line 199, in run
  File "/home/ilafin01/.config/sublime-text-3/Installed Packages/Pandoc Academic.sublime-package/PandocConvertor.py", line 171, in buildCommand
  File "/home/ilafin01/.config/sublime-text-3/Installed Packages/Pandoc Academic.sublime-package/PandocConvertor.py", line 148, in opt
  File "/home/ilafin01/.config/sublime-text-3/Installed Packages/Pandoc Academic.sublime-package/PandocConvertor.py", line 101, in template
  File "/home/ilafin01/.config/sublime-text-3/Installed Packages/Pandoc Academic.sublime-package/PandocConvertor.py", line 54, in getTemplatePath
Exception: template.html file not found!

Looking at the Plug-ins folder of sublime, it seems that it is not un-zipping the files, so the path should be

/home/ilafin01/.config/sublime-text-3/Installed Packages/Pandoc Academic.sublime-package/

I've looked at the PandocConvertor.py script, and it appends only "Pandoc Academic". Should probably with the ".sublime-package" addition.

Syntax: Fenced Code Blocks

The current syntax definition for fenced code blocks does not match the documentation for Pandoc markdown. Instead of a simple ~~~ pair, similar to the backtick-style code blocks, I think the following regex would be a significant improvement:

begin

^~~~+(\s?[{].*[}])?$

end

^~~~+$

The begin regex will match a minimum of three tildes and allow for an optional list of parameters in braces; and it will end with a line consisting only of tildes, again with a minimum of three.

It would also be a nice touch to look into the braces for a recognized language name class, and syntax highlight the fenced code block accordingly.

Thanks!

Path issues on Mac OS X

Strange things seem to happen with my Installation on Mac OS X 10.8.2

I I try to comple a testfile to HTML, i get following exception:

Template file found in the default template folder
error: Unable to execute Pandoc.                                    

Details: [Errno 2] No such file or directory
Unable to convert the file! Please check your options
Traceback (most recent call last):
  File "./sublime_plugin.py", line 356, in run_
  File "./PandocConvertor.py", line 217, in run
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/webbrowser.py", line 69, in open_new_tab
    return open(url, 2)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/webbrowser.py", line 61, in open
    if browser.open(url, new, autoraise):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/webbrowser.py", line 549, in open
    ic.launchurl(url)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/ic.py", line 238, in launchurl
    return _dft_ic.launchurl(url, hint)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/ic.py", line 205, in launchurl
    self.ic.ICLaunchURL(hint, url, 0, len(url))
MacOS.Error: (-673, 'no URL found')
Template file found in the default template folder
error: Unable to execute Pandoc. 

Afterwords I tried to comple it to DOCX, which results in:

Details: [Errno 2] No such file or directory
Unable to convert the file! Please check your options
Traceback (most recent call last):
  File "./sublime_plugin.py", line 356, in run_
  File "./PandocConvertor.py", line 223, in run
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 470, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

This happens on a fresh install of Pandoc Academic via the Package Control Plugin.
Might this be related with spaces in pathnames or something similar?
My File is located under /Users/xxx/Documents/test.markdown and has following content:

Headline
========

+------------+-------+-------+-------+
| Conditions | Col1  | Col2  | Col3  |
+============+=======+=======+=======+
| Line 1     | data1 | data2 | data3 |
+------------+-------+-------+-------+
| Line 2     | data4 | data5 | data6 |
+------------+-------+-------+-------+

Syntax Highlight is not working in the following case

Hi larlequin,
I am making note using PandocAcademic. Unfortunately, the syntax works not so good for the following case.

The relational operators are> >= < <= They all have the same precedence. Just below them in precedence are the equality operators: == !=. Relational operators have lower precedence than arithmetic operators, so an expression like i < lim-1 is taken as i < (lim-1) , as would be expected.

I just want to let you know about this. Not a big deal, so no worry.

Rax

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.