Added a table and spoilers
This commit is contained in:
parent
0d75aff055
commit
6cdc797206
6 changed files with 36 additions and 18 deletions
12
base.css
12
base.css
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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=""
|
||||
|
|
|
@ -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")
|
||||
|
|
32
index.py
32
index.py
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@import "base.css";
|
||||
.spoiler {
|
||||
.spoilertitle {
|
||||
display: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@import "base.css";
|
||||
.spoiler {
|
||||
.spoilertitle {
|
||||
cursor: pointer;
|
||||
color: green;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue