[PATCH 4 of 4] cli: front-end-build: generate pygments.css dynamically

Mads Kiilerich mads at kiilerich.com
Sun Nov 25 02:47:23 UTC 2018


On 11/22/2018 10:36 PM, Thomas De Schampheleire wrote:
> diff --git a/kallithea/bin/kallithea_cli_front_end.py b/kallithea/bin/kallithea_cli_front_end.py
> --- a/kallithea/bin/kallithea_cli_front_end.py
> +++ b/kallithea/bin/kallithea_cli_front_end.py
> @@ -48,3 +48,9 @@ def front_end_build(install_deps, genera
>           csspath = os.path.join(rootdir, 'kallithea', 'public', 'css', 'style.css')
>           subprocess.check_call([lesscpath, '--relative-urls', '--source-map',
>                   '--source-map-less-inline', lesspath, csspath])
> +        with open(os.path.join(rootdir, 'kallithea', 'public', 'css', 'pygments.css'), 'w') as f:
> +            subprocess.check_call(['pygmentize',
> +                    '-S', 'default',
> +                    '-f', 'html',
> +                    '-a', '.code-highlight'],
> +                    stdout=f)

Hmm. I realize this will fail if kallithea-cli is invoked with full path 
into the venv, and pygmentize isn't in PATH but also must be invoked 
with full path.

We should perhaps invoke pygments.cmdline.main directly instead.

/Mads


More information about the kallithea-general mailing list