|
From: <an...@us...> - 2012-03-29 05:01:53
|
Revision: 1523
http://graphics32.svn.sourceforge.net/graphics32/?rev=1523&view=rev
Author: angusj
Date: 2012-03-29 05:01:47 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Bug fixes:
1. Transform was breaking on named links that also contained enclosed text ( ie <a name="aname">enclosed text</a> )
2. Broken links check was incorrectly flagging links containing # symbol
3. Broken links check was incorrectly flagging links containing mailto:
4. The check for missing 'head' and 'link' html elements was too late in code.
Modified Paths:
--------------
trunk/DocProcessor/DocProcessor.dof
trunk/DocProcessor/DocStructure.pas
trunk/DocProcessor/MainUnit.dfm
trunk/DocProcessor/MainUnit.pas
trunk/DocProcessor/SimpleDOM.pas
Modified: trunk/DocProcessor/DocProcessor.dof
===================================================================
--- trunk/DocProcessor/DocProcessor.dof 2012-03-28 23:42:09 UTC (rev 1522)
+++ trunk/DocProcessor/DocProcessor.dof 2012-03-29 05:01:47 UTC (rev 1523)
@@ -129,3 +129,6 @@
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
+[HistoryLists\hlUnitAliases]
+Count=1
+Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
Modified: trunk/DocProcessor/DocStructure.pas
===================================================================
--- trunk/DocProcessor/DocStructure.pas 2012-03-28 23:42:09 UTC (rev 1522)
+++ trunk/DocProcessor/DocStructure.pas 2012-03-29 05:01:47 UTC (rev 1523)
@@ -368,8 +368,10 @@
for I := 0 to Links.Count - 1 do
begin
S := Links[I];
+ J := pos('#', S);
+ if J > 0 then setLength(S, J -1);
- if CheckForBrokenLinks and not fileExists(S) then
+ if CheckForBrokenLinks and not fileExists(S) and (Pos('mailto:', S) = 0) then
begin
Project.BrokenLinks.Add(' ' + S + #13#10);
Project.BrokenLinks.Add(' in ' + self.FileName + #13#10);
@@ -635,14 +637,18 @@
try
Dom.LoadFromFile(FileName);
Head := Dom.FindNode('head', True);
+ if not Assigned(Head) then
+ raise Exception.CreateFmt('File ''%s'' is invalid (missing HEAD element)', [FileName]);
Link := Head.FindNode('link', False);
+ if not Assigned(Link) then
+ raise Exception.CreateFmt('File ''%s'' is invalid (missing LINK element)', [FileName]);
Link.Attributes['href'] := StringReplace(Link.Attributes['href'], '\', '/', [rfReplaceAll]);
Title := Head.FindNode('title', False);
Title.Clear;
Title.AddText(DisplayName);
Body := Dom.FindNode('body', True);
- if not Assigned(Head) or not Assigned(Body) then
- raise Exception.CreateFmt('File ''%s'' is invalid', [FileName]);
+ if not Assigned(Body) then
+ raise Exception.CreateFmt('File ''%s'' is invalid (missing BODY element)', [FileName]);
Anchors := TStringList.Create;
Links := TStringList.Create;
Modified: trunk/DocProcessor/MainUnit.dfm
===================================================================
--- trunk/DocProcessor/MainUnit.dfm 2012-03-28 23:42:09 UTC (rev 1522)
+++ trunk/DocProcessor/MainUnit.dfm 2012-03-29 05:01:47 UTC (rev 1523)
@@ -1,5 +1,5 @@
object MainForm: TMainForm
- Left = 159
+ Left = 141
Top = 150
Width = 850
Height = 490
Modified: trunk/DocProcessor/MainUnit.pas
===================================================================
--- trunk/DocProcessor/MainUnit.pas 2012-03-28 23:42:09 UTC (rev 1522)
+++ trunk/DocProcessor/MainUnit.pas 2012-03-29 05:01:47 UTC (rev 1523)
@@ -342,7 +342,6 @@
end;
end;
end;
-
LogReplace('Transforming Files ...... done'#13#10);
LogAdd('Building TOC ...');
Project.BuildToc(ProjectDir + edProjectName.Text + '.hhc');
Modified: trunk/DocProcessor/SimpleDOM.pas
===================================================================
--- trunk/DocProcessor/SimpleDOM.pas 2012-03-28 23:42:09 UTC (rev 1522)
+++ trunk/DocProcessor/SimpleDOM.pas 2012-03-29 05:01:47 UTC (rev 1523)
@@ -587,7 +587,7 @@
Exit;
end;
end;
- DomError('Unexpected end tag');
+ DomError('Unexpected end tag - ' + S);
end;
OmitWhiteSpace(Pos);
N := Dst.Add(GetName(Pos));
@@ -614,8 +614,7 @@
if Pos^ = #0 then DomError('Unexpected document end');
end;
- if (TagInfo.ClosingType in [ctNever]) or
- ((TagInfo.ClosingType = ctAnchor) and (Attributes['name'] <> '')) then
+ if (TagInfo.ClosingType in [ctNever]) then
begin
if Pos^ <> '>' then DomError(Name + ' tag should not contain any data');
Inc(Pos);
@@ -657,7 +656,8 @@
Inc(Pos, 2);
S := GetName(Pos);
if DoHTML then S := LowerCase(S);
- if S <> Name then DomError('Unexpected end tag');
+ if S <> Name then
+ DomError('Unexpected end tag : ' + S + ' ');
if Pos^ <> '>' then DomError('End tag contains unexpected symbols');
Inc(Pos);
Exit;
@@ -677,7 +677,7 @@
begin
case P^ of
'&': S := S + P^;
- #0 : DomError('Unexpected end tag');
+ #0 : DomError('Unexpected null char (#0) in quoted text');
'<': Break;
else
S := S + P^;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|