Skip to content

Commit

Permalink
Merge pull request #900 from CyberShadow/pull-20150212-153753
Browse files Browse the repository at this point in the history
d.tag
  • Loading branch information
MartinNowak committed Feb 16, 2015
2 parents 2868a87 + 13229c1 commit 8365457
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
19 changes: 10 additions & 9 deletions chmgen.d
Expand Up @@ -13,7 +13,7 @@ import std.string;
import std.regex;
import std.path;

enum ROOT = `.`;
string docRoot = `.`;

// ********************************************************************

Expand Down Expand Up @@ -124,6 +124,7 @@ void main(string[] args)

getopt(args,
"only-tags", &onlyTags,
"root", &docRoot,
);

bool chm = !onlyTags;
Expand All @@ -135,24 +136,24 @@ void main(string[] args)
mkdirRecurse(`chm/files`);
}

enforce(exists(ROOT ~ `/phobos/index.html`),
enforce(exists(docRoot ~ `/phobos/index.html`),
`Phobos documentation not present. Please place Phobos documentation HTML files into the "phobos" subdirectory.`);

string[] files = chain(
dirEntries(ROOT ~ `/` , "*.html", SpanMode.shallow),
dirEntries(ROOT ~ `/phobos/`, "*.html", SpanMode.shallow),
// dirEntries(ROOT ~ `/js/` , SpanMode.shallow),
dirEntries(ROOT ~ `/css/` , SpanMode.shallow),
dirEntries(ROOT ~ `/images/`, "*.*" , SpanMode.shallow),
only(ROOT ~ `/favicon.ico`)
dirEntries(docRoot ~ `/` , "*.html", SpanMode.shallow),
dirEntries(docRoot ~ `/phobos/`, "*.html", SpanMode.shallow),
// dirEntries(docRoot ~ `/js/` , SpanMode.shallow),
dirEntries(docRoot ~ `/css/` , SpanMode.shallow),
dirEntries(docRoot ~ `/images/`, "*.*" , SpanMode.shallow),
only(docRoot ~ `/favicon.ico`)
).array();

foreach (fileName; files)
{
scope(failure) stderr.writeln("Error while processing file: ", fileName);

auto page = new Page;
fileName = page.fileName = fileName[ROOT.length+1 .. $].forwardSlashes();
fileName = page.fileName = fileName[docRoot.length+1 .. $].forwardSlashes();
pages[fileName] = page;

auto newFileName = `chm/files/` ~ fileName;
Expand Down
10 changes: 10 additions & 0 deletions posix.mak
Expand Up @@ -434,3 +434,13 @@ ${STABLE_DMD}:

${DUB}: ${DUB_DIR}/.cloned ${STABLE_DMD}
cd ${DUB_DIR} && DC=$(abspath ${STABLE_DMD}) ./build.sh

################################################################################
# Dman tags
################################################################################

chmgen : chmgen.d $(DMD)
$(DMD) -I${PHOBOS_DIR} -g chmgen.d

d.tag : chmgen $(ALL_FILES)
./chmgen --root=$(DOC_OUTPUT_DIR) --only-tags
3 changes: 3 additions & 0 deletions win32.mak
Expand Up @@ -303,6 +303,9 @@ chm-nav-doc.json : $(DDOC) chm-nav.dd
chm-nav-std.json : $(DDOC) $(DDOC_STD) chm-nav.dd
$(DMD) -o- -c -Df$@ $(DDOC) $(DDOC_STD) chm-nav.dd

d.tag : chmgen.exe $(TARGETS)
chmgen --only-tags

################# Other #########################

zip:
Expand Down

0 comments on commit 8365457

Please sign in to comment.