From 59a757c72a8d3de5d835b8475e7ee7d05a0b5cf8 Mon Sep 17 00:00:00 2001
From: Tibo De Peuter
Date: Thu, 19 May 2022 17:01:06 +0200
Subject: [PATCH] Grote push
---
cgi-bin/scraper.py | 10 +++++++---
index.html | 6 ++++--
style.css | 40 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/cgi-bin/scraper.py b/cgi-bin/scraper.py
index b31fc0a..9715a6e 100644
--- a/cgi-bin/scraper.py
+++ b/cgi-bin/scraper.py
@@ -32,7 +32,7 @@ def converteer(tekst, gebruiker=True):
def zoek_link(soep):
"""
Doorzoek de meegeleverde soep naar een geldige Wikipedia-link.
- :return: een geldige link indien beschikbaar, anders None
+ :return: een geldige link indien beschikbaar, anders
>>> zoek_link(BeautifulSoup(requests.get('https://en.wikipedia.org/wiki/Belgium').content, 'html.parser'))
'Northwestern_Europe'
@@ -50,6 +50,8 @@ def zoek_link(soep):
Maar eventueel als alternatief 'Landlocked_country' ??
>>> zoek_link(BeautifulSoup(requests.get('https://en.wikipedia.org/wiki/%27s-Gravenweg_168,_Kralingen').content, 'html.parser'))
'Kralingen'
+ >>> zoek_link(BeautifulSoup(requests.get('https://fr.wikipedia.org/wiki/Langue').content, 'html.parser'))
+ 'Syst%C3%A8me'
"""
# Ik heb besloten om ook lijsttypes te kunnen doorzoeken op nuttige linkjes. Dit is strikt genomen tegen de
@@ -77,7 +79,7 @@ def zoek_link(soep):
# Spans negeren is redelijk enkel en alleen om coördinaat stukjes te vermijden.
while potentieel is None or alinea.findChild().name == 'span':
- alinea = alinea.findNextSibling(ondersteuning)
+ alinea = alinea.findNextSibling(ondersteuning, recursive=False)
# Het zou kunnen dat de bewerking hierboven ervoor zorgt dat we op het einde van de pagina zijn
if alinea is None:
@@ -129,6 +131,8 @@ def run(taal, start, stop):
Paden kunnen gecontroleerd worden met https://www.xefer.com/wikipedia, al doet dit niets met 'speciale' Wikipedia-
links.
+ >>> run('fr', 'Langue', 'Philosophie')
+
Gewone controles
>>> run('en', "Belgium", "Philosophy")
{'pad': ['Belgium', 'Northwestern Europe', 'Subregion', 'Region', 'Geography', 'Science', 'Scientific method', 'Empirical evidence', 'Proposition', 'Logic', 'Reason', 'Consciousness', 'Sentience', 'Emotion', 'Mental state', 'Mind', 'Phenomenon', 'Immanuel Kant', 'Philosophy']}
@@ -139,7 +143,7 @@ def run(taal, start, stop):
Loops
>>> run('nl', 'België', 'Philosophy')
- {'error': "Cyclus gedetecteerd op 'Wetenschap', het onafgewerkte pad zal niet worden toegevoegd aan het overzicht."}
+ {'error': "Cyclus gedetecteerd op 'Wetenschap', startende vanaf 'België'. Het onafgewerkte pad zal niet worden toegevoegd aan het overzicht. "}
>>> run('en', 'Tom Inglesby', 'Contract failure')
{'pad': ['Tom Inglesby', 'Johns Hopkins Center for Health Security', 'Nonprofit organization', 'Contract failure']}
diff --git a/index.html b/index.html
index 3897b27..cc143cf 100644
--- a/index.html
+++ b/index.html
@@ -17,9 +17,11 @@
-
+
+
diff --git a/style.css b/style.css
index 2c7c3a6..eb926f4 100644
--- a/style.css
+++ b/style.css
@@ -5,11 +5,47 @@ li ul {
}
ul {
- /* list-style-type: symbols("↪");*/
- list-style-type: symbols("⬈");
+ /* alternatieven "↪" */
+ list-style-type: symbols("⬉");
}
ul#wortel {
padding: 0;
list-style-type: none;
}
+
+.header h1 {
+ text-align: center;
+ margin: 0 auto;
+
+ font-min-size: 2vw;
+ font-size: 3vw;
+ position: relative;
+}
+
+.header img {
+ display: block;
+ margin: 0 auto;
+
+ width: 10%;
+ height: 10%;
+
+ min-width: 2%;
+ min-height: 2%;
+ max-width: 20%;
+ max-height: 20%;
+}
+
+.header p {
+ font-weight: bold;
+ text-align: center;
+}
+
+.top-bar {
+ position: fixed;
+ top: 0;
+}
+
+#waarschuwing {
+ color: darkorange;
+}