Commit b8073c71 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

documentation updates

parent 5f0c6228
Loading
Loading
Loading
Loading

extra/logo.png

0 → 100644
+2.99 KiB
Loading image diff...
+3 −2
Original line number Diff line number Diff line
@@ -16,8 +16,9 @@ fi
cd "$(dirname "$0")/../.."

cp extra/web/documentation.css "${output_dir}"
cp extra/web/redirects.txt "${output_dir}/_redirects"
cp extra/web/favicon.ico "${output_dir}"
cp extra/logo.png "${output_dir}"
./extra/web/build_api_reference.py
./extra/web/build_examples.py
./extra/web/build_pages.py
find "${output_dir}" -name "_*" -delete
+4 −3
Original line number Diff line number Diff line
@@ -11,8 +11,8 @@ def build_prop(parent):
        <tbody>
          {{#props}}
            <tr>
              <td width="40%"><code><strong>{{name}}</strong></code></td>
              <td>Description goes here</td>
              <td width="35%"><code><strong>{{name}}</strong></code></td>
              <td>{{desc}}</td>
            </tr>
          {{/props}}
        </tbody>
@@ -39,7 +39,8 @@ def build_prop(parent):
  props = []
  for prop in parent.findall("./prop"):
    props.append({
      "name": prop.attrib["name"]
      "name": prop.attrib["name"],
      "desc": prop.attrib["desc"] if "desc" in prop.attrib else "",
    })

  return TPL.render(tpl, {
+3 −2
Original line number Diff line number Diff line
@@ -13,10 +13,11 @@ def build_example(url):
  env = {
    "example_url": url,
    "example_src": Path(os.path.join("examples", url + ".ptx")).read_text(),
    "title": "Example: %s" % url,
  }

  html = TPL.render(tpl, env)
  write_page(path, html)
  write_page(path, html, title=env["title"])
  copy_file(path + ".svg", os.path.join("examples", url + ".svg"))

def build_example_list(examples):
@@ -28,7 +29,7 @@ def build_example_list(examples):
    </ul>
  """
  env = {
    "list": map(lambda x: { "name": x }, examples)
    "list": map(lambda x: { "name": x }, examples),
  }

  write_file("/_example_list.gen.html", TPL.render(tpl, env))
+19 −10
Original line number Diff line number Diff line
@@ -9,19 +9,19 @@ tpl = """
<!DOCTYPE html>
<html>
  <head>
    <title>plotfx | <%= @title || "Collect and visualize timeseries data with SQL" %></title>
    <title>{{title}} | plotfx</title>
    <link href='/documentation.css' type='text/css' rel='stylesheet' />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  </head>
  <body>
    <div id="header" class="border">
      <div class="doc_wrap">
        <a href="/"><img src="/logo.png" alt="PlotFX" class="logo" /></a>
        <a class="menu {{menu_active_documentation}}" href="/">Documentation</a>
        <a class="menu {{menu_active_examples}}" href="/examples">Examples</a>
        <a class="menu {{menu_active_reference}}" href="/reference">API Reference</a>
        <a class="menu {{menu_active_download}}" href="/download">Download</a>
        <a class="menu" href="http://github.com/plotfx/plotfx" target="_blank">Github</a>
        <a class="menu" href="/documentation/download">Download</a>
        <a class="menu active" href="/reference">API Reference</a>
        <a class="menu" href="/examples">Examples</a>
        <a class="menu active" href="/">Documentation</a>
        <h1><a href="/">PlotFX</a></h1>
      </div>
    </div>

@@ -60,12 +60,21 @@ tpl = """
</html>
"""

def build_layout(url, content):
def build_layout(url, content, title=""):
  toc = yaml.load(Path("manual/toc.yaml").read_text())["documentation"]
  return TPL.render(tpl, {"content": content, "url": url, "toc": toc})
  return TPL.render(tpl, {
    "content": content,
    "url": url,
    "toc": toc,
    "title": title,
    "menu_active_documentation": "active" if (url.startswith("/documentation") or url == "/") else "",
    "menu_active_download": "active" if url.startswith("/download") else "",
    "menu_active_examples": "active" if url.startswith("/examples") else "",
    "menu_active_reference": "active" if url.startswith("/reference") else "",
  })

def write_page(url, content):
  write_file(url + "/index.html", build_layout(url, content))
def write_page(url, content, title=""):
  write_file(url + "/index.html", build_layout(url, content, title=title))

def write_file(path, content):
  output_path = os.environ["output_dir"] + path
Loading