Last night I tried unsuccessfully to install a version of pygments capable of Dart syntax highlighting. Ultimately, I want to use this to add syntax highlighting to the epub and mobi versions of Dart for Hipsters. The git-scribe toolchain that I use for ebooks can use pygments if configured correctly (as I found last night).
Dart is new enough that it is not in version 1.4 of pygments, but seems to be in 1.5. If only I can figure out how to install it. Ah... python.
I found that
easy_install Pygmentssimply installs version 1.4, which I already have via Ubuntu packages. The only mention of 1.5 on the download page is that I can find it in the "cheese shop". As far as I can tell, the "cheese shop" is a reference to the Monty Python sketch, but how that relates to a site named http://pypi.python.org, I cannot guess. No matter, I'm sure Ruby seems just as opaque to Pythonistas.
On the pypi pygments page (yeah, I just wrote that), it seems that I need to supply the
==devargument. I am unsure if
==devis a common pypi thing or not. Documentation would seem to suggest not—that supplying version numbers is more common (e.g.
easy_install PackageName==1.2.3). Something to try if
==devdoes not work...
While I am at it, one other thing that I cannot figure out on that pypi Pygments page is what a "tip" is:
The Pygments tip is installable withIs Ruby obscure like this? Anyhow...
I try installing the dev version:
➜ ~ sudo easy_install Pygments==dev Searching for Pygments==dev Reading http://pypi.python.org/simple/Pygments/ Reading http://pygments.org/ Reading http://pygments.pocoo.org/ Best match: Pygments dev Downloading http://trac.pocoo.org/repos/pygments/trunk#egg=Pygments-dev error: Can't download http://trac.pocoo.org/repos/pygments/trunk: 404 Not FoundRooting through that pocoo.org URL space, it seems that Trac has been abandoned for bitbucket. I am not sure how to go about troubleshooting that, so I try
➜ ~ sudo easy_install Pygments==1.5 Searching for Pygments==1.5 Reading http://pypi.python.org/simple/Pygments/ Reading http://pygments.org/ Reading http://pygments.pocoo.org/ Best match: Pygments 1.5 Downloading http://pypi.python.org/packages/2.7/P/Pygments/Pygments-1.5-py2.7.egg#md5=8ea02c2eafb2580336b7637be629f7ce Processing Pygments-1.5-py2.7.egg creating /usr/local/lib/python2.7/dist-packages/Pygments-1.5-py2.7.egg Extracting Pygments-1.5-py2.7.egg to /usr/local/lib/python2.7/dist-packages Adding Pygments 1.5 to easy-install.pth file Installing pygmentize script to /usr/local/bin Installed /usr/local/lib/python2.7/dist-packages/Pygments-1.5-py2.7.egg Processing dependencies for Pygments==1.5 Finished processing dependencies for Pygments==1.5That worked?! Er... I mean of course that worked. Yay!
And, indeed, I do have version 1.5 now and, more importantly, Dart pygments:
➜ ~ pygmentize -V Pygments version 1.5, (c) 2006-2011 by Georg Brandl. ➜ ~ pygmentize -L | grep -i dart * dart: Dart (filenames *.dart)Now when I run
git-scribe gen epub, I no longer get dozens of warnings about Dart not being supported. Rather I get a single warning about a missing
➜ dart-book git:(master) ✗ git-scribe gen epub GENERATING EPUB GENERATING HTML asciidoc: WARNING: book.asc: line 4: include file not found: /home/cstrom/repos/dart-book/output/stylesheets/pygments.css asciidoc: reading: /etc/asciidoc/asciidoc.conf ...Viewing the resultant epub in iBooks, I do not have syntax highlighting, so I suspect this missing CSS file. I grab the first gist I can find that might contain useful CSS and paste it into
/home/cstrom/repos/dart-book/output/stylesheets/pygments.css. The next time I run
git-scribe, I no longer get any pygments-related warning, but I still do not have syntax highlighting on the iPad.
That will serve as a stopping point for tonight. I have pygments working well enough (or at least not crashing). I will examine the rest of the toolchain in an effort to get syntax highlighting in epub working. Tomorrow.