Phabricator のプロジェクト名 #MediaWiki-extensions-Poem

Extension:Poem/ja

From MediaWiki.org
Jump to: navigation, search
この拡張機能は MediaWiki 1.21 以降にバンドルされています。このため、別途ダウンロードする必要はありません。


MediaWiki 拡張機能マニュアルManual:Extensions
Crystal Clear action run.png
Poem

リリースの状態:Extension status 安定

実装Template:Extension#type Tag
説明Template:Extension#description 詩を整形する <poem> タグを追加する
作者Template:Extension#username Nikola Smolenskitalk
最新バージョンTemplate:Extension#version continuous updates
MediaWikiTemplate:Extension#mediawiki 1.19 以降
データベースの変更Template:Extension#needs-updatephp いいえ
ライセンスTemplate:Extension#license GPL v2 以降
ダウンロード
使用するフックTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

translatewiki.net で翻訳を利用できる場合は、Poem 拡張機能の翻訳にご協力ください

使用状況とバージョン マトリクスを確認してください。

問題点Phabricator

未解決のタスク · バグを報告

The Poem extension allows easy formatting of poems and similar material within Wikitext. Once the extension is enabled, you can put any block of text within <poem></poem> tags, which has the following effects:

  • All newlines are preserved by converting them into <br /> tags
  • The block of text is enclosed in <p></p> tags (as well as a div of class "poem")
  • Colons at the beginning of a line are converted into 1 em indentation
  • Spaces at the beginning of a line are preserved and no longer invoke the <pre> tag

The extension preserves wikilinks, bolding, etc. if they are present in the poem.

Nikola Smolenski made the extension in order to practice working on extensions, after an idea by Yann Forget.[1]

It was activated on Wikisource and tested on 2006-06-23, and on the rest of the project sites on 2007-02-07.

使用法[edit]

[edit]

入力テキスト 出力
<poem>
In [[Wikipedia:Xanadu|Xanadu]] did Kubla Khan
A stately pleasure-dome decree:
Where Alph, the sacred river, ran
Through caverns measureless to man
Down to a sunless sea.

So twice five miles of fertile ground
With walls and towers were girdled round:
And there were gardens bright with sinuous rills,
Where blossomed many an incense-bearing tree;
And here were forests ancient as the hills,
Enfolding sunny spots of greenery.
</poem>

In Xanadu did Kubla Khan
A stately pleasure-dome decree:
Where Alph, the sacred river, ran
Through caverns measureless to man
Down to a sunless sea.

So twice five miles of fertile ground
With walls and towers were girdled round:
And there were gardens bright with sinuous rills,
Where blossomed many an incense-bearing tree;
And here were forests ancient as the hills,
Enfolding sunny spots of greenery.

Example with indentation[edit]

入力テキスト 出力
<poem>
Une terre au flanc maigre, âpre, avare, inclément
Où les vivants pensifs travaillent tristement, 
::Et qui donne à regret à cette race humaine
Un peu de pain pour tant de labeur et de peine ; 
::Des hommes durs, éclos sur ces sillons ingrats ; 
Des cités d’où s’en vont, en se tordant les bras, 
::La charité, la paix, la foi, sœurs vénérables ; 
L’orgueil chez les puissants et chez les misérables ; 
</poem>

Une terre au flanc maigre, âpre, avare, inclément
Où les vivants pensifs travaillent tristement,
Et qui donne à regret à cette race humaine
Un peu de pain pour tant de labeur et de peine ;
Des hommes durs, éclos sur ces sillons ingrats ;
Des cités d’où s’en vont, en se tordant les bras,
La charité, la paix, la foi, sœurs vénérables ;
L’orgueil chez les puissants et chez les misérables ;

スタイル[edit]

The poem text is wrapped in a div, which has no style by default; but inherits any style or class option passed to the poem.

For example, while indented text can be used for simple examples to prevent filling and draw a nice blue box, it can be hard to read in some cases, since long lines aren't broken. A similar, but somewhat better effect can be obtained with

<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;">

When applied to the above example, the result is as follows:

In Xanadu did Kubla Khan
A stately pleasure-dome decree:
Where Alph, the sacred river, ran
Through caverns measureless to man
Down to a sunless sea.

So twice five miles of fertile ground
With walls and towers were girdled round:
And there were gardens bright with sinuous rills,
Where blossomed many an incense-bearing tree;
And here were forests ancient as the hills,
Enfolding sunny spots of greenery.

"compact" オプション[edit]

Applying the <poem> tag with the compact option to a text of more than two lines, every line becomes a separate paragraph. (This seems to be a bug, as it is opposite to what the term suggests.)

Subsequent use of the <poem> tag with the compact option, with up to two newlines in between, gives just a single newline between texts, not a new paragraph. Thus, applied to texts of more than two lines each, every line becomes a separate paragraph, except that the last line of each text and the first line of the next text are combined into one paragraph.

入力 出力 入力 出力
<poem>
One,
Two.
</poem>
<poem>
Three?
Four!
</poem>

One,
Two.

Three?
Four!

<poem compact>
One,
Two.
</poem>
<poem compact>
Three?
Four!
</poem>
One,
Two.
Three?
Four!
Input Output Input Output
<poem>
One,
Two.
Extra.
</poem>
<poem>
Three?
Four!
Extra.
</poem>

One,
Two.
Extra.

Three?
Four!
Extra.

<poem compact>
One,
Two.
Extra.
</poem>
<poem compact>
Three?
Four!
Extra.
</poem>
One,

Two.

Extra.
Three?

Four!

Extra.

問題点と解決法[edit]

  • Variables and ParserFunctions do work inside the <poem> ... </poem> container, but NOT within the <poem ... > tag itself ; this prevents templates with code such as <poem style="{{{1}}}">.
  • One workaround is to use <div style="{{{1}}}"><poem> ... </poem></div> instead.
  • Another way is to use the #tag magic word: {{#tag:poem| ... |style="{{{1}}}"}}.
    • NB: this would however seem not to work with the "compact" option.
入力 (inside OK, within not OK) 出力
<poem style="{{{1|border: 1px solid Black;}}}">
One,
{{{2|Two.}}}
</poem>

One,
Two.

Input (both inside and within OK) Output
<div style="{{{1|border: 1px solid Black;}}}"><poem>
One,
{{{2|Two.}}}
</poem></div>

One,
Two.

{{#tag:poem|
One,
{{{2|Two.}}}
|style="{{{1|border: 1px solid Black;}}}"
}}

One,
Two.

インストール[edit]

  • ダウンロードして、ファイルを extensions/ フォルダー内の Poem という名前のディレクトリ内に配置します。
  • 以下のコードを LocalSettings.php の末尾に追加します:
    require_once "$IP/extensions/Poem/Poem.php";
    
  • YesY 完了 - ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

脚注[edit]


言語:Project:Language policy English  • 日本語