Added a table and spoilers

This commit is contained in:
Morten Delenk 2016-06-12 14:27:29 +02:00
parent 0d75aff055
commit 6cdc797206
6 changed files with 36 additions and 18 deletions

View file

@ -1,4 +1,4 @@
.spoiler:focus + .spoilerContent { .spoilertitle:focus + .spoilerContent {
display: block; display: block;
} }
.spoilerContent { .spoilerContent {
@ -60,3 +60,13 @@ aside {
article { article {
background-color: #282828; background-color: #282828;
} }
ul { padding-left:16px; }
li { padding-left:16px; }
.spoiler {
opacity: 0.0;
filter: alpha(opacity=0);
}
.spoiler:hover {
opacity: 1.0;
filter: alpha(opacity=100);
}

View file

@ -8,7 +8,7 @@ class HTMLgen:
self.titles=[] self.titles=[]
self.title=title self.title=title
def addArticle(self, name, markdown): def addArticle(self, name, markdown):
self.articles.append(markdown2.markdown(markdown)) self.articles.append(markdown2.markdown(markdown, extras=["tables","spoiler"]))
self.titles.append(name) self.titles.append(name)
def renderSite(self): def renderSite(self):
nav="" nav=""

View file

@ -34,7 +34,7 @@ def getLayoutXML():
tablerow = SubElement(table, "div") tablerow = SubElement(table, "div")
tablerow.set("class", "tablerow") tablerow.set("class", "tablerow")
navspoiler = SubElement(tablerow, "div") navspoiler = SubElement(tablerow, "div")
navspoiler.set("class", "spoiler") navspoiler.set("class", "spoilertitle")
navspoiler.set("tabindex", "1") navspoiler.set("tabindex", "1")
navspoiler.text = "Navigation" navspoiler.text = "Navigation"
nav = SubElement(tablerow, "nav") nav = SubElement(tablerow, "nav")
@ -43,7 +43,7 @@ def getLayoutXML():
main = SubElement(tablerow, "main") main = SubElement(tablerow, "main")
main.text="%(main)s" main.text="%(main)s"
asidespoiler = SubElement(tablerow, "div") asidespoiler = SubElement(tablerow, "div")
asidespoiler.set("class", "spoiler") asidespoiler.set("class", "spoilertitle")
asidespoiler.set("tabindex", "2") asidespoiler.set("tabindex", "2")
asidespoiler.text="Aside information" asidespoiler.text="Aside information"
aside = SubElement(tablerow, "aside") aside = SubElement(tablerow, "aside")

View file

@ -2,24 +2,32 @@
from htmlgen import * from htmlgen import *
print("Content-type: text/html\r\n\r\n") print("Content-type: text/html\r\n\r\n")
html=htmlgen.HTMLgen(pagelayout.getLayoutXML().decode('utf-8'),"Home Page") html=htmlgen.HTMLgen(pagelayout.getLayoutXML().decode('utf-8'),"Home Page")
html.addArticle("Markdown test","""*
* 1
* 2
* 3
# 1
# 2
# 3
## half adder truth table
| | 0 | 1 |
|---|---|---|
| 0 |0 0|0 1|
| 1 |0 1|1 0|
""")
html.addArticle("Markdown test","""*Hello, World!* html.addArticle("Markdown test","""*Hello, World!*
test test
test test
**HI** **HI**
SPOILERS:
>! SPOILERED!
>! ロボボプラネットはいいぞ
""")
**TEST**""")
html.addArticle("Markdown test","""*Hello, World!*
test
test
**HI**
**TEST**""")
html.addArticle("Markdown test","""*Hello, World!* html.addArticle("Markdown test","""*Hello, World!*
test test

View file

@ -1,5 +1,5 @@
@import "base.css"; @import "base.css";
.spoiler { .spoilertitle {
display: none; display: none;
cursor: pointer; cursor: pointer;
} }

View file

@ -1,5 +1,5 @@
@import "base.css"; @import "base.css";
.spoiler { .spoilertitle {
cursor: pointer; cursor: pointer;
color: green; color: green;
} }