Don't think that I haven't noticed that Dart for Hipsters lacks syntax highlighting for my Dart code. Like last night's bug, this was one of those things for which I just could not spare 30 minutes of investigation. Well now I can.
This is different than my issues with PDF highlighting, which I will try another day. Rather this is for the syntax highlighting in the EPUB and mobi versions.
By default, git-scribe (my ebook toolchain of choice) uses source-hightlight to do this. The problem is that source-highlight has no idea about Dart. Pygments, on the other hand were made Dart aware a while back. Perhaps that has even made it into mainstream pygments.
When I run
git-scribe gen epub
I am getting many unknown Dart errors from source-highlight:.... asciidoc: WARNING: testing.asc: line 133: filter non-zero exit code: source-highlight -f xhtml -s dart: returned 1 asciidoc: WARNING: testing.asc: line 133: no output from filter: source-highlight -f xhtml -s dart source-highlight: missing feature: language inference requires input file source-highlight: could not find a language definition for dart asciidoc: WARNING: testing.asc: line 159: filter non-zero exit code: source-highlight -f xhtml -s dart: returned 1 asciidoc: WARNING: testing.asc: line 159: no output from filter: source-highlight -f xhtml -s dart source-highlight: missing feature: language inference requires input file source-highlight: could not find a language definition for dart ....To switch to pygments, I ought to be able to edit
~/.asciidoc/asciidoc.conf
to contain:pygments=But this has no effect. So, instead, I add that line (or rather uncomment it) in the
/etc/asciidoc/asciidoc.conf
system configuration file.Only that still seems Dart-unaware. To install a more recent version of pygments, I first install
python-setuptools
:sudo apt-get install python-setuptools python-dev build-essentialThis should give me
easy_install
for the latest and greatest pygments:➜ ~ sudo easy_install Pygments Searching for Pygments Best match: Pygments 1.4 Adding Pygments 1.4 to easy-install.pth file Installing pygmentize script to /usr/local/bin Using /usr/lib/python2.7/dist-packages Processing dependencies for Pygments Finished processing dependencies for PygmentsOnly that still does not have Dart:
➜ ~ /usr/local/bin/pygmentize -L | grep -i perl * antlr-perl: ANTLR With Perl Target (filenames *.G, *.g) * perl, pl: Perl (filenames *.pl, *.pm) * perldoc: Style similar to the style used in the perldoc code blocks. ➜ ~ /usr/local/bin/pygmentize -L | grep -i dartBah! It looks as though I will need to install pygments from source code management. That is a task better suited for tomorrow.
Day #343
Weird, Pygments 1.5, which has Dart support included, were released few weeks ago (and it's already available as a package in Debian testing/unstable, which is the way I get to it).
ReplyDeleteDang it! The easy_install version that I grabbed was definitely 1.4. I'll try to figure that out tonight -- either via easy_install, manually installing the debian package on my ubuntu system, or from source.
DeleteThanks for the pointer. It's good to know there is a working 1.5 that I should be looking for :)