Skip to content
Snippets Groups Projects
Commit c3a23ae2 authored by David Rouquet's avatar David Rouquet
Browse files

Add html for images

parent b50e798c
Branches
No related tags found
1 merge request!4Main
...@@ -41,11 +41,12 @@ def prepareHTMLforMD(str): ...@@ -41,11 +41,12 @@ def prepareHTMLforMD(str):
regexAV = re.compile(r".*?PF_clipAV\('.*?', '(.*?).swf',.*") regexAV = re.compile(r".*?PF_clipAV\('.*?', '(.*?).swf',.*")
str = regexAV.sub(r"@AUDIOSTART\1@AUDIOEND", str) str = regexAV.sub(r"@AUDIOSTART\1@AUDIOEND", str)
# Fix media paths (especially for images)
str = str.replace("../media/", "/macao-hugo/media/")
return(str) return(str)
def postEditMD(str): def postEditMD(str):
###################################################
# Add audio players for audio extracted from SWF
###################################################
regexAV = re.compile(r"@AUDIOSTART.*?@AUDIOEND") regexAV = re.compile(r"@AUDIOSTART.*?@AUDIOEND")
for audioElt in regexAV.findall(str): for audioElt in regexAV.findall(str):
audioFolder = audioElt.replace("@AUDIOSTART","").replace("@AUDIOEND","").replace(r"\_","_") audioFolder = audioElt.replace("@AUDIOSTART","").replace("@AUDIOEND","").replace(r"\_","_")
...@@ -56,6 +57,12 @@ def postEditMD(str): ...@@ -56,6 +57,12 @@ def postEditMD(str):
#audioStr += r'{{< audio id="'+audioFile+r'" src="media/'+audioFolder+r'/'+audioFile+r'" >}}' #audioStr += r'{{< audio id="'+audioFile+r'" src="media/'+audioFolder+r'/'+audioFile+r'" >}}'
audioStr += '<div><audio id="'+audioFile+'" ><source src="/macao-hugo/media/'+audioFolder+r'/'+audioFile+'" type="audio/mpeg"></audio><button onclick="document.getElementById(\''+audioFile+'\').play()">Play</button></div>' audioStr += '<div><audio id="'+audioFile+'" ><source src="/macao-hugo/media/'+audioFolder+r'/'+audioFile+'" type="audio/mpeg"></audio><button onclick="document.getElementById(\''+audioFile+'\').play()">Play</button></div>'
str = str.replace(audioElt, audioStr) str = str.replace(audioElt, audioStr)
###################################################
# Add html for images and fix media paths
regexIMG = re.compile(r"!\[\]\(\.\./media/(.*?)\)")
str = regexIMG.sub(r"<img src='/macao-hugo/media/\1'>", str)
return(str) return(str)
def transform_html(graph: Graph): def transform_html(graph: Graph):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment