publish cat

master
Sandra 5 years ago
parent 8cbc1af235
commit 04e82c7206

@ -45,8 +45,7 @@ with open('login.txt', 'r') as login: # read login user & pwd
# read template files # read template files
with open('templates/title.html') as title_html:
title_template = Template(title_html.read())
SLASH = "\u2044" SLASH = "\u2044"
@ -54,12 +53,24 @@ def filenameforpage(p):
f=p.name.replace(' ','_').replace('/', SLASH) + '.html' f=p.name.replace(' ','_').replace('/', SLASH) + '.html'
return f return f
title=site.Categories['Title'] publish=site.Categories['Publish']
for p in title.members(): for cat in publish.members():
if cat.namespace!=14:
continue
print('dumping category {}'.format(cat.page_title))
# title=site.Categories['Title']
try:
with open('templates/{}.html'.format(cat.page_title.lower())) as templatefile:
template = Template(templatefile.read())
except FileNotFoundError:
with open('templates/default.html') as templatefile:
template = Template(templatefile.read())
for p in cat.members():
print(p) print(p)
htmlsrc = site.parse(page=p.name)['text']['*'] htmlsrc = site.parse(page=p.name)['text']['*']
html = template.render(page=p, body=htmlsrc)
with open(os.path.join(args.output, filenameforpage(p)), 'w') as f: with open(os.path.join(args.output, filenameforpage(p)), 'w') as f:
print(htmlsrc, file=f) print(html, file=f)
# break # break

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="0/static/archive.css" />
<script type="text/javascript" src="0/static/archive.js"></script>
<title>{{ page.name }}</title>
</head>
<body>
<h1>{{ page.name }}</h1>
<div id="body">{{ body|safe }}</div>
</body>
</html>

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../static/style.css" />
<script type="text/javascript" src="../static/script.js"></script>
<title>{{ title[0] }}</title>
</head>
<body>
<h1>{{ title[0] }}</h1>
<h2><time datetime="{{date}}">{{ date.year }}.{{ date.month }}.{{ date.day }}</time></h2>
<div id="ExpCol">
<h3>Metadata</h3>
</div>
<div id="content">
<!-- metadata creator / format / topic -->
<a class="metadata_links" href="allcreators.html" id="creatornav">Creator</a>
<div class="metadata_creator">{{ creator }}</div>
<a class="metadata_links" href="allformats.html" id="formatnav">Format</a>
<div class="metadata_format">{{ format }}</div>
<a class="metadata_links" href="alltopics.html" id="topicnav">Topic</a>
<div class="metadata_topic">{{topic}}</div>
</div>
<!-- nav -->
<div id="rightnav" class="rightnav">
<a href="index.html" id="titlenav">Title</a>
</div>
<div id="leftnav" class="leftnav">
<a href="timeline.html" id="datenav">Date</a>
</div>
<!-- organizations toogle -->
<button class="orgbtn" onclick="orgFunc()">Organizations</button>
<div class="metadata_organizations" id="org">
<ul>{{ organization }}</ul>
</div>
<!-- square -->
<div class="square"></div>
<!-- 2 btn grid switch for images -->
<div class="header" id="myHeader">
<p><button class="btn" onclick="myFunction()">100%</button></p>
<p><button class="btn" onclick="myFunction2()">overview</button></p>
</div>
<!-- images -->
{% for row in imgsmatrix %}
<div class="grid-container" id="myDIV">
{% for img in row %}
<div class="column">
<img src="{{ img }}">
</div>
{% endfor %}
</div>
{% endfor %}
</body>
</html>
{#
<div class="row">
<div class="column">
<img src="./images/VF383Hamok00.jpg" style="width:100%">
</div>
<div class="column">
<img src="./images/VF383Hamok01.jpg" style="width:100%">
</div>
<div class="column">
<img src="./images/VF383Hamok02.jpg" style="width:100%">
</div>
<div class="column">
<img src="./images/VF383Hamok03.jpg" style="width:100%">
</div>
</div>
#}

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../static/style.css" />
<script type="text/javascript" src="../static/script.js"></script>
<title>{{ title[0] }}</title>
</head>
<body>
<h1>{{ title[0] }}</h1>
<h2><time datetime="{{date}}">{{ date.year }}.{{ date.month }}.{{ date.day }}</time></h2>
<!-- metadata creator / format / topic -->
<div class="metadata_creator">{{ creator }}</div>
<div class="metadata_format">{{ format }}</div>
<div class="metadata_topic">{{topic}}</div>
<!-- nav -->
<div id="rightnav" class="rightnav">
<a href="index.html" id="titlenav">Title</a>
</div>
<div id="leftnav" class="leftnav">
<a href="timeline.html" id="datenav">Date</a>
<a href="allcreators.html" id="creatornav">Creator</a>
<a href="allformats.html" id="formatnav">Format</a>
<a href="alltopics.html" id="topicnav">Topic</a>
</div>
<!-- organizations toogle -->
<button class="orgbtn" onclick="orgFunc()">Organizations</button>
<div class="metadata_organizations" id="org">
<ul>{{ organization|list }}</ul>
</div>
<!-- square -->
<div class="square"></div>
<!-- 2 btn grid switch for images -->
<div class="header" id="myHeader">
<p><button class="btn" onclick="myFunction()">100%</button></p>
<p><button class="btn" onclick="myFunction2()">overview</button></p>
</div>
<!-- images -->
{% for row in imgsmatrix %}
<div class="grid-container" id="myDIV">
{% for img in row %}
<div class="column">
<img src="{{ img }}">
</div>
{% endfor %}
</div>
{% endfor %}
</body>
</html>
{#
<div class="row">
<div class="column">
<img src="./images/VF383Hamok00.jpg" style="width:100%">
</div>
<div class="column">
<img src="./images/VF383Hamok01.jpg" style="width:100%">
</div>
<div class="column">
<img src="./images/VF383Hamok02.jpg" style="width:100%">
</div>
<div class="column">
<img src="./images/VF383Hamok03.jpg" style="width:100%">
</div>
</div>
#}

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="0/static/archive.css" />
<script type="text/javascript" src="0/static/archive.js"></script>
<link rel="stylesheet" href="0/static/title.css" />
<script type="text/javascript" src="0/static/title.js"></script>
<title>{{ page.name }}</title>
</head>
<body class="title">
<h1>{{ page.name }}</h1>
<div id="body">{{ body|safe }}</div>
</body>
</html>

@ -2,86 +2,16 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="../static/style.css" /> <link rel="stylesheet" href="0/static/archive.css" />
<script type="text/javascript" src="../static/script.js"></script> <script type="text/javascript" src="0/static/archive.js"></script>
<title>{{ title[0] }}</title> <link rel="stylesheet" href="0/static/title.css" />
<script type="text/javascript" src="0/static/title.js"></script>
<title>{{ page.name }}</title>
</head> </head>
<body> <body class="title">
<h1>{{ title[0] }} &#8629;</h1>
<h2><time datetime="{{date}}">{{ date.year }}.{{ date.month }}.{{ date.day }}</time></h2>
<div class="metadata"> <h1>{{ page.name }}</h1>
<button class="collapsible cbtn">C</button> <div id="body">{{ body|safe }}</div>
<div class="content">
<!-- metadata creator / format / topic -->
<div class="metadata_creator">{{ creator }}</div>
<a class="metadata_links" href="allcreators.html">All Creators</a>
</div>
<button class="collapsible fbtn">f</button>
<div class="content">
<div class="metadata_format">{{ format }}</div>
<a class="metadata_links" href="allformats.html">All Formats</a>
</div>
<button class="collapsible orgbtn">Org</button>
<div class="content">
<div class="metadata_organization">{{ organization }}</div>
<a class="metadata_links" href="allorganizations.html">All Organizations</a>
</div>
<button class="collapsible tbtn">T</button>
<div class="content">
<div class="metadata_topic">{{ topic }}</div>
<a class="metadata_links" href="alltopics.html">All Topics</a>
</div>
</div>
<!-- nav -->
<!-- <div id="rightnav" class="rightnav">
<a href="index.html" id="titlenav">Title</a>
</div>
<div id="leftnav" class="leftnav">
<a href="timeline.html" id="datenav">Date</a>
</div> -->
<!-- square -->
<!-- <div class="square"></div> -->
<!-- 2 btn grid switch for images -->
<div class="header" id="myHeader">
<p><button class="btn" onclick="myFunction()">100%</button></p>
<p><button class="btn" onclick="myFunction2()">overview</button></p>
</div>
<!-- images -->
{% for row in imgsmatrix %}
<div class="grid-container" id="myDIV">
{% for img in row %}
<div class="column">
<img src="{{ img }}">
</div>
{% endfor %}
</div>
{% endfor %}
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
</script>
</body> </body>
</html> </html>

Loading…
Cancel
Save