public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pambase:master commit in: /
Date: Wed,  5 Aug 2020 06:04:00 +0000 (UTC)	[thread overview]
Message-ID: <1596607429.732fb3bbfd7d007fdca78dd4587f1a7bd34bfa6c.sam@gentoo> (raw)

commit:     732fb3bbfd7d007fdca78dd4587f1a7bd34bfa6c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 06:02:52 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 06:03:49 2020 +0000
URL:        https://gitweb.gentoo.org/proj/pambase.git/commit/?id=732fb3bb

pambase.py: strip all blank lines

It's simpler to do this in pambase.py than with
Jinja 2, at least for now.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 pambase.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pambase.py b/pambase.py
index 1ebafbe..9765778 100755
--- a/pambase.py
+++ b/pambase.py
@@ -67,7 +67,7 @@ def process_args(args):
 
 def parse_templates(processed_args):
 	load = FileSystemLoader('')
-	env = Environment(loader=load)
+	env = Environment(loader=load, trim_blocks=True, lstrip_blocks=True, keep_trailing_newline=True)
 
 	templates = [
 		"login",
@@ -87,6 +87,11 @@ def parse_templates(processed_args):
 		with open('stack/{0}'.format(template_name), "w+") as output:
 			rendered_template = template.render(processed_args)
 
+			# Strip all intermediate lines to not worry about appeasing Jinja
+			lines = rendered_template.split("\n")
+			lines = [line for line in lines if line]
+			rendered_template = "\n".join(lines)
+
 			if rendered_template:
 				output.write(rendered_template + "\n")
 


             reply	other threads:[~2020-08-05  6:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05  6:04 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-04-13 21:15 [gentoo-commits] proj/pambase:master commit in: / Mike Gilbert
2025-04-13 21:15 Mike Gilbert
2025-04-13 21:15 Mike Gilbert
2025-04-13 21:15 Mike Gilbert
2025-04-13 21:15 Mike Gilbert
2025-04-13 21:15 Mike Gilbert
2025-02-23 23:46 Sam James
2023-11-13  6:20 Sam James
2021-11-14 11:55 Mikle Kolyada
2020-10-12 15:28 Sam James
2020-08-05  6:13 Sam James
2020-06-18 10:11 Mikle Kolyada
2020-06-17 18:30 Mikle Kolyada
2020-06-16 16:26 Mikle Kolyada
2020-06-10 11:50 Mikle Kolyada
2020-06-10 11:50 Mikle Kolyada
2020-04-29 21:37 Mikle Kolyada
2020-03-04 17:32 David Seifert
2019-11-28 18:21 Mikle Kolyada
2019-11-27  9:27 Mikle Kolyada
2019-11-24 14:37 Mikle Kolyada
2019-11-15 18:09 Mikle Kolyada
2019-04-02 13:11 Mikle Kolyada
2015-05-17  5:22 Mike Frysinger
2015-02-15  4:48 Mike Frysinger
2015-02-15  4:48 Mike Frysinger
2015-02-15  4:48 Mike Frysinger
2015-02-15  4:48 Mike Frysinger
2014-03-13 14:40 Samuli Suominen
2014-03-13 14:17 Samuli Suominen
2014-03-13 14:12 Samuli Suominen
2012-04-17  7:10 Paweł Hajdan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596607429.732fb3bbfd7d007fdca78dd4587f1a7bd34bfa6c.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox