You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2017/12/07 20:17:55 UTC

[12/14] celix-site git commit: added simple image support

added simple image support


Project: http://git-wip-us.apache.org/repos/asf/celix-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix-site/commit/0bf10944
Tree: http://git-wip-us.apache.org/repos/asf/celix-site/tree/0bf10944
Diff: http://git-wip-us.apache.org/repos/asf/celix-site/diff/0bf10944

Branch: refs/heads/asf-site
Commit: 0bf109447349e8c78d9b2fe40a42048b047e7e76
Parents: bb0b379
Author: ESmink <ed...@nl.thalesgroup.com>
Authored: Tue Nov 28 10:11:19 2017 +0100
Committer: ESmink <ed...@nl.thalesgroup.com>
Committed: Tue Nov 28 10:11:19 2017 +0100

----------------------------------------------------------------------
 build.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix-site/blob/0bf10944/build.py
----------------------------------------------------------------------
diff --git a/build.py b/build.py
index 1c68a10..ceff165 100755
--- a/build.py
+++ b/build.py
@@ -80,6 +80,24 @@ for title in root:
 			file = f.read()
 		o = open(fl.find('dest').text, 'w')
 
+		# import images
+		i = 0
+		while True:
+			i = file.find('\n![', i)
+			if(i == -1):break
+			i2 = file.find('(', i)
+			if(i2 == -1):break
+			i3 = file.find(')', i)
+			if(i3 == -1):break
+			if(i2 > i3 or i3 > file.find('\n', i + 3)):
+				i += 3
+				continue
+			print(file[i:i3] + "|" + file[i2 + 1:i3])
+			# copy images here
+			with open(fl.find('path').text[:fl.find('path').text.rfind('/') + 1] + file[i2 + 1:i3]) as src:
+				with open(fl.find('dest').text[:fl.find('dest').text.rfind('/') + 1] + file[i2 + 1:i3], 'w') as dest:dest.write(src.read())
+			i += 3
+
 		# import other files
 		if fl.find('url'):
 			i = 0