Skip to content

Commit 57640fb

Browse files
committed
removed unnecessary code
1 parent ed50f7f commit 57640fb

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

runners/wikiConsole/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export class WikiConsole extends WikiRunner {
181181
runDisplayContent(runCommand: RunCommand): RunResult {
182182
let text = this.checkForText(runCommand);
183183
let textAfter = this.checkForTextAfter(runCommand);
184-
let title = this.checkForTitle(runCommand);
184+
let stepTitle = this.checkForTitle(runCommand);
185185
let tempFile = path.join(this.getTempDirectory(), runCommand.command.name + ".md");
186186
fs.writeFileSync(tempFile, "");
187187
let counter = 2;
@@ -195,21 +195,19 @@ export class WikiConsole extends WikiRunner {
195195
this.createFolder(path.join(this.outputPathTutorial, "images"), false);
196196
let imageName = path.join(this.outputPathTutorial, "images",path.basename(param.image));
197197
while(fs.existsSync(imageName)){
198-
imageName = path.join(this.outputPathTutorial, "images",counter+"_"+path.basename(param.image));
198+
imageName = path.join(this.outputPathTutorial, "images",path.parse(param.image).name+"_"+counter+path.parse(param.image).ext);
199199
counter++;
200200
}
201-
fs.createFileSync(imageName);
202201
fs.copyFileSync(path.join(this.playbookPath, param.image),imageName);
203202
fs.appendFileSync(tempFile, "image::images/"+path.basename(imageName)+"[]");
204-
counter = 2;
205203
}
206204
fs.appendFileSync(tempFile, "\n\n");
207205
}
208206

209207
let content = fs.readFileSync(tempFile, "utf-8");
210208

211-
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "nextKatacodaStep.asciidoc"),
212-
{ steptitle: runCommand.stepTitle, text: runCommand.text, textAfter: runCommand.textAfter, title: runCommand.command.parameters[0], content: content, path: runCommand.command.parameters[2]});
209+
this.renderWiki(path.join(this.getRunnerDirectory(), "templates", "displayContent.asciidoc"),
210+
{ steptitle: stepTitle, text: text, textAfter: textAfter, title: runCommand.command.parameters[0], content: content, path: runCommand.command.parameters[2]});
213211

214212
return null;
215213
}
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<% if(steptitle){ %> == <%= steptitle;%>
1+
<% if(steptitle){ %>== <%= steptitle;%>
22
=== <%= title; %>
3-
<%if(text){%><%- text; %><%}%>
4-
<%}else{%> == <%= title; %>
3+
<%if(text){%><%- text; %> <%}%>
4+
<%}else if(steptitle === undefined){%>=== <%= title; %>
5+
<%if(text){%><%- text; %> <%}%>
6+
<%}else if(steptitle === null){ %>== <%= title; %>
57
<%if(text){%><%- text; %><%}%> <%}%>
68

79
<%= content; %>
@@ -10,4 +12,5 @@
1012
After that, move to the target directory by executing `cd <%= path; %>` in the terminal.
1113
<% } %>
1214

13-
<%if(textAfter){%><%- textAfter; %><%}%>
15+
<%if(textAfter){%><%- textAfter; %><%}%>
16+

0 commit comments

Comments
 (0)