Skip to content

Commit

Permalink
improved gif handling
Browse files Browse the repository at this point in the history
  • Loading branch information
0815Creeper authored and exnersim committed Nov 24, 2023
1 parent 62523f5 commit 82b9969
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
# copy the examples from the examples branch (.md, .svg) and copy the readme in the docs folder
run: |
git fetch
git --work-tree=$WORK_TREE/.. checkout $SRC_BRANCH -- $SRC_FOLDER_PATH/*.md $SRC_FOLDER_PATH/*.svg
git --work-tree=$WORK_TREE/.. checkout $SRC_BRANCH -- $SRC_FOLDER_PATH/*.md $SRC_FOLDER_PATH/*.svg $SRC_FOLDER_PATH/*.gif
mv $WORK_TREE/src/* $WORK_TREE
rm -r $WORK_TREE/src
cp ./README.md ./docs/src/index.md
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/Example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,20 @@ jobs:
jupyter nbconvert --to script ${{ env.FILE }}
jupyter nbconvert --to markdown ${{ env.FILE }}
- name: "Fix GIF"
- name: "Fix GIFs"
run: |
if ("${{ matrix.file-name }}" -eq "juliacon_2023")
{
echo "starting the mess"
$env:Path += ";C:\Program Files\Git\usr\bin"
sed -i -E 's~(<img src=\"data:image\/gif;base64,[[:alpha:],[:digit:],\/,+,=]*\" \/>)~\`\`\`@raw html\n\1\n\`\`\`~g' examples/src/${{ matrix.file-name }}.md
echo "mess finished"
}
echo "starting gif fixing"
echo $(ls)
echo $(ls examples/src)
echo $(ls examples/src/${{ matrix.file-name }}_files)
mv examples/src/gif_*.gif examples/src/${{ matrix.file-name }}_files
$env:Path += ";C:\Program Files\Git\usr\bin"
awk '{if($0~/<img src=\"data:image\/gif;base64,[[:alpha:],[:digit:],\/,+,=]*\" \/>/) {sub(/<img src=\"data:image\/gif;base64,[[:alpha:],[:digit:],\/,+,=]*\" \/>/,\"![gif](gif_\"++i\".gif)\")}}1' examples/src/${{ matrix.file-name }}.md > examples/src/tmp_${{ matrix.file-name }}.md
mv -Force examples/src/tmp_${{ matrix.file-name }}.md examples/src/${{ matrix.file-name }}.md
echo $(ls)
echo $(ls examples/src)
echo $(ls examples/src/${{ matrix.file-name }}_files)
echo "gifs should be fixed"
- name: Archive examples artifacts
if: success() && matrix.os == 'windows-latest'
Expand Down
2 changes: 1 addition & 1 deletion examples/src/juliacon_2023.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@
"metadata": {},
"outputs": [],
"source": [
"plotEnhancements(neuralFMU, fmu, data; filename=joinpath(@__DIR__, \"NFMU_consumption.gif\"))"
"plotEnhancements(neuralFMU, fmu, data; filename=joinpath(@__DIR__, \"gif_1.gif\"))"
]
},
{
Expand Down

0 comments on commit 82b9969

Please sign in to comment.