Skip to content

Commit

Permalink
Fix errors with standalone Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
lempiji committed May 4, 2021
1 parent 654dd9b commit d81da03
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions source/commands/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ struct DefaultCommand
foreach (key, value; blocks)
{
totalCount++;
if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
writeln("begin: ", key);
scope (exit)
if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
writeln("end: ", key);

const status = evaluate(value.data, packageName, BlockType.Single, verbose.isTrue);
Expand All @@ -81,38 +81,38 @@ struct DefaultCommand
foreach (i, source; singleBlocks)
{
totalCount++;
if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
writeln("begin single: ", i);
scope (exit)
if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
writeln("end single: ", i);

const status = evaluate(source, packageName, BlockType.Single, verbose.isTrue);
errorCount += status != 0;
}

foreach (i, source; globalBlocks)
{
totalCount++;
if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
writeln("begin global :", i);
scope (exit)
if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
writeln("end global :", i);

const status = evaluate(source, packageName, BlockType.Global, verbose.isTrue);
errorCount += status != 0;
}

if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
UserIO.logInfof("Total blocks: %d", totalCount);
if (errorCount != 0)
{
UserIO.logErrorf("Errors: %d", errorCount);
return 1;
}

if (quiet.isNull || !quiet.get())
if (!quiet.get(false))
UserIO.logInfof("Success all blocks.");
return 0;
}
Expand Down Expand Up @@ -287,10 +287,12 @@ int evaluate(string source, string packageName, BlockType type, bool verbose)
import std.format : format;
import std.file : getcwd;

header = format!`/+ dub.sdl:
dependency "%s" path="%s"
+/
`(packageName, escapeSystemPath(getcwd()));
header = format!"/+ dub.sdl:\n dependency \"%s\" path=\"%s\"\n+/"(packageName,
escapeSystemPath(getcwd()));
}
else
{
header = "/+ dub.sdl:\n +/";
}

import std.file : tempDir, write, remove, mkdirRecurse, chdir;
Expand Down

0 comments on commit d81da03

Please sign in to comment.