Thread (34 messages) flat view 34 messages, 3 authors, 2016-12-28

Re: [PATCH v9 01/20] ref-filter: implement %(if), %(then), and %(else) atoms

From: Karthik Nayak <hidden>
Date: 2016-12-28 06:48:27

On Wed, Dec 28, 2016 at 2:28 AM, Junio C Hamano [off-list ref] wrote:
Karthik Nayak [off-list ref] writes:
quoted
+Some atoms like %(align) and %(if) always require a matching %(end).
+We call them "opening atoms" and sometimes denote them as %($open).
+
+When a scripting language specific quoting is in effect, everything
+between a top-level opening atom and its matching %(end) is evaluated
+according to the semantics of the opening atom and its result is
+quoted.
What is unsaid in the last paragraph is that you assume "is
evaluated according to the semantics of the opening atom" does not
involve quoting and only the result from the top-level is quoted.  I
am not sure if that is clear to the first-time readers.
How about being a little more explicit about that?

When a scripting language specific quoting is in effect, everything
between a top-level opening atom and its matching %(end) is evaluated
according to the semantics of the opening atom and only its result
from the top-level is quoted.
quoted
 EXAMPLES
 --------
@@ -273,6 +291,22 @@ eval=`git for-each-ref --shell --format="$fmt" \
 eval "$eval"
 ------------
...
+------------
+git for-each-ref --format="%(refname)%(if)%(authorname)%(then) %(color:red)Authored by: %(authorname)%(end)"
+------------
This makes readers wonder how "red"ness is reset, but that is not
something this example is interested in demonstrating.  Let's drop
the %(color:red) bit to avoid distracting readers.
Sure, will do :)

-- 
Regards,
Karthik Nayak
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help