Hello community, here is the log from the commit of package highlight for openSUSE:Factory checked in at 2020-02-03 11:11:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/highlight (Old) and /work/SRC/openSUSE:Factory/.highlight.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "highlight" Mon Feb 3 11:11:55 2020 rev:28 rq:768443 version:3.55 Changes: -------- --- /work/SRC/openSUSE:Factory/highlight/highlight.changes 2019-11-17 19:20:30.846933267 +0100 +++ /work/SRC/openSUSE:Factory/.highlight.new.26092/highlight.changes 2020-02-03 11:12:07.181808583 +0100 @@ -1,0 +2,12 @@ +Wed Jan 29 19:37:53 UTC 2020 - [email protected] + +- Update to version 3.55: + * Improved handling of empty files in xterm256 and truecolor + output (gl#saalen/highlight#147). + * Added EncodingHint attributes to filetypes.conf and language + definitions (gl#saalen/highlight#141). + * CLI: Allowed file paths as --theme and --syntax argument + (gl#saalen/highlight#145). + * GUI: Removed deprecated QTime API call. + +------------------------------------------------------------------- Old: ---- highlight-3.54.tar.bz2 highlight-3.54.tar.bz2.asc New: ---- highlight-3.55.tar.bz2 highlight-3.55.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ highlight.spec ++++++ --- /var/tmp/diff_new_pack.MxlyfX/_old 2020-02-03 11:12:09.005809505 +0100 +++ /var/tmp/diff_new_pack.MxlyfX/_new 2020-02-03 11:12:09.005809505 +0100 @@ -1,7 +1,7 @@ # # spec file for package highlight # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %bcond_without gui Name: highlight -Version: 3.54 +Version: 3.55 Release: 0 Summary: Universal Source Code to Formatted Text Converter License: GPL-3.0-or-later ++++++ highlight-3.54.tar.bz2 -> highlight-3.55.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/.gitlab-ci.yml new/highlight-3.55/.gitlab-ci.yml --- old/highlight-3.54/.gitlab-ci.yml 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/.gitlab-ci.yml 2020-01-29 19:05:28.000000000 +0100 @@ -6,15 +6,33 @@ before_script: - apt-get update - apt-get install -y make gcc g++ libboost-dev liblua5.3-dev git + # ====================== + # EditorConfig Toolchain + # ====================== + # Install Node.js: + - apt-get install -y curl + - curl -sL https://deb.nodesource.com/setup_13.x | bash + - apt-get install -y nodejs + - node -v + - npm -v + # Install EClint: + - npm install -g eclint compile: script: - - make - - make install - # Verify that our compiled app works properly with a custom "test" script - - bash ./src/ci_test.sh + - make + - make install + # Verify that our compiled app works properly with a custom "test" script + - bash ./src/ci_test.sh # Save the compiled output from the above for downloading via GitLab and in Gitlab 8.6 to use in future build steps #artifacts: # paths: # - ansifilter + +validate: + script: + # Validate committed files against EditorConfig settings via EClint using + # a custom script that in case of error lists only the problematic files: + - bash ./validate.sh + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/ChangeLog.adoc new/highlight-3.55/ChangeLog.adoc --- old/highlight-3.54/ChangeLog.adoc 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/ChangeLog.adoc 2020-01-29 19:05:28.000000000 +0100 @@ -6,6 +6,21 @@ :toc: left :toclevels: 1 +== highlight 3.55 + +29.01.2020 + + - improved handling of empty files in xterm256 and truecolor output (https://gitlab.com/saalen/highlight/issues/147) + - added EncodingHint attributes to filetypes.conf and language definitions (https://gitlab.com/saalen/highlight/issues/141) + - CLI: allowed file paths as --theme and --syntax argument (https://gitlab.com/saalen/highlight/issues/145) + - GUI: removed deprecated QTime API call + +== highlight 3.54.1 + +21.11.2019 + + - W32 CLI: fixed two pass mode if executed in Mingw shell + == highlight 3.54 11.11.2019 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/README.adoc new/highlight-3.55/README.adoc --- old/highlight-3.54/README.adoc 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/README.adoc 2020-01-29 19:05:28.000000000 +0100 @@ -1,6 +1,6 @@ = HIGHLIGHT MANUAL André Simon -v3.54, November 2019 +v3.55, January 2020 :lang: en :toc: left :toc-title: Contents @@ -627,6 +627,9 @@ EnableIndentation: Boolean, set true if syntax may be reformatted and indented IgnoreCase: Boolean, set true if keyword case should be ignored + +EncodingHint: String, default input file encoding + ................................................................................ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/README_DE.adoc new/highlight-3.55/README_DE.adoc --- old/highlight-3.54/README_DE.adoc 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/README_DE.adoc 2020-01-29 19:05:28.000000000 +0100 @@ -1,6 +1,6 @@ = HIGHLIGHT HANDBUCH André Simon -v3.54, November 2019 +v3.55, Januar 2020 :lang: de :toc: left :toc-title: Contents @@ -626,8 +626,10 @@ EnableIndentation: Boolean, True wenn Syntax formatiert und eingerueckt werden kann IgnoreCase: Boolean, True wenn Sprache nicht case-sensitive ist -................................................................................ +EncodingHint: String, Standard-Eingabeencoding + +................................................................................ ==== Globale Variablen diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/filetypes.conf new/highlight-3.55/filetypes.conf --- old/highlight-3.54/filetypes.conf 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/filetypes.conf 2020-01-29 19:05:28.000000000 +0100 @@ -14,6 +14,8 @@ -- -- You can assign complete filenames to a syntax, see the "cmake" entry. -- +-- A default input encoding can be set with an EncodingHint attribute (requires v. 3.55). +-- -- The first filetypes.conf found in a highlight search directory wins. See README.adoc for search dirs. -- -- You can override specific settings in ~/.highlight/filetypes.conf like this: @@ -36,7 +38,7 @@ { Lang="aspect", Extensions={"was", "wud"} }, { Lang="ballerina", Extensions={"bal"} }, { Lang="bat", Extensions={"cmd"} }, - { Lang="c", Extensions={"c++", "cpp", "cxx", "cc", "h", "hh", "hxx", "hpp", "cu"} }, + { Lang="c", Extensions={"c++", "cpp", "cxx", "cc", "h", "hh", "hxx", "hpp", "cu", "inl", "ipp"} }, { Lang="cmake", Filenames={"CMakeLists.txt"} }, { Lang="charmm", Extensions={"inp"} }, { Lang="coldfusion", Extensions={"cfc","cfm"} }, @@ -57,20 +59,20 @@ { Lang="gdscript", Extensions={"gd"} }, { Lang="haskell", Extensions={"hs"} }, { Lang="hugo", Extensions={"hug"} }, - { Lang="ini", Extensions={"doxyfile", "desktop", "kdev3"} }, + { Lang="ini", Extensions={"doxyfile", "desktop", "kdev3", "reg", "cfg", "inf"} }, { Lang="java", Extensions={"groovy", "grv", "jenkinsfile", "gradle"} }, { Lang="julia", Extensions={"jl"} }, - { Lang="kotlin", Extensions={"kt"} }, + { Lang="kotlin", Extensions={"kt", "kts"} }, { Lang="limbo", Extensions={"b"} }, - { Lang="lisp", Extensions={"cl", "clisp", "el", "lsp", "sbcl", "scom", "fas", "scm" } }, - { Lang="make", Extensions={"mak", "mk", "makefile"} }, + { Lang="lisp", Extensions={"cl", "clisp", "el", "lsp", "sbcl", "scom", "fas", "scm", "mud", "fasl" } }, + { Lang="make", Extensions={"mak", "mk", "makefile", "gnumakefile"} }, { Lang="meson", Filenames={ "meson.build", "meson_options.txt" } }, { Lang="snmp", Extensions={"mib", "smi"} }, { Lang="ocaml", Extensions={"ml","mli"} }, { Lang="mod2", Extensions={"mod", "def"} }, { Lang="mod3", Extensions={"m3", "i3"} }, { Lang="oberon", Extensions={"ooc"} }, - { Lang="php", Extensions={"php3", "php4", "php5", "php6"} }, + { Lang="php", Extensions={"php3", "php4", "php5", "php6", "php7", "phps", "phpt"} }, { Lang="pike", Extensions={"pmod"} }, { Lang="pl1", Extensions={"ff", "fp", "fpp", "rpp","sf", "sp", "spb", "spp","sps", "wp", "wf", "wpp","wps","wpb","bdy","spe"} }, @@ -79,7 +81,10 @@ { Lang="pro", Extensions={"pro"} }, { Lang="qmake", Extensions={"pro"} }, { Lang="progress", Extensions={"p", "i", "w"} }, - { Lang="ruby", Extensions={"rb","ruby", "pp", "rjs", "gemfile", "rakefile"} }, + { Lang="ruby", Extensions={"rb","ruby", "pp", "rjs", "gemfile", "rakefile", "appfile", "appraisals", "berksfile", + "brewfile", "capfile", "cgi", "cheffile", "config.ru", "deliverfile", "fastfile", "fcgi", "gemspec", + "guardfile", "irbrc", "jbuilder", "podfile", "podspec", "prawn", "rabl", "rake", "rantfile", "rbx", + "scanfile", "simplecov", "snapfile", "thor", "thorfile", "vagrantfile" } }, { Lang="rexx", Extensions={"rex", "rx", "the"} }, { Lang="sh", Extensions={"bash", "zsh", "ebuild", "eclass"} }, { Lang="smalltalk", Extensions={"st", "gst", "sq"} }, @@ -90,8 +95,9 @@ { Lang="verilog", Extensions={"v"} }, { Lang="html", Extensions={"htm", "xhtml", "twig", "jinja"} }, { Lang="xml", Extensions={"sgm", "sgml", "nrm", "ent","hdr", "hub", "dtd", "glade", - "wml","vxml", "wml", "tld", "csproj","xsl", "ecf", "jnlp", "xsd", "resx"} }, - { Lang="fsharp", Extensions={"fs","fsx"} }, + "wml","vxml", "wml", "tld", "csproj","xsl", "ecf", "jnlp", "xsd", + "resx", "rss", "opml"} }, + { Lang="fsharp", Extensions={"fs","fsi","fsx"} }, { Lang="informix", Extensions={"4gl"} }, { Lang="blitzbasic", Extensions={"bb"} }, { Lang="innosetup", Extensions={"iss"} }, @@ -133,7 +139,8 @@ { Lang="nasal", Extensions={"nas"} }, { Lang="clean", Extensions={"icl"} }, { Lang="bibtex", Extensions={"bib"} }, - { Lang="python", Extensions={"py"} }, + { Lang="python", Extensions={"py", "py3", "pyw", "pyi", "pyx", "pxd", "pxi", "rpy", "cpy", + "sconstruct", "gyp", "gypi", "snakefile", "wscript" } }, { Lang="python", Filenames={"SConstruct"} }, { Lang="txt", Extensions={"text"} }, { Lang="n3", Extensions={"ttl", "nt"} }, @@ -144,8 +151,9 @@ { Lang="vimscript", Extensions={"vim", "vimrc"} }, { Lang="purebasic", Extensions={"pb", "pbi", "pbf"} }, { Lang="markdown", Extensions={"md", "markdown"} }, - { Lang="clojure", Extensions={"clj"} }, + { 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.54/langDefs/hugo.lang new/highlight-3.55/langDefs/hugo.lang --- old/highlight-3.54/langDefs/hugo.lang 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/langDefs/hugo.lang 2020-01-29 19:05:28.000000000 +0100 @@ -1,8 +1,15 @@ -- ******************************** --- * Hugo Interactive Fiction * v1.0.0 || by Tristano Ajmone: --- * www.generalcoffee.com/hugo * 2019/05/24 || https://github.com/tajmone +-- * Hugo Interactive Fiction * v1.1.0 || by Tristano Ajmone: +-- * www.generalcoffee.com/hugo * 2019/11/14 || https://github.com/tajmone -- ******************************** public domain || http://unlicense.org -------------------------------------------------------------------------------- +Description = "Hugo" Categories = {"source", "interactive fiction"} +-------------------------------------------------------------------------------- +-- file extensions: +-- .hug -- adventure source +-- .h -- library source +-- .g -- grammar source +-------------------------------------------------------------------------------- -- Syntax definition for Hugo language v3.1.03 (2006). -- http://www.generalcoffee.com/hugo/gethugo.html @@ -11,15 +18,28 @@ -- graphics, developed by Kent Tessman for The General Coffee Company Film -- Productions, released under BSD-2-Clause License. -------------------------------------------------------------------------------- --- file extensions: --- .hug -- adventure source --- .h -- library source --- .g -- grammar source +-- Syntax elements: +-- * Comments -- single line (!) and block (!/ .. /!). +-- * Strings -- double quotes (") escapable with (\") +-- * Escape -- various + ASCII escapes. +-- * Interpolation -- special non-ASCII characters. +-- * PreProcessor +-- * Operators +-- * Digits -- decimal integers only. +-- * Keywords 1 -- Hugo reserved keywords. +-- * Keywords 2 -- Predefined Hugo stored values: +-- * Built-in Global Variables. +-- * Built-in Properties. +-- * Built-in Engine Variables. +-- * Keywords 3 -- Various elements that didn't fit elsewhere: +-- * Chars constants. +-- * System Words. +-- * Properties Qualifiers. +-- * Boolean Constants (true/false). +-- * Keywords 4 -- Limit Settings. -------------------------------------------------------------------------------- -Description = "Hugo" Categories = {"source", "interactive fiction"} IgnoreCase = true EnableIndentation = false --------------------------------------------------------------------------------- -Identifiers = [[ [\$]?[a-zA-Z_]\w*[#\$]? ]] +Identifiers = [[ [\$\~]?[a-zA-Z_]\w*\$? ]] Comments = {{ Block = true, Nested = false, @@ -57,7 +77,7 @@ ASCII number (or Latin-1 code). --]] Escape = [=[ (\\(?:["\\_nBbIiPpUu]|#\d{3})) ]=], --[[---------------------------------------------------------------------------- - INTERPOLATIONP + INTERPOLATION -------------------------------------------------------------------------------- We define the special char sequences as Interpolation to allow visual separation between them and the other escape sequences, which will make the code easier to @@ -81,7 +101,7 @@ \Y Japanese Yen (¥) NOTE: The RegEx below defines twice the acute accent (´) char because depending - on wether the source is in ASCII/ISO-8859-1 or UTF-8 its encoding will + on whether the source is in ASCII/ISO-8859-1 or UTF-8 its encoding will differ (the former is the expected encoding for Hugo sourceS, but the latter might be encountered in documentation projects). --]] Interpolation = [=[ (?x)(\\(?: @@ -93,63 +113,150 @@ [cLY] # Currencies: ¢ £ ¥. )) ]=] } PreProcessor = { - Prefix = [[ # ]], + Prefix = [=[ \A(?!x)x ]=], -- never matching RegEx! Continuation = "\\" } -Operators = [[ \&|<|>|\||\=|\/|\*|\+|\-|~ ]] +Operators = [[ \&|\#|<|>|\||\=|\/|\*|\+|\-|~ ]] Digits = [[ \d+ ]] Keywords = {{ ------------------------------------------------------------------------------ Id = 1, List = { -- Hugo keywords # 1 ------------------------------------------------------------------------------ - "addcontext", "and", "anything", "array", "arraydata#", "attr#", "break", - "call", "capital", "case", "child", "children", "cls", "color", "colour", - "debugdata#", "dict", "dictentry#", "do", "elder", "eldest", "else", - "elseif", "eol#", "false", "for", "graphics", "held", "hex", "if", "in", - "input", "is", "jump", "label#", "local", "locate", "move", "multi", - "multiheld", "multinotheld", "music", "newline", "not", "notheld", "number", - "object", "objectnum#", "or", "parent", "parse$", "pause", "picture", - "playback", "print", "printchar", "prop#", "quit", "random", "readfile", - "readval", "recordoff", "recordon", "remove", "repeat", "restart", "restore", - "return", "routine#", "run", "runevents", "save", "scriptoff", "scripton", - "select", "serial$", "sibling", "sound", "string", "stringdata#", "system", - "text", "textdata#", "to", "true", "undo", "value#", "var#", "verb", "video", - "while", "window", "word", "writefile", "writeval", "xobject", "xverb", - "younger", "youngest" }},{ + "addcontext", "alias", "and", "anything", "array", "attribute", "break", + "call", "capital", "case", "child", "children", "class", "cls", "color", + "colour", "compound", "constant", "dict", "do", "elder", "eldest", "else", + "elseif", "enumerate", "event", "for", "global", "graphics", "held", "hex", + "if", "in", "input", "is", "jump", "local", "locate", "move", "multi", + "multiheld", "multinotheld", "music", "nearby", "newline", "not", "notheld", + "number", "or", "parent", "pause", "picture", "playback", "print", + "printchar", "property", "punctuation", "quit", "random", "readfile", + "readval", "recordoff", "recordon", "removal", "remove", "repeat", + "replace", "resource", "restart", "restore", "return", "routine", "run", + "runevents", "save", "scriptoff", "scripton", "select", "sibling", "sound", + "start", "step", "string", "synonym", "system", "text", "to", "undo", + "verb", "video", "while", "window", "word", "writefile", "writeval", + "xverb", "younger", "youngest", + }},{ + ------------------------------------------------------------------------------ + Id = 2, List = { -- Predefined Engine Stored Values # 2 + ------------------------------------------------------------------------------ + --| Built-in Global Variables |--------------------------------------------- + ---------------------------------------------------------------------------- + "actor", "endflag", "location", "object", "objects", "player", "prompt", + "self", "system_status", "verbroutine", "words", "xobject", + ---------------------------------------------------------------------------- + --| Built-in Properties |--------------------------------------------------- + ---------------------------------------------------------------------------- + -- NOTE: "adjectives" and "nouns" are aliases defined by Hugo library, and + -- not tokens defined in the Hugo engine and compiler. + ---------------------------------------------------------------------------- + "adjective", "after", "article", "before", "name", "noun", + ---------------------------------------------------------------------------- + --| Built-in Engine Variables |--------------------------------------------- + ---------------------------------------------------------------------------- + "parse$", "serial$", + }},{ ------------------------------------------------------------------------------ - Id = 2, -- ASCII Chars constants # 2 + Id = 3, -- Chars Constants + System Words + Properties Qualifiers # 3 ------------------------------------------------------------------------------ - Regex = [=[ '[\x00-\x7F]' ]=] },{ + --| ASCII Chars constants |------------------------------------------------- + ---------------------------------------------------------------------------- + Regex = [=[ '[\x00-\x7F]' ]=] , },{ + ---------------------------------------------------------------------------- + --| System Words |---------------------------------------------------------- + ---------------------------------------------------------------------------- + Id = 3, List = { + "~all", "~and", "~any", "~except", "~oops", + ---------------------------------------------------------------------------- + --| Properties Qualifiers |------------------------------------------------- + ---------------------------------------------------------------------------- + "$additive", "$complex", + ---------------------------------------------------------------------------- + --| Boolean Constants |----------------------------------------------------- + ---------------------------------------------------------------------------- + "true", "false", + }},{ ------------------------------------------------------------------------------ - Id = 3, -- Limit Settings # 3 + Id = 4, -- Limit Settings # 4 ------------------------------------------------------------------------------ Regex = [=[ (?x-i) - (\$MAX(?: - ATTRIBUTES|GLOBALS|LOCALS|ALIASES|ARRAYS|CONSTANTS|DICTEXTEND|DICT| - DIRECTORIES|EVENTS|FLAGS|LABELS|OBJECTS|PROPERTIES|ROUTINES|SPECIALWORDS - )) ]=], - Group = 0 + (\$MAX (?: ALIASES | ARRAYS | ATTRIBUTES | CONSTANTS | DICTEXTEND | DICT | + DIRECTORIES | EVENTS | FLAGS | GLOBALS | LABELS | LOCALS | OBJECTS | + PROPERTIES | ROUTINES | SPECIALWORDS )) ]=], + Group = 0 + },{ + ------------------------------------------------------------------------------ + Id = 5, -- PreProcessor + ------------------------------------------------------------------------------ + -- These tokens are captured as keywords but then thrown back as PreProcessor + -- via OnStateChange(). This is needed because setting '#' as PreProcessor + -- delimiter would prevent capturing the '#' token for counting properties. + + Regex = [=[ (?x-i) + (\#(?: + if(clear | set | defined | undefined) | if | elseif | else | endif | + clear | set | include | link | message | switches | version + )\b) ]=], + Group = 0 }} -function OnStateChange(oldState, newState, token, kwgroup) --[[ - ============================================================================== - #01 -- Ignore Escape Sequences Outside Strings - ============================================================================== - This function ensures that escape sequences outside strings are ignored: - tokens matching an escape sequence are rejected if the previously parsed token - was not a string, an interpolation or another escape sequence. - - Based on André Simon's reply to Issue #23: - https://github.com/andre-simon/highlight/issues/23#issuecomment-332002639 - ----------------------------------------------------------------------------]] - if newState == HL_ESC_SEQ and - oldState ~= HL_STRING and - oldState ~= HL_ESC_SEQ and - oldState ~= HL_INTERPOLATION then + +function OnStateChange(oldState, newState, token, kwgroup) + --============================================================================ + -- #01 -- Ignore Escape Sequences Outside Strings + --============================================================================ + if newState == HL_ESC_SEQ and -- An escape seq. must follow either: + oldState ~= HL_STRING and -- * a string + oldState ~= HL_ESC_SEQ and -- * an escape sequence + oldState ~= HL_INTERPOLATION then -- * an interpolation + return HL_REJECT -- otherwise, reject it. + --============================================================================ + -- #02 -- Ignore Interpolations Inside Preprocessor Strings + --============================================================================ + elseif + newState == HL_INTERPOLATION and + oldState == HL_PREPROC_STRING then return HL_REJECT + --============================================================================ + -- #03 -- Throw Back Keywords from Group 5 as PreProcessor + --============================================================================ + elseif + newState == HL_KEYWORD and + kwgroup == 5 then + return HL_PREPROC end return newState end --[[============================================================================ + KNOWN ISSUES +================================================================================ +FilePath Strings: + + Escape sequences and interpolations shouldn't show up inside file path strings + following keywords like `resource`, `picture` and other similar keywords which + expect a file string after them. The syntax should track strings immediately + following these keywords and discard escapes/interpolations accordingly. The + `resource` keyword is going to be trickier because it allows multiple strings + inside a `{..}` block (and strings might be followed by comments). +================================================================================ CHANGELOG ================================================================================ +v1.1.0 (2019/11/14) | Highlight v3.54 + - Polish source. + - List keywords one kwd per line to simplify WIP and tracking changes. + - NEW: + - Added missing keyword tokens. + - Removed keyword "adjectives" and "nouns" (library defined aliases). + - Kwd Group 2 now hosts predefined Engine Values: + - Built-in Global Variables. (moved here from Group 1) + - Built-in Properties. (moved here from Group 1) + - Kwd Groups 3 and 4 are shifted and become 4 and 5. + - Kwd Group 3: (was 2) added also, along with Char Constants: + - System Words. + - Properties Qualifiers. + - Boolean Constants (true/false: moved from Group 1). + - FIXES: + - Identifiers patterns tweaked to include tokens starting with tilde. + - Ignore interpolations inside preprocessor strings. + - PreProcessor: prevent matching the '#' for proprieties count as the + beginning of a preprocessor directive. v1.0.0 (2019/05/24) | Highlight v3.51 - First release. --]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/man/highlight.1 new/highlight-3.55/man/highlight.1 --- old/highlight-3.54/man/highlight.1 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/man/highlight.1 2020-01-29 19:05:28.000000000 +0100 @@ -1,4 +1,4 @@ -.TH highlight 1 "2019-07-27" "Andre Simon" "user documentation" +.TH highlight 1 "2020-01-18" "Andre Simon" "user documentation" .SH NAME Highlight - a universal sourcecode to formatted text converter @@ -36,8 +36,8 @@ name of output directory .IP "-P, --progress" print progress bar in batch mode -.IP "-S, --syntax=<type>" -set type of source code, necessary if input file suffix is missing +.IP "-S, --syntax=<type|path>" +set type of source code, necessary if input file suffix is missing. The syntax may also be defined as path of the language file. .IP "--syntax-by-name=<name>" specify type of source code by given name. Will not read a file of this name, useful for stdin and to determine the syntax of the file before piping its content to highlight. This option overrides --syntax. .IP "-v, --verbose" @@ -107,8 +107,8 @@ start line numbering with cnt (assumes -l) .IP "--line-range=<start-end>" output only lines from number <start> to <end> -.IP "-s, --style=<style name>" -set highlighting style (theme). See --base16. +.IP "-s, --style=<style name|path>" +set highlighting style (theme). Add 'base16/' prefix to use a Base16 theme. The theme may also be defined as path of the theme file. .IP "-t --replace-tabs=<num>" replace tabs by num spaces .IP "-u, --encoding=<enc>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/plugins/outhtml_ansi_esc.lua new/highlight-3.55/plugins/outhtml_ansi_esc.lua --- old/highlight-3.54/plugins/outhtml_ansi_esc.lua 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/plugins/outhtml_ansi_esc.lua 2020-01-29 19:05:28.000000000 +0100 @@ -13,8 +13,8 @@ function Decorate(token) if token == "\27" then - -- return "<span class=\"hl esc\">ESC</span>" - -- return "�" + -- return "<span class=\"hl esc\">ESC</span>" + -- return "�" return "鉃" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/ci_test.sh new/highlight-3.55/src/ci_test.sh --- old/highlight-3.54/src/ci_test.sh 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/ci_test.sh 2020-01-29 19:05:28.000000000 +0100 @@ -3,7 +3,7 @@ # cwd: unpacked tarball dir echo "Starting CI verification script" -git clone https://gitlab.com/tajmone/highlight-test-suite/ +git clone --depth 1 https://gitlab.com/tajmone/highlight-test-suite/ #OUTPUT=`./src/highlight --list-scripts=langs` HL_BIN=./src/highlight @@ -18,122 +18,24 @@ exit 1 fi -${HL_BIN} ${TEST_DIR}/bash/syntax_test_heredoc.sh -if [ $? -eq 0 ]; then - echo "bash test #1 OK" -else - echo "bash test #1 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/js/syntax_test_string.js -if [ $? -eq 0 ]; then - echo "js test #1 OK" -else - echo "js test #1 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/nim/syntax_test_keywords.nim -if [ $? -eq 0 ]; then - echo "nim test #1 OK" -else - echo "nim test #1 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/perl/syntax_test_heredoc.pl -if [ $? -eq 0 ]; then - echo "perl test #1 OK" -else - echo "perl test #1 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/ruby/syntax_test_heredoc.rb -if [ $? -eq 0 ]; then - echo "ruby test #1 OK" -else - echo "ruby test #1 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/lua/syntax_test_com_str.lua -if [ $? -eq 0 ]; then - echo "lua test #1 OK" -else - echo "lua test #1 FAILED" - exit 1 -fi +# new set of test scripts -${HL_BIN} ${TEST_DIR}/exapunks/syntax_test_macros.exa -if [ $? -eq 0 ]; then - echo "exapunks test #1 OK" -else - echo "exapunks test #1 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/exapunks/syntax_test_labels.exa -if [ $? -eq 0 ]; then - echo "exapunks test #2 OK" -else - echo "exapunks test #2 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/exapunks/syntax_test_numbers.exa -if [ $? -eq 0 ]; then - echo "exapunks test #3 OK" -else - echo "exapunks test #3 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/exapunks/syntax_test_registers.exa -if [ $? -eq 0 ]; then - echo "exapunks test #4 OK" -else - echo "exapunks test #4 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/exapunks/syntax_test_comments.exa -if [ $? -eq 0 ]; then - echo "exapunks test #5 OK" -else - echo "exapunks test #5 FAILED" - exit 1 -fi +declare -a arr=("bash" "cpp" "exapunks" "hugo" "js" "lua" "nim" "perl" "purebasic" "ruby") -${HL_BIN} ${TEST_DIR}/hugo/syntax_test_comments.hug -if [ $? -eq 0 ]; then - echo "hugo test #1 OK" -else - echo "hugo test #1 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/hugo/syntax_test_keywords.hug -if [ $? -eq 0 ]; then - echo "hugo test #2 OK" -else - echo "hugo test #2 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/hugo/syntax_test_strings.hug -if [ $? -eq 0 ]; then - echo "hugo test #3 OK" -else - echo "hugo test #3 FAILED" - #no error until test case is adopted to UTF-8 fix in 3.53 - #exit 1 -fi -${HL_BIN} ${TEST_DIR}/hugo/syntax_test_chars.hug -if [ $? -eq 0 ]; then - echo "hugo test #4 OK" -else - echo "hugo test #4 FAILED" - exit 1 -fi -${HL_BIN} ${TEST_DIR}/hugo/syntax_test_compiler-directives.hug -if [ $? -eq 0 ]; then - echo "hugo test #5 OK" -else - echo "hugo test #5 FAILED" - exit 1 -fi +for d in "${arr[@]}" +do + bash ${TEST_DIR}/$d/regression.sh + if [ $? -eq 0 ]; then + echo "$d regression tests OK" + else + echo "$d regression tests FAILED" + exit 1 + fi +done + + +# special configurations echo '#!/usr/bin/perl' | ${HL_BIN} --verbose 2>&1 >/dev/null | grep 'Description: Perl' if [ $? -eq 0 ]; then @@ -159,9 +61,3 @@ exit 1 fi -#if [ "$OUTPUT" == "BEGIN ... END" ]; then -# echo "Output is correct, OK" -#else -# echo "Output is not right, FAIL" -# exit 1 -#fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/cli/cmdlineoptions.cpp new/highlight-3.55/src/cli/cmdlineoptions.cpp --- old/highlight-3.54/src/cli/cmdlineoptions.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/cli/cmdlineoptions.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -195,6 +195,7 @@ opt_no_version_info(false), explicit_output_format(false), opt_isolate(false), + opt_encoding_explicit(false), maxFileSize(268435456), fallbackSyntax("txt"), anchorPrefix ( "l" ), @@ -401,11 +402,20 @@ break; case 's': styleName = arg; + if (Platform::fileExists(styleName)){ + absThemePath = styleName; + } break; case 'S': case S_OPT_COMPAT_SRCLANG: syntax = arg; opt_syntax = true; + + if (Platform::fileExists(arg)){ + absLangPath = arg; + syntax = arg.substr(0, arg.find_last_of('.')); + + } break; case 't': case S_OPT_COMPAT_TAB: @@ -413,6 +423,7 @@ break; case 'u': encodingName = arg; + opt_encoding_explicit=true; break; case 'v': opt_verbose = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/cli/cmdlineoptions.h new/highlight-3.55/src/cli/cmdlineoptions.h --- old/highlight-3.54/src/cli/cmdlineoptions.h 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/cli/cmdlineoptions.h 2020-01-29 19:05:28.000000000 +0100 @@ -286,6 +286,12 @@ /** \return True if encoding specification should be omitted in output*/ bool omitEncoding() const; + /** \return True if encoding was set by user*/ + bool encodingDefined() const + { + return opt_encoding_explicit; + } + /** \return True if output should be generated if language type is unknown*/ bool forceOutput() const; @@ -484,6 +490,7 @@ bool opt_no_version_info; bool explicit_output_format; bool opt_isolate; + bool opt_encoding_explicit; off_t maxFileSize; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/cli/help.cpp new/highlight-3.55/src/cli/help.cpp --- old/highlight-3.54/src/cli/help.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/cli/help.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -41,7 +41,7 @@ cout <<"File extensions and shebangs are mapped to language definitions in \n"; cout <<"filetypes.conf (see --print-config for the configuration search paths).\n"; cout <<"\n"; - cout <<"Apply custom language definitions with --config-file.\n"; + cout <<"Apply custom language definitions with --config-file or as absolute path to -S.\n"; cout <<"\n"; cout <<"Use plug-in scripts (--plug-in) to modify syntax parsing and output.\n"; cout <<"\n"; @@ -61,13 +61,13 @@ cout <<"\n"; cout <<"These descriptions are saved as Lua scripts in HL_DATA_DIR/themes.\n"; cout <<"\n"; - cout <<"Apply custom themes with --config-file.\n"; + cout <<"Apply custom themes with --config-file or as absolute path to --theme.\n"; cout <<"\n"; cout <<"Use plug-in scripts (--plug-in) to modify the formatting output.\n"; cout <<"\n"; cout <<"Print all installed themes with --list-scripts=themes.\n"; cout <<"\n"; - cout <<"Use --base16 to read a theme of the Base16 set.\n"; + cout <<"Use --base16 to read a theme of the Base16 set or add 'base16/' as prefix.\n"; cout <<"\n"; cout <<"Exemplary config files:\n"; cout <<"darkspectrum.theme: dark canvas (vim) \n"; @@ -131,7 +131,7 @@ cout<<" -o, --output=<file> name of single output file\n"; cout<<" -P, --progress print progress bar in batch mode\n"; cout<<" -q, --quiet suppress progress info in batch mode\n"; - cout<<" -S, --syntax=<type> specify type of source code\n"; + cout<<" -S, --syntax=<type|path> specify type of source code or syntax file path\n"; cout<<" --syntax-by-name=<name> specify type of source code by given name\n"; cout<<" will not read a file of this name, useful for stdin\n"; cout<<" -v, --verbose print debug info\n"; @@ -184,7 +184,7 @@ cout<<" -K, --font-size=<num?> set font size (specific to output format)\n"; cout<<" -l, --line-numbers print line numbers in output file\n"; cout<<" -m, --line-number-start=<cnt> start line numbering with cnt (assumes -l)\n"; - cout<<" -s, --style=<style> set colour style (theme). See --base16\n"; + cout<<" -s, --style=<style|path> set colour style (theme) or theme file path\n"; cout<<" -t, --replace-tabs=<num> replace tabs by <num> spaces\n"; cout<<" -T, --doc-title=<title> document title\n"; cout<<" -u, --encoding=<enc> set output encoding which matches input file\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/cli/main.cpp new/highlight-3.55/src/cli/main.cpp --- old/highlight-3.54/src/cli/main.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/cli/main.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -45,7 +45,7 @@ { cout << "\n highlight version " << HIGHLIGHT_VERSION - << "\n Copyright (C) 2002-2019 Andre Simon <a dot simon at mailbox.org>" + << "\n Copyright (C) 2002-2020 Andre Simon <a dot simon at mailbox.org>" << "\n\n Argparser class" << "\n Copyright (C) 2006-2008 Antonio Diaz Diaz <ant_diaz at teleline.es>" << "\n\n Artistic Style Classes (3.1)" @@ -426,7 +426,7 @@ options.getLineLength() - options.getNumberWidth() : options.getLineLength(), options.getNumberSpaces() ); - generator->setEncoding ( options.getEncoding() ); + //generator->setEncoding ( options.getEncoding() ); generator->setBaseFont ( options.getBaseFont() ) ; generator->setBaseFontSize ( options.getBaseFontSize() ) ; generator->setLineNumberWidth ( options.getNumberWidth() ); @@ -594,6 +594,22 @@ printDebugInfo ( generator->getSyntaxReader(), langDefPath ); } lastSuffix = suffix; + + string encoding= options.getEncoding(); + //user has explicitly defined the encoding: + if (!options.encodingDefined()) { + + //syntax definition setting: + string encodingHint= generator->getSyntaxEncodingHint(); + if (encodingHint.size()) + encoding=encodingHint; + + // filetypes.conf setting has higher priority: + encodingHint= dataDir.getEncodingHint(suffix); + if (encodingHint.size()) + encoding=encodingHint; + } + generator->setEncoding (encoding); } if (twoPassMode && !generator->syntaxRequiresTwoPassRun()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/core/codegenerator.cpp new/highlight-3.55/src/core/codegenerator.cpp --- old/highlight-3.54/src/core/codegenerator.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/core/codegenerator.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -467,6 +467,11 @@ return (currentSyntax)? currentSyntax->getDescription(): "syntax undef"; } +string CodeGenerator::getSyntaxEncodingHint() +{ + return (currentSyntax)? currentSyntax->getEncodingHint(): ""; + +} string CodeGenerator::getThemeDescription() { return docStyle.getDescription(); @@ -1682,7 +1687,7 @@ { bool eof=false, firstLine=true; // avoid newline before printing the first output line - + applySyntaxTestCase = inFile.find("syntax_test_")!=string::npos; if ( currentSyntax->highlightingDisabled() ) { @@ -1705,7 +1710,9 @@ State state=STANDARD; - openTag ( STANDARD ); + if (outputType!=ESC_TRUECOLOR && outputType!=ESC_XTERM256) + openTag ( STANDARD ); + do { // determine next state state= getCurrentState(STANDARD); @@ -1779,11 +1786,17 @@ processWsState(); break; default: + + if ((outputType==ESC_TRUECOLOR || outputType==ESC_XTERM256) && token.size()) + openTag ( STANDARD ); + printMaskedToken (); break; } } while ( !eof ); - closeTag ( STANDARD ); + + if (token.size() || lineNumber>1 || (outputType!=ESC_TRUECOLOR && outputType!=ESC_XTERM256)) + closeTag ( STANDARD ); if (currentSyntax->getDecorateLineEndFct()) { Diluculum::LuaValueList res=callDecorateLineFct(false); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/core/datadir.cpp new/highlight-3.55/src/core/datadir.cpp --- old/highlight-3.54/src/core/datadir.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/core/datadir.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -2,7 +2,7 @@ dataDir.cpp - description ------------------- begin : Sam March 1 2003 - copyright : (C) 2003-2019 by Andre Simon + copyright : (C) 2003-2020 by Andre Simon email : [email protected] ***************************************************************************/ @@ -160,7 +160,12 @@ const string DataDir::getDocDir() { - return getSystemDataPath() ; + return getSystemDataPath(); +} + +const string DataDir::getEncodingHint (const string &syntax) { + + return encodingHint[getFileBaseName(syntax)]; } @@ -210,6 +215,8 @@ readLuaList("Filenames", langName, mapEntry, &assocByFilename); } else if (mapEntry["Shebang"] !=Diluculum::Nil) { 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.54/src/core/syntaxreader.cpp new/highlight-3.55/src/core/syntaxreader.cpp --- old/highlight-3.54/src/core/syntaxreader.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/core/syntaxreader.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -430,6 +430,10 @@ footerInjection+= ls["FooterInjection"].value().asString(); } + if (globals.count("EncodingHint")) { + encodingHint = ls["EncodingHint"].value().asString(); + } + // load hook functions if (globals.count("OnStateChange")) { validateStateChangeFct=new Diluculum::LuaFunction(ls["OnStateChange"].value().asFunction()); @@ -599,7 +603,7 @@ <<" Priority=1,\n" <<" Constraints = {\n" <<" Line = "<<lineNumber<<",\n" - <<" Filename = \""<<fileName<<"\",\n" + <<" Filename = [=["<<fileName<<"]=],\n" <<" }\n" <<"})"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/core/xterm256generator.cpp new/highlight-3.55/src/core/xterm256generator.cpp --- old/highlight-3.54/src/core/xterm256generator.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/core/xterm256generator.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -60,7 +60,8 @@ string Xterm256Generator::getFooter() { - return string("\033[m"); + //return noTrailingNewLine ? "" : "\033[m"; + return string(); } string Xterm256Generator::maskCharacter ( unsigned char c ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/gui-qt/mainwindow.cpp new/highlight-3.55/src/gui-qt/mainwindow.cpp --- old/highlight-3.54/src/gui-qt/mainwindow.cpp 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/gui-qt/mainwindow.cpp 2020-01-29 19:05:28.000000000 +0100 @@ -2,7 +2,7 @@ mainwindow.cpp ------------------- begin : Mo 16.03.2009 - copyright : (C) 2009-2019 by Andre Simon + copyright : (C) 2009-2020 by Andre Simon email : [email protected] ***************************************************************************/ @@ -648,6 +648,8 @@ readLuaList("Filenames", langName, mapEntry, &assocByFilename); } else if (mapEntry["Shebang"] !=Diluculum::Nil) { assocByShebang.insert ( make_pair ( mapEntry["Shebang"].asString(), langName ) ); + } else if (mapEntry["EncodingHint"] !=Diluculum::Nil) { + encodingHints.insert ( make_pair ( langName, mapEntry["EncodingHint"].asString() ) ); } idx++; } @@ -747,7 +749,7 @@ QMessageBox::about( this, "About Highlight", QString("Highlight is a code to formatted text converter.\n\n" "Highlight GUI %1\n" - "(C) 2002-2019 Andre Simon <a.simon at mailbox.org>\n\n" + "(C) 2002-2020 Andre Simon <a.simon at mailbox.org>\n\n" "Artistic Style Classes\n(C) 1998-2002 Tal Davidson\n" "(C) 2006-2018 Jim Pattee <jimp03 at email.com>\n\n" "Diluculum Lua wrapper\n" @@ -920,11 +922,7 @@ QMessageBox::critical(this,"Theme init error", QString::fromStdString(generator->getThemeInitError())); } - if (ui->cbEncoding->isChecked()) { - generator->setEncoding(ui->comboEncoding->currentText().toStdString()); - } else { - generator->setEncoding("none"); - } + generator->setValidateInput(ui->cbValidateInput->isChecked()); generator->setLineNumberWidth(ui->sbLineNoWidth->value()); generator->setNumberWrappedLines(!ui->cbOmitWrappedLineNumbers->isChecked()); @@ -973,6 +971,26 @@ return (ui->cbWrapping->isChecked())?highlight::WRAP_DEFAULT:highlight::WRAP_DISABLED; } +void MainWindow::applyEncoding(highlight::CodeGenerator* generator, QString &langDefPath) { + if (ui->cbEncoding->isChecked()) { + generator->setEncoding(ui->comboEncoding->currentText().toStdString()); + } else { + + string encoding="none"; + //syntax definition setting: + string encodingHint= generator->getSyntaxEncodingHint(); + if (encodingHint.size()) + encoding=encodingHint; + + // filetypes.conf setting has higher priority: + encodingHint= encodingHints[QFileInfo(langDefPath).baseName().toStdString()]; + if (encodingHint.size()) + encoding=encodingHint; + + generator->setEncoding(encoding); + } +} + void MainWindow::on_pbStartConversion_clicked() { if (!ui->lvInputFiles->count()) return; @@ -1023,7 +1041,7 @@ ui->pbCopyFile2CP->setDisabled(true); this->setCursor(Qt::WaitCursor); - QTime t; + QElapsedTimer t; t.start(); std::unique_ptr<highlight::CodeGenerator> generator(highlight::CodeGenerator::getInstance(outType)); @@ -1141,6 +1159,9 @@ generator->setHTMLAnchorPrefix(inFileName.toStdString()); } generator->setTitle(inFileName.toStdString()); + + applyEncoding(generator.get(), langDefPath); + error = generator->generateFile(currentFile, outfileName ); if (error != highlight::PARSE_OK) { if (error == highlight::BAD_INPUT) { @@ -1325,11 +1346,15 @@ langPath = getWindowsShortPath(langPath); #endif + QString clipBoardData; for (int twoPass=0; twoPass<2; twoPass++) { if ( generator->loadLanguage(langPath.toStdString()) != highlight::LOAD_FAILED) { + + applyEncoding(generator.get(), langPath); + if (getDataFromCP) { clipBoardData= QString::fromStdString( generator->generateString(savedClipboardContent.toStdString())); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/gui-qt/mainwindow.h new/highlight-3.55/src/gui-qt/mainwindow.h --- old/highlight-3.54/src/gui-qt/mainwindow.h 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/gui-qt/mainwindow.h 2020-01-29 19:05:28.000000000 +0100 @@ -2,7 +2,7 @@ mainwindow.h ------------------- begin : Mo 16.03.2009 - copyright : (C) 2009-2018 by Andre Simon + copyright : (C) 2009-2020 by Andre Simon email : [email protected] ***************************************************************************/ @@ -49,7 +49,7 @@ #include <QDir> #include <QClipboard> #include <QMimeData> -#include <QTime> +#include <QElapsedTimer> #include <QShortcut> #include <QString> #include <QList> @@ -84,7 +84,7 @@ private: Ui::MainWindowClass *ui; MMap assocByExtension, assocByFilename; - SMap assocByShebang, rememberedAssoc; + SMap assocByShebang, rememberedAssoc, encodingHints; QString fileOpenFilter; QString savedClipboardContent; QString twoPassOutFile; @@ -116,6 +116,8 @@ QString getWindowsShortPath(const QString & path); void applyCtrlValues(highlight::CodeGenerator* generator, bool previewMode); + void applyEncoding(highlight::CodeGenerator* generator, QString &langDefPath); + void selectSingleFile(QLineEdit*, const QString&, const QString&); bool loadFileTypeConfig(); bool shortNamesDisabled(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/include/codegenerator.h new/highlight-3.55/src/include/codegenerator.h --- old/highlight-3.54/src/include/codegenerator.h 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/include/codegenerator.h 2020-01-29 19:05:28.000000000 +0100 @@ -427,6 +427,9 @@ /** \return Syntaxreader description */ string getSyntaxDescription(); + /** \return Encoding hint */ + string getSyntaxEncodingHint(); + /** \return Theme description */ string getThemeDescription(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/include/datadir.h new/highlight-3.55/src/include/datadir.h --- old/highlight-3.54/src/include/datadir.h 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/include/datadir.h 2020-01-29 19:05:28.000000000 +0100 @@ -65,7 +65,7 @@ public: - StringMap assocByExtension, assocByFilename, assocByShebang; + StringMap assocByExtension, assocByFilename, assocByShebang, encodingHint; static string LSB_DATA_DIR; static string LSB_CFG_DIR; @@ -119,8 +119,11 @@ /** \return Location of documentation (README) files (GUI) */ const string getDocDir(); - // These functions were moved from main.cpp in 3.51: - + /** \param snytax name + \return Encoding hint assigned to the syntax */ + const string getEncodingHint (const string &); + + /** * \param fileName input file name * \return file extension or the base filename if no file extension exists diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/include/syntaxreader.h new/highlight-3.55/src/include/syntaxreader.h --- old/highlight-3.54/src/include/syntaxreader.h 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/include/syntaxreader.h 2020-01-29 19:05:28.000000000 +0100 @@ -2,7 +2,7 @@ syntaxreader.h - description ------------------- begin : Wed Nov 28 2001 - copyright : (C) 2001-2019 by Andre Simon + copyright : (C) 2001-2020 by Andre Simon email : [email protected] ***************************************************************************/ @@ -279,6 +279,14 @@ return currentPath; } + /** + \return encoding which is normally used for input files of this syntax + */ + string getEncodingHint() const + { + return encodingHint; + } + /** \return test function */ @@ -381,7 +389,7 @@ string currentInputFile; // Language description - string langDesc, categories; + string langDesc, categories, encodingHint; string headerInjection, footerInjection; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/src/include/version.h new/highlight-3.55/src/include/version.h --- old/highlight-3.54/src/include/version.h 2019-11-11 17:57:10.000000000 +0100 +++ new/highlight-3.55/src/include/version.h 2020-01-29 19:05:28.000000000 +0100 @@ -2,7 +2,7 @@ version.h - description ------------------- begin : Mon March 3 2003 - copyright : (C) 2003-2019 by Andre Simon + copyright : (C) 2003-2020 by Andre Simon email : [email protected] ***************************************************************************/ @@ -29,7 +29,7 @@ #define VERSION_H #define HIGHLIGHT_MAJOR "3" -#define HIGHLIGHT_MINOR "54" +#define HIGHLIGHT_MINOR "55" #define HIGHLIGHT_VERSION HIGHLIGHT_MAJOR "." HIGHLIGHT_MINOR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/highlight-3.54/validate.sh new/highlight-3.55/validate.sh --- old/highlight-3.54/validate.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/highlight-3.55/validate.sh 2020-01-29 19:05:28.000000000 +0100 @@ -0,0 +1,57 @@ +#!/bin/bash + +# "validate.sh" v1.0.2 | 2019/10/20 +#------------------------------------------------------------------------------- +# Validate code style consistency in the repository via EditorConfig settings +# and the EClint validator tool: +# https://editorconfig.org +# https://www.npmjs.com/package/eclint +#------------------------------------------------------------------------------- +echo -e "\n\033[34;1m================================================" +echo -e "\033[33;1mValidating Code Styles via EditorConfig Settings" +echo -e "\033[34;1m================================================\033[0m" + +# ================== +# Check Dependencies +# ================== +# Since the script might also be run locally by end users, check that EClint is +# installed on the user machine: + +if eclint --version > /dev/null 2>&1 ; then + echo -e "Using:" + echo -e "\033[34;1m*\033[35m Node.js $(node -v)" + echo -e "\033[34;1m*\033[35m EClint v$(eclint --version).\n\033[31;1m" +else + echo -e "\033[31;1m~~~ ERROR! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + echo -e "In order to run this script you need to install EClint (Node.js):\n" + echo -e "\thttps://www.npmjs.com/package/eclint" + echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\033[0m" + echo -e "If you've already installed Node.js on your machine, type:\n" + echo -e "\033[33;1m\tnpm install -g eclint" + echo -e "\033[31;1m\n/// Aborting All Tests ///\033[0m" + exit 1 +fi + +# ============== +# Validate Files +# ============== +# Check that project files meet the code style standards set in `.editorconfig`; +# if not, print only the list of files that failed -- because EClint reports are +# usually too long. + +tmpLog=./eclint.log +eclint check 2> $tmpLog || { + echo -e "\033[31;1m~~~ ERROR! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; + echo -e "The following files didn't pass the validation test:\n\033[33;1m"; + cat $tmpLog | grep "^[^ ]"; + echo -e "\n\033[31;1mRun ECLint locally for detailed information about the problems."; + echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; + echo -e "/// Aborting All Tests ///\033[0m"; + rm $tmpLog; + exit 1; + } +rm $tmpLog; +echo -e "\033[32;1m/// Test Passed ///\033[0m" +exit + +# EOF #
