Skip to content

Commit c98fa8d

Browse files
committed
Fix some unknown macros, switch builds to serial for now
1 parent caa801f commit c98fa8d

File tree

7 files changed

+37
-21
lines changed

7 files changed

+37
-21
lines changed

book/.output/cover_ebook.png

-521 KB
Binary file not shown.

book/.output/cover_thumb.png

-19.8 KB
Binary file not shown.

book/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ This is (currently) just the English version of the book.
44

55
To build, run `rdmd build.d`, files will be emitted to `web/book`.
66

7-
Of note: The index currently does not work, and thus has been omitted.
7+
Of note: The index currently does not work, and thus has been omitted for now.
8+
9+
```
10+
CODE_NAME=
11+
CODE_XREF=
12+
CODE_DONT_TEST=
13+
CODE_COMMENT_OUT=
14+
```

book/aliBook.ddoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
ROOT_DIR=../
22
DOCTYPE = <!DOCTYPE html>
3+
CODE_NAME=
4+
CODE_XREF=
5+
CODE_DONT_TEST=
6+
CODE_COMMENT_OUT=
7+
WORK_IN_PROCESS=
8+
COMMENTED_OUT=
9+
new=
10+
Ergin=
11+
P1= $(I $0)
12+
katma=
13+
sablon=
14+
XXX=
315

416
DEL = <span style="text-decoration:line-through">$0</span>
517
TITLE = $(RED $0)

book/build.d

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,29 @@ import std.algorithm;
55
import std.file;
66
import std.stdio;
77
import std.exception;
8-
8+
import std.path;
99
void compileToPath(string compileThis, string outputPath, bool loud = false)
1010
{
11+
import std.compiler;
1112
import core.stdc.stdlib;
13+
string[string] contextMacros;
14+
contextMacros["DVER"] = format!"%u.%03u"(version_major, version_minor);
1215
if(outputPath.indexOf("cozum") == -1)
1316
{
14-
if(loud)
15-
writeln(outputPath.replace(".html", ".cozum.html"));
17+
//We need to build a little .ddoc file to set the right predefined build macros - these are context dependant.
18+
19+
const cozumHtml = outputPath.baseName.replace(".html", ".cozum.html");
20+
contextMacros["COZUM_HTML"] = cozumHtml;
1621
//exit(0);
1722
}
23+
auto macroOut = File("contextMacros.ddoc", "w");
1824

19-
const compileString = format!"dmd -revert=markdown -D macros.ddoc html.ddoc dlang.org.ddoc doc.ddoc aliBook.ddoc %s -Df%s "(compileThis, outputPath);
25+
foreach(key, value; contextMacros)
26+
{
27+
macroOut.writefln!"%s = %s"(key, value);
28+
}
29+
macroOut.flush();
30+
const compileString = format!"dmd -revert=markdown -D contextMacros.ddoc macros.ddoc html.ddoc dlang.org.ddoc doc.ddoc aliBook.ddoc %s -Df%s "(compileThis, outputPath);
2031
if(loud)
2132
writefln!"%s:%s |> %s"(compileThis, outputPath, compileString);
2233
const res = executeShell(compileString);
@@ -36,15 +47,14 @@ int main(string[] args)
3647
const jobs = args.length == 2 ? args[1].to!ubyte : 1;
3748
const outDir = "../web/book";
3849
writeln("Building the book at ", outDir);
39-
//scope(failure) return 1;
4050

4151
enforce(executeShell("which dmd").output != "", "dmd doesn't seem to be present");
4252
if(outDir.exists) {
4353
executeShell("rm -rf " ~ outDir);
4454
}
4555
dirEntries("d.en", "*.d", SpanMode.shallow)
4656
.map!(dFile => tuple(dFile.name, buildPath(outDir, baseName(dFile).setExtension("html"))))
47-
.parallel(jobs)
57+
//.parallel(jobs)
4858
.each!(elem => compileToPath(elem.tupleof));
4959
dirEntries("d.en", "*.png", SpanMode.shallow)
5060
.each!(p => copy(p, buildPath(outDir, baseName(p).setExtension("png"))));

book/contextMacros.ddoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DVER = 2.097

book/d.en/ix.d

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)