Wordpress

Puppet – Wrong Header Line Format – Error

0

If you are writing manifests which include using templates and you receive a wrong header line format error message, it means there is a syntax error in one of your template files. The message is pretty much worthless due to it’s cryptic nature, and there appears to be an open defect to improve the messaging, but not sure that it will be fixed as the current status is “accepted”.

So check your templates, the issue that generated this warning for me was:

# Notice the <% = 
# Should be <%=
alias /<%= tpl_src_code_path %>/<% = static_asset_dir %>/;

WordPress – Syntax Highlighter – Add Custom Brush(es)

5

– EDIT (2.10.2012) –

There is now a plugin way of adding your custom brushes which I recommend you use, otherwise your brushes will be over-ridden during updates. For more information check out http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/adding-a-new-brush-language/.

– ORIGINAL –

Being a dev blog, there are a lot of code references scattered throughout this site and in hopes of making these code references easier to read, I installed a WordPress Plugin known as Syntax Highlighter (http://wordpress.org/extend/plugins/syntaxhighlighter/). By default, this plugin has a number of predefined syntaxes (aka brushes) which it will highlight (bash, php, etc), but there may be instances where  you need access to a custom brush that isn’t included.  For example, this blog is heavily versed in Symfony references requiring the need for a ‘Yaml’ brush, which makes yaml config files easier to read.  Unfortunately the yaml brush isn’t included in the default plugin package and must be downloaded separately.  Lucky for us there is a great site which makes available the yaml brush along with many others: http://www.undermyhat.org/blog/2009/09/list-of-brushes-syntaxhighligher/#overview.

I decided to post how to set-up custom brushes b/c I recently updated Syntax Highlighter and it overwrote my custom brush entries causing all my yaml references to be rendered as regular text, and having been a few months since I added the custom brush, I forgot how to do it. So I figured and article about it will help me if it happens again, and maybe help other people…

The following steps assume you already have syntax highlighter installed and activated on your wordpress blog.

cd /path/to/wordpress/wp-content/plugins/syntaxhighlighter/third-party-brushes

wget http://www.undermyhat.org/blog/wp-content/uploads/2009/09/shBrushYaml.js

cd ..

vi syntaxhighlighter.php

Before

// Register some popular third-party brushes
wp_register_script( 'syntaxhighlighter-brush-latex',      plugins_url('syntaxhighlighter/third-party-brushes/shBrushLatex.js'),            array('syntaxhighlighter-core'), '20090613'     );
wp_register_script( 'syntaxhighlighter-brush-objc',       plugins_url('syntaxhighlighter/third-party-brushes/shBrushObjC.js'),             array('syntaxhighlighter-core'), '20091207'     );

...

// Create list of brush aliases and map them to their real brushes
// The key is the language alias
// The value is the script handle suffix: syntaxhighlighter-brush-ThisBitHere  (your plugin needs to register the script itself)
$this->brushes = (array) apply_filters( 'syntaxhighlighter_brushes', array(
    'as3'           => 'as3',
    'actionscript3' => 'as3',
    'bash'          => 'bash',

...

After

// Register some popular third-party brushes
wp_register_script( 'syntaxhighlighter-brush-latex',      plugins_url('syntaxhighlighter/third-party-brushes/shBrushLatex.js'),            array('syntaxhighlighter-core'), '20090613'     );
wp_register_script( 'syntaxhighlighter-brush-objc',       plugins_url('syntaxhighlighter/third-party-brushes/shBrushObjC.js'),             array('syntaxhighlighter-core'), '20091207'     );

wp_register_script( 'syntaxhighlighter-brush-yaml',       plugins_url('syntaxhighlighter/third-party-brushes/shBrushYaml.js'),             array('syntaxhighlighter-core'), '20091222'     );

...

// Create list of brush aliases and map them to their real brushes
// The key is the language alias
// The value is the script handle suffix: syntaxhighlighter-brush-ThisBitHere  (your plugin needs to register the script itself)
$this->brushes = (array) apply_filters( 'syntaxhighlighter_brushes', array(
    'as3'           => 'as3',
    'actionscript3' => 'as3',
    'bash'          => 'bash',

...

    'yaml'          => 'yaml',
    'yml'           => 'yaml',

...

The goal is to ensure that the call made via ‘wp_register_script( ‘syntaxhighlighter-brush-<brush_name> …’ has an entry in the ‘$this->brushes‘ array. Now you should be able to wrap your yaml text with ‘yaml’ (or ‘yml’) and you should see it properly formatted.

Go to Top