switching url's: from possiblebodies.constantvzw.org/book to volumetricregimes.xyz
This commit is contained in:
parent
4e9b73b0f3
commit
52dcc03602
@ -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)]', '', 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
|
||||
|
@ -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'[(?=\d)', '', html) # remove left footnote bracket [
|
||||
html = re.sub(r'(?<=\d)]', '', 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
|
||||
|
Loading…
Reference in New Issue
Block a user