mirror of
https://github.com/Relintai/sfw.git
synced 2024-12-20 21:06:49 +01:00
Added a doc post processor script.
This commit is contained in:
parent
ba96508491
commit
2c688317fb
@ -1,10 +1,10 @@
|
||||
|
||||
./game ../merger/out/core/sfw.h -osfw_core.md.html -tsfw_core_template.html
|
||||
./game ../merger/out/object/sfw.h -osfw_object.md.html -tsfw_object_template.html
|
||||
./game ../merger/out/render_core/sfw.h -osfw_render_core.md.html -tsfw_render_core_template.html
|
||||
./game ../merger/out/render_immediate/sfw.h -osfw_render_immediate.md.html -tsfw_render_immediate_template.html
|
||||
./game ../merger/out/render_objects/sfw.h -osfw_render_objects.md.html -tsfw_render_objects_template.html
|
||||
./game ../merger/out/full/sfw.h -osfw_full.md.html -tsfw_full_template.html
|
||||
./game ../merger/out/core/sfw.h -osfw_core.html -tsfw_core_template.html
|
||||
./game ../merger/out/object/sfw.h -osfw_object.html -tsfw_object_template.html
|
||||
./game ../merger/out/render_core/sfw.h -osfw_render_core.html -tsfw_render_core_template.html
|
||||
./game ../merger/out/render_immediate/sfw.h -osfw_render_immediate.html -tsfw_render_immediate_template.html
|
||||
./game ../merger/out/render_objects/sfw.h -osfw_render_objects.html -tsfw_render_objects_template.html
|
||||
./game ../merger/out/full/sfw.h -osfw_full.html -tsfw_full_template.html
|
||||
|
||||
./game ../merger/out/sfwl_core/sfwl.h -osfwl_core.md.html -tsfwl_core_template.html
|
||||
./game ../merger/out/sfwl_full/sfwl.h -osfwl_full.md.html -tsfwl_full_template.html
|
||||
./game ../merger/out/sfwl_core/sfwl.h -osfwl_core.html -tsfwl_core_template.html
|
||||
./game ../merger/out/sfwl_full/sfwl.h -osfwl_full.html -tsfwl_full_template.html
|
||||
|
76
tools/doc/inline_docs.py
Normal file
76
tools/doc/inline_docs.py
Normal file
@ -0,0 +1,76 @@
|
||||
# The way markdeep works, is that it will process the entire document on load and it generates
|
||||
# proper html from it's markdown syntax, and then it deletes itself from the page.
|
||||
# It cannot be inlined into html, but I'd like to distribute a single file that doesn't need
|
||||
# internet access to properly open.
|
||||
# This script will open the generated docs in a browser using selenium, and save the final dom
|
||||
# to a new file. There are probably better way to do this.
|
||||
|
||||
# You need selenium to use this. Also firefox. Just use the latest:
|
||||
|
||||
# Create virtual env:
|
||||
# python -m venv venv
|
||||
|
||||
# Activate it (This is for bash on linux). Commands for other shells: https://docs.python.org/3/library/venv.html#how-venvs-work
|
||||
# . ./venv/bin/activate
|
||||
|
||||
# Install:
|
||||
# pip install selenium
|
||||
|
||||
import time
|
||||
import math
|
||||
import os
|
||||
import shutil
|
||||
import random
|
||||
import subprocess
|
||||
import selenium
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
|
||||
def ensure_dir(storage_path):
|
||||
if not os.path.exists(storage_path):
|
||||
os.makedirs(storage_path)
|
||||
|
||||
def write_to_file(path, data, mode = "w"):
|
||||
lf = open(path, "w")
|
||||
lf.write(data)
|
||||
lf.close()
|
||||
|
||||
def process_file(driver, in_file, out_file):
|
||||
browser_file_link = "file://" + os.path.abspath(in_file)
|
||||
|
||||
print("Processing: " + browser_file_link)
|
||||
|
||||
driver.get(browser_file_link)
|
||||
|
||||
#wait a few seconds
|
||||
time.sleep(5)
|
||||
|
||||
write_to_file(out_file, driver.page_source)
|
||||
|
||||
|
||||
#headless=False
|
||||
driver = webdriver.Firefox()
|
||||
|
||||
#wait a few seconds
|
||||
time.sleep(10)
|
||||
|
||||
ensure_dir("out/processed")
|
||||
|
||||
files = [
|
||||
"sfw_core.html",
|
||||
"sfw_full.html",
|
||||
"sfw_object.html",
|
||||
"sfw_render_core.html",
|
||||
"sfw_render_immediate.html",
|
||||
"sfw_render_objects.html",
|
||||
"sfwl_core.html",
|
||||
"sfwl_full.html",
|
||||
]
|
||||
|
||||
for f in files:
|
||||
process_file(driver, "out/" + f, "out/processed/" + f)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
driver.close()
|
Loading…
Reference in New Issue
Block a user