~jasper/live_doc

9967a34e970d888b1c85412bb3eeea33726bdf58 — Jasper den Ouden 1 year, 20 days ago 306461f develop
`live_doc.util.Assets` -> `live_template.Assets`, some other stuff
5 files changed, 11 insertions(+), 8 deletions(-)

A assets/interpreter/prog.simp.sh
M live_doc/main.py
R live_doc/util/Assets.py => live_template/Assets.py
M live_template/html.py
M module_pick/bare.py
A assets/interpreter/prog.simp.sh => assets/interpreter/prog.simp.sh +1 -0
@@ 0,0 1,1 @@
base_prog/
\ No newline at end of file

M live_doc/main.py => live_doc/main.py +1 -1
@@ 6,7 6,7 @@
#  (at your option) any later version.

# Asset and config fetchers.
from live_doc.util.Assets import AssetsMem, Assets
from live_template.Assets import AssetsMem, Assets

from module_pick.regular import ModulePick


R live_doc/util/Assets.py => live_template/Assets.py +0 -0
M live_template/html.py => live_template/html.py +5 -5
@@ 78,9 78,10 @@ class HtmlOutput:
        css="<link rel=stylesheet href=\"/:asset:/ext/{}\">",
        js="<script src=\"/:asset:/ext/{}\"></script>")

    def writing_format(self, s, kv, t):
    def writing_format(self, path, kv, t):
        """As-it goes expands the templates. Will run generators when needed."""
        assert isinstance(s, str), f"Likely missing asset? {(s, kv, t)}"
        s = self.s(path)
        assert isinstance(s, str), f"missing asset? `{path}` {(s, kv, t)}"
        got, lst = dict(), s.split('{')
        yield lst[0]  # First one is text.
        for part in lst[1:]:


@@ 98,7 99,7 @@ class HtmlOutput:
                                   self.asset_add[name])
                else:
                    ret = list(self.writing_format(
                        self.s("parts/key_missing" + self.ext),
                        "parts/key_missing" + self.ext,
                        dict(k=k, where=kv['path']), t))
                    yield from ret
                got[k] = ''.join(ret)  # Got it for next time.


@@ 115,8 116,7 @@ class HtmlOutput:
        if isinstance(val, (str, int, float)):
            yield str(val)
        elif isinstance(val, dict):  # Accesses sub-template with assets.
            yield from self.writing_format(self.s(val['path'] + self.ext),
                                           val, t)
            yield from self.writing_format(val['path'] + self.ext, val, t)
        elif (isinstance(val, list) and len(val) >0
                and isinstance(val[0], str) and val[0].startswith('::')):
            n = val[0][2:]

M module_pick/bare.py => module_pick/bare.py +4 -2
@@ 128,6 128,8 @@ class BareModulePick(dict, _BasicRepr):
                if ret is not None:
                    return ret

        # TODO better return options..
        self.fail_log(name, type, "completely missing", str(self.get_from))
        assert False, f"""None of the modules to get `{name}` inputs: {method}, {inp}) were suitable.\n""" + '\n'.join(map(repr, here)) + \
            "\n\n" + repr(self.get_from.keys())

        assert False, f"""None of the modules to get `{name}` inputs: {method}, {inp}) were suitable. ({len(here)})\n""" + '\n'.join(map(repr, here)) + \
            "\n\n" + repr(self.get_from.get(name))