mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Merge pull request #1766 from epergo/ep/remove-redcloth
Remove textile/redcloth
This commit is contained in:
commit
2b5d1b4509
20 changed files with 26 additions and 508 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
* Breaking change: Remove support for the erubis template engine. [#1761](https://github.com/sinatra/sinatra/pull/1761) by Eloy Pérez
|
||||
|
||||
* Breaking change: Remove support for the textile template engine. [#1766](https://github.com/sinatra/sinatra/pull/1766) 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
|
@ -26,7 +26,6 @@ gem "activesupport", "~> 6.1"
|
|||
gem 'redcarpet', platforms: [ :ruby ]
|
||||
gem 'wlang', '>= 3.0.1'
|
||||
gem 'rdiscount', platforms: [ :ruby ]
|
||||
gem 'RedCloth', platforms: [ :ruby ]
|
||||
gem 'puma'
|
||||
gem 'yajl-ruby', platforms: [ :ruby ]
|
||||
gem 'nokogiri', '> 1.5.0'
|
||||
|
|
47
README.de.md
47
README.de.md
|
@ -57,7 +57,6 @@ diesen Server verwenden.
|
|||
- [SCSS Templates](#scss-templates)
|
||||
- [Liquid Templates](#liquid-templates)
|
||||
- [Markdown Templates](#markdown-templates)
|
||||
- [Textile Templates](#textile-templates)
|
||||
- [RDoc Templates](#rdoc-templates)
|
||||
- [AsciiDoc Templates](#asciidoc-templates)
|
||||
- [Radius Templates](#radius-templates)
|
||||
|
@ -765,44 +764,6 @@ in Markdown 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.
|
||||
|
||||
#### Textile Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Abhängigkeit</td>
|
||||
<td><a href="http://redcloth.org/">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dateierweiterung</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Beispiel</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Da man aus dem Textile-Template heraus keine Ruby-Methoden aufrufen und auch
|
||||
keine locals verwenden kann, wird man Textile üblicherweise in Kombination mit
|
||||
anderen Renderern verwenden wollen:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:einfuehrung) }
|
||||
```
|
||||
|
||||
Beachte, dass man die `textile`-Methode auch aus anderen Templates heraus
|
||||
aufrufen kann:
|
||||
|
||||
```ruby
|
||||
%h1 Gruß von Haml!
|
||||
%p= textile(:Grüße)
|
||||
```
|
||||
|
||||
Da man Ruby nicht von Textile heraus aufrufen kann, können auch Layouts nicht
|
||||
in Textile 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.
|
||||
|
||||
#### RDoc Templates
|
||||
|
||||
<table>
|
||||
|
@ -814,10 +775,6 @@ Templates zu verwenden und einen anderen für das Layout, indem die
|
|||
<td>Dateierweiterung</td>
|
||||
<td><tt>.rdoc</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Beispiel</td>
|
||||
<td><tt>textile :README, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Da man aus dem RDoc-Template heraus keine Ruby-Methoden aufrufen und auch
|
||||
|
@ -1214,11 +1171,11 @@ end
|
|||
### Dateiendungen zuordnen
|
||||
|
||||
Um eine Dateiendung einer Template-Engine zuzuordnen, kann `Tilt.register`
|
||||
genutzt werden. Wenn etwa die Dateiendung `tt` für Textile-Templates genutzt
|
||||
genutzt werden. Wenn etwa die Dateiendung `tt` für Haml-Templates genutzt
|
||||
werden soll, lässt sich dies wie folgt bewerkstelligen:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Eine eigene Template-Engine hinzufügen
|
||||
|
|
41
README.es.md
41
README.es.md
|
@ -56,7 +56,6 @@ Se recomienda ejecutar `gem install puma`, porque Sinatra lo utilizará si está
|
|||
* [Plantillas SCSS](#plantillas-scss)
|
||||
* [Plantillas Liquid](#plantillas-liquid)
|
||||
* [Plantillas Markdown](#plantillas-markdown)
|
||||
* [Plantillas Textile](#plantillas-textile)
|
||||
* [Plantillas RDoc](#plantillas-rdoc)
|
||||
* [Plantillas AsciiDoc](#plantillas-asciidoc)
|
||||
* [Plantillas Radius](#plantillas-radius)
|
||||
|
@ -768,42 +767,6 @@ Como no puede utilizar Ruby desde Markdown, no puede usar layouts escritos en
|
|||
Markdown. 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 Textile
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependencias</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensiones de Archivo</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ejemplo</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
No es posible llamar métodos desde textile, ni pasarle locales. Por lo tanto,
|
||||
generalmente vas a usarlo en combinación con otro motor de renderizado:
|
||||
|
||||
```ruby
|
||||
erb :resumen, :locals => { :texto => textile(:introduccion) }
|
||||
```
|
||||
|
||||
Ten en cuenta que también puedes llamar al método `textile` desde otras
|
||||
plantillas:
|
||||
|
||||
```ruby
|
||||
%h1 Hola Desde Haml!
|
||||
%p= textile(:saludos)
|
||||
```
|
||||
|
||||
Como no puedes utilizar Ruby desde Textile, no puedes usar layouts escritos en
|
||||
Textile. 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 RDoc
|
||||
|
||||
<table>
|
||||
|
@ -1205,10 +1168,10 @@ end
|
|||
|
||||
Para asociar una extensión de archivo con un motor de renderizado, usa
|
||||
`Tilt.register`. Por ejemplo, si quieres usar la extensión `tt` para
|
||||
las plantillas Textile, puedes hacer lo siguiente:
|
||||
las plantillas Haml, puedes hacer lo siguiente:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Añadiendo Tu Propio Motor de Plantillas
|
||||
|
|
42
README.fr.md
42
README.fr.md
|
@ -57,7 +57,6 @@ Sinatra utilise le server Thin quand il est disponible.
|
|||
* [Templates SCSS](#templates-scss)
|
||||
* [Templates Liquid](#templates-liquid)
|
||||
* [Templates Markdown](#templates-markdown)
|
||||
* [Templates Textile](#templates-textile)
|
||||
* [Templates RDoc](#templates-rdoc)
|
||||
* [Templates Asciidoc](#templates-asciidoc)
|
||||
* [Templates Radius](#templates-radius)
|
||||
|
@ -770,43 +769,6 @@ pouvez pas utiliser de layouts écrits en Markdown. 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 Textile
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dépendances</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensions de fichier</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemple</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Il n’est pas possible d’appeler de méthodes depuis textile, 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 => textile(:introduction) }
|
||||
```
|
||||
|
||||
Notez que vous pouvez également appeler la méthode `textile` depuis un autre template :
|
||||
|
||||
```ruby
|
||||
%h1 Bonjour depuis Haml !
|
||||
%p= textile(:bienvenue)
|
||||
```
|
||||
|
||||
Comme vous ne pouvez pas appeler de méthode Ruby depuis Textile, vous ne pouvez
|
||||
pas utiliser de layouts écrits en Textile. 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 RDoc
|
||||
|
||||
<table>
|
||||
|
@ -1217,10 +1179,10 @@ end
|
|||
|
||||
Pour associer une extension de fichier avec un moteur de rendu, utilisez
|
||||
`Tilt.register`. Par exemple, si vous désirez utiliser l'extension
|
||||
de fichier `tt` pour les templates Textile, vous pouvez faire comme suit :
|
||||
de fichier `tt` pour les templates Haml, vous pouvez faire comme suit :
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Ajouter son propre moteur de rendu
|
||||
|
|
38
README.ja.md
38
README.ja.md
|
@ -54,7 +54,6 @@ PumaがあればSinatraはこれを利用するので、`gem install puma`する
|
|||
* [SCSS テンプレート](#scss-テンプレート)
|
||||
* [Liquid テンプレート](#liquid-テンプレート)
|
||||
* [Markdown テンプレート](#markdown-テンプレート)
|
||||
* [Textile テンプレート](#textile-テンプレート)
|
||||
* [RDoc テンプレート](#rdoc-テンプレート)
|
||||
* [AsciiDoc テンプレート](#asciidoc-テンプレート)
|
||||
* [Radius テンプレート](#radius-テンプレート)
|
||||
|
@ -700,39 +699,6 @@ erb :overview, :locals => { :text => markdown(:introduction) }
|
|||
|
||||
MarkdownからはRubyを呼ぶことができないので、Markdownで書かれたレイアウトを使うことはできません。しかしながら、`:layout_engine`オプションを渡すことでテンプレートのものとは異なるレンダリングエンジンをレイアウトのために使うことができます。
|
||||
|
||||
#### Textile テンプレート
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依存</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ファイル拡張子</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Textileからメソッドを呼び出すことも、localsに変数を渡すこともできません。
|
||||
それゆえ、他のレンダリングエンジンとの組み合わせで使うのが普通です。
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:introduction) }
|
||||
```
|
||||
|
||||
ノート: 他のテンプレート内で`textile`メソッドを呼び出せます。
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= textile(:greetings)
|
||||
```
|
||||
|
||||
TextileからはRubyを呼ぶことができないので、Textileで書かれたレイアウトを使うことはできません。しかしながら、`:layout_engine`オプションを渡すことでテンプレートのものとは異なるレンダリングエンジンをレイアウトのために使うことができます。
|
||||
|
||||
#### RDoc テンプレート
|
||||
|
||||
<table>
|
||||
|
@ -1103,10 +1069,10 @@ end
|
|||
|
||||
### ファイル拡張子の関連付け
|
||||
|
||||
任意のテンプレートエンジンにファイル拡張子を関連付ける場合は、`Tilt.register`を使います。例えば、Textileテンプレートに`tt`というファイル拡張子を使いたい場合は、以下のようにします。
|
||||
任意のテンプレートエンジンにファイル拡張子を関連付ける場合は、`Tilt.register`を使います。例えば、Hamlテンプレートに`tt`というファイル拡張子を使いたい場合は、以下のようにします。
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### オリジナルテンプレートエンジンの追加
|
||||
|
|
40
README.ko.md
40
README.ko.md
|
@ -52,7 +52,6 @@ thin이 설치되어 있을 경우 Sinatra는 thin을 통해 실행합니다.
|
|||
* [SCSS 템플릿](#scss-템플릿)
|
||||
* [Liquid 템플릿](#liquid-템플릿)
|
||||
* [Markdown 템플릿](#markdown-템플릿)
|
||||
* [Textile 템플릿](#textile-템플릿)
|
||||
* [RDoc 템플릿](#rdoc-템플릿)
|
||||
* [AsciiDoc 템플릿](#asciidoc-템플릿)
|
||||
* [Radius 템플릿](#radius-템플릿)
|
||||
|
@ -690,41 +689,6 @@ Markdown에서 루비를 호출할 수 없기 때문에, Markdown으로 작성
|
|||
사용할 수 없습니다. 하지만, `:layout_engine` 옵션으로 레이아웃의 템플릿을
|
||||
다른 렌더링 엔진으로 렌더링 할 수는 있습니다.
|
||||
|
||||
#### Textile 템플릿
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td><a href="http://redcloth.org/">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일 확장자</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>예제</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Textile에서는 메서드 호출 뿐 아니라 locals 전달도 안됩니다.
|
||||
따라서 일반적으로는 다른 렌더링 엔진과 함께 사용하게 됩니다.
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:introduction) }
|
||||
```
|
||||
|
||||
다른 템플릿 속에서 `textile` 메서드를 호출할 수도 있습니다.
|
||||
|
||||
```ruby
|
||||
%h1 안녕 Haml!
|
||||
%p= textile(:greetings)
|
||||
```
|
||||
|
||||
Textile에서 루비를 호출할 수 없기 때문에, Textile으로 작성된 레이아웃은
|
||||
사용할 수 없습니다. 하지만, `:layout_engine` 옵션으로 레이아웃의 템플릿을
|
||||
다른 렌더링 엔진으로 렌더링 할 수는 있습니다.
|
||||
|
||||
#### RDoc 템플릿
|
||||
|
||||
<table>
|
||||
|
@ -1122,11 +1086,11 @@ end
|
|||
### 파일 확장자 연결하기
|
||||
|
||||
어떤 파일 확장자를 특정 템플릿 엔진과 연결하려면, `Tilt.register`를 사용하면
|
||||
됩니다. 예를 들어, `tt`라는 파일 확장자를 Textile 템플릿과 연결하고 싶다면,
|
||||
됩니다. 예를 들어, `tt`라는 파일 확장자를 Haml 템플릿과 연결하고 싶다면,
|
||||
다음과 같이 하면 됩니다.
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### 나만의 고유한 템플릿 엔진 추가하기
|
||||
|
|
|
@ -56,7 +56,6 @@ View at: [http://localhost:4567](http://localhost:4567)
|
|||
* [SCSS ടെംപ്ലേറ്റ്സ്](#scss-templates)
|
||||
* [Liquid ടെംപ്ലേറ്റ്സ്](#liquid-templates)
|
||||
* [Markdown ടെംപ്ലേറ്റ്സ്](#markdown-templates)
|
||||
* [Textile ടെംപ്ലേറ്റ്സ്](#textile-templates)
|
||||
* [RDoc ടെംപ്ലേറ്റ്സ്](#rdoc-templates)
|
||||
* [AsciiDoc ടെംപ്ലേറ്റ്സ്](#asciidoc-templates)
|
||||
* [Radius ടെംപ്ലേറ്റ്സ്](#radius-templates)
|
||||
|
@ -735,42 +734,6 @@ Since you cannot call Ruby from Markdown, you cannot use layouts written in
|
|||
Markdown. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### Textile Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from Textile, nor to pass locals to
|
||||
it. You therefore will usually use it in combination with another
|
||||
rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `textile` method from within other templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= textile(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from Textile, you cannot use layouts written in
|
||||
Textile. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### RDoc Templates
|
||||
|
||||
<table>
|
||||
|
@ -1175,10 +1138,10 @@ end
|
|||
|
||||
To associate a file extension with a template engine, use
|
||||
`Tilt.register`. For instance, if you like to use the file extension
|
||||
`tt` for Textile templates, you can do the following:
|
||||
`tt` for Haml templates, you can do the following:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Adding Your Own Template Engine
|
||||
|
|
41
README.md
41
README.md
|
@ -58,7 +58,6 @@ pick up if available.
|
|||
* [SCSS Templates](#scss-templates)
|
||||
* [Liquid Templates](#liquid-templates)
|
||||
* [Markdown Templates](#markdown-templates)
|
||||
* [Textile Templates](#textile-templates)
|
||||
* [RDoc Templates](#rdoc-templates)
|
||||
* [AsciiDoc Templates](#asciidoc-templates)
|
||||
* [Radius Templates](#radius-templates)
|
||||
|
@ -762,42 +761,6 @@ Since you cannot call Ruby from Markdown, you cannot use layouts written in
|
|||
Markdown. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### Textile Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from Textile, nor to pass locals to
|
||||
it. You therefore will usually use it in combination with another
|
||||
rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `textile` method from within other templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= textile(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from Textile, you cannot use layouts written in
|
||||
Textile. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### RDoc Templates
|
||||
|
||||
<table>
|
||||
|
@ -1202,10 +1165,10 @@ end
|
|||
|
||||
To associate a file extension with a template engine, use
|
||||
`Tilt.register`. For instance, if you like to use the file extension
|
||||
`tt` for Textile templates, you can do the following:
|
||||
`tt` for Haml templates, you can do the following:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Adding Your Own Template Engine
|
||||
|
|
41
README.pl.md
41
README.pl.md
|
@ -55,7 +55,6 @@ którego Sinatra użyje jeżeli będzie dostępny.
|
|||
* [Szablony Less](#less-templates)
|
||||
* [Szablony Liquid](#liquid-templates)
|
||||
* [Szablony Markdown](#markdown-templates)
|
||||
* [Szablony Textile](#textile-templates)
|
||||
* [Szablony RDoc](#rdoc-templates)
|
||||
* [Szablony AsciiDoc](#asciidoc-templates)
|
||||
* [Szablony Radius](#radius-templates)
|
||||
|
@ -778,42 +777,6 @@ Since you cannot call Ruby from Markdown, you cannot use layouts written in
|
|||
Markdown. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### Textile Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from Textile, nor to pass locals to
|
||||
it. You therefore will usually use it in combination with another
|
||||
rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `textile` method from within other templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= textile(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from Textile, you cannot use layouts written in
|
||||
Textile. However, it is possible to use another rendering engine for the
|
||||
template than for the layout by passing the `:layout_engine` option.
|
||||
|
||||
#### RDoc Templates
|
||||
|
||||
<table>
|
||||
|
@ -1255,10 +1218,10 @@ end
|
|||
|
||||
To associate a file extension with a template engine, use
|
||||
`Tilt.register`. For instance, if you like to use the file extension
|
||||
`tt` for Textile templates, you can do the following:
|
||||
`tt` for Haml templates, you can do the following:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Adding Your Own Template Engine
|
||||
|
|
|
@ -66,7 +66,6 @@ disponível, o Sinatra irá utilizá-la.
|
|||
* [SCSS Templates](#scss-templates)
|
||||
* [Liquid Templates](#liquid-templates)
|
||||
* [Markdown Templates](#markdown-templates)
|
||||
* [Textile Templates](#textile-templates)
|
||||
* [RDoc Templates](#rdoc-templates)
|
||||
* [AsciiDoc Templates](#asciidoc-templates)
|
||||
* [Radius Templates](#radius-templates)
|
||||
|
@ -794,40 +793,6 @@ pode utilizar um layout escrito em Markdown. Contudo é
|
|||
possível utilizar outra engine de renderização como template,
|
||||
deve-se passar a `:layout_engine` como opção.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependência</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensão do Arquivo</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemplo</td>
|
||||
<td><tt>textile :index, :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 => textile(:introducao) }
|
||||
```
|
||||
|
||||
Note que você também pode chamar o método `textile` dentro de outros templates:
|
||||
|
||||
```ruby
|
||||
%h1 Olá do Haml!
|
||||
%p= textile(:saudacoes)
|
||||
```
|
||||
|
||||
Já que você não pode chamar o Ruby pelo Textile, você não
|
||||
pode utilizar um layout escrito em Textile. Contudo é
|
||||
possível utilizar outra engine de renderização como template,
|
||||
deve-se passar a `:layout_engine` como opção.
|
||||
|
||||
#### RDoc Templates
|
||||
|
||||
<table>
|
||||
|
@ -1247,10 +1212,10 @@ end
|
|||
|
||||
Para associar uma extensão de arquivo com um engine de template use o método
|
||||
`Tilt.register`. Por exemplo, se você quiser usar a extensão `tt` para os
|
||||
templates Textile você pode fazer o seguinte:
|
||||
templates Haml você pode fazer o seguinte:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Adicionando seu Próprio Engine de Template
|
||||
|
|
42
README.ru.md
42
README.ru.md
|
@ -58,7 +58,6 @@ ruby myapp.rb
|
|||
- [SCSS шаблоны](#scss-шаблоны)
|
||||
- [Liquid шаблоны](#liquid-шаблоны)
|
||||
- [Markdown шаблоны](#markdown-шаблоны)
|
||||
- [Textile шаблоны](#textile-шаблоны)
|
||||
- [RDoc шаблоны](#rdoc-шаблоны)
|
||||
- [AsciiDoc шаблоны](#asciidoc-шаблоны)
|
||||
- [Radius шаблоны](#radius-шаблоны)
|
||||
|
@ -764,43 +763,6 @@ erb :overview, :locals => { :text => markdown(:introduction) }
|
|||
один шаблонизатор для отображения шаблона, а другой для лэйаута при помощи
|
||||
опции `:layout_engine`.
|
||||
|
||||
#### Textile шаблоны
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Зависимости</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Расширения файлов</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Пример</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
В Textile невозможно вызывать методы или передавать локальные переменные.
|
||||
Следовательно, вам, скорее всего, придётся использовать данный шаблон
|
||||
совместно с другим шаблонизатором:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:introduction) }
|
||||
```
|
||||
|
||||
Обратите внимание на то, что вы можете вызывать метод `textile` из других шаблонов:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= textile(:greetings)
|
||||
```
|
||||
|
||||
Вы не можете вызывать Ruby код код из Textile, соответственно вы не можете
|
||||
использовать лэйауты на Textile. Тем не менее, существует возможность использовать
|
||||
один шаблонизатор для отображения шаблона, а другой для лэйаута при помощи
|
||||
опции `:layout_engine`.
|
||||
|
||||
#### RDoc шаблоны
|
||||
|
||||
<table>
|
||||
|
@ -1209,10 +1171,10 @@ end
|
|||
|
||||
Для того, чтобы связать расширение файла с движком рендеринга, используйте
|
||||
`Tilt.register`. Так, например, вызовите следующий код в том случае, если вы
|
||||
хотите использовать расширение `tt` для шаблонов Textile:
|
||||
хотите использовать расширение `tt` для шаблонов Haml:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### Добавление собственного движка рендеринга
|
||||
|
|
39
README.zh.md
39
README.zh.md
|
@ -51,7 +51,6 @@ ruby myapp.rb
|
|||
* [SCSS 模板](#scss-模板)
|
||||
* [Liquid 模板](#liquid-模板)
|
||||
* [Markdown 模板](#markdown-模板)
|
||||
* [Textile 模板](#textile-模板)
|
||||
* [RDoc 模板](#rdoc-模板)
|
||||
* [AsciiDoc 模板](#asciidoc-模板)
|
||||
* [Radius 模板](#radius-模板)
|
||||
|
@ -695,40 +694,6 @@ erb :overview, :locals => { :text => markdown(:introduction) }
|
|||
因为不能在 Markdown 中使用 Ruby 语言,你不能使用 Markdown 书写的布局。
|
||||
不过,使用其它渲染引擎作为模板的布局是可能的,这需要通过传入 `:layout_engine` 选项。
|
||||
|
||||
#### Textile 模板
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依赖项</td>
|
||||
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>文件扩展名</td>
|
||||
<td><tt>.textile</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例子</td>
|
||||
<td><tt>textile :index, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
不能在 textile 中调用 Ruby 方法,也不能传递 locals 给它。
|
||||
因此,你一般会结合其它的渲染引擎来使用它:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => textile(:introduction) }
|
||||
```
|
||||
|
||||
请注意你也可以在其他模板中调用 `textile` 方法:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= textile(:greetings)
|
||||
```
|
||||
|
||||
因为不能在 Textile 中调用 Ruby 方法,你不能用 Textile 书写布局。
|
||||
不过,使用其它渲染引擎作为模版的布局是可能的,这需要通过传递 `:layout_engine` 选项。
|
||||
|
||||
#### RDoc 模板
|
||||
|
||||
<table>
|
||||
|
@ -1115,10 +1080,10 @@ end
|
|||
### 关联文件扩展名
|
||||
|
||||
为了将一个文件扩展名到对应的模版引擎,要使用 `Tilt.register`。
|
||||
比如,如果你喜欢使用 `tt` 作为 Textile 模版的扩展名,你可以这样做:
|
||||
比如,如果你喜欢使用 `tt` 作为 Haml 模版的扩展名,你可以这样做:
|
||||
|
||||
```ruby
|
||||
Tilt.register :tt, Tilt[:textile]
|
||||
Tilt.register :tt, Tilt[:haml]
|
||||
```
|
||||
|
||||
### 添加自定义模板引擎
|
||||
|
|
|
@ -735,10 +735,6 @@ module Sinatra
|
|||
render :markdown, template, options, locals
|
||||
end
|
||||
|
||||
def textile(template, options = {}, locals = {})
|
||||
render :textile, template, options, locals
|
||||
end
|
||||
|
||||
def rdoc(template, options = {}, locals = {})
|
||||
render :rdoc, template, options, locals
|
||||
end
|
||||
|
|
|
@ -50,11 +50,6 @@ module Sinatra
|
|||
@current_engine == :markdown
|
||||
end
|
||||
|
||||
# @return [Boolean] Returns true if current engine is `:textile.
|
||||
def textile?
|
||||
@current_engine == :textile
|
||||
end
|
||||
|
||||
# @return [Boolean] Returns true if current engine is `:rdoc`.
|
||||
def rdoc?
|
||||
@current_engine == :rdoc
|
||||
|
|
|
@ -226,7 +226,7 @@ module Sinatra
|
|||
|
||||
ALLOWED_ENGINES = [
|
||||
:erb, :erubi, :haml, :hamlit, :builder, :nokogiri, :sass, :scss,
|
||||
:liquid, :markdown, :textile, :rdoc, :asciidoc, :radius, :markaby,
|
||||
:liquid, :markdown, :rdoc, :asciidoc, :radius, :markaby,
|
||||
:rabl, :slim, :creole, :mediawiki, :coffee, :yajl, :wlang
|
||||
]
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ module Sinatra
|
|||
:xml => [:builder, :nokogiri],
|
||||
:js => [:coffee],
|
||||
:html => [:erb, :erubi, :haml, :hamlit, :slim, :liquid, :radius,
|
||||
:mab, :markdown, :textile, :rdoc],
|
||||
:mab, :markdown, :rdoc],
|
||||
:all => (Sinatra::Templates.instance_methods.map(&:to_sym) +
|
||||
[:mab] - [:find_template, :markaby]),
|
||||
:json => [:yajl],
|
||||
|
|
|
@ -50,7 +50,6 @@ EOF
|
|||
s.add_development_dependency "builder"
|
||||
s.add_development_dependency "liquid"
|
||||
s.add_development_dependency "redcarpet"
|
||||
s.add_development_dependency "RedCloth", "~> 4.2.9"
|
||||
s.add_development_dependency "asciidoctor"
|
||||
s.add_development_dependency "radius"
|
||||
s.add_development_dependency "coffee-script"
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
require File.expand_path('helper', __dir__)
|
||||
|
||||
begin
|
||||
require 'redcloth'
|
||||
|
||||
class TextileTest < Minitest::Test
|
||||
def textile_app(&block)
|
||||
mock_app do
|
||||
set :views, __dir__ + '/views'
|
||||
get('/', &block)
|
||||
end
|
||||
get '/'
|
||||
end
|
||||
|
||||
it 'renders inline textile strings' do
|
||||
textile_app { textile('h1. Hiya') }
|
||||
assert ok?
|
||||
assert_equal "<h1>Hiya</h1>", body
|
||||
end
|
||||
|
||||
it 'renders .textile files in views path' do
|
||||
textile_app { textile(:hello) }
|
||||
assert ok?
|
||||
assert_equal "<h1>Hello From Textile</h1>", body
|
||||
end
|
||||
|
||||
it "raises error if template not found" do
|
||||
mock_app { get('/') { textile(:no_such_template) } }
|
||||
assert_raises(Errno::ENOENT) { get('/') }
|
||||
end
|
||||
|
||||
it "renders with inline layouts" do
|
||||
mock_app do
|
||||
layout { 'THIS. IS. #{yield.upcase}!' }
|
||||
get('/') { textile('Sparta', :layout_engine => :str) }
|
||||
end
|
||||
get '/'
|
||||
assert ok?
|
||||
assert_like 'THIS. IS. <P>SPARTA</P>!', body
|
||||
end
|
||||
|
||||
it "renders with file layouts" do
|
||||
textile_app {
|
||||
textile('Hello World', :layout => :layout2, :layout_engine => :erb)
|
||||
}
|
||||
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><%= textile :inner %></outer>" }
|
||||
get('/') { erb :outer }
|
||||
end
|
||||
|
||||
get '/'
|
||||
assert ok?
|
||||
assert_like '<outer><p>hi</p></outer>', body
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError
|
||||
warn "#{$!}: skipping textile tests"
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
h1. Hello From Textile
|
Loading…
Reference in a new issue