bdewey / org-ruby

This gem contains Ruby routines for parsing org-mode files. The most significant thing this library does today is convert org-mode files to HTML or textile.
http://www.brians-brain.org/projects/orgmode_parser.html
174 stars 93 forks source link

Org and Pygments use different language identifiers #28

Closed hanjianwei closed 12 years ago

hanjianwei commented 12 years ago

Difference between Org and Pygments leads to some errors. For example:

#+begin_src emacs-lisp
    (global-visual-line-mode)
#+end_src

Pygments will complain:

ClassNotFound: no lexer for alias 'emacs' found

It's ok if I change emacs-lisp to scheme.

wallyqs commented 12 years ago

Thanks for reporting this. The programming language name should be normalized so that it matches the way we use it in org-mode, I will patch this soon.

wallyqs commented 12 years ago

I gave a quick look both of the lists, and it seems that for most cases Pygments and Org use similar language identifiers overall, but Pygments does not support directly emacs-lisp, common-lisp and other lisp dialects. In the meantime, I will make emacs-lisp and common-lisp identifiers default to use the scheme lexer from Pygments. Also one question, how did you get the ClassNotFound error? When I test using a non-supported lexer from Pygments, it defaults on using the 'text' lexer for the block. https://github.com/bdewey/org-ruby/blob/master/lib/org-ruby/html_output_buffer.rb#L117

hanjianwei commented 12 years ago

I can reproduce the error just by the following command:

org-ruby -d test.org

test.org is a simple file you can find in this gist.

See the error message here

Thanks for your help!

Edit: the error message may be misleading. Sometimes I can get correct result. I'll check the file again and report later.

wallyqs commented 12 years ago

Ok! I added a special case for lisp dialects so that they use the scheme parser from Pygments: https://github.com/bdewey/org-ruby/commit/180d995bd7ae3b8dab99bcf0bcafd9455bfc33fc

hanjianwei commented 12 years ago

Thanks a lot!