Skip to main content

A Pygments Lexer for the HAProxy configuration syntax

Project description

Pygments Lexer for the HAProxy configuration syntax

This package enables the latest HAProxy configuration syntax highlighting for python Pygments and is used as the basis for the HAProxy lexer on the Pygments project.

The lexer keywords are maintained and updated manually using information from the documentation of the HAProxy Community version and the HAProxy Enterprise version.

Installation

To add the lexer on your already existing pygments installation run:

python setup.py install

This will install the lexer on your local system and create a python package.

To verify that the lexer is working use the sample HAProxy configuration file.

# Output the result on your command line
pygmentize -l haproxy -x haproxy.cfg

# Output the result in an HTML file
pygmentize -O full -l haproxy -o haproxy.html haproxy.cfg

Development

The main grammar rules and keywords are located under haproxylexer.

  • _haproxy_builtins.py contains lists of keywords.
  • lexer.py contains all the grammar regexes

To quickly test your changes you can run:

pygmentize -l ./haproxylexer/lexer.py:HAProxyLexer -x haproxy.cfg

Contributing

Pull requests and patches will be checked out by the maintainer and merged. Try to keep your commit messages precise and to the point.

Thanks and resources

Many thanks for the lovely Python, PyPi, and Pygments documentation.

Also a shout out to Bojan Marcovic for his vscode-haproxy-syntax and Alexander Bulimov for his atom-language-haproxy. Both were a great starting resources and the work done here will be also now easier to port for editors like VS Code, Atom, Sublime, etc.

Funny little disclaimer

The author, has never actually taken the time to learn python...

He just hacked away at this. Please forgive him for any coding "faux passes" he might have done :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haproxy-pygments-lexer-1.0.0.tar.gz (17.7 kB view details)

Uploaded Source

File details

Details for the file haproxy-pygments-lexer-1.0.0.tar.gz.

File metadata

  • Download URL: haproxy-pygments-lexer-1.0.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.4.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/2.7.15

File hashes

Hashes for haproxy-pygments-lexer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 55f61c1c8c1a3ed5bfddb8e9f1506977d2b87e369bcbb02fecbac8d623db295d
MD5 68cc131b96f37c3a55e6a99944693e38
BLAKE2b-256 8c9d224d1f1cc25ccbefedcf4f5d23f932c4be4dd152593f82c58da270cd5d86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page