From 6dc1bc5237a5442af74460c97f1f2637ea996614 Mon Sep 17 00:00:00 2001 From: Yvan Sraka Date: Wed, 16 Aug 2017 16:07:51 +0200 Subject: [PATCH] Update travis.yml, parseBook.py & makeThumbs.py --- .travis.yml | 2 +- src/makeThumbs.py | 7 +++++++ src/parseBook.py | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 42b950f..8df2e2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: python python: - 2.7 install: - - sudo apt-get install cmake xorg-dev libglu1-mesa-dev texlive-xetex texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended pandoc + - sudo apt-get install cmake xorg-dev libglu1-mesa-dev texlive-xetex texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended pandoc imagemagick - # Install glfw - git clone https://github.com/glfw/glfw.git ~/glfw - cd ~/glfw diff --git a/src/makeThumbs.py b/src/makeThumbs.py index 5be2de5..d7ebb45 100644 --- a/src/makeThumbs.py +++ b/src/makeThumbs.py @@ -14,3 +14,10 @@ for folder in folders: shaderCommand = "glslViewer " + shaderPath + " " + \ " -s 0.5 -o " + shaderImage returnCode = subprocess.call(shaderCommand, shell=True) + + for filename in glob.glob(folder + '/*.gif'): + gifPath = filename; + gifName, gifExt = os.path.splitext(filename) + pngImage = gifName + ".png" + convertCommand = "convert " + gifPath + " " + pngImage + returnCode = subprocess.call(convertCommand, shell=True) diff --git a/src/parseBook.py b/src/parseBook.py index c4f06d1..5613921 100644 --- a/src/parseBook.py +++ b/src/parseBook.py @@ -41,6 +41,14 @@ def injectShaderBlocks( _folder, _text ): print shaderCommand returnCode = subprocess.call(shaderCommand, shell=True) rta += "![]("+shaderImage+")\n" + elif line.find('.gif') >= 0: + gifPath = re.sub(r'\!\[.*\]\((.*\.gif)\)', r'\1', line.rstrip()) + gifName, gifExt = os.path.splitext(gifPath) + pngImage = gifName + ".png" + convertCommand = "convert " + gifPath + " " + pngImage + print convertCommand + returnCode = subprocess.call(convertCommand, shell=True) + rta += re.sub(r'\!\[(.*)\]\((.*)\.gif\)', r'![\1](\2-0.png)', line) + '\n' else: rta += line+'\n' return rta