Commit 04257a28 authored by colm's avatar colm

moving along nicely, gathering all of the csvs into a global dict to use on...

moving along nicely, gathering all of the csvs into a global dict to use on home page, specific pages work ok is, few issues to work out with the scraper
parent f2f6ae77
from flask import Flask, render_template, redirect
import csv
# from feeds import commits
import os
app = Flask(__name__)
thisdir = os.getcwd()
print(thisdir)
uncertainlist = os.listdir("word_patterns/")
full_dict = {}
for file in uncertainlist:
filename = file.split('.')[0]
print(filename)
file = open('word_patterns/' + file)
file = csv.reader(file)
currentlist = []
for row in file:
print(row)
currentlist.append(row)
full_dict[filename] = currentlist
@app.route("/")
def home():
print(full_dict)
uncertainlist = os.listdir("word_patterns/")
uncertainlist = [i.split('.')[0] for i in uncertainlist]
path_to_imgs='probabl/'
data_file = open('scrape_probabl.csv')
csv_file = csv.reader(data_file)
file = csv.reader(data_file)
return render_template("index.html", full_dict=full_dict, uncertainlist=uncertainlist, csv_file=csv_file, path_to_imgs=path_to_imgs, file=file)
@app.route('/collection/<uncertain>')
def word_pattern(uncertain):
uncertainlist = os.listdir("word_patterns/")
uncertainlist = [i.split('.')[0] for i in uncertainlist]
print(uncertainlist)
if uncertain in uncertainlist:
print('this is a file')
filename = 'word_patterns/' + uncertain + '.csv'
datafile = open(filename)
datafile = csv.reader(datafile)
print(filename)
else:
return render_template('error.html'), 404
return render_template("index.html", csv_file=csv_file, path_to_imgs=path_to_imgs)
return render_template("uncertain.html", uncertain=uncertain, datafile=datafile)
# , all_found_items=all_found_items, collectionName=collectionName, inventoryNb=inventoryNb, objectTitle=objectTitle, objectCulture=objectCulture, geography=geography, dating=dating, material=material, technique=technique, dimensions=dimensions, legalRightOwner=legalRightOwner, url=url, imageurl=imageurl, image=image
@app.errorhandler(404)
def not_found(error):
return render_template('error.html'), 404
......
......@@ -220,6 +220,7 @@ div.more-git-commits {
/* ------------------------------------------------------------ */
html {
font-size: 100%;
background: black;
}
@media screen and (max-width: 767px) {
html {
......@@ -228,171 +229,37 @@ html {
}
body {
background: white;
color: black;
color: white;
}
a {
color: black;
color: lightgrey;
text-decoration: none;
}
a:hover, a:focus, a:active {
color: grey;
}
a:not(> img) {
white-space: pre;
white-space: pre-wrap;
white-space: pre-line;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
white-space: -moz-pre-wrap;
white-space: -hp-pre-wrap;
word-wrap: break-word;
}
div.rss2html-note {
display: none;
}
div.top {
padding-top: 10px;
padding-bottom: 10px;
}
.lt-ie9 div.top {
padding-top: 30px;
padding-bottom: 50px;
}
@media screen and (min-width: 900px) {
div.top {
padding-top: 30px;
padding-bottom: 50px;
}
}
ul.nav {
margin: 0 !important;
font-size: 1em;
line-height: 1.375em;
list-style: none !important;
}
ul.nav li {
margin-right: 10px;
border-bottom: 1px solid;
padding-bottom: 3px;
}
.lt-ie9 ul.nav li {
display: inline-block;
}
@media screen and (min-width: 900px) {
ul.nav li {
display: inline-block;
}
}
.lt-ie9 ul.nav {
padding-top: 30px;
padding-bottom: 50px;
}
@media screen and (min-width: 900px) {
ul.nav {
padding-top: 30px;
padding-bottom: 50px;
}
}
.lt-ie9 p.align-right {
text-align: right !important;
}
@media screen and (min-width: 900px) {
p.align-right {
text-align: right !important;
}
}
h1.title {
padding-bottom: 5px;
font-size: 3em !important;
padding-top: 30px;
}
.lt-ie9 h1.title {
padding-bottom: 20px;
padding-top: 0px;
}
@media screen and (min-width: 900px) {
h1.title {
padding-bottom: 20px;
padding-top: 0px;
}
}
img.full-width-img {
width: 100%;
margin-top: 20px;
margin-bottom: 20px;
}
.samples {
margin-bottom: 6.6em;
}
.samples img, .samples video, .samples iframe {
width: 100%;
margin-bottom: 1.1em;
margin-right: 1%;
}
.samples a {
text-decoration: underline;
}
.samples .framed {
outline: 1px solid black;
}
.samples img.side-by-page {
width: 49%;
float: left;
}
.samples img.sm-gutter {
margin-right: 1%;
}
* {
box-sizing: border-box;
}
.sticky {
display: table-header-group;
}
.sticky a {
text-decoration: underline;
}
.sticky ul, .sticky li {
margin: 0 !important;
padding: 0;
div.main-nav {
margin-top: 2.2em;
}
.lt-ie9 .sticky {
position: sticky;
top: 40px;
float: left;
background-color: white;
z-index: 1;
min-height: 450px;
}
@media screen and (min-width: 1100px) {
.sticky {
position: sticky;
top: 40px;
float: left;
background-color: white;
z-index: 1;
min-height: 450px;
}
div.main-nav h1 {
text-align: center;
text-transform: uppercase;
font-weight: bold;
}
hr {
clear: both;
margin-top: 20px;
margin-bottom: 50px;
div.language-switcher {
position: absolute;
top: 2.2em;
right: 25px;
text-transform: uppercase;
font-family: propcouriersans-bold;
}
div.footer ul {
list-style-type: none;
img.thumbnail {
width: 100px;
height: auto;
}
/* ::Import styles */
......@@ -417,21 +284,21 @@ h4.feed-item-title a {
}
@font-face {
font-family: 'karmillabold';
src: url("../fonts/karmilla-bold-009-webfont.eot");
src: url("../fonts/karmilla-bold-009-webfont.svg#karmillabold") format("svg"), url("../fonts/karmilla-bold-009-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/karmilla-bold-009-webfont.woff") format("woff"), url("../fonts/karmilla-bold-009-webfont.ttf") format("truetype");
font-family: 'propcouriersans-bold';
src: url("../fonts/propcouriersans-bold-webfont.eot");
src: url("../fonts/propcouriersans-bold-webfont.svg#karmillabold") format("svg"), url("../fonts/propcouriersans-bold-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/propcouriersans-bold-webfont.woff") format("woff"), url("../fonts/propcouriersans-bold-webfont.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'karmillaregular';
src: url("../fonts/karmilla-regular-009-webfont.eot");
src: url("../fonts/karmilla-regular-009-webfont.svg#karmillaregular") format("svg"), url("../fonts/karmilla-regular-009-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/karmilla-regular-009-webfont.woff") format("woff"), url("../fonts/karmilla-regular-009-webfont.ttf") format("truetype");
font-family: 'propcouriersans';
src: url("../fonts/propcouriersans-webfont.eot");
src: url("../fonts/propcouriersans-webfont.svg#karmillaregular") format("svg"), url("../fonts/propcouriersans-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/propcouriersans-webfont.woff") format("woff"), url("../fonts/propcouriersans-webfont.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
.font-body, body {
font-family: 'karmillaregular', 'Open Sans', sans-serif, sans-serif;
font-family: 'propcouriersans', 'Open Sans', sans-serif, sans-serif;
}
.font-var {
......@@ -456,7 +323,7 @@ li {
}
strong, b {
font-weight: 700;
font-family: 'propcouriersans-bold';
}
em, i, q {
......@@ -1147,65 +1014,6 @@ input[type="checkbox"]:focus {
left: auto;
}
ul.feedEkList {
list-style-type: none;
margin-left: 0px;
margin-top: -6px;
}
.feedEkList li {
border-bottom: 1px dashed black;
padding-top: 5px;
padding-bottom: 5px;
}
.feedEkList li:last-child {
border-bottom: none;
}
div.itemTitle a {
border: 2px solid #000;
padding: 8px;
margin-top: 10px;
line-height: 60px;
font-size: 1.5em;
}
div#divgithub div.itemDate {
display: none;
}
div#divgithub .feedEkList li:last-child {
border-bottom: none;
}
div#divgithub .itemDate {
font-size: 11px;
color: #AAAAAA;
}
div.itemContent ul {
list-style-type: none;
}
div.itemContent img {
display: none;
}
div.itemContent a {
text-decoration: underline;
}
div.itemContent .a:before {
content: "https://github.com/";
}
div.itemContent blockquote {
font-size: 1.2em;
}
section.feed-aggregation div.itemTitle a {
border: 2px solid #000;
padding: 4px;
margin-top: 10px;
line-height: 34px;
font-size: 1em;
}
/* ::Print */
/* ------------------------------------------------------------ */
@media print {
......
......@@ -28,28 +28,28 @@ h4.feed-item-title a{
// ------------------------------------------------------------
@font-face {
font-family: 'karmillabold';
src: url('../fonts/karmilla-bold-009-webfont.eot');
src: url('../fonts/karmilla-bold-009-webfont.svg#karmillabold') format('svg'),
url('../fonts/karmilla-bold-009-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/karmilla-bold-009-webfont.woff') format('woff'),
url('../fonts/karmilla-bold-009-webfont.ttf') format('truetype');
font-family: 'propcouriersans-bold';
src: url('../fonts/propcouriersans-bold-webfont.eot');
src: url('../fonts/propcouriersans-bold-webfont.svg#karmillabold') format('svg'),
url('../fonts/propcouriersans-bold-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/propcouriersans-bold-webfont.woff') format('woff'),
url('../fonts/propcouriersans-bold-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'karmillaregular';
src: url('../fonts/karmilla-regular-009-webfont.eot');
src: url('../fonts/karmilla-regular-009-webfont.svg#karmillaregular') format('svg'),
url('../fonts/karmilla-regular-009-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/karmilla-regular-009-webfont.woff') format('woff'),
url('../fonts/karmilla-regular-009-webfont.ttf') format('truetype');
font-family: 'propcouriersans';
src: url('../fonts/propcouriersans-webfont.eot');
src: url('../fonts/propcouriersans-webfont.svg#karmillaregular') format('svg'),
url('../fonts/propcouriersans-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/propcouriersans-webfont.woff') format('woff'),
url('../fonts/propcouriersans-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
.font-body { font-family: 'karmillaregular', 'Open Sans', sans-serif, sans-serif; }
.font-body { font-family: 'propcouriersans', 'Open Sans', sans-serif, sans-serif; }
.font-var { font-family: Georgia, serif; }
......@@ -61,5 +61,5 @@ p, span, cite, ol, ul, pre, label, input, textarea { @include adjust-font-size-
ul { @include nobullet; }
ol { @include nobullet; }
li { line-height: inherit; }
strong, b { font-weight: 700; }
strong, b { font-family: 'propcouriersans-bold'}
em, i, q { font-style: italic; }
......@@ -8,8 +8,7 @@
// Use SASS globbing to import all _.scss files in the module folder.
// These should be independent modules that follow the BEM/SMACSS way
@import "modules/home";
@import "modules/navigation";
@import "modules/*";
......@@ -21,135 +20,42 @@ html {
@include respond-to-max(768px, $IE9: false) { // Stop at precise width, as we're talking about devices
-webkit-text-size-adjust: 100%; // Stops text scaling in iOS.
}
background: black;
}
body {
background: white;
@extend .font-body;
color: $base-color;
}
color: white;
}
a {
color: $action;
color: lightgrey;
text-decoration: none;
@include link-active-styles { // Mixin for interactions (hover,focus,active)
color: $action-respond;
}
&:not(>img) {
@include force-wrap;
}
}
div.rss2html-note{
display: none;
}
div.top{
padding-top:10px;
padding-bottom:10px;
@include respond-to($d-vp){
padding-top: 30px;
padding-bottom: 50px;
}
}
ul.nav{
margin: 0 !important;
@include adjust-font-size-to(16px);
list-style: none !important;
li{
@include respond-to($d-vp){
display: inline-block;
}
margin-right: 10px;
border-bottom:1px solid;
padding-bottom: 3px;
}
@include respond-to($d-vp){
padding-top: 30px;
padding-bottom: 50px;
}
}
p.align-right{
@include respond-to($d-vp){
text-align: right !important;
}
}
h1.title{
padding-bottom: 5px;
font-size: 3em !important;
padding-top: 30px;
@include respond-to($d-vp){
padding-bottom: 20px;
padding-top: 0px;
}
}
img.full-width-img{
width: 100%;
margin-top: 20px;
margin-bottom: 20px;
}
.samples{
@include trailer(24);
img, video, iframe{
width: 100%;
@include trailer(4);
margin-right: 1%;
}
a{
text-decoration: underline;
}
.framed{
outline: 1px solid black;
}
img.side-by-page{
width: 49%;
float: left;
}
img.sm-gutter{
margin-right: 1%;
}
}
* {
box-sizing: border-box;
}
.sticky{
a{
text-decoration: underline;
}
ul, li{
margin: 0 !important;
padding: 0;
}
display: table-header-group;
@include respond-to($e-vp){
position: sticky;
top: 40px;
float: left;
background-color: white;
z-index: 1;
min-height: 450px;
div.main-nav{
@include leader(8);
h1{
text-align: center;
text-transform: uppercase;
font-weight: bold;
}
}
hr {
clear: both;
margin-top:20px;
margin-bottom:50px;
div.language-switcher{
position: absolute;
top: 2.2em;
right: 25px;
text-transform: uppercase;
font-family: propcouriersans-bold
}
div.footer{
ul{
list-style-type: none;
}
img.thumbnail{
width: 100px;
height: auto;
}
/* ::Import styles */
......@@ -159,7 +65,6 @@ div.footer{
@import "libs/forms"; // Forms
@import "add-ons/module-typeset"; // Specific typesetting
@import "add-ons/grid"; // Grid system
@import "libs/feeds";
/* ::Print */
......
......@@ -9,23 +9,42 @@
<meta name="viewport" content="initial-scale=1">
<link rel='shortcut icon' type='image/png' sizes='32x32' href=''>
<link rel="stylesheet" href="static/build/screen.css">
<script src="static/build/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="/static/build/screen.css">
<script src="/static/build/jquery-3.2.1.min.js"></script>
{% endblock head %}
</head>
<body>
<div class="is-typeset">
{% block nav %}
<div class="main-nav row-parent">
<div class="row">
<h1><a href="/">Collection of uncertanties</a></h1>
current list of words:
{% for item in uncertainlist %}
<b><a href="/collection/{{item}}">{{item}}</a></b>
{% endfor %}
</div>
</div>
<hr>
{% endblock nav %}
{% block language %}
<div class="language-switcher">
<a href="#en">en</a>
<a href="#fr">fr</a>
<a href="#nl">nl</a>
</div>
{% endblock language %}
{% block content %}
{% endblock content %}
{% block footer %}
{% endblock footer %}
</div>
</div>
<script src="static/build/main.js"></script>
</body>
</html>
{% extends "base.html" %}
{% block content %}
{% for row in csv_file %}
{% if loop.index == 1 %}
Column names are: {{row}}<br><br><br>
{% else %}
{{loop.index}} : {{row}}<br><br>
{% endif %}
{% endfor %}
<div class="row-parent">
<div class="row">
<div class="colspan12-12 as-grid">
{{full_dict}}
{% for row in full_dict %}
{{row}}
{% endfor %}
<hr>
</div>
<div class="colspan12-6 as-grid">
{% for row in file %}
<img class="thumbnail" src="/static/probabl/{{row[13]}}">
{% endfor %}
</div>
<div class="colspan12-6 as-grid">
{% for row in csv_file %}
{% if loop.index == 1 %}
Column names are: {{row}}<br><br><br>
{% else %}
{{loop.index}} : {{row}}<br><br>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endblock %}
{% extends "base.html" %}
{% block content %}
<div class="row-parent">
<h1>{{uncertain}}</h1>
<div class="row">
{% for row in datafile %}
<div class="row__colspaced">
<div class="colspan12-8 as-grid with-gutter">
<h2>{{loop.index}} {{row[2]}} : </h2>
<p>{{row}}</p><br>
</div>
<div class="colspan12-4 as-grid with-gutter">
<small>{{row[2]}}, {{row[3]}}: </small>
<p><img src="/static/probabl/{{row[13]}}"></p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
collectionName,inventoryNb,objectName,objectTitle,objectCulture,geography,dating,material,technique,dimensions,legalRightOwner,url,imageurl,image
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment