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 C1A6F200D2D for ; Fri, 27 Oct 2017 13:51:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C029D160BDC; Fri, 27 Oct 2017 11:51:05 +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 0E2541609E9 for ; Fri, 27 Oct 2017 13:51:04 +0200 (CEST) Received: (qmail 15218 invoked by uid 500); 27 Oct 2017 11:51:04 -0000 Mailing-List: contact notifications-help@freemarker.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@freemarker.incubator.apache.org Delivered-To: mailing list notifications@freemarker.incubator.apache.org Received: (qmail 15207 invoked by uid 99); 27 Oct 2017 11:51:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Oct 2017 11:51:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 34BFC1A06AB for ; Fri, 27 Oct 2017 11:51:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id LVKPCpjPIdAm for ; Fri, 27 Oct 2017 11:51:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 2483760E5E for ; Fri, 27 Oct 2017 11:51:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 55F07E041C for ; Fri, 27 Oct 2017 11:51:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 114CF212F7 for ; Fri, 27 Oct 2017 11:51:00 +0000 (UTC) Date: Fri, 27 Oct 2017 11:51:00 +0000 (UTC) From: "Daniel Dekany (JIRA)" To: notifications@freemarker.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (FREEMARKER-82) A new whitespace tag to indicate the baseline indentation for <@macro> and includes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 27 Oct 2017 11:51:05 -0000 [ https://issues.apache.org/jira/browse/FREEMARKER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222211#comment-16222211 ] Daniel Dekany edited comment on FREEMARKER-82 at 10/27/17 11:50 AM: -------------------------------------------------------------------- More intelligent indentation would be a great feature for sure, but that involves deciding the indentation on run time. Back then I was thinking about it, and found that you ran into limitations if things just print into a `Writer` internally. Instead, you need a stream of fragments with richer semantics, so that you can tell if a fragment is indentation that might can be removed, and so on. As not using a `Writer` in API-s like `TemplateDirectiveModel` is not backward compatible, this issue was postponed to FreeMarker 3 (which however haven't yet reached the state where this will be attempted). But maybe there's a less perfect solution that works with `Writer`-s... I don't know, will have to think about it. (Also, I tried it without any directives, just generating the output that a human would expect.) was (Author: ddekany): More intelligent indentation would be a great feature for sure, but that involves deciding the indentation on run time. Back then when I was thinking about it, and found that you ran into limitations if things just print into a `Writer` internally. Instead, you need a stream of fragments with richer semantics, so that you can tell if a fragment is indentation that might can be removed, and so on. As not using a `Writer` in API-s like `TemplateDirectiveModel` is not backward compatible, this issue was postponed to FreeMarker 3 (which however haven't yet reached the state where this will be attempted). But maybe there's a less perfect solution that works with `Writer`-s... I don't know, will have to think about it. (Also, I tried it without any directives, just generating the output that a human would expect.) > A new whitespace tag to indicate the baseline indentation for <@macro> and includes. > ------------------------------------------------------------------------------------ > > Key: FREEMARKER-82 > URL: https://issues.apache.org/jira/browse/FREEMARKER-82 > Project: Apache Freemarker > Issue Type: Wish > Components: engine > Reporter: Brent > > Sometimes, perhaps most of the times, it is useful to split up small pieces of my template into macros or otherwise other templates to include. > However, since V2.3, lines containing only FTL tags get trimmed. This is annoying because I may want to include a macro or another template, with the current indentation of where I call it. > This brings me to my next point, as shown in [my answer on StackOverflow|https://stackoverflow.com/a/46973468/2686165], it is possible to keep this indentation with <#nt>, but this only works for the first line of the macro (see SO answer at the bottom). > So I propose an easy way to say "use the current indentation of the line, as a base of all the indentation for my macro or included template. > Any indentation inside the included template, or the macro would be relative. If one wished to break the relative indentation for a line inside their included template or macro, another tag should be foreseen to indicate that. > New tags: > * To indicate an indentation base for templates/macros > * To indicate that a line inside the included template/macro must not use the indentation base (so you can put lines that don't follow the indentation, perhaps <#t> already provides this functionality) -- This message was sent by Atlassian JIRA (v6.4.14#64029)