diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bbcee25 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ppp"] + path = ppp + url = https://github.com/ktyldev/ppp diff --git a/makefile b/makefile index d37c3fb..eedf3cb 100644 --- a/makefile +++ b/makefile @@ -15,7 +15,7 @@ run: $(HTML_TARGETS) $(CSS_TARGETS) $(OUT_DIR)/%.html: $(ROOT_DIR)/%.html $(HTML_INCLUDES) mkdir -p $(OUT_DIR) - python ppp.py $< $(HTML_INCLUDES) > $@ + python ppp/ppp.py $< $(HTML_INCLUDES) > $@ $(OUT_DIR)/%.css: $(ROOT_DIR)/%.css cp $< $@ diff --git a/ppp b/ppp new file mode 160000 index 0000000..e50671d --- /dev/null +++ b/ppp @@ -0,0 +1 @@ +Subproject commit e50671d1cddd6f109c4a1a14dae0a9dffb29d290 diff --git a/ppp.py b/ppp.py deleted file mode 100644 index 4c47592..0000000 --- a/ppp.py +++ /dev/null @@ -1,66 +0,0 @@ -import sys -import os.path - -err = False -paths = [] - -def print_usage(): - print("\nusage: python ppp.py ROOT TEMPLATES [...]") - -# check arguments -argc = len(sys.argv) -if argc < 3: - print_usage() - sys.exit(1) - -# figure out src dir from first include shader path root argument -sep="/" -inc_start_idx = 2 -inc_end_idx = argc - 1 -src_dir = sep.join(sys.argv[2].split(sep)[:-1]) - -def preprocess_file(path): - lines=0 - - with open(path) as f: - content = f.readlines() - content = [x.strip() for x in content] - lines=len(content) - - for line in content: - - directive = "#include" - if line.startswith(directive): - include_path = line.split(" ")[1] - - # prepend directory - include_path = "/".join([src_dir, include_path]) - - preprocess_file(include_path) - continue - - print(line) - - -for i in range(1,argc): - path = sys.argv[i] - - if not os.path.isfile(path): - - print(path + " is not a file") - err = True - continue - - if path in paths: - # ignore duplicates - continue - - paths.append(path) - -if err: - print_usage() - sys.exit(1) - -preprocess_file(sys.argv[1]) - -sys.exit(0) diff --git a/src/include/planets.html b/src/include/planets.html index 898a143..0ccf85c 100644 --- a/src/include/planets.html +++ b/src/include/planets.html @@ -1 +1,3 @@ -
+