Skip to content

Commit

Permalink
Merge pull request #42 from GunioRobot/clean
Browse files Browse the repository at this point in the history
[WhitespaceBot] for cleaning space garbage flooding outside our command centre. Thanks
  • Loading branch information
speedmax committed Nov 1, 2011
2 parents f4771d7 + d926e6a commit e2479b6
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 28 deletions.
20 changes: 20 additions & 0 deletions .gitignore
@@ -0,0 +1,20 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Logs and databases #
######################
*.log

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
12 changes: 6 additions & 6 deletions example/i18n/trans.html
Expand Up @@ -10,16 +10,16 @@
<h1>{{ _("Internationalized templates") }}</h1>

{% trans "Select languages" %}

<a href="?lang=en">{% trans "English" %}</a> |
<a href="?lang=fi">{% trans "Finish"%} </a> |
<a href="?lang=fr">{% trans "French: %}</a> |
<a href="?lang=de">{% trans "German: %}</a>

<p>
{% blocktrans %}
(software engineering) The act or process of making a product suitable for
international markets, typically by making text messages easily translatable
(software engineering) The act or process of making a product suitable for
international markets, typically by making text messages easily translatable
and ensuring support of non-Latin character sets.
{% endblocktrans %}
</p>
Expand All @@ -36,7 +36,7 @@ <h2>{% trans "Pluralization support" %}</h2>
there are number of {{ count }} items.
{% endblocktrans %}
</p>

<ul>
{% for index, user in users %}
{{ user.username }} - {{ user.tasks.length }}
Expand All @@ -47,7 +47,7 @@ <h2>{% trans "Pluralization support" %}</h2>
{% plural %}
{{ name }} has {{ count }} tasks
{% endblocktrans %}

<ol>
{% for task in user.tasks %}
<li>{{ task }}</li>
Expand All @@ -59,7 +59,7 @@ <h2>{% trans "Pluralization support" %}</h2>
</div>

<div id="footer">

</div>
</body>
</html>
6 changes: 3 additions & 3 deletions example/inheritance/layout.html
Expand Up @@ -24,7 +24,7 @@
<h1>My Webpage</h1>
<h2>My Subtitle</h2>
</div>

<div id="navigation">
<ul>
{% block navigation %}
Expand All @@ -34,13 +34,13 @@ <h2>My Subtitle</h2>
{% endblock %}
</ul>
</div>

<div id="content">
{% block content %}{% endblock %}
</div>
<div id="footer">
{% include 'shared/about.html' %}

&copy; Copyright 2007 by Yourself
</div>
{% endblock %}
Expand Down
4 changes: 2 additions & 2 deletions example/inheritance/page.html
Expand Up @@ -8,11 +8,11 @@ <h2>Userlist</h2>
<ul>
{% for user in users %}
<li><a href="/users/{{ user.username|urlencode|escape }}">{{ user.username|escape }}</a></li>

{% if not user.username == 'foobar' %}
haha
{% endif %}

{% endfor %}
</ul>
{% endblock %}
6 changes: 3 additions & 3 deletions example/simple/index.html
Expand Up @@ -6,14 +6,14 @@ <h2>Userlist</h2>
{% for user in users limit:3 %}
<li>
<a href="/users/{{ user.username|urlencode }}">{{ user.username }}</a> -

{{ user.tasks.first | safe }}
</li>

{% if not user.username == 'foobar' %}
haha
{% endif %}

{% endfor %}
</ul>

Expand Down
2 changes: 1 addition & 1 deletion example/simple/layout.html
Expand Up @@ -34,7 +34,7 @@ <h2>My Subtitle</h2>
{% endblock %}
</ul>
</div>

<div id="content">
{% block content %}{% endblock %}
</div>
Expand Down
16 changes: 8 additions & 8 deletions ext/cache.php
Expand Up @@ -3,37 +3,37 @@
class Cache_Tag extends H2o_Node {
private $cache, $ttl, $uid;
var $syntax = '/\d+/';

function __construct($argstring, $parser, $pos = 0) {
if (!empty($argstring) && !preg_match($this->syntax, $argstring)) {
throw TemplateSyntaxError('Please specify time to live value for this cache block');
}

$this->body = $parser->parse('endcache');
$this->uid = md5($parser->filename.$pos);
$this->ttl = (int) $argstring;

$options = $parser->options;

if ($this->ttl) {
$options['cache_ttl'] = $this->ttl;
}

if (!$options['cache']) {
$options['cache'] = 'file';
}
$this->cache = h2o_cache($options);
}

function render($context, $stream) {
if ($output = $this->cache->read($this->uid)) {
$stream->write($output);
return;
}

$output = new StreamWriter;
$this->body->render($context, $output);

$output = $output->close();
$this->cache->write($this->uid, $output);

Expand Down
8 changes: 4 additions & 4 deletions ext/design.php
Expand Up @@ -15,7 +15,7 @@ function __construct($argstring, $parser, $position = 0) {
$this->mode = $mode? $mode : 'p';
$this->common = !$random;
}

function render($context, $stream) {
$output = '';
switch($this->mode) {
Expand Down Expand Up @@ -45,8 +45,8 @@ function lorem_sentences($count) {
foreach(range(1, $count) as $s) {
$parts = array();
foreach (range(1, rand(1,5)) as $j)
$parts[] = lorem_words(rand(3,12));
$sentenses[] = join(', ', $parts);
$parts[] = lorem_words(rand(3,12));
$sentenses[] = join(', ', $parts);
}
return join($delimiter[rand(0,1)].' ', $sentenses).$delimiter[rand(0,1)];
}
Expand All @@ -56,7 +56,7 @@ function lorem_paragraphs($count, $common = false) {
foreach(range(1, $count) as $s) {
if ($s == 1 && $common)
$paras[] = lorem_dictionary('common_p');
else
else
$paras[] = lorem_sentences(rand(1,4));
}
return $paras;
Expand Down
2 changes: 1 addition & 1 deletion spec/templates/inherit.html
Expand Up @@ -3,5 +3,5 @@
{% block body %}
{{ block.super }}
asdf
overwrite
overwrite
{% endblock %}

0 comments on commit e2479b6

Please sign in to comment.