commit
00c97a7f60
|
@ -22,6 +22,8 @@
|
|||
|
||||
* Breaking change: Remove support for Mediawiki as a template engine. [#1791](https://github.com/sinatra/sinatra/pull/1791) by Eloy Pérez
|
||||
|
||||
* Breaking change: Remove support for Creole as a template engine. [#1792](https://github.com/sinatra/sinatra/pull/1792) by Eloy Pérez
|
||||
|
||||
* Breaking change: Remove support for the defunct Less templating library. See [#1716](https://github.com/sinatra/sinatra/issues/1716), [#1715](https://github.com/sinatra/sinatra/issues/1715) for more discussion and background. [d1af2f1e](https://github.com/sinatra/sinatra/commit/d1af2f1e6c8710419dfe3102a660f7a32f0e67e3) by Olle Jonsson
|
||||
|
||||
* Breaking change: Remove Reel integration. [54597502](https://github.com/sinatra/sinatra/commit/545975025927a27a1daca790598620038979f1c5) by Olle Jonsson
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -31,7 +31,6 @@ gem 'eventmachine'
|
|||
gem 'slim', '~> 4'
|
||||
gem 'rdoc'
|
||||
gem 'kramdown'
|
||||
gem 'creole'
|
||||
gem 'markaby'
|
||||
gem 'radius'
|
||||
gem 'asciidoctor'
|
||||
|
|
39
README.de.md
39
README.de.md
|
@ -61,7 +61,6 @@ diesen Server verwenden.
|
|||
- [Markaby Templates](#markaby-templates)
|
||||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [Yajl Templates](#yajl-templates)
|
||||
- [Auf Variablen in Templates zugreifen](#auf-variablen-in-templates-zugreifen)
|
||||
- [Templates mit `yield` und verschachtelte Layouts](#templates-mit-yield-und-verschachtelte-layouts)
|
||||
|
@ -850,44 +849,6 @@ Nimmt ebenso einen Block für Inline-Templates entgegen (siehe Beispiel).
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Abhängigkeit</td>
|
||||
<td><a href="https://github.com/minad/creole">creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dateierweiterung</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Beispiel</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Da man aus dem Creole-Template heraus keine Ruby-Methoden aufrufen und auch
|
||||
keine locals verwenden kann, wird man Creole üblicherweise in Kombination mit
|
||||
anderen Renderern verwenden wollen:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:einfuehrung) }
|
||||
```
|
||||
|
||||
Beachte, dass man die `creole`-Methode auch aus anderen Templates heraus
|
||||
aufrufen kann:
|
||||
|
||||
```ruby
|
||||
%h1 Gruß von Haml!
|
||||
%p= creole(:Grüße)
|
||||
```
|
||||
|
||||
Da man Ruby nicht von Creole heraus aufrufen kann, können auch Layouts
|
||||
nicht in Creole geschrieben werden. Es ist aber möglich, einen Renderer
|
||||
für die Templates zu verwenden und einen anderen für das Layout, indem
|
||||
die `:layout_engine`-Option verwendet wird.
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
37
README.es.md
37
README.es.md
|
@ -60,7 +60,6 @@ Se recomienda ejecutar `gem install puma`, porque Sinatra lo utilizará si está
|
|||
- [Plantillas Markaby](#plantillas-markaby)
|
||||
- [Plantillas RABL](#plantillas-rabl)
|
||||
- [Plantillas Slim](#plantillas-slim)
|
||||
- [Plantillas Creole](#plantillas-creole)
|
||||
- [Plantillas Yajl](#plantillas-yajl)
|
||||
- [Accediendo a Variables en Plantillas](#accediendo-a-variables-en-plantillas)
|
||||
- [Plantillas con `yield` y `layout` anidado](#plantillas-con-yield-y-layout-anidado)
|
||||
|
@ -858,42 +857,6 @@ También toma un bloque para plantillas inline (ver [ejemplo](#plantillas-inline
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Plantillas Creole
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependencias</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensiones de Archivo</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ejemplo</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
No es posible llamar métodos desde creole, ni pasarle locales. Por lo tanto,
|
||||
generalmente va a usarlo en combinación con otro motor de renderizado:
|
||||
|
||||
```ruby
|
||||
erb :resumen, :locals => { :texto => cerole(:introduccion) }
|
||||
```
|
||||
|
||||
Debe tomar en cuenta que también puede llamar al método `creole` desde otras
|
||||
plantillas:
|
||||
|
||||
```ruby
|
||||
%h1 Hola Desde Haml!
|
||||
%p= creole(:saludos)
|
||||
```
|
||||
|
||||
Como no puedes utilizar Ruby desde Creole, no puedes usar layouts escritos en
|
||||
Creole. De todos modos, es posible usar un motor de renderizado para el layout
|
||||
distinto al de la plantilla pasando la opción `:layout_engine`.
|
||||
|
||||
#### Plantillas Yajl
|
||||
|
||||
<table>
|
||||
|
|
38
README.fr.md
38
README.fr.md
|
@ -61,7 +61,6 @@ Sinatra utilise le server Thin quand il est disponible.
|
|||
- [Templates Markaby](#templates-markaby)
|
||||
- [Templates RABL](#templates-rabl)
|
||||
- [Templates Slim](#templates-slim)
|
||||
- [Templates Creole](#templates-creole)
|
||||
- [Templates Yajl](#templates-yajl)
|
||||
- [Accéder aux variables dans un Template](#accéder-aux-variables-dans-un-template)
|
||||
- [Templates avec `yield` et layouts imbriqués](#templates-avec-yield-et-layouts-imbriqués)
|
||||
|
@ -859,43 +858,6 @@ exemple).
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Templates Creole
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dépendances</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensions de fichier</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemple</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Il n'est pas possible d'appeler de méthodes Ruby depuis creole, ni de lui
|
||||
passer de variables locales. Par conséquent, il sera souvent utilisé en
|
||||
combinaison avec un autre moteur de rendu :
|
||||
|
||||
```ruby
|
||||
erb :accueil, :locals => { :text => markdown(:introduction) }
|
||||
```
|
||||
|
||||
Notez que vous pouvez également appeler la méthode `creole` depuis un autre template :
|
||||
|
||||
```ruby
|
||||
%h1 Bonjour depuis Haml !
|
||||
%p= creole(:bienvenue)
|
||||
```
|
||||
|
||||
Comme vous ne pouvez pas appeler de méthodes Ruby depuis Creole, vous ne pouvez
|
||||
pas utiliser de layouts écrits en Creole. Toutefois, il est possible
|
||||
d'utiliser un moteur de rendu différent pour le template et pour le layout
|
||||
en utilisant l'option `:layout_engine`.
|
||||
|
||||
#### Templates Yajl
|
||||
|
||||
<table>
|
||||
|
|
34
README.ja.md
34
README.ja.md
|
@ -58,7 +58,6 @@ PumaがあればSinatraはこれを利用するので、`gem install puma`する
|
|||
- [Markaby テンプレート](#markaby-テンプレート)
|
||||
- [RABL テンプレート](#rabl-テンプレート)
|
||||
- [Slim テンプレート](#slim-テンプレート)
|
||||
- [Creole テンプレート](#creole-テンプレート)
|
||||
- [Yajl テンプレート](#yajl-テンプレート)
|
||||
- [テンプレート内での変数へのアクセス](#テンプレート内での変数へのアクセス)
|
||||
- [`yield`を伴うテンプレートとネストしたレイアウト](#yieldを伴うテンプレートとネストしたレイアウト)
|
||||
|
@ -785,39 +784,6 @@ RadiusテンプレートからRubyのメソッドを直接呼び出すことが
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole テンプレート
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依存</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ファイル拡張子</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Creoleからメソッドを呼び出すことも、localsに変数を渡すこともできません。
|
||||
それゆえ、他のレンダリングエンジンとの組み合わせで使うのが普通です。
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
ノート: 他のテンプレート内で`creole`メソッドを呼び出せます。
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= creole(:greetings)
|
||||
```
|
||||
|
||||
CreoleからはRubyを呼ぶことができないので、Creoleで書かれたレイアウトを使うことはできません。しかしながら、`:layout_engine`オプションを渡すことでテンプレートのものとは異なるレンダリングエンジンをレイアウトのために使うことができます。
|
||||
|
||||
#### Yajl テンプレート
|
||||
|
||||
<table>
|
||||
|
|
36
README.ko.md
36
README.ko.md
|
@ -56,7 +56,6 @@ thin이 설치되어 있을 경우 Sinatra는 thin을 통해 실행합니다.
|
|||
- [Markaby 템플릿](#markaby-템플릿)
|
||||
- [RABL 템플릿](#rabl-템플릿)
|
||||
- [Slim 템플릿](#slim-템플릿)
|
||||
- [Creole 템플릿](#creole-템플릿)
|
||||
- [Yajl 템플릿](#yajl-템플릿)
|
||||
- [템플릿에서 변수에 접근하기](#템플릿에서-변수에-접근하기)
|
||||
- [템플릿에서의 `yield` 와 중첩 레이아웃](#템플릿에서의-yield-와-중첩-레이아웃)
|
||||
|
@ -779,41 +778,6 @@ Radius 템플릿에서는 루비 메서드를 호출할 수 없기
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole 템플릿
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td><a href="https://github.com/minad/creole">creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일 확장자</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>예제</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Creole에서는 메서드 호출 뿐 아니라 locals 전달도 안됩니다.
|
||||
따라서 일반적으로는 다른 렌더링 엔진과 함께 사용하게 됩니다.
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
다른 템플릿 속에서 `creole` 메서드를 호출할 수도 있습니다.
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= creole(:greetings)
|
||||
```
|
||||
|
||||
Creole에서 루비를 호출할 수 없기 때문에, Creole으로 작성된 레이아웃은
|
||||
사용할 수 없습니다. 하지만, `:layout_engine` 옵션으로 레이아웃의 템플릿을
|
||||
다른 렌더링 엔진으로 렌더링 할 수는 있습니다.
|
||||
|
||||
#### Yajl 템플릿
|
||||
|
||||
<table>
|
||||
|
|
|
@ -60,7 +60,6 @@ View at: [http://localhost:4567](http://localhost:4567)
|
|||
- [Markaby Templates](#markaby-templates)
|
||||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [Yajl Templates](#yajl-templates)
|
||||
- [Accessing Variables in Templates](#accessing-variables-in-templates)
|
||||
- [Templates with `yield` and nested layouts](#templates-with-yield-and-nested-layouts)
|
||||
|
@ -824,41 +823,6 @@ It also takes a block for inline templates (see [example](#inline-templates)).
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from Creole, nor to pass locals to it. You
|
||||
therefore will usually use it in combination with another rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `creole` method from within other templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= creole(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from Creole, you cannot use layouts written in
|
||||
Creole. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
36
README.md
36
README.md
|
@ -62,7 +62,6 @@ pick up if available.
|
|||
- [Markaby Templates](#markaby-templates)
|
||||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [Yajl Templates](#yajl-templates)
|
||||
- [Accessing Variables in Templates](#accessing-variables-in-templates)
|
||||
- [Templates with `yield` and nested layouts](#templates-with-yield-and-nested-layouts)
|
||||
|
@ -851,41 +850,6 @@ It also takes a block for inline templates (see [example](#inline-templates)).
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from Creole, nor to pass locals to it. You
|
||||
therefore will usually use it in combination with another rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `creole` method from within other templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= creole(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from Creole, you cannot use layouts written in
|
||||
Creole. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
36
README.pl.md
36
README.pl.md
|
@ -58,7 +58,6 @@ którego Sinatra użyje jeżeli będzie dostępny.
|
|||
- [Markaby Templates](#markaby-templates)
|
||||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [Stylus Templates](#stylus-templates)
|
||||
- [Yajl Templates](#yajl-templates)
|
||||
- [Accessing Variables in Templates](#accessing-variables-in-templates)
|
||||
|
@ -849,41 +848,6 @@ It also takes a block for inline templates (see [example](#inline-templates)).
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from Creole, nor to pass locals to it. You
|
||||
therefore will usually use it in combination with another rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `creole` method from within other templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= creole(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from Creole, you cannot use layouts written in
|
||||
Creole. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### Stylus Templates
|
||||
|
||||
<table>
|
||||
|
|
|
@ -70,7 +70,6 @@ disponível, o Sinatra irá utilizá-la.
|
|||
- [Markaby Templates](#markaby-templates)
|
||||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [Yajl Templates](#yajl-templates)
|
||||
- [Acessando Variáveis nos Templates](#acessando-variáveis-nos-templates)
|
||||
- [Templates com `yield` e layouts aninhados](#templates-com-yield-e-layouts-aninhados)
|
||||
|
@ -898,42 +897,6 @@ Este também recebe um bloco para templates (veja o exemplo).
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependência</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensão do Arquivo</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemplo</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Não é possível chamar métodos por este template, nem passar *locals* para o
|
||||
mesmo. Portanto normalmente é utilizado junto a outra engine de renderização:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
Note que você também pode chamar o método `creole` dentro de outros templates:
|
||||
|
||||
```ruby
|
||||
%h1 Olá do Haml!
|
||||
%p= creole(:saudacoes)
|
||||
```
|
||||
|
||||
Já que você não pode chamar o Ruby pelo Creole, você não
|
||||
pode utilizar um layout escrito em Creole. Contudo é
|
||||
possível utilizar outra engine de renderização como template,
|
||||
deve-se passar a `:layout_engine` como opção.
|
||||
|
||||
#### Yajl Templates
|
||||
|
||||
<table>
|
||||
|
|
38
README.ru.md
38
README.ru.md
|
@ -62,7 +62,6 @@ ruby myapp.rb
|
|||
- [Markaby шаблоны](#markaby-шаблоны)
|
||||
- [RABL шаблоны](#rabl-шаблоны)
|
||||
- [Slim шаблоны](#slim-шаблоны)
|
||||
- [Creole шаблоны](#creole-шаблоны)
|
||||
- [Yajl шаблоны](#yajl-шаблоны)
|
||||
- [Доступ к переменным в шаблонах](#доступ-к-переменным-в-шаблонах)
|
||||
- [Шаблоны с `yield` и вложенные лэйауты](#шаблоны-с-yield-и-вложенные-лэйауты)
|
||||
|
@ -855,43 +854,6 @@ erb :overview, :locals => { :text => rdoc(:introduction) }
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole шаблоны
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Зависимости</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Расширения файлов</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Пример</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
В Creole невозможно вызывать методы или передавать локальные переменные.
|
||||
Следовательно, вам, скорее всего, придётся использовать данный шаблон совместно
|
||||
с другим шаблонизатором:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
обратите внимание на то, что вы можете вызывать метод `creole` из других шаблонов:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= creole(:greetings)
|
||||
```
|
||||
|
||||
Вы не можете вызывать Ruby код из Creole, соответственно вы не можете
|
||||
использовать лэйауты на Creole. Тем не менее, существует возможность использовать
|
||||
один шаблонизатор для отображения шаблона, а другой для лэйаута при помощи
|
||||
опции `:layout_engine`.
|
||||
|
||||
#### Yajl шаблоны
|
||||
|
||||
<table>
|
||||
|
|
35
README.zh.md
35
README.zh.md
|
@ -55,7 +55,6 @@ ruby myapp.rb
|
|||
- [Markaby 模板](#markaby-模板)
|
||||
- [RABL 模板](#rabl-模板)
|
||||
- [Slim 模板](#slim-模板)
|
||||
- [Creole 模板](#creole-模板)
|
||||
- [Yajl 模板](#yajl-模板)
|
||||
- [在模板中访问变量](#在模板中访问变量)
|
||||
- [带 `yield` 的模板和嵌套布局](#带-yield-的模板和嵌套布局)
|
||||
|
@ -787,40 +786,6 @@ erb :overview, :locals => { :text => rdoc(:introduction) }
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
#### Creole 模板
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依赖项</td>
|
||||
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>文件扩展名</td>
|
||||
<td><tt>.creole</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例子</td>
|
||||
<td><tt>creole :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
不能在 creole 中调用 Ruby 方法,也不能传递 locals 对象给它。
|
||||
因此你一般会结合其它的渲染引擎来使用它:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => creole(:introduction) }
|
||||
```
|
||||
|
||||
注意你也可以在其它模板内调用 `creole` 方法:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= creole(:greetings)
|
||||
```
|
||||
|
||||
因为不能在 Creole 模板文件内调用 Ruby 方法,你不能用 Creole 书写布局文件。
|
||||
然而,使用其它渲染引擎作为模版的布局是可能的,这需要通过传递 `:layout_engine` 选项。
|
||||
|
||||
#### Yajl 模板
|
||||
|
||||
<table>
|
||||
|
|
|
@ -750,10 +750,6 @@ module Sinatra
|
|||
render(:slim, template, options, locals, &block)
|
||||
end
|
||||
|
||||
def creole(template, options = {}, locals = {})
|
||||
render :creole, template, options, locals
|
||||
end
|
||||
|
||||
def yajl(template, options = {}, locals = {})
|
||||
options[:default_content_type] = :json
|
||||
render :yajl, template, options, locals
|
||||
|
|
|
@ -65,11 +65,6 @@ module Sinatra
|
|||
@current_engine == :slim
|
||||
end
|
||||
|
||||
# @return [Boolean] Returns true if current engine is `:creole`.
|
||||
def creole?
|
||||
@current_engine == :creole
|
||||
end
|
||||
|
||||
# @return [Boolean] Returns true if current engine is `:ruby`.
|
||||
def ruby?
|
||||
@current_engine == :ruby
|
||||
|
|
|
@ -227,7 +227,7 @@ module Sinatra
|
|||
ALLOWED_ENGINES = [
|
||||
:erb, :erubi, :haml, :hamlit, :builder, :nokogiri,
|
||||
:liquid, :markdown, :rdoc, :asciidoc, :radius, :markaby,
|
||||
:rabl, :slim, :creole, :yajl
|
||||
:rabl, :slim, :yajl
|
||||
]
|
||||
|
||||
def self.prefixed(*names)
|
||||
|
|
|
@ -52,7 +52,6 @@ EOF
|
|||
s.add_development_dependency "asciidoctor"
|
||||
s.add_development_dependency "radius"
|
||||
s.add_development_dependency "nokogiri"
|
||||
s.add_development_dependency "creole"
|
||||
s.add_development_dependency "markaby"
|
||||
s.add_development_dependency "rake", "< 11"
|
||||
s.add_development_dependency "rack-test", "< 2"
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
require File.expand_path('helper', __dir__)
|
||||
|
||||
begin
|
||||
require 'creole'
|
||||
|
||||
class CreoleTest < Minitest::Test
|
||||
def creole_app(&block)
|
||||
mock_app do
|
||||
set :views, __dir__ + '/views'
|
||||
get('/', &block)
|
||||
end
|
||||
get '/'
|
||||
end
|
||||
|
||||
it 'renders inline creole strings' do
|
||||
creole_app { creole '= Hiya' }
|
||||
assert ok?
|
||||
assert_body "<h1>Hiya</h1>"
|
||||
end
|
||||
|
||||
it 'renders .creole files in views path' do
|
||||
creole_app { creole :hello }
|
||||
assert ok?
|
||||
assert_body "<h1>Hello From Creole</h1>"
|
||||
end
|
||||
|
||||
it "raises error if template not found" do
|
||||
mock_app { get('/') { creole :no_such_template } }
|
||||
assert_raises(Errno::ENOENT) { get('/') }
|
||||
end
|
||||
|
||||
it "renders with inline layouts" do
|
||||
mock_app do
|
||||
layout { 'THIS. IS. #{yield.upcase}!' }
|
||||
get('/') { creole 'Sparta', :layout_engine => :str }
|
||||
end
|
||||
get '/'
|
||||
assert ok?
|
||||
assert_like 'THIS. IS. <P>SPARTA</P>!', body
|
||||
end
|
||||
|
||||
it "renders with file layouts" do
|
||||
creole_app do
|
||||
creole 'Hello World', :layout => :layout2, :layout_engine => :erb
|
||||
end
|
||||
assert ok?
|
||||
assert_body "ERB Layout!\n<p>Hello World</p>"
|
||||
end
|
||||
|
||||
it "can be used in a nested fashion for partials and whatnot" do
|
||||
mock_app do
|
||||
template(:inner) { "hi" }
|
||||
template(:outer) { "<outer><%= creole :inner %></outer>" }
|
||||
get('/') { erb :outer }
|
||||
end
|
||||
|
||||
get '/'
|
||||
assert ok?
|
||||
assert_like '<outer><p>hi</p></outer>', body
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError
|
||||
warn "#{$!}: skipping creole tests"
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
= Hello From Creole
|
Loading…
Reference in New Issue