Grote push
This commit is contained in:
parent
847f6650e9
commit
59a757c72a
3 changed files with 49 additions and 7 deletions
|
@ -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']}
|
||||
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
</p>
|
||||
|
||||
<hr/>
|
||||
|
||||
</div>
|
||||
<div class="header">
|
||||
<img src="images/wikipedia_edit.png" alt="The Wikipedia Logo but rotated" id="logo">
|
||||
<h1>Phikipathia</h1>
|
||||
<h3>Philosophy Wikipedia Path visualiser</h3>
|
||||
<p>Philosophy Wikipedia Path visualiser</p>
|
||||
</div>
|
||||
<div id="visualisatie">
|
||||
</div>
|
||||
|
|
40
style.css
40
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;
|
||||
}
|
||||
|
|
Reference in a new issue