wiki: <em>, tags in table cell

git-svn-id: trunk@35617 -
This commit is contained in:
mattias 2012-02-28 22:00:21 +00:00
parent 61a12a5cc6
commit a8098f0d48
5 changed files with 36 additions and 21 deletions

View File

@ -133,7 +133,7 @@ var
Filename: String;
begin
Filename:=PageToFilename(Page,true);
DebugLn(['TWiki2HTMLConverter.SavePage ',Filename]);
//DebugLn(['TWiki2HTMLConverter.SavePage ',Filename]);
ms:=TMemoryStream.Create;
try
SavePageToStream(Page,ms);

View File

@ -348,7 +348,7 @@ begin
end;
wptP, wptBold, wptItalic, wptStrikeTagShort, wptUnderlineTag, wptTT,
wptSup, wptSub, wptSmall, wptSpan, wptString, wptVar, wptKey,
wptSup, wptSub, wptSmall, wptEm, wptSpan, wptString, wptVar, wptKey,
wptPre, wptCenter,
wptBulletList, wptNumberedList, wptDefinitionList,
wptTable, wptTableRow, wptTableCell, wptTableHeadCell,

View File

@ -53,6 +53,7 @@ type
wptSup, // <sup>
wptSub, // <sub>
wptSmall, // <small>
wptEm, // <em>
wptString, // <string>
wptVar, // <var>
wptKey, // <key>
@ -139,6 +140,7 @@ const
(Caption: 'Sup'; Flags: []; Group: wpgFont; BaseToken: wptSup), // wptSup,
(Caption: 'Sub'; Flags: []; Group: wpgFont; BaseToken: wptSub), // wptSub,
(Caption: 'Small'; Flags: []; Group: wpgFont; BaseToken: wptSmall), // wptSmall,
(Caption: 'Em'; Flags: []; Group: wpgFont; BaseToken: wptEm), // wptEm,
(Caption: 'String'; Flags: []; Group: wpgFont; BaseToken: wptString), // wptString,
(Caption: 'Var'; Flags: []; Group: wpgFont; BaseToken: wptVar), // wptVar,
(Caption: 'Key'; Flags: []; Group: wpgFont; BaseToken: wptKey), // wptKey,
@ -276,6 +278,7 @@ type
procedure EmitTextToken;
procedure ParseCell;
procedure ParseAttributes(StartPos, EndPos: PChar);
procedure ParseNoWiki;
procedure CloseTableCell;
procedure CloseRangeToken(Typ: TWPTokenType);
procedure OpenRangeToken(Typ: TWPTokenType);
@ -587,6 +590,27 @@ begin
//debugln(['TWikiPage.ParseAttributes stopped at <',dbgstr(StartPos,p-StartPos),'>']);
end;
procedure TWikiPage.ParseNoWiki;
begin
// ignore all tags
// this is not the same as pre (preformatted treats spaces and line breaks)
EmitTextToken;
FCurP:=FindTagEnd(FCurP);
FLastEmitPos:=FCurP;
repeat
case FCurP^ of
#0: break;
'<':
if TokenIs('</nowiki>') then
break;
end;
inc(FCurP);
until false;
EmitTextToken;
FCurP:=FindTagEnd(FCurP);
FLastEmitPos:=FCurP;
end;
procedure TWikiPage.CloseTableCell;
var
t: TWPTokenType;
@ -993,6 +1017,9 @@ begin
if NextBar^='[' then begin
// a link
break;
end else if (NextBar^='<') and IsIdentStartChar[NextBar[1]] then begin
// a tag
break;
end;
inc(NextBar);
end;
@ -1051,6 +1078,7 @@ begin
else if CompareIdentifiers(NameP,'sup')=0 then EmitTag(wptSup,Range)
else if CompareIdentifiers(NameP,'sub')=0 then EmitTag(wptSub,Range)
else if CompareIdentifiers(NameP,'small')=0 then EmitTag(wptSmall,Range)
else if CompareIdentifiers(NameP,'em')=0 then EmitTag(wptEm,Range)
else if CompareIdentifiers(NameP,'string')=0 then EmitTag(wptString, Range)
else if CompareIdentifiers(NameP,'var')=0 then EmitTag(wptVar,Range)
else if CompareIdentifiers(NameP,'key')=0 then EmitTag(wptKey,Range)
@ -1079,23 +1107,7 @@ begin
//debugln(['TWikiPage.Parse ',dbgs(Pointer(FCurP)),' ',FCurP^,' ',FindTagEnd(FCurP)-FCurP]);
HandleCode;
end else if TokenIs('<nowiki>') then begin
// ignore all tags
// this is not the same as pre (preformatted treats spaces and line breaks)
EmitTextToken;
FCurP:=FindTagEnd(FCurP);
FLastEmitPos:=FCurP;
repeat
case FCurP^ of
#0: break;
'<':
if TokenIs('</nowiki>') then
break;
end;
inc(FCurP);
until false;
EmitTextToken;
FCurP:=FindTagEnd(FCurP);
FLastEmitPos:=FCurP;
ParseNoWiki;
end else begin
UnknownTag;
end;

View File

@ -299,7 +299,7 @@ begin
writeln(' --format=[fpdoc|html|xhtml|chm]');
writeln(' --outputdir=<output directory> : directory for all files. default: ',Converter.OutputDir);
writeln(' --imagesdir=<images directory> : directory of image files. default: ',Converter.ImagesDir);
writeln(' --title=<string> : the title of the wiki. default: ',Converter.ImagesDir);
writeln(' --title=<string> : the title of the wiki. default: "',Converter.Title,'"');
writeln(' --nowarnurl=<string> : do not warn for URLs starting with this. Can be given multiple times.');
writeln(' <inputfile> : wiki page in xml format, can be given multiple times');
writeln(' Duplicates are ignored.');

View File

@ -363,6 +363,8 @@ begin
// a change
Page:=LeftStr(href,Pos('&',href)-1);
//writeln('TWikiGet.GetRecent page="'+Page+'"');
if not (FAllPages.Contains(Page)) then
continue; // deleted in the mean time
if CheckedPages.Contains(Page) then continue;
if IsIgnoredPage(Page) then continue;
if FNeededPages.Contains(Page) then continue;
@ -749,6 +751,7 @@ begin
writeln('--allmissing : download all wiki pages, if file not already there.');
writeln('--recent=<days> : download pages again if changed in the last days on the site.');
writeln(' includes --allmissing.');
writeln(' ToDo: check more than last 500 changes.');
writeln('--ignore-recent=<minutes> : do not download again files younger than this on disk.');
writeln(' combine with --recent. Default: ',IgnoreFilesYoungerThanMin);
writeln('--shownotusedpages : show not used files in the output directory.');
@ -762,7 +765,7 @@ begin
writeln('Example: download the whole wiki');
writeln(' ',ExeName,' --allmissing');
writeln('Example: call this to download new files once per week');
writeln(' ',ExeName,' --recent=8');
writeln(' ',ExeName,' --recent=8 --deletenotusedpages --deletenotusedimages');
end;
var