Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select lexer with --filename argument #77

Merged
merged 1 commit into from Oct 24, 2017
Merged

Select lexer with --filename argument #77

merged 1 commit into from Oct 24, 2017

Conversation

douglas-larocca
Copy link
Contributor

cgit's syntax highlighting filter pipes to STDIN and provides the
filename in argv; the analyzer often fails but we have access to the
original filename, so we add an optional argument to specify the
filename to use for matching a lexer when reading from STDIN; when
[files...] are provided to chroma this is completely ignored

cgit's syntax highlighting filter pipes to STDIN and provides the
filename in argv; the analyzer often fails but we have access to the
original filename, so we add an optional argument to specify the
filename to use for matching a lexer when reading from STDIN; when
[files...] are provided to chroma this is completely ignored
@douglas-larocca
Copy link
Contributor Author

For reference, the cgit source filter script being used to wrap chroma:

#!/bin/sh
exec chroma --unbuffered --filename=$1 --style=pastie --html --html-inline-styles --html-only

From the cgit docs:

source filter::
	This filter is given a single parameter: the filename of the source
	file to filter. The filter can use the filename to determine (for
	example) the syntax highlighting mode. The contents of the source
	file that is to be filtered is available on standard input and the
	filtered contents is expected on standard output.

@alecthomas alecthomas merged commit 3d8ce90 into alecthomas:master Oct 24, 2017
@alecthomas
Copy link
Owner

Seems like a good idea, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants