Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117879 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89559 invoked from network); 8 Jun 2022 16:58:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Jun 2022 16:58:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7E1F81804D4 for ; Wed, 8 Jun 2022 11:44:32 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS16276 46.105.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from 19.mo583.mail-out.ovh.net (19.mo583.mail-out.ovh.net [46.105.35.78]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 8 Jun 2022 11:44:31 -0700 (PDT) Received: from player779.ha.ovh.net (unknown [10.109.146.50]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 1B21423DCB for ; Wed, 8 Jun 2022 18:44:30 +0000 (UTC) Received: from php.earth (mail-lj1-f181.google.com [209.85.208.181]) (Authenticated sender: peter.kokot@php.earth) by player779.ha.ovh.net (Postfix) with ESMTPSA id CD99B2B469D57 for ; Wed, 8 Jun 2022 18:44:29 +0000 (UTC) Authentication-Results:garm.ovh; auth=pass (GARM-110S0048665766c-636b-44b5-81db-4001c03293db, 6C5EB688C8DDD24BD2BE9F194981271C284C8815) smtp.auth=peter.kokot@php.earth X-OVh-ClientIp:209.85.208.181 Received: by mail-lj1-f181.google.com with SMTP id b7so11172108ljr.6 for ; Wed, 08 Jun 2022 11:44:29 -0700 (PDT) X-Gm-Message-State: AOAM530FHJ5zGKpPR+N0a6amhxG046DGWYnWw2ia4XJUP28iZv9mtlnV yHoJiQNJb3zmDdJlo0rtw0DaYjWQlFDU6Gp8JbY= X-Google-Smtp-Source: ABdhPJyDbnC/+S8NOewuXZ9RTsIzqAlnC0Ob5XeWf+n7kJvdGSEyN3LS+uy7oudwBfM00Dyz2Jw82W56JCDN0r76bGc= X-Received: by 2002:a2e:9ed6:0:b0:255:5fcb:6490 with SMTP id h22-20020a2e9ed6000000b002555fcb6490mr23562341ljk.447.1654713869206; Wed, 08 Jun 2022 11:44:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 8 Jun 2022 20:44:17 +0200 X-Gmail-Original-Message-ID: Message-ID: To: shinji igarashi Cc: Sara Golemon , Robert Landers , internals Content-Type: multipart/alternative; boundary="000000000000610c7705e0f418df" X-Ovh-Tracer-Id: 17153648034531369478 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddtjedguddvhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeggfhgjhfffkffuvfevtgesrgdtreertddtjeenucfhrhhomheprfgvthgvrhcumfhokhhothcuoehpvghtkhesphhhphdrnhgvtheqnecuggftrfgrthhtvghrnhepvdevveeuveejjeekgeffgfdtieetfeevuddtvedthfffvdeiheffudfhudettdefnecuffhomhgrihhnpehphhhprdhnvghtpdhtfihighhfihguughlvgdrtghomhdpshihmhhfohhnhidrtghomhenucfkpheptddrtddrtddrtddpvddtledrkeehrddvtdekrddukedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejjeelrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepphgvthhksehphhhprdhnvghtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvthdpoffvtefjohhsthepmhhoheekfe Subject: Re: [PHP-DEV] Re: Adding new closing tag =?> for keeping trailing newline From: petk@php.net (Peter Kokot) --000000000000610c7705e0f418df Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 8 Jun 2022 at 20:16, shinji igarashi wrote: > > declare(ignore_newline_after_close_tag=3Dfalse); > > Thanks for coming up with another idea! > > As others have already pointed out, disabling the closing tag from > eating trailing newline throughout the file would be inconvenient if > we want to use control statements in the template. > > However, we currently only have one closing tag, but we already > have two opening tags. So, for example, if we use declare to disable > the newline eating only when closing a PHP block started with ` it can produce the desired output. > > > > - > > > I'm honestly not sure if adding a declare switch is better received > than a new closing tag, though. > > Thanks! > > -- > Shinji Igarashi > > 2022=E5=B9=B46=E6=9C=888=E6=97=A5(=E6=B0=B4) 12:34 Sara Golemon : > > > > On Tue, Jun 7, 2022 at 10:27 AM Robert Landers > wrote: > > > FWIW, I think it makes a lot of sense, having used golang's template > > > language (not everyone is generating HTML with PHP). I think you may > > > just be dealing with a vocal minority and it would be worth putting t= o > > > an actual vote. Even if it fails, we'll learn something the next time > > > someone wants to change something like this. > > > > > > > While my gut response for the new end tag is in the "no" column, I do > wonder if we can accommodate "non-html" scenarios in a broader (maybe mor= e > palatable?) way by assuming that if you want the newline to be respected = on > one line, you probably want it that way for the whole file. > > > > > declare(ignore_newline_after_close_tag=3Dfalse); // defaults to true, i= .e > existing behavior > > > > This would avoid any new syntax rules, but still provide the ability fo= r > php-as-template-engine to behave in the user's preferred mode. > > > > -Sara > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php I'm just adding a few cents into this discussion for some inspiration. If I'm not mistaken, the Twig template engine, for example, has such a difference integrated in the output tag and the statement tag. The statement tag ({% %}) behaves as PHP tag, it removes the newline character. The outputting tag ({{ }}) adds a newline at the end. See this: https://twigfiddle.com/pto9qx More info about this here: https://twig.symfony.com/doc/3.x/templates.html#whitespace-control So, it is actually important to have such functionality in templates. --000000000000610c7705e0f418df--