forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowdown.wsf
44 lines (38 loc) · 1.25 KB
/
showdown.wsf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<job id="IncludeExample">
<script language="JScript" src="showdown.js"/>
<script language="JScript">
try
{
if (WScript.Arguments.length == 2)
{
var inputFile = WScript.Arguments.item(0);
var outputFile = WScript.Arguments.item(1);
var fso = WScript.CreateObject("Scripting.FileSystemObject");
var text = fso.OpenTextFile(inputFile, 1).ReadAll();
var html = new Showdown.converter().makeHtml(text);
var stream = fso.OpenTextFile(outputFile, 2, true);
stream.Write(html);
stream.Close();
WScript.Echo("HTML written to " + outputFile);
}
else
{
WScript.Echo("Usage: CScript.exe showdown.wsf <md input file> <html output file>");
}
WScript.Quit(0);
}
catch (e)
{
WScript.Echo("Error: " + e);
try
{
for(prop in e)
{
WScript.Echo(prop + ": " + e[prop]);
}
}
catch (e) {}
WScript.Quit(1);
}
</script>
</job>