new front page layout
This commit is contained in:
parent
40ec5db009
commit
d818035d16
@ -25,8 +25,25 @@ table td {
|
||||
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 {
|
||||
width: 20em;
|
||||
width: 100%;
|
||||
border: 2px grey ridge;
|
||||
}
|
||||
|
||||
|
||||
19
gen.py
19
gen.py
@ -26,7 +26,13 @@ def translate(txt, dirname):
|
||||
print('error opening <table> file. aborting...');
|
||||
sys.exit(0);
|
||||
|
||||
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);
|
||||
link_md = markdown.markdown(link);
|
||||
|
||||
@ -34,7 +40,11 @@ def translate(txt, dirname):
|
||||
link_md = link_md.replace('data/', dirname + '/');
|
||||
|
||||
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):
|
||||
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
|
||||
# for the project - no layout applied to it, only md
|
||||
if desc_txt:
|
||||
desc_md = None
|
||||
if os.path.isfile(desc_txt):
|
||||
try:
|
||||
desc_file = open(desc_txt, 'r+');
|
||||
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:
|
||||
# an array of files names or glob patterns
|
||||
|
||||
if index_txt:
|
||||
content_index = None
|
||||
if os.path.isfile(index_txt):
|
||||
try:
|
||||
index_file = open(index_txt, 'r+');
|
||||
content_index = json.loads(index_file.read());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user