Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D59E6200D4E for ; Thu, 7 Dec 2017 21:17:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D425A160C20; Thu, 7 Dec 2017 20:17:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1F4DF160C24 for ; Thu, 7 Dec 2017 21:17:46 +0100 (CET) Received: (qmail 22320 invoked by uid 500); 7 Dec 2017 20:17:46 -0000 Mailing-List: contact commits-help@celix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@celix.apache.org Delivered-To: mailing list commits@celix.apache.org Received: (qmail 22108 invoked by uid 99); 7 Dec 2017 20:17:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Dec 2017 20:17:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 27617F6144; Thu, 7 Dec 2017 20:17:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pnoltes@apache.org To: commits@celix.apache.org Date: Thu, 07 Dec 2017 20:17:55 -0000 Message-Id: <1dc524c0d10447feb817db7bde85245f@git.apache.org> In-Reply-To: <045cf3471bdd4385b22edab97e7c8e47@git.apache.org> References: <045cf3471bdd4385b22edab97e7c8e47@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/14] celix-site git commit: added simple image support archived-at: Thu, 07 Dec 2017 20:17:48 -0000 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 Authored: Tue Nov 28 10:11:19 2017 +0100 Committer: ESmink 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