Skip to content

Commit

Permalink
v2.2.6 (#7)
Browse files Browse the repository at this point in the history
* Fixed: Export to HTML: white spaces in notes not preserved

* Code review

* Code review

* Code review

* Code review

* Code review

* v2.2.6

* Update README.md
  • Loading branch information
maurizuki authored Mar 17, 2022
1 parent 3f8366c commit ce74076
Show file tree
Hide file tree
Showing 37 changed files with 8,570 additions and 18,457 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ In order to start to use O2, please read the [*Getting started* section of the w

## Change log

### Version 2.2.6
- Fixed: multiple consecutive white spaces in notes are not preserved during export to HTML.
- Minor improvements.

### Version 2.2.5
- Export to HTML: new page style in three flavors.
- Check for updates: integration with the GitHub REST API.
Expand Down
2 changes: 1 addition & 1 deletion release.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ upx --compress-icons=0 $AppExeFilePath

# Build the installer file

iscc.exe $SetupScriptFilePath
iscc $SetupScriptFilePath

# Generate the version information file

Expand Down
Binary file modified setup/ReadMe.rtf
Binary file not shown.
4 changes: 2 additions & 2 deletions sf_net/upd8r.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<AppVersion>
<MajorVersion>2</MajorVersion>
<MinorVersion>2</MinorVersion>
<Release>5</Release>
<Build>477</Build>
<Release>6</Release>
<Build>482</Build>
</AppVersion>
<DownloadURL>https://github.com/maurizuki/O2/releases/latest</DownloadURL>
</Update>
80 changes: 2 additions & 78 deletions src/Library/uO2Objects.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
interface

uses
Classes, Contnrs, SysUtils, System.Types, uO2Classes;
Classes, Contnrs, SysUtils, Types, System.Generics.Collections, uO2Classes;

type
TO2Field = class(TO2CollectionItem)
Expand Down Expand Up @@ -109,35 +109,16 @@ TO2Objects = class(TO2Collection)
property Objects[Index: Integer]: TO2Object read GetObjects; default;
end;

TO2ObjectListEnumerator = class(TListEnumerator)
public
function GetCurrent: TO2Object;
property Current: TO2Object read GetCurrent;
end;

TO2ObjectList = class(TObjectList)
private
function GetItem(Index: Integer): TO2Object;
procedure SetItem(Index: Integer; AObject: TO2Object);
TO2ObjectList = class(TObjectList<TO2Object>)
public
constructor Create;
function Add(AObject: TO2Object): Integer;
function Extract(AObject: TO2Object): TO2Object;
function Remove(AObject: TO2Object): Integer;
function GetEnumerator: TO2ObjectListEnumerator;
function IndexOf(AObject: TO2Object): Integer;
procedure Insert(Index: Integer; AObject: TO2Object);
function First: TO2Object;
function Last: TO2Object;
procedure GetFieldNames(const List: TStrings);
procedure GetTags(const List: TStrings);
procedure AddTag(const Tag: string);
procedure DeleteTag(const Tag: string);
function ReplaceFieldName(const FieldName, NewFieldName: string): Integer;
procedure ReplaceFieldValue(const FieldName, NewFieldValue: string);
procedure ReplaceTag(const Tag, NewTag: string);
property Items[Index: Integer]: TO2Object
read GetItem write SetItem; default;
end;

implementation
Expand Down Expand Up @@ -579,70 +560,13 @@ procedure TO2Objects.GetTags(const List: TStrings);
end;
end;

{ TO2ObjectListEnumerator }

function TO2ObjectListEnumerator.GetCurrent: TO2Object;
begin
Result := inherited GetCurrent;
end;

{ TO2ObjectList }

constructor TO2ObjectList.Create;
begin
inherited Create(False);
end;

function TO2ObjectList.GetItem(Index: Integer): TO2Object;
begin
Result := TO2Object(inherited Items[Index]);
end;

procedure TO2ObjectList.SetItem(Index: Integer; AObject: TO2Object);
begin
inherited Items[Index] := AObject;
end;

function TO2ObjectList.Add(AObject: TO2Object): Integer;
begin
Result := inherited Add(AObject);
end;

function TO2ObjectList.Extract(AObject: TO2Object): TO2Object;
begin
Result := TO2Object(inherited Extract(AObject));
end;

function TO2ObjectList.Remove(AObject: TO2Object): Integer;
begin
Result := inherited Remove(AObject);
end;

function TO2ObjectList.GetEnumerator: TO2ObjectListEnumerator;
begin
Result := TO2ObjectListEnumerator.Create(Self);
end;

function TO2ObjectList.IndexOf(AObject: TO2Object): Integer;
begin
Result := inherited IndexOf(AObject);
end;

procedure TO2ObjectList.Insert(Index: Integer; AObject: TO2Object);
begin
inherited Insert(Index, AObject);
end;

function TO2ObjectList.First: TO2Object;
begin
Result := TO2Object(inherited First);
end;

function TO2ObjectList.Last: TO2Object;
begin
Result := TO2Object(inherited Last);
end;

procedure TO2ObjectList.GetFieldNames(const List: TStrings);
var
AList: TStringList;
Expand Down
141 changes: 46 additions & 95 deletions src/Library/uO2Relations.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
interface

uses
Classes, Contnrs, SysUtils, System.Types, uO2Classes, uO2Objects;
Classes, Contnrs, SysUtils, Types, System.Generics.Collections,
System.Generics.Defaults, uO2Classes, uO2Objects;

type
TO2ObjRelation = class;
Expand Down Expand Up @@ -72,7 +73,7 @@ TO2Relations = class(TO2Collection)
property Relations[Index: Integer]: TO2Relation read GetRelations; default;
end;

TO2ObjRelation = class(TObject)
TO2ObjRelation = class
private
FRelation: TO2Relation;
FObject: TO2Object;
Expand All @@ -84,29 +85,20 @@ TO2ObjRelation = class(TObject)
property Role: string read FRole write FRole;
end;

TO2ObjRelationsEnumerator = class(TListEnumerator)
TO2ObjRelations = class(TObjectList<TO2ObjRelation>)
public
function GetCurrent: TO2ObjRelation;
property Current: TO2ObjRelation read GetCurrent;
procedure SortByObjName;
procedure SortByRole;
end;

TO2ObjRelations = class(TObjectList)
private
function GetItem(Index: Integer): TO2ObjRelation;
procedure SetItem(Index: Integer; AObjRelation: TO2ObjRelation);
TCompareObjRelationByObjName = class(TComparer<TO2ObjRelation>)
public
function Add(AObjRelation: TO2ObjRelation): Integer;
function Extract(AObjRelation: TO2ObjRelation): TO2ObjRelation;
function Remove(AObjRelation: TO2ObjRelation): Integer;
function GetEnumerator: TO2ObjRelationsEnumerator;
function IndexOf(AObjRelation: TO2ObjRelation): Integer;
procedure Insert(Index: Integer; AObjRelation: TO2ObjRelation);
function First: TO2ObjRelation;
function Last: TO2ObjRelation;
procedure SortByObjName;
procedure SortByRole;
property Items[Index: Integer]: TO2ObjRelation read GetItem
write SetItem; default;
function Compare(const Left, Right: TO2ObjRelation): Integer; override;
end;

TCompareObjRelationByRole = class(TComparer<TO2ObjRelation>)
public
function Compare(const Left, Right: TO2ObjRelation): Integer; override;
end;

implementation
Expand Down Expand Up @@ -369,97 +361,56 @@ constructor TO2ObjRelation.Create;
FRole := '';
end;

{ TO2ObjRelationsEnumerator }

function TO2ObjRelationsEnumerator.GetCurrent: TO2ObjRelation;
begin
Result := inherited GetCurrent;
end;

{ TO2ObjRelations }

function TO2ObjRelations.GetItem(Index: Integer): TO2ObjRelation;
begin
Result := TO2ObjRelation(inherited Items[Index]);
end;

procedure TO2ObjRelations.SetItem(Index: Integer; AObjRelation: TO2ObjRelation);
begin
inherited Items[Index] := AObjRelation;
end;

function TO2ObjRelations.Add(
AObjRelation: TO2ObjRelation): Integer;
begin
Result := inherited Add(AObjRelation);
end;

function TO2ObjRelations.Extract(AObjRelation: TO2ObjRelation): TO2ObjRelation;
begin
Result := TO2ObjRelation(inherited Extract(AObjRelation));
end;

function TO2ObjRelations.Remove(
AObjRelation: TO2ObjRelation): Integer;
begin
Result := inherited Remove(AObjRelation);
end;

function TO2ObjRelations.GetEnumerator: TO2ObjRelationsEnumerator;
begin
Result := TO2ObjRelationsEnumerator.Create(Self);
end;

function TO2ObjRelations.IndexOf(
AObjRelation: TO2ObjRelation): Integer;
begin
Result := inherited IndexOf(AObjRelation);
end;

procedure TO2ObjRelations.Insert(Index: Integer;
AObjRelation: TO2ObjRelation);
procedure TO2ObjRelations.SortByObjName;
var
AComparer: TCompareObjRelationByObjName;
begin
inherited Insert(Index, AObjRelation);
AComparer := TCompareObjRelationByObjName.Create;
try
Sort(AComparer);
finally
AComparer.Free;
end;
end;

function TO2ObjRelations.First: TO2ObjRelation;
procedure TO2ObjRelations.SortByRole;
var
AComparer: TCompareObjRelationByRole;
begin
Result := TO2ObjRelation(inherited First);
AComparer := TCompareObjRelationByRole.Create;
try
Sort(AComparer);
finally
AComparer.Free;
end;
end;

function TO2ObjRelations.Last: TO2ObjRelation;
begin
Result := TO2ObjRelation(inherited Last);
end;
{ TCompareObjRelationByObjName }

function ListSortByObjName(Item1, Item2: Pointer): Integer;
function TCompareObjRelationByObjName.Compare(const Left,
Right: TO2ObjRelation): Integer;
var
Name1, Name2: string;
NameLeft, NameRight: string;
begin
if Assigned(TO2ObjRelation(Item1).Obj) then
Name1 := TO2ObjRelation(Item1).Obj.Name
if Assigned(TO2ObjRelation(Left).Obj) then
NameLeft := TO2ObjRelation(Left).Obj.Name
else
Name1 := '';
if Assigned(TO2ObjRelation(Item2).Obj) then
Name2 := TO2ObjRelation(Item2).Obj.Name
NameLeft := '';
if Assigned(TO2ObjRelation(Right).Obj) then
NameRight := TO2ObjRelation(Right).Obj.Name
else
Name2 := '';
Result := CompareText(Name1, Name2);
NameRight := '';
Result := CompareText(NameLeft, NameRight);
end;

procedure TO2ObjRelations.SortByObjName;
begin
Sort(ListSortByObjName);
end;

function ListSortByRole(Item1, Item2: Pointer): Integer;
begin
Result := CompareText(TO2ObjRelation(Item1).Role, TO2ObjRelation(Item2).Role);
end;
{ TCompareObjRelationByRole }

procedure TO2ObjRelations.SortByRole;
function TCompareObjRelationByRole.Compare(const Left,
Right: TO2ObjRelation): Integer;
begin
Sort(ListSortByRole);
Result := CompareText(TO2ObjRelation(Left).Role, TO2ObjRelation(Right).Role);
end;

end.
2 changes: 1 addition & 1 deletion src/Library/uO2Xml.pas
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface
Classes, XMLDoc, XMLIntf, xmldom, msxmldom;

type
TO2XmlFiler = class(TObject)
TO2XmlFiler = class
private
FInstance: TPersistent;
protected
Expand Down
6 changes: 3 additions & 3 deletions src/O2/ENU/o2_DRC.rcn
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<header>
<prop-group name="ITEHeaderProp">
<prop prop-type="Version">9.0</prop>
<prop prop-type="SelfDateTime">44614.7565740741</prop>
<prop prop-type="OrigDateTime">44614.7565740741</prop>
<prop prop-type="XlatDateTime">44588.4124305556</prop>
<prop prop-type="SelfDateTime">44632.816875</prop>
<prop prop-type="OrigDateTime">44632.816875</prop>
<prop prop-type="XlatDateTime">44614.7848611111</prop>
<prop prop-type="Translated">1130</prop>
<prop prop-type="UnTranslated">0</prop>
</prop-group>
Expand Down
5 changes: 2 additions & 3 deletions src/O2/ENU/uHTMLExport.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -1126,10 +1126,10 @@ object HTMLExport: THTMLExport
Name = 'link-color'
end
item
Name = 'border-color'
Name = 'alt-bg-color'
end
item
Name = 'alt-bg-color'
Name = 'border-color'
end>
Left = 16
Top = 96
Expand Down Expand Up @@ -1245,7 +1245,6 @@ object HTMLExport: THTMLExport
'6f6c6f723b'
'096d617267696e2d746f703a202e3572656d3b'
'0970616464696e673a202e31323572656d3b'
'09666f6e742d66616d696c793a206d6f6e6f73706163653b'
'7d')
end
object ExportDialog: TSaveDialog
Expand Down
Loading

0 comments on commit ce74076

Please sign in to comment.