Skip to content

Commit

Permalink
Fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
FWDekker committed Oct 10, 2019
1 parent 5a3d294 commit ce599a9
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions Edit scripts/ExportWikiDIAL.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ function canProcess(e: IInterface): Boolean;
end;

function process(dial: IInterface): Integer;
var transcript: String;
begin
// Filter out non-quest elements and nested elements
if not canProcess(dial) then begin
// No warning needed because this is expected behavior
exit;
end;

addQuest(ExportWikiDIAL_outputLines, dial);
transcript := trim(getQuestTranscript(dial));
if not (transcript = '') then begin
ExportWikiDIAL_outputLines.add(transcript + #10 + #10);
end;
end;

function finalize: Integer;
Expand All @@ -35,7 +39,7 @@ function finalize: Integer;
end;


procedure addQuest(output: TStringList; quest: IInterface);
function getQuestTranscript(quest: IInterface): String;
var linkable: Integer;

topics: IInterface;
Expand Down Expand Up @@ -63,16 +67,17 @@ procedure addQuest(output: TStringList; quest: IInterface);
exit;
end;

ExportWikiDIAL_outputLines.add('==[' + getFileName(getFile(quest)) + '] ' + evBySignature(quest, 'EDID') +
' (' + stringFormID(quest) + ')==');
ExportWikiDIAL_outputLines.add('{|class="va-table va-table-full np-table-dialogue"');
ExportWikiDIAL_outputLines.add('|-');
ExportWikiDIAL_outputLines.add('! style="width:2%" | #');
ExportWikiDIAL_outputLines.add('! style="width:8%" | Dialog Topic');
ExportWikiDIAL_outputLines.add('! style="width:5%" | Form ID');
ExportWikiDIAL_outputLines.add('! style="width:30%" | Response Text');
ExportWikiDIAL_outputLines.add('! style="width:30%" | Script Notes');
ExportWikiDIAL_outputLines.add('');
result := result
+ '==[' + getFileName(getFile(quest)) + '] ' + evBySignature(quest, 'EDID')
+ ' (' + stringFormID(quest) + ')==' + #10
+ '{|class="va-table va-table-full np-table-dialogue"' + #10
+ '|-' + #10
+ '! style="width:2%" | #' + #10
+ '! style="width:8%" | Dialog Topic' + #10
+ '! style="width:5%" | Form ID' + #10
+ '! style="width:30%" | Response Text' + #10
+ '! style="width:30%" | Script Notes' + #10
+ #10;

linkable := 1;

Expand Down Expand Up @@ -112,34 +117,36 @@ procedure addQuest(output: TStringList; quest: IInterface);
for i := 0 to eCount(responses) - 1 do begin
response := eByIndex(responses, i);

ExportWikiDIAL_outputLines.add('|-');
ExportWikiDIAL_outputLines.add('| {{Linkable|' + intToStr(linkable) + '}}');
result := result
+ '|-' + #10
+ '| {{Linkable|' + intToStr(linkable) + '}}' + #10;
if not topicHasRowSpan then begin
ExportWikiDIAL_outputLines.add('| rowspan="' + intToStr(topicSize) + '" | {{ID|' +
stringFormID(topic) + '}}');
result := result
+ '| rowspan="' + intToStr(topicSize) + '" | {{ID|' + stringFormID(topic) + '}}' + #10;
topicHasRowSpan := true;
end;
if not dialogHasRowSpan then begin
if eCount(responses) = 1 then begin
ExportWikiDIAL_outputLines.add('| {{ID|' + stringFormID(dialog) + '}}');
result := result + '| {{ID|' + stringFormID(dialog) + '}}' + #10;
end else begin
ExportWikiDIAL_outputLines.add('| rowspan="'
+ intToStr(eCount(responses)) + '" | {{ID|' + stringFormID(dialog) + '}}');
result := result
+ '| rowspan="' + intToStr(eCount(responses))
+ '" | {{ID|' + stringFormID(dialog) + '}}' + #10;
end;
dialogHasRowSpan := true;
end;
ExportWikiDIAL_outputLines.add('| ' + escapeHTML(trim(evBySignature(response, 'NAM1'))));
ExportWikiDIAL_outputLines.add('| ''''' + escapeHTML(trim(evBySignature(response, 'NAM2'))) + '''''');
ExportWikiDIAL_outputLines.add('');
result := result
+ '| ' + escapeHTML(trim(evBySignature(response, 'NAM1'))) + #10
+ '| ''''' + escapeHTML(trim(evBySignature(response, 'NAM2'))) + '''''' + #10
+ '' + #10;

linkable := linkable + 1;
end;
end;
end;


ExportWikiDIAL_outputLines.add('|}');
ExportWikiDIAL_outputLines.add(#10);
result := result + '|}';
end;

function getElementAfter(group: IInterface; previousFormID: Integer): IInterface;
Expand Down

0 comments on commit ce599a9

Please sign in to comment.