Merge pull request #1791 from epergo/ep/remove-mediawiki
Remove Mediawiki
This commit is contained in:
commit
c47b1ecbee
|
@ -20,6 +20,8 @@
|
|||
|
||||
* Breaking change: Remove support for CoffeeScript as a template engine. [#1790](https://github.com/sinatra/sinatra/pull/1790) by Eloy Pérez
|
||||
|
||||
* 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 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
|
||||
|
|
3
Gemfile
3
Gemfile
|
@ -18,8 +18,6 @@ gem 'yard'
|
|||
gem "rack-protection", path: "rack-protection"
|
||||
gem "sinatra-contrib", path: "sinatra-contrib"
|
||||
|
||||
gem "twitter-text", "1.14.7"
|
||||
|
||||
|
||||
gem "activesupport", "~> 6.1"
|
||||
|
||||
|
@ -34,7 +32,6 @@ gem 'slim', '~> 4'
|
|||
gem 'rdoc'
|
||||
gem 'kramdown'
|
||||
gem 'creole'
|
||||
gem 'wikicloth'
|
||||
gem 'markaby'
|
||||
gem 'radius'
|
||||
gem 'asciidoctor'
|
||||
|
|
39
README.de.md
39
README.de.md
|
@ -62,7 +62,6 @@ diesen Server verwenden.
|
|||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [MediaWiki Templates](#mediawiki-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)
|
||||
|
@ -889,44 +888,6 @@ 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.
|
||||
|
||||
#### MediaWiki Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Abhängigkeit</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dateierweiterungen</td>
|
||||
<td><tt>.mediawiki</tt> und <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Beispiel</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Da man aus dem Mediawiki-Template heraus keine Ruby-Methoden aufrufen
|
||||
und auch keine locals verwenden kann, wird man Mediawiki üblicherweise
|
||||
in Kombination mit anderen Renderern verwenden wollen:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Beachte: Man kann die `mediawiki`-Methode auch aus anderen Templates
|
||||
heraus aufrufen:
|
||||
|
||||
```ruby
|
||||
%h1 Grüße von Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
Da man Ruby nicht von MediaWiki heraus aufrufen kann, können auch
|
||||
Layouts nicht in MediaWiki 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>
|
||||
|
|
35
README.es.md
35
README.es.md
|
@ -61,7 +61,6 @@ Se recomienda ejecutar `gem install puma`, porque Sinatra lo utilizará si está
|
|||
- [Plantillas RABL](#plantillas-rabl)
|
||||
- [Plantillas Slim](#plantillas-slim)
|
||||
- [Plantillas Creole](#plantillas-creole)
|
||||
- [MediaWiki Templates](#mediawiki-templates)
|
||||
- [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)
|
||||
|
@ -895,40 +894,6 @@ 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`.
|
||||
|
||||
#### MediaWiki Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependencia</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extension de Archivo</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ejemplo</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
No es posible llamar métodos desde el markup de MediaWiki, ni pasar locales al mismo.
|
||||
Por lo tanto usualmente lo usarás en combinación con otro motor de renderizado:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Nota que también puedes llamar al método `mediawiki` desde dentro de otras plantillas:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
Debido a que no puedes llamar a Ruby desde MediaWiki, no puedes usar los diseños escritos en MediaWiki.
|
||||
De todas maneras, es posible usar otro motor de renderizado para esa plantilla pasando la opción :layout_engine.
|
||||
|
||||
#### Plantillas Yajl
|
||||
|
||||
<table>
|
||||
|
|
39
README.fr.md
39
README.fr.md
|
@ -62,7 +62,6 @@ Sinatra utilise le server Thin quand il est disponible.
|
|||
- [Templates RABL](#templates-rabl)
|
||||
- [Templates Slim](#templates-slim)
|
||||
- [Templates Creole](#templates-creole)
|
||||
- [Templates MediaWiki](#templates-mediawiki)
|
||||
- [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)
|
||||
|
@ -897,44 +896,6 @@ 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 MediaWiki
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dépendances</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensions de fichier</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemple</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Il n’est pas possible d’appeler de méthodes Ruby depuis Mediawiki, ni de lui
|
||||
passer de variables locales. Par conséquent, il sera souvent utilisé en
|
||||
combinaison avec un autre moteur de rendu :
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Notez que vous pouvez également appeler la méthode `mediawiki` depuis un
|
||||
autre template :
|
||||
|
||||
```ruby
|
||||
%h1 Bonjour depuis Haml !
|
||||
%p= mediawiki(:bienvenue)
|
||||
```
|
||||
|
||||
Comme vous ne pouvez pas appeler de méthodes Ruby depuis MediaWiki, vous ne pouvez
|
||||
pas utiliser de layouts écrits en MediaWiki. 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>
|
||||
|
|
26
README.ja.md
26
README.ja.md
|
@ -59,7 +59,6 @@ PumaがあればSinatraはこれを利用するので、`gem install puma`する
|
|||
- [RABL テンプレート](#rabl-テンプレート)
|
||||
- [Slim テンプレート](#slim-テンプレート)
|
||||
- [Creole テンプレート](#creole-テンプレート)
|
||||
- [MediaWiki テンプレート](#mediawiki-テンプレート)
|
||||
- [Yajl テンプレート](#yajl-テンプレート)
|
||||
- [テンプレート内での変数へのアクセス](#テンプレート内での変数へのアクセス)
|
||||
- [`yield`を伴うテンプレートとネストしたレイアウト](#yieldを伴うテンプレートとネストしたレイアウト)
|
||||
|
@ -819,31 +818,6 @@ erb :overview, :locals => { :text => creole(:introduction) }
|
|||
|
||||
CreoleからはRubyを呼ぶことができないので、Creoleで書かれたレイアウトを使うことはできません。しかしながら、`:layout_engine`オプションを渡すことでテンプレートのものとは異なるレンダリングエンジンをレイアウトのために使うことができます。
|
||||
|
||||
#### MediaWiki テンプレート
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依存</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ファイル拡張子</td>
|
||||
<td><tt>.mediawiki</tt> および <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
MediaWikiのテンプレートは直接メソッドから呼び出したり、ローカル変数を通すことはできません。それゆえに、通常は別のレンダリングエンジンと組み合わせて利用します。
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
ノート: 他のテンプレートから部分的に`mediawiki`メソッドを呼び出すことも可能です。
|
||||
|
||||
#### Yajl テンプレート
|
||||
|
||||
<table>
|
||||
|
|
36
README.ko.md
36
README.ko.md
|
@ -57,7 +57,6 @@ thin이 설치되어 있을 경우 Sinatra는 thin을 통해 실행합니다.
|
|||
- [RABL 템플릿](#rabl-템플릿)
|
||||
- [Slim 템플릿](#slim-템플릿)
|
||||
- [Creole 템플릿](#creole-템플릿)
|
||||
- [MediaWiki 템플릿](#mediawiki-템플릿)
|
||||
- [Yajl 템플릿](#yajl-템플릿)
|
||||
- [템플릿에서 변수에 접근하기](#템플릿에서-변수에-접근하기)
|
||||
- [템플릿에서의 `yield` 와 중첩 레이아웃](#템플릿에서의-yield-와-중첩-레이아웃)
|
||||
|
@ -815,41 +814,6 @@ Creole에서 루비를 호출할 수 없기 때문에, Creole으로 작성된
|
|||
사용할 수 없습니다. 하지만, `:layout_engine` 옵션으로 레이아웃의 템플릿을
|
||||
다른 렌더링 엔진으로 렌더링 할 수는 있습니다.
|
||||
|
||||
#### MediaWiki 템플릿
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>의존성</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>파일 확장자</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>예제</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
MediaWiki 마크업에서는 메서드 호출 뿐 아니라 locals 전달도 불가능합니다.
|
||||
따라서 일반적으로는 다른 렌더링 엔진과 함께 사용하게 됩니다.
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
다른 템플릿 속에서 `mediawiki` 메서드를 호출할 수도 있습니다.
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
MediaWiki에서 루비를 호출할 수 없기 때문에, MediaWiki으로 작성된 레이아웃은
|
||||
사용할 수 없습니다. 하지만, `:layout_engine` 옵션으로 레이아웃의 템플릿을
|
||||
다른 렌더링 엔진으로 렌더링 할 수는 있습니다.
|
||||
|
||||
#### Yajl 템플릿
|
||||
|
||||
<table>
|
||||
|
|
|
@ -61,7 +61,6 @@ View at: [http://localhost:4567](http://localhost:4567)
|
|||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [MediaWiki Templates](#mediawiki-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)
|
||||
|
@ -860,43 +859,6 @@ 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.
|
||||
|
||||
#### MediaWiki Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from MediaWiki markup, nor to pass
|
||||
locals to it. You therefore will usually use it in combination with
|
||||
another rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `mediawiki` method from within other
|
||||
templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from MediaWiki, you cannot use layouts written in
|
||||
MediaWiki. 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>
|
||||
|
|
38
README.md
38
README.md
|
@ -63,7 +63,6 @@ pick up if available.
|
|||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [MediaWiki Templates](#mediawiki-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)
|
||||
|
@ -887,43 +886,6 @@ 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.
|
||||
|
||||
#### MediaWiki Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from MediaWiki markup, nor to pass
|
||||
locals to it. You therefore will usually use it in combination with
|
||||
another rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `mediawiki` method from within other
|
||||
templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from MediaWiki, you cannot use layouts written in
|
||||
MediaWiki. 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>
|
||||
|
|
38
README.pl.md
38
README.pl.md
|
@ -59,7 +59,6 @@ którego Sinatra użyje jeżeli będzie dostępny.
|
|||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [MediaWiki Templates](#mediawiki-templates)
|
||||
- [Stylus Templates](#stylus-templates)
|
||||
- [Yajl Templates](#yajl-templates)
|
||||
- [Accessing Variables in Templates](#accessing-variables-in-templates)
|
||||
|
@ -885,43 +884,6 @@ 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.
|
||||
|
||||
#### MediaWiki Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependency</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File Extension</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from MediaWiki markup, nor to pass
|
||||
locals to it. You therefore will usually use it in combination with
|
||||
another rendering engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `mediawiki` method from within other
|
||||
templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
Since you cannot call Ruby from MediaWiki, you cannot use layouts written in
|
||||
MediaWiki. 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>
|
||||
|
|
|
@ -71,7 +71,6 @@ disponível, o Sinatra irá utilizá-la.
|
|||
- [RABL Templates](#rabl-templates)
|
||||
- [Slim Templates](#slim-templates)
|
||||
- [Creole Templates](#creole-templates)
|
||||
- [MediaWiki Templates](#mediawiki-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)
|
||||
|
@ -935,47 +934,6 @@ 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.
|
||||
|
||||
#### MediaWiki Templates
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Dependência</td>
|
||||
<td>
|
||||
<a href="https://github.com/nricciar/wikicloth" title="WikiCloth">
|
||||
WikiCloth
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Extensão do Arquivo</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exemplo</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
It is not possible to call methods from MediaWiki markup, nor to pass locals to
|
||||
it. You therefore will usually use it in combination with another rendering
|
||||
engine:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Note that you may also call the `mediawiki` method from within other templates:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
Já que você não pode chamar o Ruby pelo MediaWiki, você não
|
||||
pode utilizar um layout escrito em MediaWiki. 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
|
@ -63,7 +63,6 @@ ruby myapp.rb
|
|||
- [RABL шаблоны](#rabl-шаблоны)
|
||||
- [Slim шаблоны](#slim-шаблоны)
|
||||
- [Creole шаблоны](#creole-шаблоны)
|
||||
- [MediaWiki шаблоны](#mediawiki-шаблоны)
|
||||
- [Yajl шаблоны](#yajl-шаблоны)
|
||||
- [Доступ к переменным в шаблонах](#доступ-к-переменным-в-шаблонах)
|
||||
- [Шаблоны с `yield` и вложенные лэйауты](#шаблоны-с-yield-и-вложенные-лэйауты)
|
||||
|
@ -893,43 +892,6 @@ erb :overview, :locals => { :text => creole(:introduction) }
|
|||
один шаблонизатор для отображения шаблона, а другой для лэйаута при помощи
|
||||
опции `:layout_engine`.
|
||||
|
||||
#### MediaWiki шаблоны
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Зависимости</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Расширения файлов</td>
|
||||
<td><tt>.mediawiki</tt> и <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Пример</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
В разметке MediaWiki невозможно вызывать методы или передавать локальные переменные.
|
||||
Следовательно, вам, скорее всего, придётся использовать этот шаблон совместно
|
||||
с другим шаблонизатором:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
Обратите внимание на то, что вы можете вызывать метод `mediawiki` из других шаблонов:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
Вы не можете вызывать Ruby код из MediaWiki, соответственно вы не можете
|
||||
использовать лэйауты на MediaWiki. Тем не менее, существует возможность использовать
|
||||
один шаблонизатор для отображения шаблона, а другой для лэйаута при помощи
|
||||
опции `:layout_engine`.
|
||||
|
||||
#### Yajl шаблоны
|
||||
|
||||
<table>
|
||||
|
|
35
README.zh.md
35
README.zh.md
|
@ -56,7 +56,6 @@ ruby myapp.rb
|
|||
- [RABL 模板](#rabl-模板)
|
||||
- [Slim 模板](#slim-模板)
|
||||
- [Creole 模板](#creole-模板)
|
||||
- [MediaWiki 模板](#mediawiki-模板)
|
||||
- [Yajl 模板](#yajl-模板)
|
||||
- [在模板中访问变量](#在模板中访问变量)
|
||||
- [带 `yield` 的模板和嵌套布局](#带-yield-的模板和嵌套布局)
|
||||
|
@ -822,40 +821,6 @@ erb :overview, :locals => { :text => creole(:introduction) }
|
|||
因为不能在 Creole 模板文件内调用 Ruby 方法,你不能用 Creole 书写布局文件。
|
||||
然而,使用其它渲染引擎作为模版的布局是可能的,这需要通过传递 `:layout_engine` 选项。
|
||||
|
||||
#### MediaWiki 模板
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>依赖项</td>
|
||||
<td><a href="https://github.com/nricciar/wikicloth" title="WikiCloth">WikiCloth</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>文件扩展名</td>
|
||||
<td><tt>.mediawiki</tt> and <tt>.mw</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>例子</td>
|
||||
<td><tt>mediawiki :wiki, :layout_engine => :erb</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
在 MediaWiki 标记文件内不能调用 Ruby 方法,也不能传递 locals 对象给它。
|
||||
因此你一般会结合其它的渲染引擎来使用它:
|
||||
|
||||
```ruby
|
||||
erb :overview, :locals => { :text => mediawiki(:introduction) }
|
||||
```
|
||||
|
||||
注意你也可以在其它模板内调用 `mediawiki` 方法:
|
||||
|
||||
```ruby
|
||||
%h1 Hello From Haml!
|
||||
%p= mediawiki(:greetings)
|
||||
```
|
||||
|
||||
因为不能在 MediaWiki 文件内调用 Ruby 方法,你不能用 MediaWiki 书写布局文件。
|
||||
然而,使用其它渲染引擎作为模版的布局是可能的,这需要通过传递 `:layout_engine` 选项。
|
||||
|
||||
#### Yajl 模板
|
||||
|
||||
<table>
|
||||
|
|
|
@ -754,10 +754,6 @@ module Sinatra
|
|||
render :creole, template, options, locals
|
||||
end
|
||||
|
||||
def mediawiki(template, options = {}, locals = {})
|
||||
render :mediawiki, template, options, locals
|
||||
end
|
||||
|
||||
def yajl(template, options = {}, locals = {})
|
||||
options[:default_content_type] = :json
|
||||
render :yajl, template, options, locals
|
||||
|
|
|
@ -3,7 +3,6 @@ gemspec
|
|||
|
||||
gem 'sinatra', path: '..'
|
||||
gem 'rack-protection', path: '../rack-protection'
|
||||
gem "twitter-text", "1.14.7"
|
||||
|
||||
group :development, :test do
|
||||
platform :jruby do
|
||||
|
|
|
@ -227,7 +227,7 @@ module Sinatra
|
|||
ALLOWED_ENGINES = [
|
||||
:erb, :erubi, :haml, :hamlit, :builder, :nokogiri,
|
||||
:liquid, :markdown, :rdoc, :asciidoc, :radius, :markaby,
|
||||
:rabl, :slim, :creole, :mediawiki, :yajl
|
||||
:rabl, :slim, :creole, :yajl
|
||||
]
|
||||
|
||||
def self.prefixed(*names)
|
||||
|
|
|
@ -53,7 +53,6 @@ EOF
|
|||
s.add_development_dependency "radius"
|
||||
s.add_development_dependency "nokogiri"
|
||||
s.add_development_dependency "creole"
|
||||
s.add_development_dependency "wikicloth"
|
||||
s.add_development_dependency "markaby"
|
||||
s.add_development_dependency "rake", "< 11"
|
||||
s.add_development_dependency "rack-test", "< 2"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
require File.expand_path('helper', __dir__)
|
||||
|
||||
begin
|
||||
require 'wikicloth'
|
||||
|
||||
class MediaWikiTest < Minitest::Test
|
||||
def mediawiki_app(&block)
|
||||
mock_app do
|
||||
set :views, __dir__ + '/views'
|
||||
get('/', &block)
|
||||
end
|
||||
get '/'
|
||||
end
|
||||
|
||||
it 'supports both .mw and .mediawiki extensions' do
|
||||
assert_equal Tilt[:mw], Tilt[:mediawiki]
|
||||
end
|
||||
|
||||
it 'renders inline mediawiki strings' do
|
||||
mediawiki_app { mediawiki "''Hiya''" }
|
||||
assert ok?
|
||||
assert_include body, '<i>Hiya</i>'
|
||||
end
|
||||
|
||||
it 'renders .mediawiki files in views path' do
|
||||
mediawiki_app { mediawiki :hello }
|
||||
assert ok?
|
||||
assert_include body, "<i>Hello from MediaWiki</i>"
|
||||
end
|
||||
|
||||
it 'raises error if template not found' do
|
||||
mock_app { get('/') { mediawiki :no_such_template } }
|
||||
assert_raises(Errno::ENOENT) { get('/') }
|
||||
end
|
||||
|
||||
it 'renders with inline layouts' do
|
||||
mock_app do
|
||||
layout { 'THIS. IS. #{yield.upcase}!' }
|
||||
get('/') { mediawiki 'Sparta', :layout_engine => :str }
|
||||
end
|
||||
get '/'
|
||||
assert ok?
|
||||
assert_like 'THIS. IS. <P>SPARTA</P>!', body
|
||||
end
|
||||
|
||||
it 'renders with file layouts' do
|
||||
mediawiki_app do
|
||||
mediawiki '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><%= mediawiki :inner %></outer>" }
|
||||
get('/') { erb :outer }
|
||||
end
|
||||
|
||||
get '/'
|
||||
assert ok?
|
||||
assert_like '<outer><p>hi</p></outer>', body
|
||||
end
|
||||
end
|
||||
rescue LoadError
|
||||
warn "#{$!}: skipping mediawiki tests"
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
''Hello from MediaWiki''
|
Loading…
Reference in New Issue