Skip to content

Commit

Permalink
improved gif handling
Browse files Browse the repository at this point in the history
  • Loading branch information
0815Creeper committed Nov 22, 2023
1 parent 62523f5 commit 61c40fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 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
15 changes: 7 additions & 8 deletions .github/workflows/Example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ 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"
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_"++i".gif")}}1' examples/src/${{ matrix.file-name }}.md > examples/src/tmp_${{ matrix.file-name }}.md
mv examples/src/tmp_${{ matrix.file-name }}.md examples/src/${{ matrix.file-name }}.md
echo "gifs should be fixed"
- name: Archive examples artifacts
if: success() && matrix.os == 'windows-latest'
Expand Down

0 comments on commit 61c40fa

Please sign in to comment.