From 6501fe8c2d74bc8fb2b798117479c14a03c4f04e Mon Sep 17 00:00:00 2001
From: Peter Johnson <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 6 Oct 2022 23:03:34 +0100
Subject: [PATCH 01/33] Create .gitattributes
Get Linguist to highlight .ps files as Pascal (fixes #36)
Also get Linguist to count Markdown files in repo stats (no related issue)
---
.gitattributes | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..765207f
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,6 @@
+# Customise GitHub Linguist
+
+# Highlight Inno Setup's .ps files as Pascal
+*.ps linguist-language=Pascal
+# Include Markdown files in stats
+*.md linguist-detectable
From c16b3af976ace701cffef9375d244c4d02ff3a7b Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Tue, 18 Oct 2022 12:53:12 +0100
Subject: [PATCH 02/33] Add new -v option as alias for --version
---
Src/UParams.pas | 1 +
1 file changed, 1 insertion(+)
diff --git a/Src/UParams.pas b/Src/UParams.pas
index 2357191..0ccf1b8 100644
--- a/Src/UParams.pas
+++ b/Src/UParams.pas
@@ -219,6 +219,7 @@ constructor TParams.Create(const Config: TConfig);
Add('-r', siInputClipboard);
Add('-s', siEmbedCSS);
Add('-t', siTitle);
+ Add('-v', siVersion);
Add('-w', siOutputClipboard);
Add('-z', siLineNumberStart);
// long forms
From 7cc5f86cb5b839c729b03c46ce7978bb1ca54f11 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Tue, 18 Oct 2022 12:54:17 +0100
Subject: [PATCH 03/33] Update User Guide and Help screen
Add new -v short form command to --version command information
---
Docs/UserGuide.html | 2 +-
Src/Assets/Help.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Docs/UserGuide.html b/Docs/UserGuide.html
index 70aa6fb..a10cc71 100644
--- a/Docs/UserGuide.html
+++ b/Docs/UserGuide.html
@@ -938,7 +938,7 @@
--version |
- |
+ -v |
Displays the program's version number. The remainder of the command line
is ignored, except for --help , which takes precendence.
diff --git a/Src/Assets/Help.txt b/Src/Assets/Help.txt
index 54168e9..a88cc2d 100644
--- a/Src/Assets/Help.txt
+++ b/Src/Assets/Help.txt
@@ -139,7 +139,7 @@ PasHi supports the following commands:
no-warn - no warnings: sign-on, error and
completion messages only.
quiet - error messages only.
---version Displays program version. Do not use with other
+--version -v Displays program version. Do not use with other
commands.
--viewport Determines the type, if any, of viewport meta-data
written to a HTML document head section. The next
From be0e9e279713ef4097643c0757d00a80d15dc5b9 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Tue, 18 Oct 2022 13:03:49 +0100
Subject: [PATCH 04/33] Add 'frag' option to --doc-type command
'frag' is alias for 'fragment'
---
Src/UParams.pas | 1 +
1 file changed, 1 insertion(+)
diff --git a/Src/UParams.pas b/Src/UParams.pas
index 0ccf1b8..d6f9d4d 100644
--- a/Src/UParams.pas
+++ b/Src/UParams.pas
@@ -314,6 +314,7 @@ constructor TParams.Create(const Config: TConfig);
Add('html4', dtHTML4);
Add('html5', dtHTML5);
Add('fragment', dtFragment);
+ Add('frag', dtFragment);
end;
// lookup table for any command with boolean parameters
fBooleanLookup := TDictionary.Create(
From 1eeb3ea473a1345d43fc2966d39de0ea9fd53e11 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Tue, 18 Oct 2022 13:06:53 +0100
Subject: [PATCH 05/33] Update UserGuide.html
Add info about new '--doc-type frag' command parameter
Fixes #47
---
Docs/UserGuide.html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Docs/UserGuide.html b/Docs/UserGuide.html
index a10cc71..994962b 100644
--- a/Docs/UserGuide.html
+++ b/Docs/UserGuide.html
@@ -480,9 +480,9 @@
html5 : Complete HTML 5 document.
- fragment : An HTML code fragment containing only the
- highlighted code wrapped in <div> ...
- </div> tags.
+ fragment or frag : An HTML code fragment
+ containing only the highlighted code wrapped in
+ <div> ... </div> tags.
Various commands that relate only to complete HTML documents are
ignored when this option is used.
From 25b1da40fce2a64cc6c9d6d2f8b602d71e994672 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Tue, 18 Oct 2022 14:11:22 +0100
Subject: [PATCH 06/33] Add missing public section in TCSSNames
---
Src/Hiliter.UHiliters.pas | 1 +
1 file changed, 1 insertion(+)
diff --git a/Src/Hiliter.UHiliters.pas b/Src/Hiliter.UHiliters.pas
index 62c36c0..598eb07 100644
--- a/Src/Hiliter.UHiliters.pas
+++ b/Src/Hiliter.UHiliters.pas
@@ -67,6 +67,7 @@ TLegacyCSSNames = class(TInterfacedObject, ICSSClassNames)
/// Supplies names of CSS classes used in highlighting.
TCSSNames = class(TInterfacedObject, ICSSClassNames)
+ public
function MainClass: string;
function ElementClass(const Elem: THiliteElement): string;
end;
From 790c744b7627ac143792ee649c2d466f628b10f7 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 11:21:39 +0100
Subject: [PATCH 07/33] Enable `-` (dash) to be used as a parameter.
Previously a single dash was taken as the start of the next command.
---
Src/UParams.pas | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Src/UParams.pas b/Src/UParams.pas
index d6f9d4d..7a02cb8 100644
--- a/Src/UParams.pas
+++ b/Src/UParams.pas
@@ -485,8 +485,10 @@ function TParams.GetStringParameter(const Cmd: TCommand): string;
Result := ''
else
Result := fParamQueue.Peek;
- if (Result = '') or AnsiStartsStr('-', Result) then
- raise ECommandError.Create(Cmd.Name, sNoParam);
+ WriteLn('Result ', Result);
+ if (Result = '')
+ or (AnsiStartsStr('-', Result) and (Result <> '-')) then
+ raise ECommandError.Create(Cmd.Name, sNoParam);
end;
function TParams.GetVerbosityParameter(const Cmd: TCommand): TVerbosity;
From 32609985de7cb965fd88ac06f27a907c11e5adbe Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 16:17:33 +0100
Subject: [PATCH 08/33] Add support for parsing set parameters on command line
Set parameters begin with "{", end with "}" and have 0 or more comma
separated values. E.g. {elem1, elem2, elem3}, {elem1} & {}.
---
Src/UParams.pas | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/Src/UParams.pas b/Src/UParams.pas
index 7a02cb8..86bcfef 100644
--- a/Src/UParams.pas
+++ b/Src/UParams.pas
@@ -100,6 +100,9 @@ TCommand = record
/// commands provided.
TParams = class(TObject)
strict private
+ const
+ SetParamOpener = '{';
+ SetParamCloser = '}';
var
fParamQueue: TQueue; // Queue of parameters to be processed
fCmdLookup: TDictionary;
@@ -119,6 +122,8 @@ TParams = class(TObject)
procedure GetCmdLineParams;
procedure ParseCommand(const IsConfigCmd: Boolean);
procedure ParseFileName;
+ function TryParseSetParam(const Param: string; out Elems: TStringDynArray):
+ Boolean;
function GetStringParameter(const Cmd: TCommand): string;
function GetBooleanParameter(const Cmd: TCommand): Boolean;
function GetEncodingParameter(const Cmd: TCommand): TOutputEncodingId;
@@ -803,6 +808,31 @@ procedure TParams.ParseFileName;
fParamQueue.Dequeue;
end;
+function TParams.TryParseSetParam(const Param: string;
+ out Elems: TStringDynArray): Boolean;
+var
+ ParamContent: string;
+begin
+ // A set parameter has the form (in sort of BNF):
+ // "{" [ { "," } ] "}"
+ // where elem is simple text
+ // E.gs:
+ // {} - empty set
+ // {elem} - one item set
+ // {elem1,elem2,elem3} - three item set
+ // Note - there can be no spaces anywhere in the parameter
+ SetLength(Elems, 0);
+ if Length(Param) < 2 then
+ Exit(False);
+ if Param[1] <> SetParamOpener then
+ Exit(False);
+ if Param[Length(Param)] <> SetParamCloser then
+ Exit(False);
+ ParamContent := Copy(Param, 2, Length(Param) - 2);
+ Elems := SplitString(ParamContent, ',');
+ Result := True;
+end;
+
{ TCommand }
constructor TCommand.Create(const Cmd: string);
From 1c70e44eeccbf3f7725f395ce117eb9a12b276a8 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 16:18:50 +0100
Subject: [PATCH 09/33] Add new THiliteElements set type
---
Src/Hiliter.UGlobals.pas | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Src/Hiliter.UGlobals.pas b/Src/Hiliter.UGlobals.pas
index d3e6e27..26c9404 100644
--- a/Src/Hiliter.UGlobals.pas
+++ b/Src/Hiliter.UGlobals.pas
@@ -41,6 +41,9 @@ interface
heError // an unrecognised piece of code (shouldn't happen)
);
+ /// Set of hiliter elements.
+ THiliteElements = set of THiliteElement;
+
/// Records options used to customise syntax highlighting.
///
THiliteOptions = record
From 85515d4b5c51ca5cd7fc18c3a0f1a3338425e1d4 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 16:21:02 +0100
Subject: [PATCH 10/33] Add new THiliteOptions.ExcludedElements property
This property provides a set of syntax highlighter elements for
which no tags and associated styling are to be emitted.
Update TRendererFactory.CreateRenderer to set new property.
---
Src/Hiliter.UGlobals.pas | 9 +++++++--
Src/Renderers.UFactory.pas | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/Src/Hiliter.UGlobals.pas b/Src/Hiliter.UGlobals.pas
index 26c9404..162e8fc 100644
--- a/Src/Hiliter.UGlobals.pas
+++ b/Src/Hiliter.UGlobals.pas
@@ -53,14 +53,17 @@ THiliteOptions = record
fPadding: Char;
fStartNumber: Word;
fAlternateLines: Boolean;
+ fExcludedElements: THiliteElements;
public
property UseLineNumbering: Boolean read fUseLineNumbering;
property Width: Byte read fWidth;
property Padding: Char read fPadding;
property StartNumber: Word read fStartNumber;
property AlternateLines: Boolean read fAlternateLines;
+ property ExcludedElements: THiliteElements read fExcludedElements;
constructor Create(AUseLineNumbering: Boolean; AWidth: Byte;
- APadding: Char; AAlternateLines: Boolean; AStartNumber: Word);
+ APadding: Char; AAlternateLines: Boolean; AStartNumber: Word;
+ AExcludedElements: THiliteElements);
end;
/// Interface implemented by all highlighter classes.
@@ -86,7 +89,8 @@ implementation
{ THiliteOptions }
constructor THiliteOptions.Create(AUseLineNumbering: Boolean;
- AWidth: Byte; APadding: Char; AAlternateLines: Boolean; AStartNumber: Word);
+ AWidth: Byte; APadding: Char; AAlternateLines: Boolean; AStartNumber: Word;
+ AExcludedElements: THiliteElements);
begin
fUseLineNumbering := AUseLineNumbering;
if fUseLineNumbering then
@@ -102,6 +106,7 @@ constructor THiliteOptions.Create(AUseLineNumbering: Boolean;
fStartNumber := 0;
end;
fAlternateLines := AAlternateLines;
+ fExcludedElements := AExcludedElements;
end;
end.
diff --git a/Src/Renderers.UFactory.pas b/Src/Renderers.UFactory.pas
index 638648a..e868dd2 100644
--- a/Src/Renderers.UFactory.pas
+++ b/Src/Renderers.UFactory.pas
@@ -51,7 +51,8 @@ class function TRendererFactory.CreateRenderer(const SourceCode: string;
Config.LineNumberWidth,
Config.LineNumberPadding,
Config.Striping,
- Config.LineNumberStart
+ Config.LineNumberStart,
+ Config.ExcludedSpans
)
);
case Config.DocType of
From d97c07296f0b9e3a4aeb6c65ae1de72faa366244 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 16:23:21 +0100
Subject: [PATCH 11/33] Update THTMLHiliter not to style specified hilite
elements
Elements specified in THiliteOptions.ExcludedElements property are
no longer styled and surrounding tags are not included in
output HTML.
---
Src/Hiliter.UHiliters.pas | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/Src/Hiliter.UHiliters.pas b/Src/Hiliter.UHiliters.pas
index 598eb07..b350f1d 100644
--- a/Src/Hiliter.UHiliters.pas
+++ b/Src/Hiliter.UHiliters.pas
@@ -78,6 +78,7 @@ THTMLHiliter = class sealed(TParsedSyntaxHiliter, ISyntaxHiliter)
strict private
fCSSClases: ICSSClassNames; // provides name of CSS classes
fIsEmptyLine: Boolean; // flags if a line has no content
+ function IsElemRequired(const Elem: THiliteElement): Boolean;
strict protected
procedure BeginDoc; override;
procedure EndDoc; override;
@@ -195,15 +196,17 @@ function TParsedSyntaxHiliter.LineNumberStr: string;
procedure THTMLHiliter.AfterElem(Elem: THiliteElement);
begin
- // Close the element's span
- Writer.Append('');
+ if IsElemRequired(Elem) then
+ // Close the element's span
+ Writer.Append('');
end;
procedure THTMLHiliter.BeforeElem(Elem: THiliteElement);
begin
inherited;
- // Open a span for required class
- Writer.AppendFormat('', [fCSSClases.ElementClass(Elem)]);
+ if IsElemRequired(Elem) then
+ // Open a span for required class
+ Writer.AppendFormat('', [fCSSClases.ElementClass(Elem)]);
end;
procedure THTMLHiliter.BeginDoc;
@@ -249,6 +252,16 @@ procedure THTMLHiliter.EndLine;
Writer.AppendLine('');
end;
+function THTMLHiliter.IsElemRequired(const Elem: THiliteElement): Boolean;
+var
+ E: THiliteElement;
+begin
+ for E in Options.ExcludedElements do
+ if E = Elem then
+ Exit(False);
+ Result := True;
+end;
+
procedure THTMLHiliter.WriteElem(const ElemText: string);
begin
// Write element text with illegal characters converted to entities
From 78fc9c84652f8e6a8b6cdc4b09a329f45b3cf231 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 16:25:36 +0100
Subject: [PATCH 12/33] Add support for --inhibit-styling command
Support added to command line parser and config object for this new
command.
---
Src/UConfig.pas | 7 ++++-
Src/UParams.pas | 76 ++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/Src/UConfig.pas b/Src/UConfig.pas
index 805b7ef..5111fac 100644
--- a/Src/UConfig.pas
+++ b/Src/UConfig.pas
@@ -15,7 +15,8 @@
interface
uses
- SysUtils, Classes;
+ SysUtils, Classes,
+ Hiliter.UGlobals;
type
@@ -110,6 +111,7 @@ TConfig = class(TObject)
fStriping: Boolean;
fViewport: TViewport;
fEdgeCompatibility: Boolean;
+ fExcludedSpans: THiliteElements;
function GetInputFiles: TArray;
public
constructor Create;
@@ -156,6 +158,8 @@ TConfig = class(TObject)
property Viewport: TViewport read fViewport write fViewport default vpNone;
property EdgeCompatibility: Boolean
read fEdgeCompatibility write fEdgeCompatibility default False;
+ property ExcludedSpans: THiliteElements
+ read fExcludedSpans write fExcludedSpans default [];
procedure AddInputFile(const FN: string);
function OutputEncoding: TEncoding;
function OutputEncodingName: string;
@@ -199,6 +203,7 @@ constructor TConfig.Create;
fStriping := False;
fViewport := vpNone;
fEdgeCompatibility := False;
+ fExcludedSpans := [];
end;
destructor TConfig.Destroy;
diff --git a/Src/UParams.pas b/Src/UParams.pas
index 86bcfef..9ffc9e9 100644
--- a/Src/UParams.pas
+++ b/Src/UParams.pas
@@ -18,8 +18,10 @@ interface
uses
// Delphi
SysUtils,
+ Types,
Generics.Collections,
// Project
+ Hiliter.UGlobals,
UConfig;
type
@@ -56,7 +58,8 @@ interface
siViewport, // which viewport meta-data to output, if any
siEdgeCompatibility,// whether edge compatibility info meta-data is output
siLineNumberStart, // specifies starting line number
- siVersion // display program's version
+ siVersion, // display program's version
+ siInhibitStyling // inhibits styling of some highlight elements
);
type
@@ -115,6 +118,8 @@ TParams = class(TObject)
fVerbosityLookup: TDictionary;
fPaddingLookup: TDictionary;
fViewportLookup: TDictionary;
+ fHiliteSpanClsLookup: TDictionary;
+ fHiliteAliasLookup: TDictionary;
fConfig: TConfig; // Reference to program's configuration object
fWarnings: TList;
fFirstCommandFound: Boolean; // detects filenames after 1st command
@@ -133,6 +138,7 @@ TParams = class(TObject)
UInt16;
function GetPaddingParameter(const Cmd: TCommand): Char;
function GetViewportParameter(const Cmd: TCommand): TViewport;
+ function GetExcludedSpansParameter(const Cmd: TCommand): THiliteElements;
function GetWarnings: TArray;
function AdjustCommandName(const Name: string; IsCfgCmd: Boolean): string;
function IsV1Command(const Name: string): Boolean;
@@ -176,6 +182,7 @@ implementation
// Delphi
StrUtils, Classes, Character,
// Project
+ Hiliter.UHiliters,
UComparers, UConfigFiles;
@@ -196,6 +203,9 @@ function TParams.AdjustCommandName(const Name: string;
end;
constructor TParams.Create(const Config: TConfig);
+var
+ HiliteElem: THiliteElement;
+ CSSNames: TCSSNames;
begin
Assert(Assigned(Config), 'TParams.Create: Config is nil');
inherited Create;
@@ -258,6 +268,7 @@ constructor TParams.Create(const Config: TConfig);
Add('--viewport', siViewport);
Add('--edge-compatibility', siEdgeCompatibility);
Add('--version', siVersion);
+ Add('--inhibit-styling', siInhibitStyling);
// commands kept for backwards compatibility with v1.x
Add('-frag', siFragment);
Add('-hidecss', siForceHideCSS);
@@ -369,10 +380,31 @@ constructor TParams.Create(const Config: TConfig);
Add('tablet', vpPhone);
end;
fWarnings := TList.Create(TTextComparer.Create);
+
+ fHiliteSpanClsLookup := TDictionary.Create(
+ TTextEqualityComparer.Create
+ );
+ fHiliteAliasLookup := TDictionary.Create(
+ TTextEqualityComparer.Create
+ );
+ CSSNames := TCSSNames.Create;
+ try
+ for HiliteElem := Low(THiliteElement) to High(THiliteElement) do
+ begin
+ fHiliteSpanClsLookup.Add(CSSNames.ElementClass(HiliteElem), HiliteElem);
+ // add element name as alias for {element-name}
+ fHiliteAliasLookup.Add(CSSNames.ElementClass(HiliteElem), [HiliteElem]);
+ end;
+ finally
+ CSSNames.Free;
+ end;
+ fHiliteAliasLookup.Add('-', []); // alias for empty set {}
end;
destructor TParams.Destroy;
begin
+ fHiliteAliasLookup.Free;
+ fHiliteSpanClsLookup.Free;
fWarnings.Free;
fViewportLookup.Free;
fPaddingLookup.Free;
@@ -451,6 +483,43 @@ function TParams.GetEncodingParameter(const Cmd: TCommand): TOutputEncodingId;
Result := fEncodingLookup[Param];
end;
+function TParams.GetExcludedSpansParameter(const Cmd: TCommand):
+ THiliteElements;
+var
+ Param: string;
+ Spans: TStringDynArray;
+ Span: string;
+resourcestring
+ sBadSpanCls = 'Invalid span class name for %s: ';
+ sBadParam = 'Invalid parameter for %s: ';
+begin
+ // Parameter is EITHER a set or an alias for a set
+ // Set is enclosed in {}, alias is not.
+ Param := GetStringParameter(Cmd);
+ if TryParseSetParam(Param, Spans) then
+ begin
+ // Parameter is a valid set of zero or more elements
+ Result := [];
+ for Span in Spans do
+ begin
+ if not fHiliteSpanClsLookup.ContainsKey(Span) then
+ raise ECommandError.Create(
+ Cmd.Name, sBadSpanCls + Format('"%s', [Span])
+ );
+ Include(Result, fHiliteSpanClsLookup[Span]);
+ end;
+ end
+ else
+ begin
+ // Not a set parameter - test for a valid alias
+ if not fHiliteAliasLookup.ContainsKey(Param) then
+ raise ECommandError.Create(
+ Cmd.Name, sBadParam + Format('"%s"', [Param])
+ );
+ Result := fHiliteAliasLookup[Param];
+ end;
+end;
+
function TParams.GetNumericParameter(const Cmd: TCommand; const Lo,
Hi: UInt16): UInt16;
var
@@ -791,6 +860,11 @@ procedure TParams.ParseCommand(const IsConfigCmd: Boolean);
fConfig.EdgeCompatibility := GetBooleanParameter(Command);
fParamQueue.Dequeue;
end;
+ siInhibitStyling:
+ begin
+ fConfig.ExcludedSpans := GetExcludedSpansParameter(Command);
+ fParamQueue.Dequeue;
+ end;
end;
end;
From c4d3c081c9ccebe54f023fdb8127f444f4370792 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 16:26:35 +0100
Subject: [PATCH 13/33] Update docs re new --inhibit-style command
Changes user guide and program help text.
Closes #30
---
Docs/UserGuide.html | 36 ++++++++++++++++++++++++++++++++++++
Src/Assets/Help.txt | 23 +++++++++++++++++++++++
2 files changed, 59 insertions(+)
diff --git a/Docs/UserGuide.html b/Docs/UserGuide.html
index 994962b..be615ff 100644
--- a/Docs/UserGuide.html
+++ b/Docs/UserGuide.html
@@ -672,6 +672,42 @@
required CSS class names.
|
+
+ --inhibit-styling |
+ |
+
+ Enables styling for specified syntactic elements to be omitted from the
+ HTML output. This is useful in reducing the size of HTML documents if you
+ have elements that are not styled in any way.
+ This command must be followed by a parameter which is either
+ the name of a syntactic element for which styling is to be prevented
+ or a set of zero or more syntactic elements. A set is a comma
+ delimited list of element names, enclosed in { and
+ } characters. When a set of two or more elements is specified
+ styling is inhibited for all the elements. The list must not contain
+ spaces. Valid element names are:
+
+ space white space
+ comment comments
+ kwd keywords
+ ident identifiers
+ sym symbols
+ str string literals
+ num integers
+ float floating point numbers
+ hex hexadecimal numbers
+ preproc pre-processor instructions
+ asm assembler code
+ err syntax errors
+
+ Use {} (an empty set) or - (a minus sign) to
+ enable all elements to be highlighted (the default).
+ Examples: To suppress generation of styling for white space only, use
+ --inhibit-styling space or --inhibit-styling
+ {space} . To suppress both white space and syntax errors use
+ --inhibit-styling {space,err} .
+ |
+
--encoding |
-e |
diff --git a/Src/Assets/Help.txt b/Src/Assets/Help.txt
index a88cc2d..61d115c 100644
--- a/Src/Assets/Help.txt
+++ b/Src/Assets/Help.txt
@@ -63,6 +63,29 @@ PasHi supports the following commands:
no - do not enclose CSS [default]
Alternatively use -c+ to enclose CSS in comments or
-c- not to do so.
+--inhibit-styling Enables styling for specified syntactic elements to
+ be omitted from the HTML output. The following
+ parameter must be in set format: a comma delimited
+ list of the names of syntactic elements for which
+ styling is to be prevented. The list must be
+ enclosed in { and } characters, for e.g.
+ {space,kwd}. Valid element names are:
+ space - white space
+ comment - comments
+ kwd - keywords
+ ident - identifiers
+ sym - symbols
+ str - string literals
+ num - integers
+ float - floating point numbers
+ hex - hexadecimal numbers
+ preproc - pre-processor instructions
+ asm - assembler code
+ err - syntax errors
+ Use the empty set, {}, to style all elements
+ [default].
+ Where there is just one syntactic element being
+ specified, the curly brackets can be omitted.
--input-clipboard -r Read source code from the clipboard instead of
stdin or file(s).
--input-stdin Read source code from stdin [default].
From 02b534f0b647462a420f977a335196a36cdbcb9d Mon Sep 17 00:00:00 2001
From: Peter Johnson <5164283+delphidabbler@users.noreply.github.com>
Date: Wed, 19 Oct 2022 16:39:15 +0100
Subject: [PATCH 14/33] Update README.md
Add link to User Guide on `master` branch
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6dc62bf..ae471d9 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ For users who prefer to use a GUI, PasHi's installer provides the option to inst
For full details of how to install PasHi etc. see the file `ReadMe.txt` that is included in the program download.
-A comprehensive user guide, `UserGuide.html` is installed alongside PasHi. PasHiGUI provides a menu option to display the file.
+A comprehensive user guide, [`UserGuide.html`](https://htmlpreview.github.io/?https://github.com/delphidabbler/pashi/blob/master/Docs/UserGuide.html) is installed alongside PasHi. PasHiGUI provides a menu option to display the file.
> **Note:** Both `ReadMe.txt` and `UserGuide.html` can also be found in the `Docs` directory in PasHi's [GitHub repository](https://github.com/delphidabbler/pashi).
From df205118665d6740e66a7dcb8dd3ef9e32462d1a Mon Sep 17 00:00:00 2001
From: Peter Johnson <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 00:48:03 +0100
Subject: [PATCH 15/33] Update config-template
Add comments describing inhibit-styling command
Fix some formatting errors
---
Config/config-template | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/Config/config-template b/Config/config-template
index 6f7e61e..dffd986 100644
--- a/Config/config-template
+++ b/Config/config-template
@@ -145,7 +145,7 @@
# title-default
-# -- Output document encoding ---
+# --- Output document encoding ---
# Command:
# encoding
# where is one of "utf-8", "utf-16", "windows-1252" or "iso-8859-1"
@@ -188,7 +188,28 @@
# legacy-css no
-# -- Line numbering
+# --- Code generation ---
+# Command:
+# inhibit-styling
+# where is either:
+# a set of zero or more of the values, "space", "comment", "kwd", "ident",
+# "sym", "str", "num", "float", "hex", "preproc", "asm" or "err",
+# separated by commas, with no spaces, and enclosed in curly brackets,
+# or:
+# a single one of the above values,
+# or:
+# a minus sign, "-", as an alias for the empty set "{}".
+# Examples:
+# inhibit-styling {space}
+# inhibit-styling space
+# inhibit-styling {num,float,hex}
+# inhibit-styling {}
+# inhibit-styling -
+# Default:
+# inhibit-styling {}
+
+
+# --- Line numbering ---
# Commands:
# line-numbering
# where is either "on" or "off"
@@ -202,7 +223,7 @@
# line-number-padding space
-# -- Line styling
+# --- Line styling ---
# Command:
# striping
# where is either "on" or "off"
@@ -210,16 +231,16 @@
# striping off
-# -- Meta tags
+# --- Meta tags ---
# Commands:
# viewport
# where is one of "phone" or "none"
# edge-compatibility
# where is either "on" or "off"
-# Defaults:
-# viewport none
-# ** the viewport default is DEPRECATED: may change in next major release
-# edge-compatibility off
+# Defaults:
+# viewport none
+# ** the viewport default is DEPRECATED: may change in next major release
+# edge-compatibility off
# --- Output verbosity ---
From 9e1136ee6f3b0605ecb10b9f9f29e0b9f6ed84ce Mon Sep 17 00:00:00 2001
From: Peter Johnson <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 01:18:01 +0100
Subject: [PATCH 16/33] Update config-template
Add back line-number-start command details
Fixes #53
---
Config/config-template | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Config/config-template b/Config/config-template
index dffd986..544c107 100644
--- a/Config/config-template
+++ b/Config/config-template
@@ -217,10 +217,13 @@
# where is a number in range 1..6
# line-number-padding
# where is one of "space", "zero", "dot" or "dash"
+# line-number-start
+# where is a number in range 1...9999
# Defaults:
# line-numbering off
# line-number-width 3
# line-number-padding space
+# line-number-start 1
# --- Line styling ---
From d847d12a4d2bd08250ea758e0957e8e372a0201d Mon Sep 17 00:00:00 2001
From: Peter Johnson <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 01:27:56 +0100
Subject: [PATCH 17/33] Update CHANGELOG.md
Fix error re config-template file changes for release 2.2.0
Add details of change of config files version number for releases 2.1.0 & 2.2.0
---
CHANGELOG.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bdd9af9..f63c236 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -56,9 +56,8 @@ This release includes _PasHi_ v2.2.0 and _PasHiGUI_ v1.2.0. Changes are as follo
* Fixed CSS errors
* Made minor changes to read-me file that is included in distributions.
* Updated various web addresses in documentation.
-* Updated `config-template` comments:
- * noted fact that the `version` command can't be used in the `config` file
- * added details of new `line-number-start` command & its parameters
+* Updated `config-template` comments to note that the `version` command can't be used in the `config` file
+* Bumped config files version from 4 to 5.
## Release 2.1.0 - 2021-09-22
@@ -96,6 +95,7 @@ This release includes _PasHi_ v2.1.0 and _PasHiGUI_ v1.1.0. Changes are as follo
* noted fact that the `help` command can no longer be used in the `config` file
* added details of new `viewport` and `edge-compatibility` commands
* noted new command parameters
+* Bumped config files version from 3 to 4.
* Commented all v1 CSS classes as deprecated in `.css` files.
## Release 2.0.0 - 2016-09-22
From 1f82b431972953975948da3dc2cfd036f649a781 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 11:11:16 +0100
Subject: [PATCH 18/33] Update operation of --trim parameter
--trim is now able to trim trailing spaces as well as leading and
trailing blank lines.
Parameters change from Boolean to "-" (do nothing), "lines",
"spaces" & "all". Boolean parameters and -m switch are deprecated
and changed to map to "--trim lines" when true and "--trim -" when
false.
Closes #29
---
Src/UConfig.pas | 17 +++++++++---
Src/UParams.pas | 58 ++++++++++++++++++++++++++++++++++++----
Src/USourceProcessor.pas | 29 +++++++++++++++++---
3 files changed, 91 insertions(+), 13 deletions(-)
diff --git a/Src/UConfig.pas b/Src/UConfig.pas
index 5111fac..1e6403a 100644
--- a/Src/UConfig.pas
+++ b/Src/UConfig.pas
@@ -73,6 +73,15 @@ interface
vpPhone
);
+ /// Enumerates different trim operations applied to source code.
+ /// prior to processing.
+ TTrimOperation = (
+ tsNone, // don't trim anything
+ tsLines, // trim blank lines from beginning and end of a source file
+ tsSpaces, // trim trailing spaces from source code lines
+ tsBoth // trim blank lines and spaces
+ );
+
/// Valid range of separator lines between files.
TSeparatorLines = 0..16;
@@ -100,7 +109,7 @@ TConfig = class(TObject)
fCSSSource: TCSSSource;
fCSSLocation: string;
fOutputEncodingId: TOutputEncodingId;
- fTrimSource: Boolean;
+ fTrimSource: TTrimOperation;
fInFiles: TStringList;
fSeparatorLines: TSeparatorLines;
fLegacyCSSNames: Boolean;
@@ -140,8 +149,8 @@ TConfig = class(TObject)
property InputFiles: TArray read GetInputFiles;
property BrandingPermitted: Boolean
read fBrandingPermitted write fBrandingPermitted default True;
- property TrimSource: Boolean
- read fTrimSource write fTrimSource default True;
+ property TrimSource: TTrimOperation
+ read fTrimSource write fTrimSource default tsLines;
property SeparatorLines: TSeparatorLines
read fSeparatorLines write fSeparatorLines default 1;
property LegacyCSSNames: Boolean
@@ -193,7 +202,7 @@ constructor TConfig.Create;
fBrandingPermitted := True;
fLanguage := '';
fVerbosity := vbNormal;
- fTrimSource := True;
+ fTrimSource := tsLines;
fSeparatorLines := 1;
fLegacyCSSNames := False;
fUseLineNumbering := False;
diff --git a/Src/UParams.pas b/Src/UParams.pas
index 9ffc9e9..872ccf6 100644
--- a/Src/UParams.pas
+++ b/Src/UParams.pas
@@ -49,6 +49,7 @@ interface
siHelp, // display help
siVerbosity, // determines amount of messages output by program
siTrim, // determines if source code is trimmed
+ siTrim2, // determines if & how source code is trimmed
siSeparatorLines, // specifies number of lines that separate source files
siLineNumbering, // determines if output file is to be line numbered
siLineNumberWidth, // specifies width of line numbers in characters
@@ -120,6 +121,7 @@ TParams = class(TObject)
fViewportLookup: TDictionary;
fHiliteSpanClsLookup: TDictionary;
fHiliteAliasLookup: TDictionary;
+ fTrimLookup: TDictionary;
fConfig: TConfig; // Reference to program's configuration object
fWarnings: TList;
fFirstCommandFound: Boolean; // detects filenames after 1st command
@@ -381,6 +383,19 @@ constructor TParams.Create(const Config: TConfig);
end;
fWarnings := TList.Create(TTextComparer.Create);
+ fTrimLookup := TDictionary.Create(
+ TTextEqualityComparer.Create
+ );
+ fTrimLookup.Add('-', tsNone);
+ fTrimLookup.Add('none', tsNone);
+ fTrimLookup.Add('nothing', tsNone);
+ fTrimLookup.Add('lines', tsLines);
+ fTrimLookup.Add('spaces', tsSpaces);
+ fTrimLookup.Add('all', tsBoth);
+ fTrimLookup.Add('everything', tsBoth);
+ // Additionally old Boolean params are supported, but deprecated.
+ // False => 'none' and True => 'lines'
+
fHiliteSpanClsLookup := TDictionary.Create(
TTextEqualityComparer.Create
);
@@ -490,8 +505,8 @@ function TParams.GetExcludedSpansParameter(const Cmd: TCommand):
Spans: TStringDynArray;
Span: string;
resourcestring
- sBadSpanCls = 'Invalid span class name for %s: ';
- sBadParam = 'Invalid parameter for %s: ';
+ sBadSpanCls = 'Invalid span class name for "%s": ';
+ sBadParam = 'Invalid parameter for "%s": ';
begin
// Parameter is EITHER a set or an alias for a set
// Set is enclosed in {}, alias is not.
@@ -653,15 +668,19 @@ procedure TParams.ParseCommand(const IsConfigCmd: Boolean);
resourcestring
// Error messages
sBadCommand = 'Unrecognised command "%s"';
+ sBadParam = 'Unrecognised parameter "%0:s" for command "%1:s"';
sCantBeSwitch = '%s cannot be a switch command';
sMustBeSwitch = '%s must be a switch command: append "+" or "-"';
- sBlacklisted = 'The "%s" command is not permitted.';
+ sBlacklisted = 'The "%s" command is not permitted';
// Warnings
sDeprecatedCmd = 'The "%s" command is deprecated';
+ sDeprecatedParam = 'The "%0:s" parameter of the "%1:s" command is deprecated';
+ sDeprecatedSwitch = 'The "%s" switch is deprecated';
sDepDocType = 'The "html4" parameter of the "%s" command is deprecated';
var
Command: TCommand;
CommandId: TCommandId;
+ Param: string;
begin
Command := fParamQueue.Dequeue;
if not fCmdLookup.ContainsKey(Command.Name) then
@@ -791,10 +810,39 @@ procedure TParams.ParseCommand(const IsConfigCmd: Boolean);
siTrim:
begin
if Command.IsSwitch then
- fConfig.TrimSource := Command.SwitchValue
+ begin
+ if Command.SwitchValue = True then
+ fConfig.TrimSource := tsLines
+ else
+ fConfig.TrimSource := tsNone;
+ fWarnings.Add(
+ Format(
+ sDeprecatedSwitch, [AdjustCommandName(Command.Name, IsConfigCmd)]
+ )
+ );
+ end
else
begin
- fConfig.TrimSource := GetBooleanParameter(Command);
+ Param := GetStringParameter(Command);
+ if fTrimLookup.ContainsKey(Param) then
+ fConfig.TrimSource := fTrimLookup[Param]
+ else if fBooleanLookup.ContainsKey(Param) then
+ begin
+ if fBooleanLookup[Param] = True then
+ fConfig.TrimSource := tsLines
+ else
+ fConfig.TrimSource := tsNone;
+ fWarnings.Add(
+ Format(
+ sDeprecatedParam,
+ [Param, AdjustCommandName(Command.Name, IsConfigCmd)]
+ )
+ );
+ end
+ else
+ raise Exception.CreateFmt(
+ sBadParam, [Param, AdjustCommandName(Command.Name, IsConfigCmd)]
+ );
fParamQueue.Dequeue;
end;
end;
diff --git a/Src/USourceProcessor.pas b/Src/USourceProcessor.pas
index 6c34125..a690f71 100644
--- a/Src/USourceProcessor.pas
+++ b/Src/USourceProcessor.pas
@@ -23,7 +23,8 @@ TSourceProcessor = class(TObject)
strict private
var
fConfig: TConfig;
- class function TrimSource(const SourceCode: string): string;
+ class function TrimSourceLines(const SourceCode: string): string;
+ class function TrimSourceTrailingSpaces(const SourceCode: string): string;
function Separator: string;
public
constructor Create(const Config: TConfig);
@@ -64,8 +65,10 @@ function TSourceProcessor.Process(const Sources: TArray): string;
for SourceCode in Sources do
begin
ProcessedSource := SourceCode;
- if fConfig.TrimSource then
- ProcessedSource := TrimSource(ProcessedSource);
+ if fConfig.TrimSource in [tsLines, tsBoth] then
+ ProcessedSource := TrimSourceLines(ProcessedSource);
+ if fConfig.TrimSource in [tsSpaces, tsBoth] then
+ ProcessedSource := TrimSourceTrailingSpaces(ProcessedSource);
AddToOutput(ProcessedSource);
end;
Result := SB.ToString;
@@ -83,7 +86,8 @@ function TSourceProcessor.Separator: string;
Result := Result + CRLF;
end;
-class function TSourceProcessor.TrimSource(const SourceCode: string): string;
+class function TSourceProcessor.TrimSourceLines(const SourceCode: string):
+ string;
var
Lines: TStringList;
begin
@@ -98,4 +102,21 @@ class function TSourceProcessor.TrimSource(const SourceCode: string): string;
end;
end;
+class function TSourceProcessor.TrimSourceTrailingSpaces(
+ const SourceCode: string): string;
+var
+ Lines: TStringList;
+ Idx: Integer;
+begin
+ Lines := TStringList.Create;
+ try
+ Lines.Text := SourceCode;
+ for Idx := 0 to Pred(Lines.Count) do
+ Lines[Idx] := TrimRight(Lines[Idx]);
+ Result := Lines.Text;
+ finally
+ Lines.Free;
+ end;
+end;
+
end.
From 23da819e87f13baf9697e4e519a888832ba1c8a9 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 11:11:47 +0100
Subject: [PATCH 19/33] Update `config-template` re changes to --trim command
---
Config/config-template | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Config/config-template b/Config/config-template
index 6f7e61e..8b77996 100644
--- a/Config/config-template
+++ b/Config/config-template
@@ -78,9 +78,12 @@
# --- Input source trimming ---
# Command:
# trim
-# where ie either "yes" or "no"
+# where is one of "-", "lines", "spaces", "all", "yes" or "no"
+# ** the "yes" and "no" parameters are DEPRECATED
+# use "lines" instead of "yes" and "-" instead of "no"
# Default:
-# trim yes
+# trim lines
+# ** the default is DEPRECATED: may change to "all" in next release
# --- Multiple input file separation ---
From ddfec9f515bfc30dd2bb95b3da89d3d925f901aa Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 11:12:48 +0100
Subject: [PATCH 20/33] Update user guide and help screen
Modify entry for --trim command re changes per issue #29
---
Docs/UserGuide.html | 56 +++++++++++++++++++++++++++++++++++++--------
Src/Assets/Help.txt | 19 ++++++++++-----
2 files changed, 59 insertions(+), 16 deletions(-)
diff --git a/Docs/UserGuide.html b/Docs/UserGuide.html
index be615ff..90d7822 100644
--- a/Docs/UserGuide.html
+++ b/Docs/UserGuide.html
@@ -741,28 +741,64 @@
--trim |
- -m |
+ -m
+ [deprecated] |
- Determines if source code is trimmed of leading and trailing blank lines
+ Determines if or how source code is trimmed of blank lines and spaces
before highlighting. Multiple source files are trimmed individually before
concatenation.
In the case of --trim the following parameter is used to
- turn trimming on or off:
+ specify the type of trimming to be performed:
+
+ -
+
- , none or nothing :
+ do not trim anything.
+
+ -
+
lines :
+ trim leading and trailing blank lines (the default)
+ Default deprecated – to change to
+ all ..
+
+ -
+
spaces :
+ trim trailing spaces from lines.
+
+ -
+
all or everything :
+ trim leading and trailing blank lines and trim trailing spaces from
+ lines.
+
+
+ --trim also supports the following Boolean values that were
+ used with --trim in PasHi v2.2.1 and earlier.
-
True , 1 , Y , yes or
- on :
- Source code is trimmed (the default).
+ on all deprecated:
+ Aliases for --trim lines .
-
False , 0 , N , no or
- off :
- Source code is not trimmed.
+ off all deprecated:
+ Aliases for --trim none .
+
+
+ The short form of the command, -m , acted as a switch in
+ PasHi v2.2.1 and earlier. The command is now interpreted as
+ follows:
+
+ -
+
-m+ and -m1 both
+ deprecated:
+ Aliases for --trim lines .
+
+ -
+
-m- and -m0 both
+ deprecated:
+ Aliases for --trim none .
- The short form of the command, -m , acts as a switch:
- -m+ and -m1 switch trimming on while
- -m- and -m0 switch it off.
|
diff --git a/Src/Assets/Help.txt b/Src/Assets/Help.txt
index 61d115c..595e82e 100644
--- a/Src/Assets/Help.txt
+++ b/Src/Assets/Help.txt
@@ -146,14 +146,21 @@ PasHi supports the following commands:
include spaces surround the text in double quotes.
--title-default Uses the program's default title for the output
document [default].
---trim -m Determines whether input documents are trimmed of
- leading and trailing blank lines. --trim requires
+--trim -m Determines whether and how input documents are
+ trimmed of blank lines and spaces. --trim requires
the next parameter to supply one of the following
values:
- yes - trim [default]
- no - do not trim
- Alternatively use -m+ to trim or -m- to prevent
- trimming.
+ - - do not trim anything.
+ lines - trim leading and trailing blank lines.
+ [default] (*default deprecated: lines option
+ will remain*)
+ spaces - trim trailing spaces from lines
+ all - trim leading and trailing blank lines and
+ trim trailing spaces from lines
+ yes - alias for "lines" parameter (*deprecated*)
+ no - alias for "-" parameter (*deprecated*)
+ -m+ (*deprecated*) is an alias for "--trim lines"
+ and -m- (*deprecated*) is an alias for "trim -".
--verbosity Specifies the amount of output from the program.
The next parameter must be one of:
normal - sign-on, error, warning and completion
From 8304978b4edd57ab152b7a3c2fa72227019b81c5 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 11:14:34 +0100
Subject: [PATCH 21/33] Fix minor formatting issue in `config-template`
---
Config/config-template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Config/config-template b/Config/config-template
index da59bb5..e1ad6fe 100644
--- a/Config/config-template
+++ b/Config/config-template
@@ -220,7 +220,7 @@
# where is a number in range 1..6
# line-number-padding
# where is one of "space", "zero", "dot" or "dash"
-# line-number-start
+# line-number-start
# where is a number in range 1...9999
# Defaults:
# line-numbering off
From 7d3a113d069feea45199ed2e083f365666b5851f Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 11:46:25 +0100
Subject: [PATCH 22/33] Remove debug statement from UParams
Left behind a debugging WriteLn command used while adding support
fo use of `-` as a parameter
---
Src/UParams.pas | 1 -
1 file changed, 1 deletion(-)
diff --git a/Src/UParams.pas b/Src/UParams.pas
index 872ccf6..c336d3a 100644
--- a/Src/UParams.pas
+++ b/Src/UParams.pas
@@ -574,7 +574,6 @@ function TParams.GetStringParameter(const Cmd: TCommand): string;
Result := ''
else
Result := fParamQueue.Peek;
- WriteLn('Result ', Result);
if (Result = '')
or (AnsiStartsStr('-', Result) and (Result <> '-')) then
raise ECommandError.Create(Cmd.Name, sNoParam);
From 2de14d32b546e246916cd7141583fd098278affc Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 17:35:08 +0100
Subject: [PATCH 23/33] Fix bug in --trim spaces implementation
---
Src/USourceProcessor.pas | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Src/USourceProcessor.pas b/Src/USourceProcessor.pas
index a690f71..ff35001 100644
--- a/Src/USourceProcessor.pas
+++ b/Src/USourceProcessor.pas
@@ -34,6 +34,7 @@ TSourceProcessor = class(TObject)
implementation
uses
+ StrUtils,
Classes,
IO.Readers.UFactory, UConsts;
@@ -111,12 +112,16 @@ class function TSourceProcessor.TrimSourceTrailingSpaces(
Lines := TStringList.Create;
try
Lines.Text := SourceCode;
- for Idx := 0 to Pred(Lines.Count) do
- Lines[Idx] := TrimRight(Lines[Idx]);
- Result := Lines.Text;
+ Result := '';
+ if Lines.Count = 0 then
+ Exit;
+ Result := TrimRight(Lines[0]);
+ for Idx := 1 to Pred(Lines.Count) do
+ Result := Result + EOL + TrimRight(Lines[Idx]);
finally
Lines.Free;
end;
end;
end.
+
From cb1be04c001ca31ab09c346b15edc8298e65871b Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 17:38:37 +0100
Subject: [PATCH 24/33] Add new IsStrInList function to UUtils
---
Src/GUI/UUtils.pas | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/Src/GUI/UUtils.pas b/Src/GUI/UUtils.pas
index 07ec6d0..2f06bf2 100644
--- a/Src/GUI/UUtils.pas
+++ b/Src/GUI/UUtils.pas
@@ -3,7 +3,7 @@
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/
*
- * Copyright (C) 2006-2016, Peter Johnson (www.delphidabbler.com).
+ * Copyright (C) 2006-2022, Peter Johnson (www.delphidabbler.com).
*
* Various utility routines.
}
@@ -28,10 +28,16 @@ function StringFromStream(const Stm: TStream): string;
function ListFiles(const Dir, Wildcard: string; const List: TStrings): Boolean;
+function IsStrInList(const Str: string; const List: array of string;
+ CaseSensitive: Boolean): Boolean;
+
+
implementation
uses
+ // Project
+ UConsts,
// Delphi
SysUtils, ActiveX;
@@ -116,5 +122,21 @@ function ListFiles(const Dir, Wildcard: string; const List: TStrings): Boolean;
end;
end;
+function IsStrInList(const Str: string; const List: array of string;
+ CaseSensitive: Boolean): Boolean;
+var
+ TestFn: function(const A, B: string): Boolean;
+ Elem: string;
+begin
+ if CaseSensitive then
+ TestFn := SameStr
+ else
+ TestFn := SameText;
+ Result := False;
+ for Elem in List do
+ if TestFn(Elem, Str) then
+ Exit(True);
+end;
+
end.
From e8c4b562528c21ddbd82c9764dd17d920e422d5b Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 17:39:49 +0100
Subject: [PATCH 25/33] Add support for updated --trim command to GUI
Miscellaneous pane of PasHiGUI updated to be able to choose to trim
lines, spaces or both.
---
Src/GUI/FmMain.dfm | 14 ++++++++++----
Src/GUI/FrOptions.UMisc.dfm | 32 +++++++++++++++++++++-----------
Src/GUI/FrOptions.UMisc.pas | 37 ++++++++++++++++++++++++++++++++++---
3 files changed, 65 insertions(+), 18 deletions(-)
diff --git a/Src/GUI/FmMain.dfm b/Src/GUI/FmMain.dfm
index 2ff88a7..6817009 100644
--- a/Src/GUI/FmMain.dfm
+++ b/Src/GUI/FmMain.dfm
@@ -255,7 +255,9 @@ object MainForm: TMainForm
Color = clWindow
Collapsed = True
TabOrder = 0
- ExpandedHeight = 262
+ ExplicitTop = 90
+ ExplicitWidth = 204
+ ExpandedHeight = 284
inline frmMisc: TMiscOptionsFrame
Left = 0
Top = 0
@@ -263,8 +265,8 @@ object MainForm: TMainForm
Height = 0
Align = alClient
TabOrder = 0
- ExplicitWidth = 219
- ExplicitHeight = 0
+ ExplicitWidth = 202
+ ExplicitHeight = 250
end
end
object cpnlLines: TCategoryPanel
@@ -274,6 +276,8 @@ object MainForm: TMainForm
Color = clWindow
Collapsed = True
TabOrder = 1
+ ExplicitTop = 60
+ ExplicitWidth = 204
ExpandedHeight = 192
inline frmLines: TLineStyleOptionsFrame
Left = 0
@@ -293,6 +297,8 @@ object MainForm: TMainForm
Color = clWindow
Collapsed = True
TabOrder = 2
+ ExplicitTop = 30
+ ExplicitWidth = 204
ExpandedHeight = 286
inline frmCSS: TCSSOptionsFrame
Left = 0
@@ -461,7 +467,7 @@ object MainForm: TMainForm
Left = 336
Top = 152
Bitmap = {
- 494C010105000900200010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
+ 494C010105000900240010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000002000000001002000000000000020
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
diff --git a/Src/GUI/FrOptions.UMisc.dfm b/Src/GUI/FrOptions.UMisc.dfm
index 0ca388e..a467dfb 100644
--- a/Src/GUI/FrOptions.UMisc.dfm
+++ b/Src/GUI/FrOptions.UMisc.dfm
@@ -1,33 +1,35 @@
inherited MiscOptionsFrame: TMiscOptionsFrame
+ Height = 283
+ ExplicitHeight = 283
object lblSeparatorLines: TLabel
Left = 8
- Top = 36
+ Top = 60
Width = 111
Height = 13
Caption = 'Separate input files by '
end
object lblSeparatorLinesEnd: TLabel
Left = 162
- Top = 36
+ Top = 60
Width = 29
Height = 13
Caption = 'line(s)'
end
object lblLanguage: TLabel
Left = 8
- Top = 64
+ Top = 88
Width = 123
Height = 26
Caption = 'HTML document language'#13#10'(leave blank for default)'
end
object lblTitle: TLabel
Left = 8
- Top = 104
+ Top = 128
Width = 116
Height = 26
Caption = 'Title of HTML document'#13#10'(leave blank for default)'
end
- object chkTrim: TCheckBox
+ object chkTrimLines: TCheckBox
Left = 8
Top = 8
Width = 217
@@ -37,7 +39,7 @@ inherited MiscOptionsFrame: TMiscOptionsFrame
end
object seSeparatorLines: TSpinEdit
Left = 117
- Top = 33
+ Top = 57
Width = 40
Height = 22
EditorEnabled = False
@@ -49,7 +51,7 @@ inherited MiscOptionsFrame: TMiscOptionsFrame
end
object edLanguage: TEdit
Left = 145
- Top = 69
+ Top = 93
Width = 49
Height = 21
MaxLength = 5
@@ -57,14 +59,14 @@ inherited MiscOptionsFrame: TMiscOptionsFrame
end
object edTitle: TEdit
Left = 8
- Top = 136
+ Top = 160
Width = 186
Height = 21
TabOrder = 3
end
object chkBranding: TCheckBox
Left = 8
- Top = 166
+ Top = 190
Width = 217
Height = 17
Caption = 'Include "branding" in documents'
@@ -72,7 +74,7 @@ inherited MiscOptionsFrame: TMiscOptionsFrame
end
object chkViewport: TCheckBox
Left = 8
- Top = 189
+ Top = 213
Width = 217
Height = 17
Caption = 'Set viewport to make mobile friendly'
@@ -80,10 +82,18 @@ inherited MiscOptionsFrame: TMiscOptionsFrame
end
object chkEdgeCompatibility: TCheckBox
Left = 8
- Top = 212
+ Top = 236
Width = 217
Height = 17
Caption = 'Include MS Edge compatibility info'
TabOrder = 6
end
+ object chkTrimSpaces: TCheckBox
+ Left = 8
+ Top = 29
+ Width = 217
+ Height = 17
+ Caption = 'Trim spaces from line ends'
+ TabOrder = 7
+ end
end
diff --git a/Src/GUI/FrOptions.UMisc.pas b/Src/GUI/FrOptions.UMisc.pas
index fdf3c54..c9c99a0 100644
--- a/Src/GUI/FrOptions.UMisc.pas
+++ b/Src/GUI/FrOptions.UMisc.pas
@@ -20,7 +20,7 @@ interface
type
TMiscOptionsFrame = class(TBaseOptionsFrame)
- chkTrim: TCheckBox;
+ chkTrimLines: TCheckBox;
lblSeparatorLines: TLabel;
seSeparatorLines: TSpinEdit;
lblSeparatorLinesEnd: TLabel;
@@ -31,6 +31,7 @@ TMiscOptionsFrame = class(TBaseOptionsFrame)
chkBranding: TCheckBox;
chkViewport: TCheckBox;
chkEdgeCompatibility: TCheckBox;
+ chkTrimSpaces: TCheckBox;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -40,6 +41,9 @@ TMiscOptionsFrame = class(TBaseOptionsFrame)
implementation
+uses
+ UUtils;
+
{$R *.dfm}
{ TMultiFileOptionsFrame }
@@ -56,8 +60,22 @@ destructor TMiscOptionsFrame.Destroy;
end;
procedure TMiscOptionsFrame.Initialise(const Options: TOptions);
+var
+ StrVal: string;
begin
- chkTrim.Checked := Options.GetParamAsBool('trim');
+ StrVal := Options.GetParamAsStr('trim');
+ // Filter out deprecated values for --trim command
+ if IsStrInList(StrVal, ['true', '1', 'y', 'yes', 'on'], False) then
+ StrVal := 'lines'
+ else if IsStrInList(StrVal, ['false', '0', 'n', 'no', 'off'], False) then
+ StrVal := '-'
+ // Choose one item from aliases for --trim parameter names
+ else if IsStrInList(StrVal, ['none', 'nothing'], False) then
+ StrVal := '-'
+ else if IsStrInList(StrVal, ['everything'], False) then
+ StrVal := 'all';
+ chkTrimLines.Checked := IsStrInList(StrVal, ['all', 'lines'], False);
+ chkTrimSpaces.Checked := IsStrInList(StrVal, ['all', 'spaces'], False);
seSeparatorLines.Value := Options.GetParamAsInt('separator-lines');
@@ -82,7 +100,20 @@ procedure TMiscOptionsFrame.Initialise(const Options: TOptions);
procedure TMiscOptionsFrame.UpdateOptions(const Options: TOptions);
begin
- Options.Store('trim', chkTrim.Checked);
+ if chkTrimLines.Checked then
+ begin
+ if chkTrimSpaces.Checked then
+ Options.Store('trim', 'all')
+ else
+ Options.Store('trim', 'lines');
+ end
+ else
+ begin
+ if chkTrimSpaces.Checked then
+ Options.Store('trim', 'spaces')
+ else
+ Options.Store('trim', '-');
+ end;
Options.Store('separator-lines', seSeparatorLines.Value);
From c0d747eaae96bf7cfcb2f719048b0ed6dc22bdb1 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 20:11:00 +0100
Subject: [PATCH 26/33] Add support for --inhibit-styles command to GUI
"Document Type" panel in options pane renamed as "Document
Generation".
Check list box added to select which highlighter entities are not to
be styled.
Update options for new "inhibit-styles" entry.
Miscellaneous pane of PasHiGUI updated to be able to choose to trim
lines, spaces or both.
---
Src/GUI/FmMain.dfm | 16 +++++----
Src/GUI/FrOptions.UDocType.dfm | 16 +++++++++
Src/GUI/FrOptions.UDocType.pas | 60 +++++++++++++++++++++++++++++++++-
Src/GUI/UOptions.pas | 2 ++
4 files changed, 87 insertions(+), 7 deletions(-)
diff --git a/Src/GUI/FmMain.dfm b/Src/GUI/FmMain.dfm
index 6817009..9498ca6 100644
--- a/Src/GUI/FmMain.dfm
+++ b/Src/GUI/FmMain.dfm
@@ -249,7 +249,7 @@ object MainForm: TMainForm
ParentColor = True
TabOrder = 2
object cpnlMisc: TCategoryPanel
- Top = 190
+ Top = 317
Height = 30
Caption = 'Miscellaneous'
Color = clWindow
@@ -270,7 +270,7 @@ object MainForm: TMainForm
end
end
object cpnlLines: TCategoryPanel
- Top = 160
+ Top = 287
Height = 30
Caption = 'Line Numbering && Striping'
Color = clWindow
@@ -291,7 +291,7 @@ object MainForm: TMainForm
end
end
object cpnlCSS: TCategoryPanel
- Top = 130
+ Top = 257
Height = 30
Caption = 'Style Sheets'
Color = clWindow
@@ -313,19 +313,23 @@ object MainForm: TMainForm
end
object cpnlDocType: TCategoryPanel
Top = 0
- Height = 130
- Caption = 'Document Type'
+ Height = 257
+ Caption = 'Document Generation'
Color = clWindow
TabOrder = 3
inline frmDocType: TDocTypeOptionsFrame
Left = 0
Top = 0
Width = 219
- Height = 104
+ Height = 231
Align = alClient
TabOrder = 0
ExplicitWidth = 219
ExplicitHeight = 104
+ inherited clblInhibitStyling: TCheckListBox
+ BevelEdges = []
+ BevelInner = bvLowered
+ end
end
end
end
diff --git a/Src/GUI/FrOptions.UDocType.dfm b/Src/GUI/FrOptions.UDocType.dfm
index e300df7..d081789 100644
--- a/Src/GUI/FrOptions.UDocType.dfm
+++ b/Src/GUI/FrOptions.UDocType.dfm
@@ -6,6 +6,14 @@ inherited DocTypeOptionsFrame: TDocTypeOptionsFrame
Height = 13
Caption = 'Document type:'
end
+ object lblInhibitStyling: TLabel
+ Left = 8
+ Top = 106
+ Width = 69
+ Height = 13
+ Caption = 'Inhibit Styling:'
+ FocusControl = clbInhibitStyling
+ end
object rbDocTypeFragment: TRadioButton
Left = 8
Top = 8
@@ -34,4 +42,12 @@ inherited DocTypeOptionsFrame: TDocTypeOptionsFrame
Style = csDropDownList
TabOrder = 2
end
+ object clbInhibitStyling: TCheckListBox
+ Left = 8
+ Top = 124
+ Width = 188
+ Height = 97
+ ItemHeight = 13
+ TabOrder = 3
+ end
end
diff --git a/Src/GUI/FrOptions.UDocType.pas b/Src/GUI/FrOptions.UDocType.pas
index 660425a..b01c859 100644
--- a/Src/GUI/FrOptions.UDocType.pas
+++ b/Src/GUI/FrOptions.UDocType.pas
@@ -16,7 +16,7 @@ interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls,
+ Dialogs, StdCtrls, CheckLst,
FrOptions.UHelper, FrOptions.UBase, UOptions;
type
@@ -25,10 +25,13 @@ TDocTypeOptionsFrame = class(TBaseOptionsFrame)
rbDocTypeComplete: TRadioButton;
cbCompleteDocType: TComboBox;
lblCompleteDocType: TLabel;
+ clbInhibitStyling: TCheckListBox;
+ lblInhibitStyling: TLabel;
procedure rbDocTypeFragmentClick(Sender: TObject);
procedure rbDocTypeCompleteClick(Sender: TObject);
private
fDocTypeMap: TValueMap;
+ fInhibitStylesMap: TValueMap;
procedure UpdateControls;
public
constructor Create(AOwner: TComponent); override;
@@ -40,6 +43,10 @@ TDocTypeOptionsFrame = class(TBaseOptionsFrame)
implementation
+uses
+ StrUtils,
+ Types;
+
{$R *.dfm}
{ TDocTypeOptionsFrame }
@@ -56,6 +63,23 @@ constructor TDocTypeOptionsFrame.Create(AOwner: TComponent);
end;
fDocTypeMap.GetDescriptions(cbCompleteDocType.Items);
cbCompleteDocType.ItemIndex := fDocTypeMap.IndexOfValue('html5');
+
+ fInhibitStylesMap := TValueMap.Create;
+ fInhibitStylesMap.Add('White space', 'space');
+ fInhibitStylesMap.Add('Comments', 'comment');
+ fInhibitStylesMap.Add('Keywords', 'kwd');
+ fInhibitStylesMap.Add('Identifiers', 'ident');
+ fInhibitStylesMap.Add('Symbols', 'sym');
+ fInhibitStylesMap.Add('String literals', 'str');
+ fInhibitStylesMap.Add('Integers', 'num');
+ fInhibitStylesMap.Add('Floating Point Numbers', 'float');
+ fInhibitStylesMap.Add('Hexadecimal numbers', 'hex');
+ fInhibitStylesMap.Add('Pre-processor instructions', 'preproc');
+ fInhibitStylesMap.Add('Inline assembler', 'asm');
+ fInhibitStylesMap.Add('Syntax Errors', 'err');
+ fInhibitStylesMap.GetDescriptions(clbInhibitStyling.Items);
+ clbInhibitStyling.ItemIndex := fInhibitStylesMap.IndexOfValue('space');
+
UpdateControls;
end;
@@ -68,6 +92,10 @@ destructor TDocTypeOptionsFrame.Destroy;
procedure TDocTypeOptionsFrame.Initialise(const Options: TOptions);
var
DocType: string;
+ Styles: TStringDynArray;
+ StylesStr: string;
+ Style: string;
+ Idx: Integer;
begin
DocType := Options.GetParamAsStr('doc-type');
if DocType = 'fragment' then
@@ -81,6 +109,20 @@ procedure TDocTypeOptionsFrame.Initialise(const Options: TOptions);
rbDocTypeComplete.Checked := True;
cbCompleteDocType.ItemIndex := fDocTypeMap.IndexOfValue(DocType);
end;
+
+ StylesStr := Options.GetParamAsStr('inhibit-styling');
+ if Length(StylesStr) >= 2 then
+ begin
+ StylesStr := Copy(StylesStr, 2, Length(StylesStr) - 2);
+ Styles := SplitString(StylesStr, ',');
+ for Style in Styles do
+ begin
+ Idx := fInhibitStylesMap.IndexOfValue(Style);
+ if Idx >= 0 then
+ clbInhibitStyling.Checked[Idx] := True;
+ end;
+ end;
+
UpdateControls;
end;
@@ -95,6 +137,9 @@ procedure TDocTypeOptionsFrame.rbDocTypeFragmentClick(Sender: TObject);
end;
procedure TDocTypeOptionsFrame.UpdateOptions(const Options: TOptions);
+var
+ Idx: Integer;
+ Value: string;
begin
if rbDocTypeFragment.Checked then
Options.Store('doc-type', 'fragment')
@@ -102,6 +147,19 @@ procedure TDocTypeOptionsFrame.UpdateOptions(const Options: TOptions);
Options.Store(
'doc-type', fDocTypeMap.ValueByIndex(cbCompleteDocType.ItemIndex)
);
+
+ Value := '';
+ for Idx := 0 to Pred(clbInhibitStyling.Count) do
+ begin
+ if clbInhibitStyling.Checked[Idx] then
+ begin
+ if Value = '' then
+ Value := fInhibitStylesMap.ValueByIndex(Idx)
+ else
+ Value := Value + ',' + fInhibitStylesMap.ValueByIndex(Idx);
+ end;
+ end;
+ Options.Store('inhibit-styling', '{' + Value + '}');
end;
procedure TDocTypeOptionsFrame.UpdateControls;
diff --git a/Src/GUI/UOptions.pas b/Src/GUI/UOptions.pas
index 8fab43f..d35f7bc 100644
--- a/Src/GUI/UOptions.pas
+++ b/Src/GUI/UOptions.pas
@@ -252,6 +252,8 @@ procedure TOptions.SetDefaults;
Store('viewport', 'none');
if not IsSet('edge-compatibility') then
Store('edge-compatibility', False);
+ if not IsSet('inhibit-styling') then
+ Store('inhibit-styling', '{}');
end;
procedure TOptions.Store(const Option, Value: string);
From 92ce53773740c66e7ec04c6564ef943342be372a Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 20:27:47 +0100
Subject: [PATCH 27/33] Rename inhibit styling check list box in main form
---
Src/GUI/FmMain.dfm | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/Src/GUI/FmMain.dfm b/Src/GUI/FmMain.dfm
index 9498ca6..dc44049 100644
--- a/Src/GUI/FmMain.dfm
+++ b/Src/GUI/FmMain.dfm
@@ -255,8 +255,6 @@ object MainForm: TMainForm
Color = clWindow
Collapsed = True
TabOrder = 0
- ExplicitTop = 90
- ExplicitWidth = 204
ExpandedHeight = 284
inline frmMisc: TMiscOptionsFrame
Left = 0
@@ -265,8 +263,8 @@ object MainForm: TMainForm
Height = 0
Align = alClient
TabOrder = 0
- ExplicitWidth = 202
- ExplicitHeight = 250
+ ExplicitWidth = 219
+ ExplicitHeight = 0
end
end
object cpnlLines: TCategoryPanel
@@ -276,8 +274,6 @@ object MainForm: TMainForm
Color = clWindow
Collapsed = True
TabOrder = 1
- ExplicitTop = 60
- ExplicitWidth = 204
ExpandedHeight = 192
inline frmLines: TLineStyleOptionsFrame
Left = 0
@@ -297,8 +293,6 @@ object MainForm: TMainForm
Color = clWindow
Collapsed = True
TabOrder = 2
- ExplicitTop = 30
- ExplicitWidth = 204
ExpandedHeight = 286
inline frmCSS: TCSSOptionsFrame
Left = 0
@@ -325,8 +319,8 @@ object MainForm: TMainForm
Align = alClient
TabOrder = 0
ExplicitWidth = 219
- ExplicitHeight = 104
- inherited clblInhibitStyling: TCheckListBox
+ ExplicitHeight = 231
+ inherited clbInhibitStyling: TCheckListBox
BevelEdges = []
BevelInner = bvLowered
end
@@ -471,7 +465,7 @@ object MainForm: TMainForm
Left = 336
Top = 152
Bitmap = {
- 494C010105000900240010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
+ 494C010105000900280010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000002000000001002000000000000020
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
From 053edafe39bed3106712e11545706cb804c9320c Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 20:29:13 +0100
Subject: [PATCH 28/33] Bump config files version from 5 to 6
---
Config/version | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Config/version b/Config/version
index 7813681..62f9457 100644
--- a/Config/version
+++ b/Config/version
@@ -1 +1 @@
-5
\ No newline at end of file
+6
\ No newline at end of file
From c8be553ba1aa87ef760d677f8d05f10b757e908f Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Thu, 20 Oct 2022 20:30:06 +0100
Subject: [PATCH 29/33] Add info about user guide & help to `config-template`
---
Config/config-template | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Config/config-template b/Config/config-template
index e1ad6fe..8b1d8dd 100644
--- a/Config/config-template
+++ b/Config/config-template
@@ -65,6 +65,10 @@
#
# A complete list of valid commands follows. Commands and parameters that are
# slated for removal in the next major release are flagged as deprecated.
+#
+# For an explanation of what these commands do see the documentation of the
+# related command line command in the user guide or in PasHi's help screen,
+# accessed by typing "PasHi --help".
# --- Input source commands ---
From a18e3838866c7d734455e3a3b71c4f441102202a Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Sat, 22 Oct 2022 10:28:40 +0100
Subject: [PATCH 30/33] Fix memory leek.
Fix leak in TDocTypeOptionsFrame destrucutor in
`Src/GUI/FrOptions.UDocType.pas`.
Fixes #58
---
Src/GUI/FrOptions.UDocType.pas | 1 +
1 file changed, 1 insertion(+)
diff --git a/Src/GUI/FrOptions.UDocType.pas b/Src/GUI/FrOptions.UDocType.pas
index b01c859..8682acd 100644
--- a/Src/GUI/FrOptions.UDocType.pas
+++ b/Src/GUI/FrOptions.UDocType.pas
@@ -85,6 +85,7 @@ constructor TDocTypeOptionsFrame.Create(AOwner: TComponent);
destructor TDocTypeOptionsFrame.Destroy;
begin
+ fInhibitStylesMap.Free;
fDocTypeMap.Free;
inherited;
end;
From e9d2c310e604da68aa2c2b21eaddb7af4998bd30 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Sat, 22 Oct 2022 11:14:50 +0100
Subject: [PATCH 31/33] Tweak content & reformat User Guide
---
Docs/UserGuide.html | 388 ++++++++++++++++++++++----------------------
1 file changed, 198 insertions(+), 190 deletions(-)
diff --git a/Docs/UserGuide.html b/Docs/UserGuide.html
index 90d7822..3e32cd2 100644
--- a/Docs/UserGuide.html
+++ b/Docs/UserGuide.html
@@ -96,6 +96,9 @@
margin: 0.5em 0 0 0;
padding: 0;
}
+ td p:first-child {
+ margin-top: 0;
+ }
pre,
code,
.file,
@@ -288,10 +291,10 @@
- HTML 4 [deprecated], XHTML and HTML 5 are all supported. CSS is used for styling. Style
- sheets may be external or can be embedded in the HTML document. Several
- predefined style sheets can be installed with the program. You can also
- create [deprecated], XHTML and HTML 5 are all
+ supported. CSS is used for styling. Style sheets may be external or can be
+ embedded in the HTML document. Several predefined style sheets can be
+ installed with the program. You can also create your own.
@@ -306,7 +309,7 @@
- PasHiGUI, an optional GUI front end for PasHi, is included
+ PasHiGUI, a GUI front end for PasHi, is optionally included
in the release. This provides a point and click way of using PasHi.
Most, but not all, command line options are supported. Files and text can be
dragged and dropped onto the program's window to highlight them.
@@ -410,63 +413,63 @@
--input-stdin |
|
- Reads source code from standard input. Since standard input is the default
- input source, this command is provided mainly to restore the default
- behaviour if it has been overridden in the config file.
- This command should not be combined with --input-clipboard or
- used if file names are specified on the command line.
+ Reads source code from standard input. Since standard input is the
+ default input source, this command is provided mainly to restore the
+ default behaviour if it has been overridden in the config file.
+ This command should not be combined with --input-clipboard
+ or used if file names are specified on the command line.
|
--input-clipboard |
-r |
- Reads source code from the clipboard.
- This command should not be combined with --input-stdin or
- used if file names are specified on the command line.
+ Reads source code from the clipboard.
+ This command should not be combined with --input-stdin or
+ used if file names are specified on the command line.
|
--output-stdout |
|
- Writes highlighted code to standard output. Since standard output is the
- default output destination, this command is provided mainly to restore the
- default behaviour if it has been overridden in the config file.
- This command should not be combined with either --output-file
- or --output-clipboard .
+ Writes highlighted code to standard output. Since standard output is
+ the default output destination, this command is provided mainly to restore
+ the default behaviour if it has been overridden in the config file.
+ This command should not be combined with either
+ --output-file or --output-clipboard .
|
--output-file |
-o |
- Writes highlighted code to the file specified by the following parameter.
- Using this command has exactly the same effect as redirecting standard
- output to a file.
- This command should not be combined with either
- --output-stdout or --output-clipboard .
+ Writes highlighted code to the file specified by the following
+ parameter. Using this command has exactly the same effect as redirecting
+ standard output to a file.
+ This command should not be combined with either
+ --output-stdout or --output-clipboard .
|
--output-clipboard |
-w |
- Writes highlighted code to the clipboard. All output is stored as Unicode
- text. Character set information is excluded from complete HTML documents.
-
- Do not combine this command with either --output-stdout
- or --output-file .
+ Writes highlighted code to the clipboard. All output is stored as
+ Unicode text. Character set information is excluded from complete HTML
+ documents.
+ Do not combine this command with either --output-stdout
+ or --output-file .
|
--doc-type |
-d |
- Determines the type of document to be output. All but one of the document
- types are complete HTML documents. The required document type is specified
- in the following parameter which must be one of:
-
+ Determines the type of document to be output. All but one of the
+ document types are complete HTML documents. The required document type is
+ specified in the following parameter which must be one of:
+
-
xhtml : Complete XHTML document (the default):
Default deprecated – to change to
@@ -492,12 +495,13 @@
--branding |
-b |
- Switches on or off the inclusion of "branding" information in
+ Switches on or off the inclusion of "branding" information in
output documents. Branding means that the document contains code
- indicating that the document was generated by PasHi.
- In the case of --branding , the following parameter determines
- whether branding is switched on or off. The parameter must be one of:
-
+ indicating that the document was generated by PasHi.
+ In the case of --branding , the following parameter
+ determines whether branding is switched on or off. The parameter must be
+ one of:
+
-
True , 1 , Y , yes or
on :
@@ -509,103 +513,102 @@
Exclude branding.
- The short form of the command, -b , acts as a switch:
+ The short form of the command, -b , acts as a switch:
-b+ and -b1 include branding while
- -b- and -b0 exclude it.
+ -b- and -b0 exclude it.
|
|
--language |
-l |
- Specifies the language used in the output document. A language code
+ Specifies the language used in the output document. A language code
recognised by HTML must be provided in the parameter that immediately
follows this command. The code is not checked. If this command is not
- supplied then no language information is included in the output file.
-
- This command has no effect if the --doc-type fragment
- command is used.
+ supplied then no language information is included in the output file.
+ This command has no effect if the --doc-type fragment
+ command is used.
|
--language-neutral |
|
- Indicates that no language information is to be included in output
+ Indicates that no language information is to be included in output
documents. Since this is the default behaviour this command is provided
mainly to restore that behaviour if it has been overridden in the config
- file.
+ file.
|
--title |
-t |
- Sets the title of the output document. The title text must be supplied in
- the parameter immediately following the command. Titles containing spaces
- must be enclosed in double quotes.
- This command has no effect if the --doc-type fragment
- command is also used.
+ Sets the title of the output document. The title text must be supplied
+ in the parameter immediately following the command. Titles containing
+ spaces must be enclosed in double quotes.
+ This command has no effect if the --doc-type fragment
+ command is also used.
|
--title-default |
|
- Indicates that the default title is to be used in the output document.
+ Indicates that the default title is to be used in the output document.
Since this is the default behaviour this command is provided mainly to
- restore that behaviour if it has been overridden in the config file.
- This command has no effect if the
- --doc-type fragment command is also used.
+ restore that behaviour if it has been overridden in the config file.
+ This command has no effect if the
+ --doc-type fragment command is also used.
|
--embed-css |
-s |
- Creates an embedded CSS style sheet in the output document. The CSS is
+ Creates an embedded CSS style sheet in the output document. The CSS is
read from the file whose name is specified by the parameter immediately
following the command. The CSS must define the styles described
- below.
- If the file name includes no path information, e.g.
+ below.
+ If the file name includes no path information, e.g.
delphi2006.css , then the file will be expected to be found in
the %AppData%\DelphiDabbler\PasHi directory. To
read a file from the working directory, prepend .\ to it,
- e.g. .\delphi2006.css .
- Do not combine this command with --link-css or
+ e.g. .\delphi2006.css .
+ Do not combine this command with --link-css or
--default-css because the commands are mutually exclusive and
the result will be unpredictable. --embed-css is ignored if
- the --doc-type fragment command is also used.
+ the --doc-type fragment command is also used.
|
--link-css |
-k |
- Specifies the URL of an external CSS file to be linked from the generated
- HTML file. The URL must be given in the parameter immediately following
- this command. The URL can be relative or absolute. The linked CSS file
- must define the styles described below.
- Since no CSS is embedded in the output file the
+ Specifies the URL of an external CSS file to be linked from the
+ generated HTML file. The URL must be given in the parameter immediately
+ following this command. The URL can be relative or absolute. The linked
+ CSS file must define the styles described below.
+ Since no CSS is embedded in the output file the
--hide-css command does nothing if used with this command.
Do not combine --link-css with --embed-css or
--default-css because the commands are mutually exclusive and
the result will be unpredicatble. --link-css is ignored if
- --doc-type fragment is also used.
+ --doc-type fragment is also used.
|
--default-css |
|
- Inidicates that the default style sheet is to be embedded in the output
+ Inidicates that the default style sheet is to be embedded in the output
document. Since this is the default behaviour, this command is provided
mainly to restore that behaviour if it has been overridden in the config
- file.
- This command negates both the --embed-css and
+ file.
+ This command negates both the --embed-css and
--link-css commands and should not be combined with them
because the result will be unpredictable. --default-css is
- ignored if the --doc-type fragment command is also used.
+ ignored if the --doc-type fragment command is also used.
|
@@ -613,14 +616,14 @@
[deprecated]
-c |
- Determines wheher embedded CSS code is wrapped in HTML comment tags
+ Determines wheher embedded CSS code is wrapped in HTML comment tags
(<!-- ... --> ). This command is provided
because some old browsers will render the CSS as text unless it is
- enclosed in comment tags.
- In the case of --hide-css the parameter following the command
- determines whether the CSS is hidden in comments or not. This parameter
- must be one of the following:
-
+ enclosed in comment tags.
+ In the case of --hide-css the parameter following the
+ command determines whether the CSS is hidden in comments or not. This
+ parameter must be one of the following:
+
-
True , 1 , Y , yes or
on :
@@ -632,12 +635,12 @@
Do not use comments (the default).
- The short form of the command, -c , acts as a switch.
+ The short form of the command, -c , acts as a switch.
-c+ and -c1 hide the CSS in comments while
- -c- and -c0 do not.
- --hide-css is ignored when either the
+ -c- and -c0 do not.
+ --hide-css is ignored when either the
--doc-type fragment or --link-css commands
- are used.
+ are used.
|
@@ -646,11 +649,11 @@
|
- Determines whether CSS classes in generated HTML documents revert to those
- used in PasHi v1 (legacy) or whether the new class names
+ Determines whether CSS classes in generated HTML documents revert to
+ those used in PasHi v1 (legacy) or whether the new class names
introduced in PasHi v2 are used. The next parameter must have one
- of the following values:
-
+ of the following values:
+
-
True , 1 , Y , yes or
on :
@@ -662,60 +665,60 @@
Use new CSS class names (the default).
- This command is provided for when you have to maintain code that uses the
- old CSS style names. New code should use the new class names.
- When using the --embed-css or --link-css
+ This command is provided for when you have to maintain code that uses
+ the old CSS style names. New code should use the new class names.
+ When using the --embed-css or --link-css
commands you should be careful to ensure that the CSS file you are
embedding or linking defines the correct class names. The CSS files that
are optionally installed with PasHi define both legacy and new
CSS classes. See below for information about the
- required CSS class names.
+ required CSS class names.
|
--inhibit-styling |
|
- Enables styling for specified syntactic elements to be omitted from the
+ Enables styling for specified syntactic elements to be omitted from the
HTML output. This is useful in reducing the size of HTML documents if you
- have elements that are not styled in any way.
- This command must be followed by a parameter which is either
+ have elements that are not styled in any way.
+ This command must be followed by a parameter which is either
the name of a syntactic element for which styling is to be prevented
or a set of zero or more syntactic elements. A set is a comma
delimited list of element names, enclosed in { and
- } characters. When a set of two or more elements is specified
- styling is inhibited for all the elements. The list must not contain
- spaces. Valid element names are:
-
- space white space
- comment comments
- kwd keywords
- ident identifiers
- sym symbols
- str string literals
- num integers
- float floating point numbers
- hex hexadecimal numbers
- preproc pre-processor instructions
- asm assembler code
- err syntax errors
+ } characters. The list must not contain spaces. Valid element
+ names are:
+
+ space : white space
+ comment : comments
+ kwd : keywords
+ ident : identifiers
+ sym : symbols
+ str : string literals
+ num : integers
+ float : floating point numbers
+ hex : hexadecimal numbers
+ preproc : pre-processor instructions
+ asm : assembler code
+ err : syntax errors
- Use {} (an empty set) or - (a minus sign) to
- enable all elements to be highlighted (the default).
- Examples: To suppress generation of styling for white space only, use
+ Use {} (an empty set) or - (a minus sign) to
+ enable all elements to be highlighted (the default).
+ Examples: To suppress generation of styling for white space only, use
--inhibit-styling space or --inhibit-styling
{space} . To suppress both white space and syntax errors use
- --inhibit-styling {space,err} .
+ --inhibit-styling {space,err} .
|
--encoding |
-e |
- Sets the character encoding used for output to that specified in the
+ Sets the character encoding used for output to that specified in the
next parameter. HTML documents are marked with the chosen format and the
- resulting file may include byte order marks. Valid encoding parameters are:
-
+ resulting file may include byte order marks. Valid encoding parameters
+ are:
+
-
utf-8 or utf8 : Encodes in Unicode using
UTF-8 format with byte order mark (the default).
@@ -735,8 +738,9 @@
latin1 : Encodes in ISO-8859-1 format.
- This command is ignored if the --output-clipboard command is
- specified, because data is always written to the clipboard in Unicode.
+ This command is ignored if the --output-clipboard command
+ is specified, because data is always written to the clipboard in
+ Unicode.
|
@@ -744,12 +748,12 @@
-m
[deprecated] |
- Determines if or how source code is trimmed of blank lines and spaces
+ Determines if or how source code is trimmed of blank lines and spaces
before highlighting. Multiple source files are trimmed individually before
- concatenation.
- In the case of --trim the following parameter is used to
- specify the type of trimming to be performed:
-
+ concatenation.
+ In the case of --trim the following parameter is used to
+ specify the type of trimming to be performed:
+
-
- , none or nothing :
do not trim anything.
@@ -770,9 +774,10 @@
lines.
- --trim also supports the following Boolean values that were
- used with --trim in PasHi v2.2.1 and earlier.
-
+ --trim also supports the following Boolean values that
+ were used with --trim in PasHi v2.2.1 and
+ earlier.
+
-
True , 1 , Y , yes or
on all deprecated:
@@ -784,10 +789,10 @@
Aliases for --trim none .
- The short form of the command, -m , acted as a switch in
+ The short form of the command, -m , acted as a switch in
PasHi v2.2.1 and earlier. The command is now interpreted as
- follows:
-
+ follows:
+
-
-m+ and -m1 both
deprecated:
@@ -805,22 +810,22 @@
--separator-lines |
|
- Specifies the number of blank lines to insert between the contents of each
- source file. The required number of lines is given in the following
- parameter and must be in the range 0..16. The default value is 1.
- This command is ignored unless more than one file is specified on the
- command line.
+ Specifies the number of blank lines to insert between the contents of
+ each source file. The required number of lines is given in the following
+ parameter and must be in the range 0..16. The default value is 1.
+ This command is ignored unless more than one file is specified on the
+ command line.
|
|
--line-numbering |
-n |
- Determines whether line numbers are prepended to each line of source code
- in the output document.
- In the case of --line-numbering the following parameter is
- used to switch line numbering on or off:
-
+ Determines whether line numbers are prepended to each line of source
+ code in the output document.
+ In the case of --line-numbering the following parameter is
+ used to switch line numbering on or off:
+
-
True , 1 , Y , yes or
on :
@@ -832,31 +837,32 @@
Line numbers are disabled (the default).
- The short form of the command, -n , acts as a switch:
+ The short form of the command, -n , acts as a switch:
-n+ and -n1 enable line numbering on while
- -n- and -n0 disable it.
+ -n- and -n0 disable it.
|
--line-number-width |
-i |
- Determines the minimum width, in characters, occupied by line numbers.
+ Determines the minimum width, in characters, occupied by line numbers.
Line numbers are padded to this width if necessary, but longer line
numbers are not truncated. The required width is given in the following
- parameter and must be in the range 1..6. The default value is 3.
- This command is ignored if line numbering is not enabled: see the
- --line-numbering command.
+ parameter and must be in the range 1..6. The default value is 3.
+ This command is ignored if line numbering is not enabled: see the
+ --line-numbering command.
|
--line-number-padding |
-p |
- Determines the padding character to be used when the number of characters
- in a line number is less than the available width. The required character
- is specified in the following parameter, which must be one of:
-
+ Determines the padding character to be used when the number of
+ characters in a line number is less than the available width. The required
+ character is specified in the following parameter, which must be one
+ of:
+
-
space : Pads with space characters (the default).
@@ -870,28 +876,28 @@
dot : Pads with dots (.).
- This command is ignored if line numbering is not enabled: see the
- --line-numbering command.
+ This command is ignored if line numbering is not enabled: see the
+ --line-numbering command.
|
--line-number-start |
-z |
- Determines the number of the first line in the listing, in the range
- 1..9999. The default value is 1.
- This command is ignored if line numbering is not enabled: see the
- --line-numbering command.
+ Determines the number of the first line in the listing, in the range
+ 1..9999. The default value is 1.
+ This command is ignored if line numbering is not enabled: see the
+ --line-numbering command.
|
--striping |
|
- Determines whether alternate lines of source code in the output document
- are styled differently or appear the same. The next parameter must be one
- of the following values:
-
+ Determines whether alternate lines of source code in the output
+ document are styled differently or appear the same. The next parameter
+ must be one of the following values:
+
-
True , 1 , Y , yes or
on :
@@ -903,24 +909,24 @@
All lines have the same appearance (the default).
- Each line of output is enclosed in its own <pre> tag.
- When striping is disabled each <pre> tag has class
+ Each line of output is enclosed in its own <pre>
+ tag. When striping is disabled each <pre> tag has class
line which can optionally be defined in CSS to style the
line. When striping is enabled the line class is replaced by
odd-line and even-line on alternate lines.
These classes must be defined differently in CSS otherwise no difference
between alternate lines will be visible. See below for
- more information about the necessary CSS classes.
+ more information about the necessary CSS classes.
|
--viewport |
|
- Determines the type, if any, of viewport meta-data that is written to a
+ Determines the type, if any, of viewport meta-data that is written to a
HTML document head section. The type of meta-data depends on the value
- the next parameter, which must be one of:
- |
--edge-compatibility |
|
- Determines whether a Microsoft Edge IE compatibility meta tag is written
- to an HTML document head. The next parameter must be one of the following
- values:
-
+ Determines whether a Microsoft Edge IE compatibility meta tag is
+ written to an HTML document head. The next parameter must be one of the
+ following values:
+
-
True , 1 , Y , yes or
on :
@@ -956,18 +962,18 @@
Do not write the meta data (the default).
- This command has no effect if the --doc-type fragment
- command is also used.
+ This command has no effect if the --doc-type fragment
+ command is also used.
|
--verbosity |
|
- Determines the amount of output PasHi writes to standard error while
+ Determines the amount of output PasHi writes to standard error while
executing. The amount of output depends on the value of the next
- parameter, which must be one of:
-
+ parameter, which must be one of:
+
-
normal : Normal screen output (the default). This causes
the program to display sign-on information and to display a message
@@ -998,22 +1004,24 @@
--quiet |
-q |
- Alias for the --verbosity quiet command.
+ Alias for the --verbosity quiet command.
|
|
--help |
-h |
- Displays a help screen. The remainder of the command line is ignored.
+ Displays a help screen. The remainder of the command line is
+ ignored.
|
--version |
-v |
- Displays the program's version number. The remainder of the command line
- is ignored, except for --help , which takes precendence.
+ Displays the program's version number. The remainder of the command
+ line is ignored, except for --help , which takes
+ precendence.
|
@@ -1045,32 +1053,32 @@
-rc
[deprecated] |
- Alias for the --input-clipboard command.
+ Alias for the --input-clipboard command.
|
-wc
[deprecated] |
- Alias for the --output-clipboard command.
+ Alias for the --output-clipboard command.
|
-frag
[deprecated] |
- Alias for the --doc-type fragment command.
+ Alias for the --doc-type fragment command.
|
-hidecss
[deprecated] |
- Alias for -c+ or the --hide-css yes
- command.
- Note: the --hide-css and
+ Alias for -c+ or the --hide-css yes
+ command.
+ Note: the --hide-css and
-c commands are also
- [deprecated].
+ [deprecated].
|
@@ -1251,7 +1259,7 @@
scripts are:
-
+
-
config-template
@@ -1374,7 +1382,7 @@
There are further CSS classes that can be associated with each line. They are:
-
+
-
.line
@@ -1418,7 +1426,7 @@
class should be provided. These classes are:
-
+
-
.comment
@@ -1682,7 +1690,7 @@
PasHi is first run after installation. The files are:
-
+
-
delphi4.css
From 6b704d5387091a3c7c9c865c03271ec979ba2789 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Sat, 22 Oct 2022 11:51:47 +0100
Subject: [PATCH 32/33] Update version numbers for PasHi & PasHiGUI
---
VERSION | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/VERSION b/VERSION
index bc1c12a..17434b1 100644
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
# PasHi & PasHiGUI file & product version numbers
-cmdlinefilever=2.2.1
-cmdlinebuild=14
-guifilever=1.2.1
-guibuild=8
-productver=2.2.1
+cmdlinefilever=2.3.0
+cmdlinebuild=15
+guifilever=1.3.0
+guibuild=9
+productver=2.3.0
From 5a831a8857ef07e178a336be69d95c9ddbbf9199 Mon Sep 17 00:00:00 2001
From: delphidabbler <5164283+delphidabbler@users.noreply.github.com>
Date: Sat, 22 Oct 2022 11:52:03 +0100
Subject: [PATCH 33/33] Update change log re release 2.3.0
---
CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f63c236..6d271b4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,43 @@ This change log begins with the first ever pre-release version of what was then
From release 2.0.0 the version numbering has attempted to adhere to the principles of [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Release 2.3.0 - 2022-10-22
+
+This release includes _PasHi_ v2.3.0 and _PasHiGUI_ v1.3.0
+
+### PasHi 2.3.0 [build 15]
+
+* Added new `--inhibit-styling` command to prevent `` tags from being emitted for specified highlighter elements. [Issue 30]
+* Modified operation of `--trim` command to add facility to trim trailing spaces from source code lines. Added new parameters to specify whether lines, trailing spaces or nothing are to be trimmed. Maintained backward compatibility with older parameters, but deprecated them. [Issue 29]
+* Added new `-v` command as an alias for `--verbosity`. [Issue 38]
+* Added `frag` parameter as an alias for `fragment` in `--doc-type` command. [Issue 47]
+* Enabled `-` to be used as a parameter.
+* Added support for parsing set type parameters in form `{elem1,elem2,...}`.
+* Updated text of help screen re the new & modified commands.
+* Some minor refactoring.
+
+### PasHiGUI 1.3.0 [build 9]
+
+* Updated options pane to provide support for the new `--inhibit-styling` and modified `--trim` commands.
+
+### General
+
+* Update `UserGuide.html`:
+ * Add information about new & modified commands.
+ * Tweaked some content.
+ * Restyled tales for impreved readability.
+* Bumped config files version from 5 to 6. [Issue 55]
+* Updated `config-template`:
+ * Added comments detailing new `inhibit-styling` and modified `trim` commands.
+ * Added information about `line-number-satrt` command omitted from previous release. [Issue 53]
+ * Standardised formatting of comments.
+ * Added content explaining how to get help on the purpose of the config file commands.
+
+### Repository changes
+
+* Added link to user guide in `README.md`. [Issue 50]
+* Corrected formatting of Inno Setup files on GitHub. [Issue 36]
+
## Release 2.2.1 - 2022-08-29
This release includes _PasHi_ v2.2.1 and _PasHiGUI_ v1.2.1. Changes are as follows: