new front page layout
This commit is contained in:
parent
40ec5db009
commit
d818035d16
@ -25,8 +25,25 @@ table td {
|
|||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table td h1 {
|
||||||
|
bborder: 1px red solid;
|
||||||
|
margin-top: 0.4em;
|
||||||
|
margin-bottom: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td p {
|
||||||
|
bborder: 1px red solid;
|
||||||
|
margin-top: 0.1em;
|
||||||
|
margin-bottom: 0.4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
table tr {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
table td img {
|
table td img {
|
||||||
width: 20em;
|
width: 100%;
|
||||||
border: 2px grey ridge;
|
border: 2px grey ridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
<table>
2
<table>
@ -3,6 +3,8 @@
|
|||||||
<td>
|
<td>
|
||||||
[[text_md]]
|
[[text_md]]
|
||||||
</td>
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
[[link_md]]
|
[[link_md]]
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
21
gen.py
21
gen.py
@ -26,7 +26,13 @@ def translate(txt, dirname):
|
|||||||
print('error opening <table> file. aborting...');
|
print('error opening <table> file. aborting...');
|
||||||
sys.exit(0);
|
sys.exit(0);
|
||||||
|
|
||||||
[text, link] = txt.split('- - -');
|
href = None
|
||||||
|
sections = txt.count('- - -');
|
||||||
|
if sections == 1:
|
||||||
|
[text, link] = txt.split('- - -');
|
||||||
|
elif sections == 2:
|
||||||
|
[text, link, href] = txt.split('- - -');
|
||||||
|
|
||||||
text_md = markdown.markdown(text);
|
text_md = markdown.markdown(text);
|
||||||
link_md = markdown.markdown(link);
|
link_md = markdown.markdown(link);
|
||||||
|
|
||||||
@ -34,7 +40,11 @@ def translate(txt, dirname):
|
|||||||
link_md = link_md.replace('data/', dirname + '/');
|
link_md = link_md.replace('data/', dirname + '/');
|
||||||
|
|
||||||
out = table.read().replace('[[text_md]]', text_md);
|
out = table.read().replace('[[text_md]]', text_md);
|
||||||
return out.replace('[[link_md]]', link_md);
|
out = out.replace('[[link_md]]', link_md);
|
||||||
|
if href:
|
||||||
|
href = href.replace('data/', dirname + '/');
|
||||||
|
out = "<a " + href + ">" + out + "</a>";
|
||||||
|
return out
|
||||||
|
|
||||||
def escape_date(dirname):
|
def escape_date(dirname):
|
||||||
return re.sub('^20\d{2}?.', '', dirname)
|
return re.sub('^20\d{2}?.', '', dirname)
|
||||||
@ -63,7 +73,8 @@ def index_content(dir_name, data_dir, index_txt, desc_txt, template):
|
|||||||
|
|
||||||
# desc_txt is a markdown file containing description
|
# desc_txt is a markdown file containing description
|
||||||
# for the project - no layout applied to it, only md
|
# for the project - no layout applied to it, only md
|
||||||
if desc_txt:
|
desc_md = None
|
||||||
|
if os.path.isfile(desc_txt):
|
||||||
try:
|
try:
|
||||||
desc_file = open(desc_txt, 'r+');
|
desc_file = open(desc_txt, 'r+');
|
||||||
desc_md = markdown.markdown(desc_file.read());
|
desc_md = markdown.markdown(desc_file.read());
|
||||||
@ -76,8 +87,8 @@ def index_content(dir_name, data_dir, index_txt, desc_txt, template):
|
|||||||
|
|
||||||
# index_txt is a json file containing one thing:
|
# index_txt is a json file containing one thing:
|
||||||
# an array of files names or glob patterns
|
# an array of files names or glob patterns
|
||||||
|
content_index = None
|
||||||
if index_txt:
|
if os.path.isfile(index_txt):
|
||||||
try:
|
try:
|
||||||
index_file = open(index_txt, 'r+');
|
index_file = open(index_txt, 'r+');
|
||||||
content_index = json.loads(index_file.read());
|
content_index = json.loads(index_file.read());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user