Hi there,

I'd love to be able to use syntax highlighting for Puppet code in some upcoming articles on http://koumbit.org, but the GeSHi filter doesn't support the Puppet language by default. Thankfully, extending GeSHi to include new languages appears pretty straight-forward, and someone has already created a plug-in for Puppet: https://github.com/jasonhancock/geshi-language-files/blob/master/puppet.php

It should just be a matter of dropping the relevant files into a folder in the GeSHi library, but I'll experiment a bit, and come back with a patch.

Comments

ergonlogic’s picture

The puppet.php file needs to be in the /sites/all/libraries/geshi/ directory. FYI, to be able to use new language definitions, it's important to flush the language definition cache, which can be done from: admin/settings/geshifilter

ergonlogic’s picture

Status: Active » Needs review
StatusFileSize
new944 bytes

I've attached a patch for the required changes, but I also pushed a new feature branch: http://drupalcode.org/project/kplatforms.git/shortlog/refs/heads/geshi_p...

Instead of messing with the downloading and applying the patch, this should allow:

git checkout 6.x-1.x
git pull
git pull origin geshi_puppet
git merge geshi_puppet

After which the feature branch can be deleted (both locally, and on d.o):

git branch -d geshi_puppet
git push origin :geshi_puppet
j0nathan’s picture

Status: Needs review » Reviewed & tested by the community

Hi ergonlogic,

I'm sorry I don't really understand what you do with the branches.

Regarding the file you want to put, I think this should be [type] = get, not [type] = file, or maybe this has been changed. I am not sure you have to write [destination] = libraries/geshi because we already say it is a library libraries[geshi_puppet]. The [destination] is useful if you want to specify another directory (ex.: a library in a module's folder).

I did not test it, but I would write it like this:

; GeSHi Puppet language definition
libraries[geshi_puppet][overwrite] = TRUE
libraries[geshi_puppet][directory_name] = geshi
libraries[geshi_puppet][download][type] = get
libraries[geshi_puppet][download][url] = https://raw.github.com/jasonhancock/geshi-language-files/7fd7a709d857f74b78d42990a2381a45eeb93429/puppet.php

Feel free to commit the GeSHi Puppet language definition after testing the makefile.

Thank you

j0nathan’s picture

Assigned: Unassigned » ergonlogic
j0nathan’s picture

Component: Code » New module request
j0nathan’s picture

Component: New module request » Module list
j0nathan’s picture

Version: 6.x-1.x-dev » 8.x-1.x-dev
j0nathan’s picture

Assigned: ergonlogic » j0nathan
Status: Reviewed & tested by the community » Needs review
j0nathan’s picture

Status: Needs review » Fixed
j0nathan’s picture

puppet.php goes in libraries/geshi/geshi
http://drupalcode.org/project/kplatforms.git/commit/4d9cdc7

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 45e8feb on 8.x-1.x, 8.x-2.x, lock by j0nathan:
    Issue #1645198 : Support Puppet code in GeSHi.
    
  • Commit 4d9cdc7 on 8.x-1.x, 8.x-2.x, lock by j0nathan:
    Issue #1645198 : puppet.php goes in libraries/geshi/geshi.