Browse Source

backup of update.py

master
manetta 3 years ago
parent
commit
4e7f3cbf77
  1. 35
      command-line/update.py

35
command-line/update.py

@ -167,6 +167,41 @@ def tweaking(html):
html = html.replace('trans*genealogical', 'trans✶genealogical')
html = html.replace('', '<span class="star">✶</span>')
html = html.replace('<p><a href="#File', '<p class="image"><a href="#File') # give <p>'s that contain an non-thumb image a .image class
pattern1 = r'''<h2><span class="mw-headline" id=".*">.*</span><span class="mw-editsection"><span class="mw-editsection-bracket"></span></span></h2>
<p><b>.*?</b>
</p>''' # title + author
pattern2 = r'''<h2><span class="mw-headline" id=".*?">.*?</span><span class="mw-editsection"><span class="mw-editsection-bracket"></span></span></h2>
<h2 style="display:none;"><span class="mw-headline" id=".*?">.*?</span></h2>
<p><b>.*?</b>
</p>''' # exceptions: custom running headers
pattern3 = r'''<h2><span class="mw-headline" id=".*?">.*?</span><span class="mw-editsection"><span class="mw-editsection-bracket"></span></span></h2>''' # only title
pattern4 = r'''<h2><span id="x,_y,_z_\(4_filmstills\)"></span><span class="mw-headline" id="x.2C_y.2C_z_.284_filmstills.29">x, y, z \(4 filmstills\)</span><span class="mw-editsection"><span class="mw-editsection-bracket"></span></span></h2>
<p><b>Jara Rocha, Femke Snelting</b>
</p>'''
pattern5 = r'''<h2><span id="Somatopologies_\(materials_for_a_movie_in_the_making\)"></span><span class="mw-headline" id="Somatopologies_.28materials_for_a_movie_in_the_making.29">Somatopologies \(materials<br> for a movie in the making\)</span><span class="mw-editsection"><span class="mw-editsection-bracket"></span></span></h2>
<p><b>Possible Bodies \(Jara Rocha, Femke Snelting\)</b>
</p>'''
pattern6 = r'''<h2><span id="Rehearsal_as_the_\‘Other\’_to_Hypercomputation"></span><span class="mw-headline" id="Rehearsal_as_the_\.E2\.80\.98Other\.E2\.80\.99_to_Hypercomputation">Rehearsal as the \‘Other\’ to Hypercomputation</span><span class="mw-editsection"><span class="mw-editsection-bracket"></span></span></h2>
<p><b>Maria Dada</b>
</p>'''
pattern7 = r'''<h2><span id="We_hardly_encounter_anything_that_didn’t_really_matter"></span><span class="mw-headline" id="We_hardly_encounter_anything_that_didn\.E2\.80\.99t_really_matter">We hardly encounter anything that didn’t really matter</span><span class="mw-editsection"><span class="mw-editsection-bracket"></span></span></h2>
<p><b>Phil Langley in conversation with Possible Bodies</b>
</p>'''
results = re.findall(rf'{pattern1}|{pattern2}|{pattern3}|{pattern4}|{pattern5}|{pattern6}|{pattern7}', html)
for match in results:
html = html.replace(match, f'<div class="title-wrapper">{ match }</div>')
# for result in results:
# print(result)
# print('---')
# print('---')
# print('AANTAL:', len(results))
# print('SET LEN:', len(set(results)))
# print('---')
# html = html.replace('', '')
# html = html.replace('', '')
return html

Loading…
Cancel
Save