From a22ba5659637c920e424dcc2ecc13995a1f1e966 Mon Sep 17 00:00:00 2001 From: Mikulas Date: Thu, 3 Apr 2014 10:02:06 +0200 Subject: [PATCH] Added support for Latte --- lib/linguist/languages.yml | 7 + samples/Latte/layout.latte | 59 +++++++++ samples/Latte/template.latte | 243 +++++++++++++++++++++++++++++++++++ 3 files changed, 309 insertions(+) create mode 100644 samples/Latte/layout.latte create mode 100644 samples/Latte/template.latte diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 6eb2a378..0102e2e2 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -945,6 +945,13 @@ Lasso: color: "#2584c3" primary_extension: .lasso +Latte: + type: markup + color: "#A8FF97" + group: HTML + lexer: Smarty + primary_extension: .latte + Less: type: markup group: CSS diff --git a/samples/Latte/layout.latte b/samples/Latte/layout.latte new file mode 100644 index 00000000..5e94975f --- /dev/null +++ b/samples/Latte/layout.latte @@ -0,0 +1,59 @@ +{** + * @param string $basePath web base path + * @param string $robots tell robots how to index the content of a page (optional) + * @param array $flashes flash messages + *} + + + + + + + + + + + {ifset $title}{$title} › {/ifset}Translation report + + + + + + + {block #head}{/block} + + + + + + {block #navbar} + {include _navbar.latte} + {/block} + +
+
+
+ {include _flash.latte, flash => $flash} +
+
+ + {include #content} +
+ + + + + {block #scripts}{/block} + + diff --git a/samples/Latte/template.latte b/samples/Latte/template.latte new file mode 100644 index 00000000..1718045a --- /dev/null +++ b/samples/Latte/template.latte @@ -0,0 +1,243 @@ +{var $title => "⚐ {$new->title}"} +{define author} + + + {$author->name|trim} + + + {$author->estimatedTimeTranslated|secondsToTime}{* + *}{if $author->joined}, {/if} + {if $author->joined}joined {$author->joined|timeAgo}{/if}{* + *}{ifset $postfix}, {$postfix}{/ifset} +{/define} +{block #scripts} + +{/block} +{block #content} + +{if isset($old)} +

Diffing revision #{$old->revision} and #{$new->revision}

+{else} +

First revision

+{/if} + +{var $editor = $user->loggedIn && $new->language === 'cs'} +{var $rev = $new->video->siteRevision} +
+
+

+ published {$new->publishedAt|timeAgo}{* + *}{ifset $old}, + + {$new->textChange * 100|number} % text change{* + *}{* + *}{if $new->timeChange}, + + {$new->timeChange * 100|number} % timing change + + {/if} + {/ifset} +

+ {cache $new->id, expires => '+4 hours'} +

+ {if isset($old) && $old->author->name !== $new->author->name} + {include author, author => $old->author, class => 'author-old'} + — + {include author, author => $new->author, class => 'author-new'} + {elseif isset($old)} + {include author, author => $new->author, class => 'author-new', postfix => 'authored both revisions'} + {else} + {include author, author => $new->author, class => 'author-new'} + {/if} +

+ {/cache} + + {var $threshold = 10} + {cache $new->id} + {var $done = $new->timeTranslated} + {var $outOf = $new->video->canonicalTimeTranslated} + {if $outOf} +

+ Only {$done|time} translated out of {$outOf|time}, + {(1-$done/$outOf) * 100|number} % ({$outOf - $done|time}) left +

+

+ Seems complete: {$done|time} translated out of {$outOf|time} +

+ {elseif $done} +

+ Although {$done|time} is translated, there are no English subtitles for comparison. +

+ {/if} + {/cache} + + {if $editor} + {var $ksid = $new->video->siteId} + {if $ksid} + + Video on khanovaskola.cz + {if $new->revision === $rev} + (on this revision) + {elseif $new->revision > $rev} + (on older revision #{$rev}) + {else} + (on newer revision #{$rev}) + {/if} + + {/if} + {/if} + +

{$diffs->title|noescape}

+
{$diffs->description|noescape}
+
+
+ {$line->text|noescape}  +
+
+ + + +
+
+ + {if $editor} + {if $new->approved} + + Revision has been approved{if $new->editor} by {$new->editor->name}{/if}. + + + + Edit on Amara + + + on Khan Academy + + + {elseif $new->incomplete} + + Revision has been marked as incomplete by {if $new->editor}{$new->editor->name}{/if}. + + {include editButton} + {include kaButton} + + {* else $new->status === UNSET: *} + {elseif $new->video->siteId} + + {include kaButton} + + {else} + + {include kaButton} +
+
Filed under category:
+ {foreach $new->video->categories as $list} + — {$list|implode:' › '}{sep}
{/sep} + {/foreach} +
+ {/if} + {/if} +
+
+

All revisions:

+ + {foreach $new->video->getRevisionsIn($new->language) as $revision} + + + + + + + {if $user->loggedIn && $revision->comments->count()} + + + + {/if} + {if $user->loggedIn && $new->id === $revision->id} + + + + {/if} + + {/foreach} +
+ #{$revision->revision} + + + + {$revision->author->name} + + + + {$revision->publishedAt|timeAgo} + + + {* vars $outOf, $threshold already set *} + {default $outOf = $new->video->canonicalTimeTranslated} + {if $outOf} {* ignore if canonical time not set *} + {var $done = $revision->timeTranslated} + + {$done/$outOf * 100|number} % + + + ~100 % + + {/if} + + {if $revision->incomplete || $revision->approved} + {var $i = $revision->incomplete} + + {if $i}incomplete{else}approved{/if} + + {/if} +
+ + + + + +
+ + {$comment->user->name}: + + + + {$comment->text} + +
+
+ {form commentForm} +
+ {input text, class => "form-control", placeholder => "Comment this revision (only visible to other editors)"} + + + +
+ {/form} +
+ +
+