Hello community, here is the log from the commit of package highlight for openSUSE:Factory checked in at 2020-04-15 20:05:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/highlight (Old) and /work/SRC/openSUSE:Factory/.highlight.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "highlight" Wed Apr 15 20:05:19 2020 rev:29 rq:792533 version:3.56 Changes: -------- --- /work/SRC/openSUSE:Factory/highlight/highlight.changes 2020-02-03 11:12:07.181808583 +0100 +++ /work/SRC/openSUSE:Factory/.highlight.new.2738/highlight.changes 2020-04-15 20:07:41.406153916 +0200 @@ -1,0 +2,20 @@ +Wed Apr 8 17:52:05 UTC 2020 - [email protected] + +- Update to version 3.56: + * Added support for Sequence Alignment Maps (SAM files). + * Added empty-file mode to --no-trailing-nl + (gl#saalen/highlight#147). + * Fixed issue with --syntax-by-name waiting for stdin + (gl#saalen/highlight#151). + * Fixed issue with --syntax reading matching files in the + current working directory (gl#saalen/highlight#151). + * Fixed string parsing in lisp.lang (gl#saalen/highlight#150). + * Fixed output of UTF-8 text in xterm256 or truecolor output + (gl#saalen/highlight#152). + * Fixed regex in js.lang. + * Fixed calculation of testcase markers with UTF-8 input. + * Allowed number literals with underscores in Java, Scala, D, + Julia, C#, Perl and Ada definitions. + * Added Nord theme. + +------------------------------------------------------------------- Old: ---- highlight-3.55.tar.bz2 highlight-3.55.tar.bz2.asc New: ---- highlight-3.56.tar.bz2 highlight-3.56.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ highlight.spec ++++++ --- /var/tmp/diff_new_pack.7DZxqu/_old 2020-04-15 20:07:41.954154288 +0200 +++ /var/tmp/diff_new_pack.7DZxqu/_new 2020-04-15 20:07:41.958154292 +0200 @@ -18,7 +18,7 @@ %bcond_without gui Name: highlight -Version: 3.55 +Version: 3.56 Release: 0 Summary: Universal Source Code to Formatted Text Converter License: GPL-3.0-or-later ++++++ highlight-3.55.tar.bz2 -> highlight-3.56.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/ChangeLog.adoc new/highlight-3.56/ChangeLog.adoc --- old/highlight-3.55/ChangeLog.adoc 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/ChangeLog.adoc 2020-04-07 20:17:39.000000000 +0200 @@ -6,6 +6,21 @@ :toc: left :toclevels: 1 +== highlight 3.56 + +06.04.2020 + + - added support for Sequence Alignment Maps (SAM files) + - added empty-file mode to `--no-trailing-nl` (https://gitlab.com/saalen/highlight/issues/147) + - fixed issue with `--syntax-by-name` waiting for stdin (https://gitlab.com/saalen/highlight/-/issues/151) + - fixed issue with `--syntax` reading matching files in the current working directory (https://gitlab.com/saalen/highlight/-/issues/151) + - fixed string parsing in lisp.lang (https://gitlab.com/saalen/highlight/-/issues/150) + - fixed output of UTF-8 text in xterm256 or truecolor output (https://gitlab.com/saalen/highlight/-/issues/152) + - fixed regex in js.lang (thanks to Jens Schleusener) + - fixed calculation of testcase markers with UTF-8 input + - allowed number literals with underscores in Java, Scala, D, Julia, C#, Perl and Ada definitions + - added Nord theme (https://gitlab.com/saalen/highlight/-/merge_requests/125) + == highlight 3.55 29.01.2020 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/README.adoc new/highlight-3.56/README.adoc --- old/highlight-3.55/README.adoc 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/README.adoc 2020-04-07 20:17:39.000000000 +0200 @@ -1,6 +1,6 @@ = HIGHLIGHT MANUAL André Simon -v3.55, January 2020 +v3.56, April 2020 :lang: en :toc: left :toc-title: Contents @@ -192,7 +192,7 @@ -o, --output=<file> name of single output file -P, --progress print progress bar in batch mode -q, --quiet suppress progress info in batch mode - -S, --syntax=<type> specify type of source code + -S, --syntax=<type|path> specify type of source code or syntax file path --syntax-by-name=<name> specify type of source code by given name will not read a file of this name, useful for stdin -v, --verbose print debug info @@ -242,7 +242,7 @@ -K, --font-size=<num?> set font size (specific to output format) -l, --line-numbers print line numbers in output file -m, --line-number-start=<cnt> start line numbering with cnt (assumes -l) - -s, --style=<style> set colour style (theme). See --base16 + -s, --style=<style|path> set colour style (theme) or theme file path -t, --replace-tabs=<num> replace tabs by <num> spaces -T, --doc-title=<title> document title -u, --encoding=<enc> set output encoding which matches input file @@ -259,10 +259,9 @@ --keep-injections output plug-in injections in spite of -f --kw-case=<case> change case of case insensitive keywords <case> = [upper, lower, capitalize] - --no-trailing-nl omit trailing newline + --no-trailing-nl[=mode] omit trailing newline. If mode is empty-file, omit + only for empty input --no-version-info omit version info comment - --two-pass=<file> write plug-in with persistent state information - (beta; requires syntax with store instructions) (X)HTML output options: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/README_DE.adoc new/highlight-3.56/README_DE.adoc --- old/highlight-3.55/README_DE.adoc 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/README_DE.adoc 2020-04-07 20:17:39.000000000 +0200 @@ -1,6 +1,6 @@ = HIGHLIGHT HANDBUCH André Simon -v3.55, Januar 2020 +v3.56, April 2020 :lang: de :toc: left :toc-title: Contents @@ -181,8 +181,8 @@ -i, --input=<file> name of single input file -o, --output=<file> name of single output file -P, --progress print progress bar in batch mode - -q, --quiet supress progress info in batch mode - -S, --syntax=<type> specify type of source code + -q, --quiet suppress progress info in batch mode + -S, --syntax=<type|path> specify type of source code or syntax file path --syntax-by-name=<name> specify type of source code by given name will not read a file of this name, useful for stdin -v, --verbose print debug info @@ -232,7 +232,7 @@ -K, --font-size=<num?> set font size (specific to output format) -l, --line-numbers print line numbers in output file -m, --line-number-start=<cnt> start line numbering with cnt (assumes -l) - -s, --style=<style> set colour style (theme). See --base16 + -s, --style=<style|path> set colour style (theme) or theme file path -t, --replace-tabs=<num> replace tabs by <num> spaces -T, --doc-title=<title> document title -u, --encoding=<enc> set output encoding which matches input file @@ -249,10 +249,9 @@ --keep-injections output plug-in injections in spite of -f --kw-case=<case> change case of case insensitive keywords <case> = [upper, lower, capitalize] - --no-trailing-nl omit trailing newline + --no-trailing-nl[=mode] omit trailing newline. If mode is empty-file, omit + only for empty input --no-version-info omit version info comment - --two-pass=<file> write plug-in with persistent state information - (beta; requires syntax with store instructions) (X)HTML output options: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/README_TESTCASES.adoc new/highlight-3.56/README_TESTCASES.adoc --- old/highlight-3.55/README_TESTCASES.adoc 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/README_TESTCASES.adoc 2020-04-07 20:17:39.000000000 +0200 @@ -1,6 +1,6 @@ = HIGHLIGHT TESTCASES MANUAL André Simon -v3.52, May 2019 +v3.56, April 2020 :lang: en :icons: font :toc: left @@ -27,10 +27,11 @@ See the feature discussion here: https://gitlab.com/saalen/highlight/issues/80 -[WARNING] + +[NOTE] ================================================================================ -This feature is considered experimental. -Please report problems and bugs like false positives. +For UTF-8 encoded input, you need to set `--encoding=utf-8`. Otherwise the +state indicator positions will not be calculated correctly. ================================================================================ @@ -68,7 +69,7 @@ A test will succeed at a position with whitespace if the enclosing state is matched or if `ws` is tested specifically. -Starting with release 3.52, you can negate the state with a leading `~`. +Add a leading `~` to an indicator to match any other state as success. === Example @@ -123,5 +124,5 @@ ......................................................... -The highlight GUI will show the error messages in an error summary prompt. +The highlight GUI will show error messages in an error summary prompt. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/filetypes.conf new/highlight-3.56/filetypes.conf --- old/highlight-3.55/filetypes.conf 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/filetypes.conf 2020-04-07 20:17:39.000000000 +0200 @@ -154,7 +154,7 @@ { Lang="clojure", Extensions={"clj", "cljc", "cljs", "edn"} }, { Lang="solidity", Extensions={"sol"} }, { Lang="ps1", Extensions={"psm1", "psd1"} }, - + { Lang="exapunks", Extensions={"exapunks", "exa"} }, { Lang="exapunks", Shebang=[[^(?i:NOTE\sEXAPUNKS)\b]] }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/gui_files/ext/fileopenfilter.conf new/highlight-3.56/gui_files/ext/fileopenfilter.conf --- old/highlight-3.55/gui_files/ext/fileopenfilter.conf 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/gui_files/ext/fileopenfilter.conf 2020-04-07 20:17:39.000000000 +0200 @@ -189,6 +189,7 @@ R (*.r) Ruby (*.rb *.pp *.rjs) Rust (*.rs) +SAM (*.sam) SAS (*.sas) SASS/SCSS (*.scss) Scala (*.scala) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/ada.lang new/highlight-3.56/langDefs/ada.lang --- old/highlight-3.55/langDefs/ada.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/ada.lang 2020-04-07 20:17:39.000000000 +0200 @@ -56,3 +56,6 @@ Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\.]] +Digits=[[ (?:0x|0X|0b)[0-9a-fA-F_]+|\d*[\.\_]?\d+(?:[eE][\-\+]?\d+)?[fFlLuU]? ]] + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/csharp.lang new/highlight-3.56/langDefs/csharp.lang --- old/highlight-3.55/langDefs/csharp.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/csharp.lang 2020-04-07 20:17:39.000000000 +0200 @@ -56,4 +56,6 @@ Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|@|\?|\$|\|]] +Digits=[[ (?:0x|0X|0b)[0-9a-fA-F_]+|\d*[\.\_]?\d+(?:[eE][\-\+]?\d+)?[fFlLuU]? ]] + EnableIndentation=true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/d.lang new/highlight-3.56/langDefs/d.lang --- old/highlight-3.55/langDefs/d.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/d.lang 2020-04-07 20:17:39.000000000 +0200 @@ -132,3 +132,6 @@ } Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\~|\$]] + +Digits=[[ (?:0x|0X|0b)[0-9a-fA-F_]+|\d*[\.\_]?\d+(?:[eE][\-\+]?\d+)?[fFlLuU]? ]] + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/java.lang new/highlight-3.56/langDefs/java.lang --- old/highlight-3.55/langDefs/java.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/java.lang 2020-04-07 20:17:39.000000000 +0200 @@ -41,4 +41,6 @@ Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\|]] +Digits=[[ (?:0x|0X|0b)[0-9a-fA-F_]+|\d*[\.\_]?\d+(?:[eE][\-\+]?\d+)?[fFlLuU]? ]] + EnableIndentation=true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/js.lang new/highlight-3.56/langDefs/js.lang --- old/highlight-3.55/langDefs/js.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/js.lang 2020-04-07 20:17:39.000000000 +0200 @@ -25,7 +25,7 @@ -- may be replaced by NestedSections { Id=3, - Regex=[[\/[^*\s/].*?[^\\]/[msixpodualgcy]*]], + Regex=[[\/[^*\s/][^\s]*?[^\\]/[msixpodualgcy]*]], Group=0 }, @@ -73,7 +73,7 @@ -- resolve issue with regex expression which spans strings like "</i>" + VAR + "</i>" function OnStateChange(oldState, newState, token, groupID) - if string.sub(token,1,1)=="/" and oldState==HL_STRING and newState==HL_KEYWORD and groupID == 3 then + if string.sub(token,1,1)=="/" and (oldState==HL_STRING or oldState==HL_COMMENT) and newState==HL_KEYWORD and groupID == 3 then return HL_REJECT end return newState diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/julia.lang new/highlight-3.56/langDefs/julia.lang --- old/highlight-3.55/langDefs/julia.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/julia.lang 2020-04-07 20:17:39.000000000 +0200 @@ -52,3 +52,6 @@ IgnoreCase=false Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|=|\/|\*|\%|\+|\-|\~|\$|\?|\||\^]] + +Digits=[[ (?:0x|0X|0b)[0-9a-fA-F_]+|\d*[\.\_]?\d+(?:[eE][\-\+]?\d+)?[fFlLuU]? ]] + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/lisp.lang new/highlight-3.56/langDefs/lisp.lang --- old/highlight-3.55/langDefs/lisp.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/lisp.lang 2020-04-07 20:17:39.000000000 +0200 @@ -12,10 +12,13 @@ { Id=2, Regex=[[ def(un|method)\s+([\w\-]+)]], Group=2 }, + { Id=3, + Regex=[[ \[.+?\]|\[/\w+\] ]], + }, } Strings={ - Delimiter=[[ "|\[\w+\]|\[/\w+\] ]], + Delimiter=[[ " ]], } Comments={ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/perl.lang new/highlight-3.56/langDefs/perl.lang --- old/highlight-3.55/langDefs/perl.lang 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/langDefs/perl.lang 2020-04-07 20:17:39.000000000 +0200 @@ -100,6 +100,8 @@ --todo for 1..5 Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\@|~|\=|\/|\*|\+|\-|\$|\.|\^|\~|\%|\|]] +Digits=[[ (?:0x|0X|0b)[0-9a-fA-F_]+|\d*[\.\_]?\d+(?:[eE][\-\+]?\d+)?[fFlLuU]? ]] + -- fix recognition of $ and other Perl perversions function OnStateChange(oldState, newState, token, groupID) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/langDefs/sam.lang new/highlight-3.56/langDefs/sam.lang --- old/highlight-3.55/langDefs/sam.lang 1970-01-01 01:00:00.000000000 +0100 +++ new/highlight-3.56/langDefs/sam.lang 2020-04-07 20:17:39.000000000 +0200 @@ -0,0 +1,43 @@ + +Description="Sequence Alignment Map (use with sam_seq.lua plug-in)" + +Categories = {"source"} + +--Digits = [[ (?:0x|0X|0b)[0-9a-fA-F']+|\d*[\.]?\d+(?:[eE][\-\+]\d+)?[lLuU]* ]] + +Keywords={ + + { Id=1, + Regex=[[(SRR|SNES)\d+\.\d+]], Group=0 + }, + { Id=2, + Regex=[[chr\d+]] + }, + + { Id=3, + Regex=[[\d+[DMS][DM\d]*]] + }, + + { Id=2, + Regex=[[ [ASXNMDOGYTR]{2}\: ]] + }, + + { Id=5, + Regex=[[ [ATCG]{64,} ]] + }, + + { Id=4, + Regex=[[ [\S]{100,} ]] + } +} + +Comments = { + { + Block=false, + Delimiter = { [[^@]] } + } +} + +IgnoreCase=false + +Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|=|\/|\*|\%|\+|\-|\~|\||\^|\?]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/man/highlight.1 new/highlight-3.56/man/highlight.1 --- old/highlight-3.55/man/highlight.1 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/man/highlight.1 2020-04-07 20:17:39.000000000 +0200 @@ -129,8 +129,8 @@ output plug-in header and footer injections in spite of -f .IP "--kw-case=<upper|lower|capitalize>" output all keywords in given case if language is not case sensitive -.IP "--no-trailing-nl" -omit trailing newline +.IP "--no-trailing-nl[=mode]" +omit trailing newline. If mode is "empty-file", omit only for empty input .IP "--no-version-info" omit version info comment .IP "--wrap-no-numbers" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/plugins/sam_seq.lua new/highlight-3.56/plugins/sam_seq.lua --- old/highlight-3.55/plugins/sam_seq.lua 1970-01-01 01:00:00.000000000 +0100 +++ new/highlight-3.56/plugins/sam_seq.lua 2020-04-07 20:17:39.000000000 +0200 @@ -0,0 +1,53 @@ +Description="Generate coloured bio sequences in Sequence Alignment Maps" + +-- optional parameter: syntax description +function syntaxUpdate(desc) + + t = {} + t["A"] = "144;238;144" --144, 238, 144 + t["T"] = "240;128;128" --240, 128, 128 + t["C"] = "173;216;230" --173, 216, 230 + t["G"] = "255;160;122" --255, 160, 122 + + function Decorate(token, state, kwclass) + + if ( (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML or HL_OUTPUT == HL_FORMAT_TRUECOLOR) + and #token > 63 and state == HL_KEYWORD and not string.match(token,"[^ATCG]") ) then + + retVal = "" + for c in token:gmatch"." do + if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then + retVal = retVal .. "<span class='elem_".. c .. "'>".. c .. "</span>" + elseif (HL_OUTPUT == HL_FORMAT_TRUECOLOR) then + retVal = retVal .. "\27[48;2;".. t[c] .. "m".. c .. "\27m" + end + end + return retVal + end + end +end + +function themeUpdate(desc) + if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then + + Injections[#Injections+1]=[[ +span.elem_A { + background-color: lightgreen; +} +span.elem_T { + background-color: lightcoral; +} +span.elem_C { + background-color: lightblue; +} +span.elem_G { + background-color: lightsalmon; +} +]] + end +end + +Plugins={ + { Type="lang", Chunk=syntaxUpdate }, + { Type="theme", Chunk=themeUpdate } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/cli/cmdlineoptions.cpp new/highlight-3.56/src/cli/cmdlineoptions.cpp --- old/highlight-3.55/src/cli/cmdlineoptions.cpp 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/cli/cmdlineoptions.cpp 2020-04-07 20:17:39.000000000 +0200 @@ -120,7 +120,7 @@ { S_OPT_EOL_DELIM_CR, OPT_EOL_DELIM_CR, Arg_parser::no }, { S_OPT_PRINT_STYLE, OPT_PRINT_STYLE, Arg_parser::no }, { S_OPT_BASE16, OPT_BASE16, Arg_parser::maybe }, - { S_OPT_NO_TRAILING_NL, OPT_NO_TRAILING_NL, Arg_parser::no }, + { S_OPT_NO_TRAILING_NL, OPT_NO_TRAILING_NL, Arg_parser::maybe }, { S_OPT_KEEP_INJECTIONS, OPT_KEEP_INJECTIONS, Arg_parser::no }, { S_OPT_FORCE_STDOUT, OPT_FORCE_STDOUT, Arg_parser::no }, { S_OPT_LATEX_BEAMER, OPT_LATEX_BEAMER, Arg_parser::no }, @@ -152,6 +152,7 @@ lineNrStart ( 1 ), lineRangeStart( 0 ), lineRangeEnd( 0 ), + opt_no_trailing_nl(0), canvasPaddingWidth(0), wrappingStyle ( highlight::WRAP_DISABLED ), outputType ( highlight::HTML ), @@ -189,7 +190,6 @@ opt_delim_CR (false), opt_print_style(false), opt_base16_theme(false), - opt_no_trailing_nl(false), opt_keep_injections(false), opt_force_stdout(false), opt_no_version_info(false), @@ -411,10 +411,9 @@ syntax = arg; opt_syntax = true; - if (Platform::fileExists(arg)){ + if (Platform::fileExists(arg) && string::npos!=arg.find_last_of('.')){ absLangPath = arg; syntax = arg.substr(0, arg.find_last_of('.')); - } break; case 't': @@ -516,7 +515,7 @@ case S_OPT_COMPAT_LINEREF: opt_linenumbers = true; opt_attach_line_anchors = true; - anchorPrefix = ( arg.empty() ) ? "line":arg; + anchorPrefix = ( arg.empty() ) ? "line" : arg; break; case S_OPT_EOL_DELIM_CR: opt_delim_CR = true; @@ -533,7 +532,9 @@ styleName = arg; break; case S_OPT_NO_TRAILING_NL: - opt_no_trailing_nl = true; + opt_no_trailing_nl = 1; + if (arg=="empty-file" || arg=="blank") + opt_no_trailing_nl = 2; break; case S_OPT_KEEP_INJECTIONS: opt_keep_injections = true; @@ -592,10 +593,7 @@ } break; } - // case S_OPT_TWO_PASS: - // twoPassFile=arg; - // break; - + default: cerr << "highlight: option parsing failed" << endl; } @@ -903,7 +901,7 @@ { return opt_page_color; } -bool CmdLineOptions::disableTrailingNL() const +int CmdLineOptions::disableTrailingNL() const { return opt_no_trailing_nl; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/cli/cmdlineoptions.h new/highlight-3.56/src/cli/cmdlineoptions.h --- old/highlight-3.55/src/cli/cmdlineoptions.h 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/cli/cmdlineoptions.h 2020-04-07 20:17:39.000000000 +0200 @@ -116,8 +116,6 @@ #define OPT_PIPED_FNAME "syntax-by-name" #define OPT_ISOLATE_TAGS "isolate" #define OPT_MAX_FILE_SIZE "max-size" -//#define OPT_TWO_PASS "two-pass" - // Improve CLI option compatibility with GNU source-highlight #define OPT_COMPAT_DOC "doc" @@ -291,6 +289,12 @@ { return opt_encoding_explicit; } + + /** \return True if style was defined by user*/ + bool styleDefined() const + { + return !styleName.empty(); + } /** \return True if output should be generated if language type is unknown*/ bool forceOutput() const; @@ -352,8 +356,9 @@ /** \return list of astyle options */ const vector <string> &getAStyleOptions() const; - /** \return True if trailing nl should be omitted */ - bool disableTrailingNL() const ; + /** \return 1 if trailing nl should be omitted, + * 2 if it should only be ommitted for empty input */ + int disableTrailingNL() const ; /** \return The given base font size, empty string by default */ const string& getBaseFontSize() const ; @@ -420,6 +425,7 @@ int lineNrStart; // line number start count int lineRangeStart; // line range start int lineRangeEnd; // line range end + int opt_no_trailing_nl; unsigned int canvasPaddingWidth; // line number start count @@ -484,7 +490,6 @@ bool opt_delim_CR; bool opt_print_style; bool opt_base16_theme; - bool opt_no_trailing_nl; bool opt_keep_injections; bool opt_force_stdout; bool opt_no_version_info; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/cli/help.cpp new/highlight-3.56/src/cli/help.cpp --- old/highlight-3.55/src/cli/help.cpp 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/cli/help.cpp 2020-04-07 20:17:39.000000000 +0200 @@ -201,7 +201,8 @@ cout<<" --keep-injections output plug-in injections in spite of -f\n"; cout<<" --kw-case=<case> change case of case insensitive keywords\n"; cout<<" <case> = [upper, lower, capitalize]\n"; - cout<<" --no-trailing-nl omit trailing newline\n"; + cout<<" --no-trailing-nl[=mode] omit trailing newline. If mode is empty-file, omit\n"; + cout<<" only for empty input\n"; cout<<" --no-version-info omit version info comment\n"; // cout<<" --two-pass=<file> write plug-in with persistent state information\n"; // cout<<" (beta; requires syntax with store instructions)\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/cli/main.cpp new/highlight-3.56/src/cli/main.cpp --- old/highlight-3.55/src/cli/main.cpp 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/cli/main.cpp 2020-04-07 20:17:39.000000000 +0200 @@ -382,7 +382,7 @@ } string themePath=options.getAbsThemePath().empty() ? dataDir.getThemePath ( options.getThemeName(), options.useBase16Theme() ): options.getAbsThemePath(); - + unique_ptr<highlight::CodeGenerator> generator ( highlight::CodeGenerator::getInstance ( options.getOutputType() ) ); generator->setHTMLAttachAnchors ( options.attachLineAnchors() ); @@ -438,7 +438,7 @@ generator->setStartingInputLine(options.getLineRangeStart()); generator->setMaxInputLineCnt(options.getLineRangeEnd()); } - + bool styleFileWanted = !options.fragmentOutput() || options.styleOutPathDefined(); const vector <string> pluginFileList=collectPluginPaths( options.getPluginPaths()); @@ -511,15 +511,15 @@ string inFileName, outFilePath; string suffix, lastSuffix; string twoPassOutFile=Platform::getTempFilePath(); - if ( options.syntaxGiven() ) { // user defined language definition, valid for all files string syntaxByFile=options.getSyntaxByFilename(); string testSuffix = syntaxByFile.empty() ? options.getSyntax() : dataDir.getFileSuffix(syntaxByFile); - suffix = dataDir.guessFileType (testSuffix, syntaxByFile, syntaxByFile.empty(), true ); + //FIXME + suffix = dataDir.guessFileType (testSuffix, syntaxByFile, syntaxByFile.empty(), options.getSingleOutFilename().length()==0 ); } - + generator->setFilesCnt(fileCount); - + while ( i < fileCount && !initError ) { if ( Platform::fileSize(inFileList[i]) > options.getMaxFileSize() ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/core/codegenerator.cpp new/highlight-3.56/src/core/codegenerator.cpp --- old/highlight-3.55/src/core/codegenerator.cpp 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/core/codegenerator.cpp 2020-04-07 20:17:39.000000000 +0200 @@ -146,13 +146,14 @@ maxLineCnt ( UINT_MAX ), inputFilesCnt (0), processedFilesCnt (0), + noTrailingNewLine(0), + terminatingChar ( '\0' ), formatter ( NULL ), formattingEnabled ( false ), formattingPossible ( false ), validateInput ( false ), numberWrappedLines ( true ), - noTrailingNewLine(false), resultOfHook(false), lineContainedTestCase(false), applySyntaxTestCase(false), @@ -225,7 +226,7 @@ includeStyleDef = flag; } -void CodeGenerator::disableTrailingNL ( bool flag ) +void CodeGenerator::disableTrailingNL ( int flag ) { noTrailingNewLine = flag; } @@ -566,6 +567,11 @@ { // end of line? if ( lineIndex == line.length() ) { + + //more testing required: + if (outputType==ESC_TRUECOLOR || outputType==ESC_XTERM256) + lastLineLength=StringTools::utf8_strlen(line); + bool eof=false; if ( preFormatter.isEnabled() ) { if ( !preFormatter.hasMoreLines() ) { @@ -574,7 +580,7 @@ ++lineNumber; numberCurrentLine = true; } else { - if(numberWrappedLines) + if (numberWrappedLines) ++lineNumber; numberCurrentLine = numberWrappedLines; } @@ -586,7 +592,6 @@ numberCurrentLine = true; } - lastLineLength=lineIndex; lineIndex=0; if (!lineContainedTestCase && applySyntaxTestCase){ @@ -752,19 +757,21 @@ { for ( unsigned int i=0; i< s.length(); i++ ) { ss << maskCharacter ( s[i] ); - - // do not add a trace indicator state for each byte of a UTF-8 sequence, only for the seq start - // https://stackoverflow.com/questions/4063146/getting-the-actual-length-of-a-utf-8-encoded-stdstring - //if ( applySyntaxTestCase && ( (s[i]&0xff) != 0xC2 || StringTools::change_case(encoding) !="utf-8" ) /*&& ( (s[i] & 0xc0) != 0x80 || StringTools::change_case(encoding) !="utf-8" ) */ ) { - if ( applySyntaxTestCase && ( (s[i] & 0xc0) != 0x80 || StringTools::change_case(encoding) !="utf-8" ) /*&& ( (s[i] & 0xc0) != 0x80 || StringTools::change_case(encoding) !="utf-8" ) */ ) { + } + + // The test markers position should also be deternmined by calculating the code points + if ( applySyntaxTestCase ) { - PositionState ps(currentState, getCurrentKeywordClassId(), false); + PositionState ps(currentState, getCurrentKeywordClassId(), false); + + int slen = encoding=="utf-8" ? StringTools::utf8_strlen(s) : s.length(); + for (int i=0; i< slen; i++ ) { stateTraceCurrent.push_back(ps); - - if (stateTraceCurrent.size()>200) - stateTraceCurrent.erase(stateTraceCurrent.begin(), stateTraceCurrent.begin() + 100 ); - } - } + } + if (stateTraceCurrent.size()>200) + stateTraceCurrent.erase(stateTraceCurrent.begin(), stateTraceCurrent.begin() + 100 ); + } + } @@ -1787,8 +1794,9 @@ break; default: - if ((outputType==ESC_TRUECOLOR || outputType==ESC_XTERM256) && token.size()) - openTag ( STANDARD ); + // breaks Unicode sequences: + // if ((outputType==ESC_TRUECOLOR || outputType==ESC_XTERM256) && token.size()) + // openTag ( STANDARD ); printMaskedToken (); break; @@ -1805,7 +1813,7 @@ } } - printNewLines = !noTrailingNewLine; + printNewLines = noTrailingNewLine==0 || ( noTrailingNewLine==2 && ( token.size() || lineNumber>1) ); *out << getNewLine(); *out << flush; } @@ -2338,10 +2346,10 @@ } //fix canvas whitespace - if (outputType==ESC_XTERM256 || outputType==ESC_TRUECOLOR){ + if (outputType==ESC_XTERM256 || outputType==ESC_TRUECOLOR){ *out<< maskWsBegin; - } - + } + *out<<wsBuffer; wsBuffer.clear(); } @@ -2405,6 +2413,9 @@ //column: lineIndex (not a UTF-8 validated string position) void CodeGenerator::runSyntaxTestcases(unsigned int column){ + if (encoding=="utf-8") + column = StringTools::utf8_strlen(line.substr(0, column)); + unsigned int assertGroup=0; size_t typeDescPos=line.find_first_not_of("\t ^", lineIndex); State assertState=_UNKNOWN; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/core/datadir.cpp new/highlight-3.56/src/core/datadir.cpp --- old/highlight-3.55/src/core/datadir.cpp 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/core/datadir.cpp 2020-04-07 20:17:39.000000000 +0200 @@ -168,7 +168,6 @@ return encodingHint[getFileBaseName(syntax)]; } - string DataDir::getFileSuffix(const string& fileName) { size_t ptPos=fileName.rfind("."); @@ -217,7 +216,7 @@ assocByShebang.insert ( make_pair ( mapEntry["Shebang"].asString(), langName ) ); } else if (mapEntry["EncodingHint"] !=Diluculum::Nil) { encodingHint.insert ( make_pair ( langName, mapEntry["EncodingHint"].asString() ) ); - } + } idx++; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/core/stringtools.cpp new/highlight-3.56/src/core/stringtools.cpp --- old/highlight-3.55/src/core/stringtools.cpp 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/core/stringtools.cpp 2020-04-07 20:17:39.000000000 +0200 @@ -128,4 +128,19 @@ return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); } +int utf8_strlen(const string& str) +{ + int c,i,ix,q; + for (q=0, i=0, ix=str.length(); i < ix; i++, q++) + { + c = (unsigned char) str[i]; + if (c>=0 && c<=127) i+=0; + else if ((c & 0xE0) == 0xC0) i+=1; + else if ((c & 0xF0) == 0xE0) i+=2; + else if ((c & 0xF8) == 0xF0) i+=3; + else return 0; + } + return q; +} + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/core/xterm256generator.cpp new/highlight-3.56/src/core/xterm256generator.cpp --- old/highlight-3.55/src/core/xterm256generator.cpp 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/core/xterm256generator.cpp 2020-04-07 20:17:39.000000000 +0200 @@ -89,10 +89,9 @@ bgs << "\033[48;5;"<< bgApprox << "m"; } canvasColSeq = bgs.str(); - - //see CodeGenerator::flushWs maskWsBegin = canvasColSeq; } + openTags.push_back ( getOpenTag ( docStyle.getDefaultStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getStringStyle() ) ); openTags.push_back ( getOpenTag ( docStyle.getNumberStyle() ) ); @@ -135,6 +134,7 @@ // apply color approximation, 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit) s << "38;5;"<< ( int ) rgb2xterm ( rgb ) << "m"; } + return s.str(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/include/codegenerator.h new/highlight-3.56/src/include/codegenerator.h --- old/highlight-3.55/src/include/codegenerator.h 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/include/codegenerator.h 2020-04-07 20:17:39.000000000 +0200 @@ -349,9 +349,10 @@ void setIncludeStyle ( bool flag ); /** tell parser to omit trailing newline character - \param flag true if no trailing newline should be printed + \param flag 1 if no trailing newline should be printed, + 2 omit newline only for empty input */ - void disableTrailingNL ( bool flag ); + void disableTrailingNL ( int flag ); /** Set style input path \param path path to style input file @@ -799,6 +800,10 @@ unsigned int inputFilesCnt; unsigned int processedFilesCnt; + /** Flag to test if trailing newline should be printed */ + int noTrailingNewLine; + + /**last character of the last line*/ unsigned char terminatingChar; @@ -817,8 +822,6 @@ /** Flag if wrapped lines should receive unique line numbers as well */ bool numberWrappedLines; - /** Flag to test if trailing newline should be printed */ - bool noTrailingNewLine; /** indicator if current state was set by Lua hook function */ bool resultOfHook; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/include/datadir.h new/highlight-3.56/src/include/datadir.h --- old/highlight-3.55/src/include/datadir.h 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/include/datadir.h 2020-04-07 20:17:39.000000000 +0200 @@ -122,7 +122,7 @@ /** \param snytax name \return Encoding hint assigned to the syntax */ const string getEncodingHint (const string &); - + /** * \param fileName input file name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/include/stringtools.h new/highlight-3.56/src/include/stringtools.h --- old/highlight-3.55/src/include/stringtools.h 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/include/stringtools.h 2020-04-07 20:17:39.000000000 +0200 @@ -86,6 +86,8 @@ string getPathAcronym(const string&path, char delim); bool endsWith(std::string const & value, std::string const & ending); + +int utf8_strlen(const string& str); } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/src/include/version.h new/highlight-3.56/src/include/version.h --- old/highlight-3.55/src/include/version.h 2020-01-29 19:05:28.000000000 +0100 +++ new/highlight-3.56/src/include/version.h 2020-04-07 20:17:39.000000000 +0200 @@ -29,7 +29,7 @@ #define VERSION_H #define HIGHLIGHT_MAJOR "3" -#define HIGHLIGHT_MINOR "55" +#define HIGHLIGHT_MINOR "56" #define HIGHLIGHT_VERSION HIGHLIGHT_MAJOR "." HIGHLIGHT_MINOR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.55/themes/nord.theme new/highlight-3.56/themes/nord.theme --- old/highlight-3.55/themes/nord.theme 1970-01-01 01:00:00.000000000 +0100 +++ new/highlight-3.56/themes/nord.theme 2020-04-07 20:17:39.000000000 +0200 @@ -0,0 +1,25 @@ +Description="Nord" + +-- Theme handcrafted by Dave Hall, based on nordtheme.com + +Categories = {"dark"} + +Default = { Colour="#d8dee9" } +Canvas = { Colour="#2e3440" } +Number = { Colour="#b48ead" } +Escape = { Colour="#ebcb8b" } +String = { Colour="#a3be8c" } +StringPreProc = { Colour="#a3be8c" } +BlockComment = { Colour="#4c566a" } +LineComment = { Colour="#4c566a" } +PreProcessor = { Colour="#5e81ac" } +LineNum = { Colour="#303030" } +Operator = { Colour="#81a1c1" } +Interpolation = { Colour="#ebcb8b" } + +Keywords = { + { Colour= "#81a1c1" }, + { Colour= "#434c5e" }, + { Colour= "#88c0d0" }, + { Colour= "#8fbcbb" }, +}
