Add some improvements to kate-syntax-highlighter for use in scripting

Authored by xciml on Aug 30 2018, 7:48 AM.

Description

Add some improvements to kate-syntax-highlighter for use in scripting

This patch aims at making the kate-syntax-highlighter tool independent of the filesystem for better use in pipelines.

A --stdin option was added to signify that the text stream comes from standard input instead of a file. If a source file is still provided, the program implicitly chooses that instead.
This makes the tool usable in pipelines.

MIME types can now be used in the -s option
This is useful for when the file name can't be trusted to give an appropriate type (it might be a hash), but the MIME type is provided by a protocol or database through which the file is accessed. This way translation to the program's syntax names doesn't have to be done outside of the program.

A -T/--title option was added to explicitly specify the HTML page's title. I arbitrarily chose "Kate Syntax Highlighter" as a default title from stdin streams and the default is unchanged for a specified source file.
This is needed because now that a filename isn't guaranteed, it's hard to make a default title that's always appropriate. So just let the user specify it without having to rummage through it later to replace it.

Other than these added features, behaviour does (should) not change.

Differential Revision: https://phabricator.kde.org/D14236

Details