summaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
authorGabor Kelemen <kelemeng@gnome.hu>2016-12-21 00:32:28 +0100
committerOlivier Hallot <olivier.hallot@edx.srv.br>2016-12-24 15:50:28 +0000
commit6f19c099aa6852d0ec0570d9f56281e7f7032f81 (patch)
treee27f33ac4442fa825a0282a5371881b48312fbba /helpers
parentUpdate Area tab page and Area dialog help pages (diff)
downloadhelp-6f19c099aa6852d0ec0570d9f56281e7f7032f81.tar.gz
help-6f19c099aa6852d0ec0570d9f56281e7f7032f81.zip
Add script to check for broken image references
Such may appear if images are moved around in the icon theme directories or between the icon themes and the helpcontent2 repo. Simple typos are also possible. Change-Id: Iafee73efe9776ebf8ae74919c90644570593d94e Reviewed-on: https://gerrit.libreoffice.org/32264 Reviewed-by: Olivier Hallot <olivier.hallot@edx.srv.br> Tested-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/find-invalid-help-images.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/helpers/find-invalid-help-images.sh b/helpers/find-invalid-help-images.sh
new file mode 100755
index 0000000000..c73d40ed28
--- /dev/null
+++ b/helpers/find-invalid-help-images.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This script looks up <image ...> tags in helpcontent, checks whether the
+# referenced file exist in the galaxy theme or in source/ and prints a warning if it does not.
+# Execute from the root directory of the helpcontent2 repository.
+# No parameters are used.
+
+images=$(git grep \<image source/);
+
+while read nextline ; do
+
+ # Source file is before the first :
+ sourcefile=${nextline%%:*};
+
+ # There is only one image tag per line, let's extract the src path
+ img2=${nextline#*src=\"};
+ img3=${img2%%\"*};
+
+ # Check the images existence
+ if [ ! -f "../icon-themes/galaxy/$img3" ] ; then
+ # Not present in galaxy, but it may be under source/
+ if [ ! -f "source/$img3" ] ; then
+ # Not even there, we have an error!
+ echo "$img3 included in file $sourcefile is not found in the galaxy theme or the help media!";
+ fi
+ fi
+done <<< "$images"