celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [12/14] celix-site git commit: added simple image support
Date Thu, 07 Dec 2017 20:17:55 GMT
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 <edwin.smink@nl.thalesgroup.com>
Authored: Tue Nov 28 10:11:19 2017 +0100
Committer: ESmink <edwin.smink@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


Mime
View raw message