switching url's: from possiblebodies.constantvzw.org/book to volumetricregimes.xyz

This commit is contained in:
manetta 2021-10-26 08:36:48 +02:00
parent 4e9b73b0f3
commit 52dcc03602
2 changed files with 12 additions and 12 deletions

View File

@ -83,12 +83,12 @@ def download_media(html, images, wiki):
# replace src link
image_path = f'{ PUBLIC_STATIC_FOLDER_PATH }/images/{ filename }' # here the images need to link to the / of the domain, for flask :/// confusing! this breaks the whole idea to still be able to make a local copy of the file
matches = re.findall(rf'src="/book/images/.*?px-{ filename }"', html) # for debugging
matches = re.findall(rf'src="/images/.*?px-{ filename }"', html) # for debugging
if matches:
html = re.sub(rf'src="/book/images/.*?px-{ filename }"', f'src="{ image_path }"', html)
html = re.sub(rf'src="/images/.*?px-{ filename }"', f'src="{ image_path }"', html)
else:
matches = re.findall(rf'src="/book/images/.*?{ filename }"', html) # for debugging
html = re.sub(rf'src="/book/images/.*?{ filename }"', f'src="{ image_path }"', html)
matches = re.findall(rf'src="/images/.*?{ filename }"', html) # for debugging
html = re.sub(rf'src="/images/.*?{ filename }"', f'src="{ image_path }"', html)
# print(f'{filename}: {matches}\n------') # for debugging: each image should have the correct match!
return html
@ -148,7 +148,7 @@ def clean_up(html):
html = string (HTML)
"""
html = re.sub(r'\[.*edit.*\]', '', html) # remove the [edit]
html = re.sub(r'href="/book/index.php\?title=', 'href="#', html) # remove the internal wiki links
html = re.sub(r'href="/index.php\?title=', 'href="#', html) # remove the internal wiki links
html = re.sub(r'[(?=\d)', '', html) # remove left footnote bracket [
html = re.sub(r'(?<=\d)&#93;', '', html) # remove right footnote bracket ]
return html
@ -233,7 +233,7 @@ def update_material_now(pagename, wiki):
if __name__ == "__main__":
wiki = 'https://possiblebodies.constantvzw.org/book' # remove tail slash '/'
wiki = 'https://volumetricregimes.xyz' # remove tail slash '/'
pagename = 'Unfolded'
publication_unfolded = update_material_now(pagename, wiki) # download the latest version of the page

View File

@ -84,12 +84,12 @@ def download_media(html, images, wiki):
# replace src link
image_path = f'{ PUBLIC_STATIC_FOLDER_PATH }/images/{ filename }' # here the images need to link to the / of the domain, for flask :/// confusing! this breaks the whole idea to still be able to make a local copy of the file
matches = re.findall(rf'src="/book/images/.*?px-{ filename }"', html) # for debugging
matches = re.findall(rf'src="/images/.*?px-{ filename }"', html) # for debugging
if matches:
html = re.sub(rf'src="/book/images/.*?px-{ filename }"', f'src="{ image_path }"', html)
html = re.sub(rf'src="/images/.*?px-{ filename }"', f'src="{ image_path }"', html)
else:
matches = re.findall(rf'src="/book/images/.*?{ filename }"', html) # for debugging
html = re.sub(rf'src="/book/images/.*?{ filename }"', f'src="{ image_path }"', html)
matches = re.findall(rf'src="/images/.*?{ filename }"', html) # for debugging
html = re.sub(rf'src="/images/.*?{ filename }"', f'src="{ image_path }"', html)
# print(f'{filename}: {matches}\n------') # for debugging: each image should have the correct match!
return html
@ -149,7 +149,7 @@ def clean_up(html):
html = string (HTML)
"""
html = re.sub(r'\[.*edit.*\]', '', html) # remove the [edit]
html = re.sub(r'href="/book/index.php\?title=', 'href="#', html) # remove the internal wiki links
html = re.sub(r'href="/index.php\?title=', 'href="#', html) # remove the internal wiki links
html = re.sub(r'&#91;(?=\d)', '', html) # remove left footnote bracket [
html = re.sub(r'(?<=\d)&#93;', '', html) # remove right footnote bracket ]
return html
@ -234,7 +234,7 @@ def update_material_now(pagename, wiki):
if __name__ == "__main__":
wiki = 'https://possiblebodies.constantvzw.org/book' # remove tail slash '/'
wiki = 'https://volumetricregimes.xyz' # remove tail slash '/'
pagename = 'Unfolded'
publication_unfolded = update_material_now(pagename, wiki) # download the latest version of the page