Reapply "Soy: bump version and use new "??" operator" This reverts commit 1946930bc2f5837371c121ff458cbc5263d9291c. Change-Id: I92b5e330f1dbfa9fd07f90eab9c6f82bdd38260b
diff --git a/WORKSPACE b/WORKSPACE index 0c55d21..b1bedac 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -140,8 +140,8 @@ maven_jar( name = "soy", - artifact = "com.google.template:soy:2022-07-20", - sha1 = "f64eb90da6d91beddf11653865c90f26d26710cf", + artifact = "com.google.template:soy:2023-09-13", + sha1 = "b88a029df7408c58452f80d6518723f1386d69b5", ) FLOGGER_VERS = "0.7.4"
diff --git a/resources/com/google/gitiles/templates/Common.soy b/resources/com/google/gitiles/templates/Common.soy index c38f727..c5fb238 100644 --- a/resources/com/google/gitiles/templates/Common.soy +++ b/resources/com/google/gitiles/templates/Common.soy
@@ -49,13 +49,13 @@ <link rel="stylesheet" type="text/css" href="{$url}"> {/for} {/if} - {delcall gitiles.customHeadTagPart variant="$customVariant ?: ''" /} + {call customHeadTagPart variant="'' + ($customVariant ?? '')" /} </head> <body class="Site"> <header class="Site-header"> <div class="Header"> - {delcall gitiles.customHeader variant="$customVariant ?: ''" /} + {call customHeader variant="'' + ($customVariant ?? '')" /} {if $menuEntries and length($menuEntries)} <div class="Header-menu"> @@ -95,14 +95,14 @@ * This can be used to include per-project CSS/JS by * providing custom variants. */ -{deltemplate gitiles.customHeadTagPart} +{template customHeadTagPart modifiable="true" legacydeltemplatenamespace="gitiles.customHeadTagPart" usevarianttype="string"} <!-- default customHeadTagPart --> -{/deltemplate} +{/template} /** * Default custom header implementation for Gitiles. */ -{deltemplate gitiles.customHeader} +{template customHeader modifiable="true" legacydeltemplatenamespace="gitiles.customHeader" usevarianttype="string"} {@inject SITE_TITLE: string} <!-- default customHeader --> <div class="Header-title"> @@ -110,44 +110,44 @@ {$SITE_TITLE} {/msg} </div> -{/deltemplate} +{/template} /** * Footer 'powered by' element * * Please call this in custom variants as well. */ -{deltemplate gitiles.footerPoweredBy} +{template footerPoweredBy modifiable="true" legacydeltemplatenamespace="gitiles.footerPoweredBy"} <span class="Footer-poweredBy"> Powered by <a href="https://gerrit.googlesource.com/gitiles/">Gitiles</a> </span> -{/deltemplate} +{/template} /** * Footer format badge * * You can use this in custom footers as well. */ -{deltemplate gitiles.footerFormatBadge} +{template footerFormatBadge modifiable="true" legacydeltemplatenamespace="gitiles.footerFormatBadge"} <span class="Footer-formats"> <a class="u-monospace Footer-formatsItem" href="?format=TEXT">{msg desc="text format"}txt{/msg}</a> {sp} <a class="u-monospace Footer-formatsItem" href="?format=JSON">{msg desc="JSON format"}json{/msg}</a> </span> -{/deltemplate} +{/template} /** * Default Footer */ -{deltemplate gitiles.customFooter} +{template customFooter modifiable="true" legacydeltemplatenamespace="gitiles.customFooter" usevarianttype="string"} <!-- default customFooter --> <footer class="Site-footer"> <div class="Footer"> - {delcall gitiles.footerPoweredBy /} - {delcall gitiles.footerFormatBadge /} + {call footerPoweredBy /} + {call footerFormatBadge /} </div> </footer> -{/deltemplate} +{/template} /** * Main footer. @@ -159,7 +159,7 @@ {@param? customVariant: ?} /** variant name for custom styling. */ </div> <!-- Container --> </div> <!-- Site-content --> - {delcall gitiles.customFooter variant="$customVariant ?: ''" /} + {call customFooter variant="'' + ($customVariant ?? '')" /} </body> </html> {/template}
diff --git a/resources/com/google/gitiles/templates/Doc.soy b/resources/com/google/gitiles/templates/Doc.soy index db46994..ac32006 100644 --- a/resources/com/google/gitiles/templates/Doc.soy +++ b/resources/com/google/gitiles/templates/Doc.soy
@@ -18,14 +18,14 @@ /** * Default Doc Footer */ -{deltemplate gitiles.customDocFooter} +{template customDocFooter modifiable="true" legacydeltemplatenamespace="gitiles.customDocFooter" usevarianttype="string"} {@param? sourceUrl: ?} /** url for source view of the page. */ {@param? logUrl: ?} /** url for log history of page. */ {@param? blameUrl: ?} /** url for blame of page source. */ <!-- default customDocFooter --> <footer class="Site-footer"> <div class="Footer"> - {delcall gitiles.footerPoweredBy /} + {call common.footerPoweredBy /} <div class="Footer-links"> {if $sourceUrl}<a class="Footer-link" href="{$sourceUrl}">{msg desc="text for the source link"}source{/msg}</a>{/if} {if $logUrl}<a class="Footer-link" href="{$logUrl}">{msg desc="text for the log link"}log{/msg}</a>{/if} @@ -33,7 +33,7 @@ </div> </div> </footer> -{/deltemplate} +{/template} /** * Documentation page rendered from markdown. @@ -59,7 +59,7 @@ <link rel="stylesheet" type="text/css" href="{$staticUrls.BASE_CSS_URL}" /> <link rel="stylesheet" type="text/css" href="{$staticUrls.DOC_CSS_URL}" /> <link rel="stylesheet" type="text/css" href="{$staticUrls.PRETTIFY_CSS_URL}" /> - {delcall gitiles.customHeadTagPart variant="$customVariant ?: ''" /} + {call common.customHeadTagPart variant="'' + ($customVariant ?? '')" /} </head> <body class="Site"> <header class="Site-header {if $navbarHtml}Site-header--withNavbar{/if}"> @@ -84,7 +84,7 @@ </div> </div> </div> - {delcall gitiles.customDocFooter variant="$customVariant ?: ''" /} + {call customDocFooter variant="'' + ($customVariant ?? '')" /} {if $analyticsId} /* From https://developers.google.com/analytics/devguides/collection/analyticsjs/ */ <script>
diff --git a/resources/com/google/gitiles/templates/LogDetail.soy b/resources/com/google/gitiles/templates/LogDetail.soy index 23ae8eb..13dc7c0 100644 --- a/resources/com/google/gitiles/templates/LogDetail.soy +++ b/resources/com/google/gitiles/templates/LogDetail.soy
@@ -62,10 +62,10 @@ * Wrapper for a single log entry with pretty format and variant. */ {template logEntryWrapper} - {@param variant: ?} /** variant name for log entry template. */ + {@param variant: string} /** variant name for log entry template. */ {@param entry: ?} /** log entry; see .logEntry. */ <li class="CommitLog-item CommitLog-item--{$variant}"> - {delcall gitiles.logEntry variant="$variant ?: 'default'" data="$entry" /} + {call logEntry variant="$variant" data="$entry" /} </li> {/template} @@ -84,7 +84,6 @@ {/if} {/template} - /** * Single log entry indicating the full log is empty. */ @@ -92,11 +91,10 @@ <li class="CommitLog-item CommitLog-item--empty">{msg desc="informational text for when the log is empty"}No commits.{/msg}</li> {/template} - /** * Single pretty log entry, similar to --pretty=oneline. */ -{deltemplate gitiles.logEntry variant="'oneline'"} +{template oneLineLogEntry visibility="private" modifies="logEntry" variant="'oneline'"} {@param abbrevSha: ?} /** abbreviated SHA-1. */ {@param sha: ?} /** commit SHA-1. */ {@param url: ?} /** URL to commit detail page. */ @@ -147,13 +145,13 @@ </span> {/if} -{/deltemplate} +{/template} /** * Default single log entry (oneline format). */ -{deltemplate gitiles.logEntry variant="'default'"} +{template logEntry modifiable="true" legacydeltemplatenamespace="gitiles.LogEntry" usevarianttype="string"} {@param abbrevSha: ?} /** abbreviated SHA-1. */ {@param sha: ?} /** commit SHA-1. */ {@param url: ?} /** URL to commit detail page. */ @@ -173,14 +171,14 @@ newPath: the new path after the rename or copy. score: the similarity score of the rename or copy. */ -{delcall gitiles.logEntry variant="'oneline'" data="all" /} -{/deltemplate} + {call logEntry variant="'oneline'" data="all" /} +{/template} /** * Single pretty log entry, similar to --pretty=full. */ -{deltemplate gitiles.logEntry variant="'full'"} +{template fullLogEntry visibility="private" modifies="logEntry" variant="'full'"} {@param abbrevSha: ?} /** abbreviated SHA-1. */ {@param sha: ?} /** commit SHA-1. */ {@param url: ?} /** URL to commit detail page. */ @@ -236,7 +234,6 @@ </td> <td>{$committer.time}</td> </tr> - {if $rename} <tr> <td colspan="3"> @@ -262,4 +259,4 @@ <pre class="u-pre u-monospace MetadataMessage"> {$message} </pre> -{/deltemplate} +{/template}