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;
}
.spoilerContent {
@ -60,3 +60,13 @@ aside {
article {
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.title=title
def addArticle(self, name, markdown):
self.articles.append(markdown2.markdown(markdown))
self.articles.append(markdown2.markdown(markdown, extras=["tables","spoiler"]))
self.titles.append(name)
def renderSite(self):
nav=""

View file

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

View file

@ -2,24 +2,32 @@
from htmlgen import *
print("Content-type: text/html\r\n\r\n")
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!*
test
test
**HI**
SPOILERS:
>! SPOILERED!
>! ロボボプラネットはいいぞ
**TEST**""")
html.addArticle("Markdown test","""*Hello, World!*
test
test
**HI**
**TEST**""")
""")
html.addArticle("Markdown test","""*Hello, World!*
test

View file

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

View file

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