You've already forked lazarus-ccr
Create more meaningful HTML links from help.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4264 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -27,7 +27,7 @@ uses
|
|||||||
|
|
||||||
const
|
const
|
||||||
ProgramName = 'CvtHelp';
|
ProgramName = 'CvtHelp';
|
||||||
ProgramVersion = '0.01';
|
ProgramVersion = '0.03';
|
||||||
|
|
||||||
var
|
var
|
||||||
OldFileName : string;
|
OldFileName : string;
|
||||||
@ -210,9 +210,13 @@ begin
|
|||||||
WriteLn(NewFileVar, '-->');
|
WriteLn(NewFileVar, '-->');
|
||||||
end
|
end
|
||||||
|
|
||||||
|
{Important note: If you formatted your topics or popup text (what
|
||||||
|
you're linking to) with a different style name, change or add to
|
||||||
|
the next few lines (remove spaces from your style names).}
|
||||||
else if (Pos('class=Topictitle', InStr) > 0) or
|
else if (Pos('class=Topictitle', InStr) > 0) or
|
||||||
(Pos('class=Topic>', InStr) > 0) then {Found a topic?}
|
(Pos('class=Topic>', InStr) > 0) or
|
||||||
begin
|
(Pos('class=Popuptext><a', InStr) > 0) then {Found a topic?}
|
||||||
|
begin {Note since PopupText may have >1 paragraph, look for actual topic}
|
||||||
{Get footnote number _ftnXX}
|
{Get footnote number _ftnXX}
|
||||||
FnPos := Pos('#_', InStr) + 1;
|
FnPos := Pos('#_', InStr) + 1;
|
||||||
FnRef := '';
|
FnRef := '';
|
||||||
@ -227,8 +231,10 @@ begin
|
|||||||
TopicMapped := False;
|
TopicMapped := False;
|
||||||
if MapSection.Values[TopicStr] <> '' then
|
if MapSection.Values[TopicStr] <> '' then
|
||||||
begin
|
begin
|
||||||
WriteLn(NewFileVar, '<a name="', MapSection.Values[TopicStr],
|
WriteLn(NewFileVar, '<a name="', TopicStr, '"></a>');
|
||||||
'"></a>');
|
//Was previously outputting MapSection.Values[TopicStr], which is
|
||||||
|
// just the help numeric value - more meaningful to use topic name
|
||||||
|
// (meaning same as non-mapped topics).
|
||||||
TopicMapped := True;
|
TopicMapped := True;
|
||||||
end;
|
end;
|
||||||
if not TopicMapped then {No mapping in project file for topic?}
|
if not TopicMapped then {No mapping in project file for topic?}
|
||||||
@ -237,21 +243,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{Save part of 1st topic line}
|
{Save part of 1st topic line}
|
||||||
if Pos('class=Topictitle', InStr) > 0 then
|
Write(NewFileVar, Copy(InStr, 1, Pos('>', InStr)));
|
||||||
Write(NewFileVar, Copy(InStr, 1, Pos('class=Topictitle>', InStr)+16))
|
|
||||||
else
|
|
||||||
Write(NewFileVar, Copy(InStr, 1, Pos('class=Topic>', InStr)+11));
|
|
||||||
BuildStr := InStr;
|
BuildStr := InStr;
|
||||||
repeat {Get rest of topic lines}
|
repeat {Get rest of topic lines}
|
||||||
ReadLn(OldFileVar, InStr);
|
ReadLn(OldFileVar, InStr);
|
||||||
if InStr <> '' then
|
if InStr <> '' then
|
||||||
BuildStr := BuildStr + ' ' + InStr;
|
BuildStr := BuildStr + ' ' + InStr;
|
||||||
until InStr = '';
|
until InStr = '';
|
||||||
TopicPos := Length(BuildStr);
|
TopicPos := Pos('+</span>', BuildStr);
|
||||||
repeat
|
if TopicPos = 0 then
|
||||||
Dec(TopicPos);
|
TopicPos := Pos('$</span>', BuildStr);
|
||||||
until (TopicPos = 0) or (BuildStr[TopicPos] = '>');
|
if TopicPos = 0 then
|
||||||
WriteLn(NewFileVar, Copy(BuildStr, TopicPos+2, MaxInt));
|
TopicPos := Pos('#</span>', BuildStr);
|
||||||
|
Delete(BuildStr, 1, TopicPos);
|
||||||
|
TopicPos := Pos('</a>', BuildStr) + 5;
|
||||||
|
WriteLn(NewFileVar, Copy(BuildStr, TopicPos, MaxInt));
|
||||||
end
|
end
|
||||||
|
|
||||||
else if CompareText(InStr, '<div><br clear=all>') = 0 then {Found footnotes?}
|
else if CompareText(InStr, '<div><br clear=all>') = 0 then {Found footnotes?}
|
||||||
@ -288,11 +294,10 @@ begin
|
|||||||
if (Pos(TopicStr, InStr) > LinkPos) and
|
if (Pos(TopicStr, InStr) > LinkPos) and
|
||||||
(Pos(TopicStr, InStr) < NextLinkPos) then
|
(Pos(TopicStr, InStr) < NextLinkPos) then
|
||||||
begin
|
begin
|
||||||
BuildStr := Copy(InStr, 1, LinkPos-1) + '<a href="#';
|
BuildStr := Copy(InStr, 1, LinkPos-1) + '<a href="#' + TopicStr;
|
||||||
if MapSection.Values[TopicStr] <> '' then
|
//Was previously outputting MapSection.Values[TopicStr] if
|
||||||
BuildStr := BuildStr + MapSection.Values[TopicStr]
|
// non-blank, which is just the help numeric value - more
|
||||||
else
|
// meaningful to use topic name.
|
||||||
BuildStr := BuildStr + TopicStr;
|
|
||||||
UnlinkPos := Pos('</u>', InStr);
|
UnlinkPos := Pos('</u>', InStr);
|
||||||
BuildStr := BuildStr + '">' +
|
BuildStr := BuildStr + '">' +
|
||||||
Copy(InStr, LinkPos+3, UnlinkPos-LinkPos-3) + '</a>' +
|
Copy(InStr, LinkPos+3, UnlinkPos-LinkPos-3) + '</a>' +
|
||||||
|
Reference in New Issue
Block a user