Browse Source

mediawiki pages html content to templates

master
zeroth 4 years ago
parent
commit
f7df9b1dab
  1. 43
      daapinterface.py
  2. 6
      templates/about-wiki.html
  3. 12
      templates/casestudy.html
  4. 14
      templates/upload.html

43
daapinterface.py

@ -341,14 +341,20 @@ def searchtools():
######################### ABOUT
@app.route("/about")
def about():
url="https://daap.bannerrepeater.org/w/index.php?title=Project:About&action=render"
url="https://daap.bannerrepeater.org/w/index.php?title=About&action=render"
# Make a GET request to fetch the raw HTML content
html_content = requests.get(url).text
# Parse the html content
soup = BeautifulSoup(html_content, "lxml")
print(soup.prettify()) # print the parsed data of html
# print(soup.prettify()) # print the parsed data of html
text=soup.find("p")
text=soup.find("html")
# adapt the path to img with regex
# test = text.replace("wiki/File:","wiki/Special:Redirect/file/")
# text.replace_with(test)
text=Markup(text)
return render_template('about-wiki.html', text=text)
@ -361,7 +367,36 @@ def tutorials():
######################### UPLOAD
@app.route("/upload")
def upload():
return render_template('upload.html')
url="https://daap.bannerrepeater.org/w/index.php?title=Upload&action=render"
# Make a GET request to fetch the raw HTML content
html_content = requests.get(url).text
# Parse the html content
soup = BeautifulSoup(html_content, "lxml")
# print(soup.prettify()) # print the parsed data of html
text=soup.find("html")
text=Markup(text)
return render_template('upload.html', text=text)
# #################### CASE STUDY
@app.route("/casestudy")
def casestudy():
url="https://daap.bannerrepeater.org/w/index.php?title=Carolee_Schneemann_case_study&action=render"
# Make a GET request to fetch the raw HTML content
html_content = requests.get(url).text
# Parse the html content
soup = BeautifulSoup(html_content, "lxml")
# print(soup.prettify()) # print the parsed data of html
text=soup.find("html")
text=Markup(text)
return render_template('casestudy.html', text=text)
######################### LOGIN

6
templates/about-wiki.html

@ -3,4 +3,10 @@
{{ text }}
<style type="text/css">
div#toc{
display: none
}
</style>
{% endblock content %}

12
templates/casestudy.html

@ -0,0 +1,12 @@
{% extends "layout.html" %}
{% block content %}
{{ text }}
<style type="text/css">
div#toc{
display: none
}
</style>
{% endblock content %}

14
templates/upload.html

@ -1,15 +1,13 @@
{% extends "layout.html" %}
{% block content %}
<div id="upload-intro">
<h3>UPLOAD</h3>
<p>Upload page upcoming</p>
</div>
<div id="upload-content">
<div id="upload-content-left"></div>
<div id="upload-content-right"></div>
</div>
{{ text }}
<style type="text/css">
div#toc{
display: none
}
</style>
{% endblock content %}
Loading…
Cancel
Save