Skip to content

Commit

Permalink
added subclass for html ninja file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
István Bozsó committed Jul 10, 2020
1 parent 398d870 commit ab09574
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 5 deletions.
33 changes: 33 additions & 0 deletions css/notes.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,36 @@ th {
tr:nth-child(even) {
background-color: #f2f2f2;
}

/* Table of Contents */

.table-of-contents {
float: right;
width: 40%;
background: #eee;
font-size: 0.8em;
padding: 1em 2em;
margin: 0 0 0.5em 0.5em;
}
.table-of-contents ul {
padding: 0;
}
.table-of-contents li {
margin: 0 0 0.25em 0;
}
.table-of-contents a {
text-decoration: none;
}
.table-of-contents a:hover,
.table-of-contents a:active {
text-decoration: underline;
}

h3:target {
animation: highlight 1s ease;
}

@keyframes highlight {
from { background: yellow; }
to { background: white; }
}
19 changes: 14 additions & 5 deletions utils/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def out(infile, **kwargs):
ext = kwargs.get("ext", None)
outdir = kwargs.get("outdir", "build")

ret = pth.join(outdir, pth.splitext(pth.basename(infile))[0])
ret = path.join(outdir, path.splitext(path.basename(infile))[0])

if ext is not None:
ret += ext
Expand All @@ -190,13 +190,13 @@ def __init__(self, *args, **kwargs):
self.pattern, self.include_paths, self.files = \
kwargs["pattern"], kwargs["include_paths"], eset

def search_file(self, path):
def search_file(self, Path):
for p in self.include_paths:
f = pth.join(p, path)
f = path.join(p, Path)

# print(f, pth.isfile(f))

if pth.isfile(f):
if path.isfile(f):
return f

return None
Expand Down Expand Up @@ -273,7 +273,7 @@ def __init__(self, *args, **kwargs):

def sources(self, sources, **kwargs):
for src in sources:
self.deps.include_paths.add(pth.abspath(pth.dirname(src)))
self.deps.include_paths.add(path.abspath(path.dirname(src)))

self.deps.get_dependencies(src)

Expand All @@ -295,6 +295,15 @@ def full(self, sources, **kwargs):
self.newline()


class Html(HTML):
ext = ".build.html"

def out(self, src, **kwargs):
kwargs.setdefault("outdir", ".")

return super().out(src, **kwargs)


class Compiled(Ninja):
obj_ext = ".o"

Expand Down

0 comments on commit ab09574

Please sign in to comment.