Skip to content

Commit

Permalink
Starting to build a compile script that spits out nicely formatted pa…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
BSVino committed Aug 13, 2014
1 parent de7f138 commit f172012
Show file tree
Hide file tree
Showing 9 changed files with 1,343 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/htdocs
/*.pyc
5 changes: 5 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off

\Python27\python.exe compile.py

pause
71 changes: 71 additions & 0 deletions compile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import os
import shutil
import time
import opengl

def create_directory(dir):
if not os.path.exists(dir):
os.makedirs(dir)

output_dir = "htdocs/"

print "Resetting output dir..."
if os.path.exists(output_dir):
try:
shutil.rmtree(output_dir);
except:
pass # It gives an error sometimes. If it didn't work it's not a huge deal though.

while not os.path.exists(output_dir):
try:
create_directory(output_dir)
except:
pass # It gives an error sometimes. If it didn't work try again/

print "Done."

print "Reading templates..."
header_fp = open("html/header.html")
header = header_fp.read()
header_fp.close()

footer_fp = open("html/footer.html")
footer = footer_fp.read()
footer_fp.close()
print "Done."

for version in opengl.version_commands:
written = 0

print "Version " + version + " ..."

for command in opengl.commands_version:
if not version in opengl.commands_version[command]:
continue

create_directory(output_dir + version)

gldir = "gl" + version[0]

fp = open(gldir + "/" + command + ".xhtml")
command_html = fp.read().decode('utf8')
fp.close()

output_html = header + command_html + footer

output = open(output_dir + version + "/" + command, "w")
output.write(output_html.encode('ascii', 'xmlcharrefreplace'))
output.close()

written += 1

print "Wrote " + str(written) + " commands for version " + version

f = []
for (dirpath, dirnames, filenames) in os.walk("html/copy"):
f.extend(filenames)

for file in f:
shutil.copy("html/copy/" + file, output_dir + file)

print "Copied " + str(len(f)) + " files"
48 changes: 48 additions & 0 deletions html/copy/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
102 changes: 102 additions & 0 deletions html/copy/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
body {
background: #f9f9f9;

font-family: Roboto;
font-size: 14px;
line-height: 150%;
}

pre {
margin: 10px;
}

h1, h2, h3, h4, h5, h6 {
margin-top: 10px;
margin-bottom: 5px;
}

h1 {
font-size: 28px;
font-weight: bold;
text-decoration: underline;
margin-top: 30px;
margin-bottom: 10px;
}

h2 {
font-size: 24px;
font-weight: bold;
margin-top: 30px;
margin-bottom: 10px;
}

h3 {
font-size: 20px;
font-weight: bold;
}

h4 {
font-size: 18px;
font-weight: bold;
}

h5 {
font-size: 16px;
font-weight: bold;
}

h6 {
font-size: 14px;
font-weight: bold;
}

em {
font-style: italic;
}

dt {
float: left;
width: 100px;
clear: both;
margin-top: 10px;
}

dd {
float: left;
width: 540px;
margin-top: 10px;
}

dl {
width: 650px;
clear: both;
display: table;
}

#everything {
width: 950px;
margin-left: auto;
margin-right: auto;
}

#toc {
width: 300px;
float: left;
}

#khronos {
width: 650px;
float: left;
}

.programlisting, code {
font-family: 'Source Code Pro';
}

.function {
font-weight: bold;
}

.constant {
color: #6f008a;
}
5 changes: 5 additions & 0 deletions html/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
</div>
</div>

</body>
</html>
18 changes: 18 additions & 0 deletions html/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>OpenGL API Documentation</title>
<link href="../reset.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="everything">
<div id="toc">
TABLE OF CONTENTS

</div>

<div id="khronos">
Loading

0 comments on commit f172012

Please sign in to comment.