ویکی ماخذ
urwikisource
https://ur.wikisource.org/wiki/%D8%B5%D9%81%D8%AD%DB%82_%D8%A7%D9%88%D9%84
MediaWiki 1.46.0-wmf.24
first-letter
میڈیا
خاص
تبادلۂ خیال
صارف
تبادلۂ خیال صارف
ویکی ماخذ
تبادلۂ خیال ویکی ماخذ
فائل
تبادلۂ خیال فائل
میڈیاویکی
تبادلۂ خیال میڈیاویکی
سانچہ
تبادلۂ خیال سانچہ
معاونت
تبادلۂ خیال معاونت
زمرہ
تبادلۂ خیال زمرہ
مصنف
تبادلۂ خیال مصنف
صفحہ
تبادلۂ خیال صفحہ
اشاریہ
تبادلۂ خیال اشاریہ
TimedText
TimedText talk
ماڈیول
تبادلۂ خیال ماڈیول
Event
Event talk
اشاریہ:Ram Charcha in Urdu by Munshi Premchand.pdf
252
917
32322
31732
2026-04-22T02:16:34Z
Satdeep Gill
85
32322
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|Type=book
|Title=
|Language=ur
|Volume=
|Author=
|Translator=
|Editor=
|Illustrator=
|School=
|Publisher=
|Address=
|Year=
|Key=
|ISBN=
|OCLC=
|LCCN=
|BNF_ARK=
|ARC=
|DOI=
|Source=_empty_
|Image=1
|Progress=X
|Transclusion=no
|Validation_date=
|Pages=<pagelist />
|Volumes=
|Remarks=
|Width=
|Header=
|Footer=
|tmplver=
}}
pl43nlhaquobu6x7do5a63sddr83orp
32323
32322
2026-04-22T02:16:54Z
Satdeep Gill
85
32323
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|Type=book
|Title=
|Language=ur
|Volume=
|Author=
|Translator=
|Editor=
|Illustrator=
|School=
|Publisher=
|Address=
|Year=
|Key=
|ISBN=
|OCLC=
|LCCN=
|BNF_ARK=
|ARC=
|DOI=
|Source=pdf
|Image=1
|Progress=X
|Transclusion=no
|Validation_date=
|Pages=<pagelist />
|Volumes=
|Remarks=
|Width=
|Header=
|Footer=
|tmplver=
}}
jdizl656fl40hjjdghmuhw6kyjjis42
اشاریہ:Betal-pachcheesi-mazhar-ali-khan-wila-ebooks-3.pdf
252
12113
31983
27497
2026-04-22T01:48:51Z
Satdeep Gill
85
31983
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|مصنف=
|عنوان=
|سال=
|ناشر=
|ماخذ=
|تصویر=
|صفحات=
|ملاحظات=
}}
[[زمرہ:Urdu]]
q3jlb0ke2fjrso7ifrmdtzwe5rq0s0h
32028
31983
2026-04-22T02:12:54Z
Satdeep Gill
85
32028
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|Type=book
|Title=
|Language=en
|Volume=
|Author=
|Translator=
|Editor=
|Illustrator=
|School=
|Publisher=
|Address=
|Year=
|Key=
|ISBN=
|OCLC=
|LCCN=
|BNF_ARK=
|ARC=
|DOI=
|Source=_empty_
|Image=1
|Progress=X
|Transclusion=no
|Validation_date=
|Pages=<pagelist />
|Volumes=
|Remarks=
|Width=
|Header=
|Footer=
|tmplver=
}}
[[زمرہ:Urdu]]
rnidm7l3m8raq3b194omghy22dgf80q
32029
32028
2026-04-22T02:13:31Z
Satdeep Gill
85
32029
proofread-index
text/x-wiki
{{:MediaWiki:Proofreadpage_index_template
|Type=book
|Title=
|Language=ur
|Volume=
|Author=
|Translator=
|Editor=
|Illustrator=
|School=
|Publisher=
|Address=
|Year=
|Key=
|ISBN=
|OCLC=
|LCCN=
|BNF_ARK=
|ARC=
|DOI=
|Source=_empty_
|Image=1
|Progress=X
|Transclusion=no
|Validation_date=
|Pages=<pagelist />
|Volumes=
|Remarks=
|Width=
|Header=
|Footer=
|tmplver=
}}
pl43nlhaquobu6x7do5a63sddr83orp
صفحہ:Betal-pachcheesi-mazhar-ali-khan-wila-ebooks-3.pdf/34
250
12700
31930
30796
2026-04-21T23:01:29Z
Charan Gill
46
31930
proofread-page
text/x-wiki
<noinclude><pagequality level="1" user="Taranpreet Goswami" /></noinclude>اور پشو پنچھی تک ہے ایک جی کی رکشا کرنا دھرم ہے جہان مین اسکے برابر کوئی ادھرم نہین جو شخص دوسرے کا گوشت کھا کر اپنا گوشت بڑھاتے ہین وہ آخرکار دوزخ مین پڑتے ہین اس سے انسان کو لازم یہ ہے کہ جی کی رکشا کرے اور جو لوگ کہ دوسرے کا دکھ نہ سمجھتے ہون اور غیرون کے جی بھی مار مار کے کھاتے ہون انکی اس دنیا مین عمر کم ہوتی ہواور یولے لنگڑے کانے اندھے ہونے کپڑے ایسے اعضاء سے محروم مو نیم لیتے
ہین جیسے نشو اور بھی کے انگ کھاتے ہین ویسے ہی انگ اپنے کھواتے ہین اور شراب پینا بہت بڑا گناہ ہے
اس سے شراب
اور گوشت کا کھانا بجا نہین اس طرح راجہ کو دیوان نے اپنی ست کا گیان سمجھا کر این این
رسیور اسنیاسی در رویش کسی کو نہ مانا چاہئے
اور اسی دھرم سے راج
کرتا تھا ایک دن کا کے ہین جو مرگیا پھرا کا بنیاد حرم دجون نام گری پڑیٹھا اور
راج
کرنے لگا ایک دن اسے بھی چند دیوان کو کپڑوا سر پر سات چوٹی رکھو نھ کالا کرو اگر ھے پر چڑھوا
ڈونڈی بجواتانی دلوا دیس سے نکال دیا ایک دن وہ راجہ سنت رت مین رانیون کو ساتھ لے ایک باغ
کی سیر کو گیا اس باغ مین ایک بڑا تالاب تھا اور اسمین کنول پھول رہے تھے راجہ اس سردور کی شوبھا دیکھے
کپڑے اتار اشنان کرنے کو اترا ایک پھول توڑ تیر پر آرانی کے ہاتھ مین دینے لگا کہ وہ پھول ہاتھ سے
پھوٹ کر رانی کے پائون پر گرا اور اسکی چوٹ سے رانی کا پانون ٹوٹ گیاتب راجہ گھر کر بارگی با نترل کر
اس کی او کھد کرنے لگا کہ اتنے مین رات ہوئی اور چند رمان نے پرکاش کیا چاند کی جوت پڑتے ہی دوسری
رانی کے شریر مین پھپھولے پڑگئے تو مین اچانک دوسرے کسی گرہنسی کی مونس کی آواز آئی اس سے
تیسری رانی کے شرمن ایسا درد ہوا کہ خش آگیا اتنی بات کہ مبتال بولا اے را جبران مینون مین است
شکار کون ہے راجہ نے کہا جس کے شریر مین درد پوشش آباد ہی بہت نازک ہو یہ بات من میتال
پھر اسی درخت پر جا لٹکا اور راجہ اسے اتار گٹھری باند ھ کا نذریعے پر رکھ لیچلا
گیارھوین کہانی
بیتال بولا کہ پونے پو نام ایک نگر ہو بان بلیو نام ایک راجہ تھا اور اسکے دیوان کا نامر ست پر کاش تھا
اس دیوان کی استری کا نام شی اس راجہ نے ایک روز اپنے دیوان سے کہا جو ا جہ ہوکر سند استری
سے بھوگ نہ کرے تو راج کرنا اسکا ہے سود ہے یہ بات کہ دیوان کو راج کا بھارہ سے آپ سکھہ سے پیش کرنے کے
اور راج کی سب چنتا چھوڑ دی اور دن رات آنند مین رہنے لگا اتفاقا ایک روز وہ دیوان اپنے گھرمین
اداس بیٹھا تھا کہ مین اسکی جور نے پوچھاسلامی ان
دنون آپکو بہت دبلاد دیتی ہون وہ بولا رات دن
مجھے راج کی فکر رہتی ہو اس سے شر دبلا ہو گیا اور راجہ تو انھون پر اپنے عیش و آرام مین رہتا ہو تو روایت<noinclude>[[Category:urdu]]</noinclude>
qehy9h7i1246myas7dbbppzc4sx2zj4
32340
31930
2026-04-22T04:14:58Z
Charan Gill
46
32340
proofread-page
text/x-wiki
<noinclude><pagequality level="1" user="Taranpreet Goswami" /></noinclude>اور پشو پنچھی تک ہے ایک جی کی رکشا کرنا دھرم ہے جہان مین اسکے برابر کوئی ادھرم نہین جو شخص دوسرے کا گوشت کھا کر اپنا گوشت بڑھاتے ہین وہ آخرکار دوزخ مین پڑتے ہین اس سے انسان کو لازم یہ ہے کہ جی کی رکشا کرے اور جو لوگ کہ دوسرے کا دکھ نہ سمجھتے ہون اور غیرون کے جی بھی مار مار کے کھاتے ہون انکی اس دنیا مین عمر کم ہوتی ہواور یولے لنگڑے کانے اندھے ہونے کبڑے ایسے اعضاء سے محروم ہو جنم لیتے ہین جیسے پشو اور پنچھی کے انگ کھاتے ہین ویسے ہی انگ اپنے کھواتے ہین اور شراب پینا بہت بڑا گناہ ہے اس سے شراب اور گوشت کا کھانا بجا نہین اس طرح راجہ کو دیوان نے اپنی ست کا گیان سمجھا کر ایسا جین دھرم مین لایا کہ جو یہ کہتا تھا وہے راجکا کرتا تھا اور برہمن جوگی جنگم اسنیاسی در رویش کسی کو نہ مانا چاہئے
اور اسی دھرم سے راج
کرتا تھا ایک دن کا کے ہین جو مرگیا پھرا کا بنیاد حرم دجون نام گری پڑیٹھا اور
راج
کرنے لگا ایک دن اسے بھی چند دیوان کو کپڑوا سر پر سات چوٹی رکھو نھ کالا کرو اگر ھے پر چڑھوا
ڈونڈی بجواتانی دلوا دیس سے نکال دیا ایک دن وہ راجہ سنت رت مین رانیون کو ساتھ لے ایک باغ
کی سیر کو گیا اس باغ مین ایک بڑا تالاب تھا اور اسمین کنول پھول رہے تھے راجہ اس سردور کی شوبھا دیکھے
کپڑے اتار اشنان کرنے کو اترا ایک پھول توڑ تیر پر آرانی کے ہاتھ مین دینے لگا کہ وہ پھول ہاتھ سے
پھوٹ کر رانی کے پائون پر گرا اور اسکی چوٹ سے رانی کا پانون ٹوٹ گیاتب راجہ گھر کر بارگی با نترل کر
اس کی او کھد کرنے لگا کہ اتنے مین رات ہوئی اور چند رمان نے پرکاش کیا چاند کی جوت پڑتے ہی دوسری
رانی کے شریر مین پھپھولے پڑگئے تو مین اچانک دوسرے کسی گرہنسی کی مونس کی آواز آئی اس سے
تیسری رانی کے شرمن ایسا درد ہوا کہ خش آگیا اتنی بات کہ مبتال بولا اے را جبران مینون مین است
شکار کون ہے راجہ نے کہا جس کے شریر مین درد پوشش آباد ہی بہت نازک ہو یہ بات من میتال
پھر اسی درخت پر جا لٹکا اور راجہ اسے اتار گٹھری باند ھ کا نذریعے پر رکھ لیچلا
گیارھوین کہانی
بیتال بولا کہ پونے پو نام ایک نگر ہو بان بلیو نام ایک راجہ تھا اور اسکے دیوان کا نامر ست پر کاش تھا
اس دیوان کی استری کا نام شی اس راجہ نے ایک روز اپنے دیوان سے کہا جو ا جہ ہوکر سند استری
سے بھوگ نہ کرے تو راج کرنا اسکا ہے سود ہے یہ بات کہ دیوان کو راج کا بھارہ سے آپ سکھہ سے پیش کرنے کے
اور راج کی سب چنتا چھوڑ دی اور دن رات آنند مین رہنے لگا اتفاقا ایک روز وہ دیوان اپنے گھرمین
اداس بیٹھا تھا کہ مین اسکی جور نے پوچھاسلامی ان
دنون آپکو بہت دبلاد دیتی ہون وہ بولا رات دن
مجھے راج کی فکر رہتی ہو اس سے شر دبلا ہو گیا اور راجہ تو انھون پر اپنے عیش و آرام مین رہتا ہو تو روایت<noinclude>[[Category:urdu]]</noinclude>
scljby5m67wirff1eofeoh1sxytkmwg
32341
32340
2026-04-22T05:46:56Z
Charan Gill
46
32341
proofread-page
text/x-wiki
<noinclude><pagequality level="1" user="Taranpreet Goswami" /></noinclude>اور پشو پنچھی تک ہے ایک جی کی رکشا کرنا دھرم ہے جہان مین اسکے برابر کوئی ادھرم نہین جو شخص دوسرے کا گوشت کھا کر اپنا گوشت بڑھاتے ہین وہ آخرکار دوزخ مین پڑتے ہین اس سے انسان کو لازم یہ ہے کہ جی کی رکشا کرے اور جو لوگ کہ دوسرے کا دکھ نہ سمجھتے ہون اور غیرون کے جی بھی مار مار کے کھاتے ہون انکی اس دنیا مین عمر کم ہوتی ہواور یولے لنگڑے کانے اندھے ہونے کبڑے ایسے اعضاء سے محروم ہو جنم لیتے ہین جیسے پشو اور پنچھی کے انگ کھاتے ہین ویسے ہی انگ اپنے کھواتے ہین اور شراب پینا بہت بڑا گناہ ہے اس سے شراب اور گوشت کا کھانا بجا نہین اس طرح راجہ کو دیوان نے اپنی ست کا گیان سمجھا کر ایسا جین دھرم مین لایا کہ جو یہ کہتا تھا وہے راجکا کرتا تھا اور برہمن جوگی جنگم اسنیاسی درویش کسی کو نہ مانا چاہئے اور اسی دھرم سے راج کرتا تھا ایک دن کال کے بس مین مرگیا پھرا کا بیٹا دھرم دھوج نام گری پڑیٹھا اور
راج
کرنے لگا ایک دن اسے بھی چند دیوان کو کپڑوا سر پر سات چوٹی رکھو نھ کالا کرو اگر ھے پر چڑھوا
ڈونڈی بجواتانی دلوا دیس سے نکال دیا ایک دن وہ راجہ سنت رت مین رانیون کو ساتھ لے ایک باغ
کی سیر کو گیا اس باغ مین ایک بڑا تالاب تھا اور اسمین کنول پھول رہے تھے راجہ اس سردور کی شوبھا دیکھے
کپڑے اتار اشنان کرنے کو اترا ایک پھول توڑ تیر پر آرانی کے ہاتھ مین دینے لگا کہ وہ پھول ہاتھ سے
پھوٹ کر رانی کے پائون پر گرا اور اسکی چوٹ سے رانی کا پانون ٹوٹ گیاتب راجہ گھر کر بارگی با نترل کر
اس کی او کھد کرنے لگا کہ اتنے مین رات ہوئی اور چند رمان نے پرکاش کیا چاند کی جوت پڑتے ہی دوسری
رانی کے شریر مین پھپھولے پڑگئے تو مین اچانک دوسرے کسی گرہنسی کی مونس کی آواز آئی اس سے
تیسری رانی کے شرمن ایسا درد ہوا کہ خش آگیا اتنی بات کہ مبتال بولا اے را جبران مینون مین است
شکار کون ہے راجہ نے کہا جس کے شریر مین درد پوشش آباد ہی بہت نازک ہو یہ بات من میتال
پھر اسی درخت پر جا لٹکا اور راجہ اسے اتار گٹھری باند ھ کا نذریعے پر رکھ لیچلا
گیارھوین کہانی
بیتال بولا کہ پونے پو نام ایک نگر ہو بان بلیو نام ایک راجہ تھا اور اسکے دیوان کا نامر ست پر کاش تھا
اس دیوان کی استری کا نام شی اس راجہ نے ایک روز اپنے دیوان سے کہا جو ا جہ ہوکر سند استری
سے بھوگ نہ کرے تو راج کرنا اسکا ہے سود ہے یہ بات کہ دیوان کو راج کا بھارہ سے آپ سکھہ سے پیش کرنے کے
اور راج کی سب چنتا چھوڑ دی اور دن رات آنند مین رہنے لگا اتفاقا ایک روز وہ دیوان اپنے گھرمین
اداس بیٹھا تھا کہ مین اسکی جور نے پوچھاسلامی ان
دنون آپکو بہت دبلاد دیتی ہون وہ بولا رات دن
مجھے راج کی فکر رہتی ہو اس سے شر دبلا ہو گیا اور راجہ تو انھون پر اپنے عیش و آرام مین رہتا ہو تو روایت<noinclude>[[Category:urdu]]</noinclude>
e5rqren66sflzvithjfhl19lb0z42a9
32342
32341
2026-04-22T06:19:02Z
BalramBodhi
60
32342
proofread-page
text/x-wiki
<noinclude><pagequality level="1" user="Taranpreet Goswami" /></noinclude>اور پشو پنچھی تک ہرایک جی کی رکشا کرنا دھرم ہے جہان مین اسکے برابر کوئی ادھرم نہین جو شخص دوسرے کا گوشت کھا کر اپنا گوشت بڑھاتے ہین وہ آخرکار دوزخ مین پڑتے ہین اس سے انسان کو لازم یہ ہے کہ جی کی رکشا کرے اور جو لوگ کہ دوسرے کا دکھ نہ سمجھتے ہون اور غیرون کے جی بھی مار مار کے کھاتے ہون انکی اس دنیا مین عمر کم ہوتی ہے اور لولے لنگڑے کانے اندھے ہونے کبڑے ایسے اعضاء سے محروم ہو جنم لیتے ہین جیسے پشو اور پنچھی کے انگ کھاتے ہین ویسے ہی انگ اپنے کھواتے ہین اور شراب پینا بہت بڑا گناہ ہے اس سے شراب اور گوشت کا کھانا بجا نہین اس طرح راجہ کو دیوان نے اپنی مت کا گیان سمجھا کر ایسا جین دھرم مین لایا کہ جو یہ کہتا تھا وہے راجہ کرتا تھا اور برہمن جوگی جنگم سیورا سنیاسی درویش کسی کو نہ مانا چاہئے اور اسی دھرم سے راج کرتا تھا ایک دن کال کے بس ہو مرگیا پھر اسکا بیٹا دھرم دھوج نام گدی پر بیٹھا اور
راج کرنے لگا ایک دن اسنے ابھی چند دیوان کو پکڑوا سر پر سات چوٹی رکھوا منھ کالا کروا گدھے پر چڑھوا ڈونڈی بجوا تالی دلوا دیس سے نکال دیا ایک دن وہ راجہ بسنت رت مین رانیون کو ساتھ لے ایک باغ کی سیر کو گیا اس باغ مین ایک بڑا تالاب تھا اور اسمین کنول پھول رہے تھے راجہ اس سروور کی شوبھا دیکھ کپڑے اتار اشنان کرنے کو اترا ایک پھول توڑ تیر پر آ رانی کے ہاتھ مین دینے لگا کہ وہ پھول ہاتھ سے چھوٹ کر رانی کے پائون پر گرا اور اسکی چوٹ سے رانی کا پانون ٹوٹ گیا تب راجہ گھبرا کر ایک بارگی باہر نکل کر اس کی اوکھد کرنے لگا کہ اتنے مین رات ہوئی اور چندرمان نے پرکاش کیا چاند کی جوت پڑتے ہی دوسری رانی کے شریر مین پھپھولے پڑگئے تو مین اچانک دوسرے کسی گرہستی کی موسل کی آواز آئی اس سے
تیسری رانی کے شرمن ایسا درد ہوا کہ خش آگیا اتنی بات کہ مبتال بولا اے را جبران مینون مین است
شکار کون ہے راجہ نے کہا جس کے شریر مین درد پوشش آباد ہی بہت نازک ہو یہ بات من میتال
پھر اسی درخت پر جا لٹکا اور راجہ اسے اتار گٹھری باند ھ کا نذریعے پر رکھ لیچلا
گیارھوین کہانی
بیتال بولا کہ پونے پو نام ایک نگر ہو بان بلیو نام ایک راجہ تھا اور اسکے دیوان کا نامر ست پر کاش تھا
اس دیوان کی استری کا نام شی اس راجہ نے ایک روز اپنے دیوان سے کہا جو ا جہ ہوکر سند استری
سے بھوگ نہ کرے تو راج کرنا اسکا ہے سود ہے یہ بات کہ دیوان کو راج کا بھارہ سے آپ سکھہ سے پیش کرنے کے
اور راج کی سب چنتا چھوڑ دی اور دن رات آنند مین رہنے لگا اتفاقا ایک روز وہ دیوان اپنے گھرمین
اداس بیٹھا تھا کہ مین اسکی جور نے پوچھاسلامی ان
دنون آپکو بہت دبلاد دیتی ہون وہ بولا رات دن
مجھے راج کی فکر رہتی ہو اس سے شر دبلا ہو گیا اور راجہ تو انھون پر اپنے عیش و آرام مین رہتا ہو تو روایت<noinclude>[[Category:urdu]]</noinclude>
ohe7rkcbmqy803tkv1nn10oqedw39i7
32343
32342
2026-04-22T09:32:22Z
Charan Gill
46
32343
proofread-page
text/x-wiki
<noinclude><pagequality level="1" user="Taranpreet Goswami" /></noinclude>اور پشو پنچھی تک ہرایک جی کی رکشا کرنا دھرم ہے جہان مین اسکے برابر کوئی ادھرم نہین جو شخص دوسرے کا گوشت کھا کر اپنا گوشت بڑھاتے ہین وہ آخرکار دوزخ مین پڑتے ہین اس سے انسان کو لازم یہ ہے کہ جی کی رکشا کرے اور جو لوگ کہ دوسرے کا دکھ نہ سمجھتے ہون اور غیرون کے جی بھی مار مار کے کھاتے ہون انکی اس دنیا مین عمر کم ہوتی ہے اور لولے لنگڑے کانے اندھے ہونے کبڑے ایسے اعضاء سے محروم ہو جنم لیتے ہین جیسے پشو اور پنچھی کے انگ کھاتے ہین ویسے ہی انگ اپنے کھواتے ہین اور شراب پینا بہت بڑا گناہ ہے اس سے شراب اور گوشت کا کھانا بجا نہین اس طرح راجہ کو دیوان نے اپنی مت کا گیان سمجھا کر ایسا جین دھرم مین لایا کہ جو یہ کہتا تھا وہے راجہ کرتا تھا اور برہمن جوگی جنگم سیورا سنیاسی درویش کسی کو نہ مانا چاہئے اور اسی دھرم سے راج کرتا تھا ایک دن کال کے بس ہو مرگیا پھر اسکا بیٹا دھرم دھوج نام گدی پر بیٹھا اور
راج کرنے لگا ایک دن اسنے ابھی چند دیوان کو پکڑوا سر پر سات چوٹی رکھوا منھ کالا کروا گدھے پر چڑھوا ڈونڈی بجوا تالی دلوا دیس سے نکال دیا ایک دن وہ راجہ بسنت رت مین رانیون کو ساتھ لے ایک باغ کی سیر کو گیا اس باغ مین ایک بڑا تالاب تھا اور اسمین کنول پھول رہے تھے راجہ اس سروور کی شوبھا دیکھ کپڑے اتار اشنان کرنے کو اترا ایک پھول توڑ تیر پر آ رانی کے ہاتھ مین دینے لگا کہ وہ پھول ہاتھ سے چھوٹ کر رانی کے پائون پر گرا اور اسکی چوٹ سے رانی کا پانون ٹوٹ گیا تب راجہ گھبرا کر ایک بارگی باہر نکل کر اس کی اوکھد کرنے لگا کہ اتنے مین رات ہوئی اور چندرمان نے پرکاش کیا چاند کی جوت پڑتے ہی دوسری رانی کے شریر مین پھپھولے پڑگئے تو مین اچانک دوسرے کسی گرہستی کی موسل کی آواز آئی اس سے تیسری رانی کے شر مین ایسا درد ہوا کہ غش آگیا اتنی بات کہہ بیتال بولا اے راجہ ان تینون مین اتِ
شکمار کون ہے راجہ نے کہا جس کے شریر مین درد ہو غش آیا وہی بہت نازک ہے یہ بات سُن بیتال پھر اسی درخت پر جا لٹکا اور راجہ اسے اتار گٹھری باندھ کاندھے پر رکھ لیچلا
{{c|گیارھوین کہانی}}
بیتال بولا کہ پونے پور نام ایک نگر ہے بہان بلبھ نام ایک راجہ تھا اور اسکے دیوان کا نام ست پرکاش تھا اس دیوان کی استری کا نام لکشمی اس راجہ نے ایک روز اپنے دیوان سے کہا جو راجہ ہوکر سندر استری سے بھوگ نہ کرے تو راج کرنا اسکا ہے سود ہے یہ بات کہ دیوان کو راج کا بھار دے آپ سکھہ سے عیش کرنے لگا اور راج کی سب چنتا چھوڑ دی اور دن رات آنند مین رہنے لگا اتفاقاً ایک روز وہ دیوان اپنے گھر مین اداس بیٹھا تھا کہ اسمین اسکی جورو نے پوچھا سلوامی ان
دنون آپکو بہت دُبلا دیکھتی ہون وہ بولا رات دن مجھے راج کی فکر رہتی ہی اس سے شریر دبلا ہو گیا اور راجہ تو انھون پر اپنے عیش و آرام مین رہتا ہے تو روایت<noinclude>[[Category:urdu]]</noinclude>
c65ifdhnrhhophhbzvhqvovh1tc80zv
سانچہ:Center/s
10
12895
32220
2025-11-05T05:14:07Z
en>CalendulaAsteraceae
0
Changed protection settings for "[[Template:Center/s]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32220
wikitext
text/x-wiki
<templatestyles src="center/styles.css" /><div class="wst-center tiInherit {{yesno|{{{nomargin|false}}}|yes=wst-center-nomargin}} {{#if:{{{class|}}}|{{{class|}}}}}" {{optional style|width={{{width|}}}|style={{{style|}}}}}><noinclude>
</div>
{{documentation|Template:Center/doc}}
</noinclude>
63lvr94yd95st11iu6bz9b09u8v2ed1
32221
31871
2026-04-22T02:15:05Z
Satdeep Gill
85
[[:en:Template:Center/s]] سے 1 نسخہ درآمد کیا گیا
31871
wikitext
text/x-wiki
<templatestyles src="center/styles.css" /><div class="wst-center tiInherit {{yesno|{{{nomargin|false}}}|yes=wst-center-nomargin}} {{#if:{{{class|}}}|{{{class|}}}}}" {{optional style|width={{{width|}}}|style={{{style|}}}}}><noinclude>
</div>
{{documentation|Template:Center/doc}}
</noinclude>
63lvr94yd95st11iu6bz9b09u8v2ed1
سانچہ:Center/e
10
12896
32222
2017-06-03T15:50:33Z
en>Beleg Tâl
0
merge
32222
wikitext
text/x-wiki
#redirect [[Template:Div end]]
s7hmu109ak6fmskssps3uvofxnxug6y
32223
31872
2026-04-22T02:15:05Z
Satdeep Gill
85
[[:en:Template:Center/e]] سے 1 نسخہ درآمد کیا گیا
31872
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{documentation}}
</noinclude>
4svdptpks693oo75dst5prxxduoz5on
سانچہ:Center/styles.css
10
12897
32240
2026-01-03T20:53:02Z
en>Alien333
0
readd margin:0 auto (makes the block still centered when width-limited
32240
sanitized-css
text/css
/* Basic alignment */
.wst-center {
text-align: center;
margin:0 auto;
}
/*
* p-wrapping gives us a hard 7px bottom margin that is undesireable when
* trying to align another element just below us (like a horizontal rule).
* This is a workaround for that by simply forcing the margin to zero.
*/
.wst-center.wst-center-nomargin > p {
margin-top: 0;
margin-bottom: 0;
}
adt37czn9vnhyxyv4vo6yqeve7mrja5
32241
31873
2026-04-22T02:15:06Z
Satdeep Gill
85
[[:en:Template:Center/styles.css]] سے 1 نسخہ درآمد کیا گیا
31873
sanitized-css
text/css
/* Basic alignment */
.wst-center {
text-align: center;
margin:0 auto;
}
/*
* p-wrapping gives us a hard 7px bottom margin that is undesireable when
* trying to align another element just below us (like a horizontal rule).
* This is a workaround for that by simply forcing the margin to zero.
*/
.wst-center.wst-center-nomargin > p {
margin-top: 0;
margin-bottom: 0;
}
adt37czn9vnhyxyv4vo6yqeve7mrja5
سانچہ:Center
10
12898
32194
2025-11-05T05:14:31Z
en>CalendulaAsteraceae
0
32194
wikitext
text/x-wiki
{{center/s|nomargin={{{nomargin|false}}}|class={{{class|}}}|width={{{width|}}}|style={{{style|}}}}}
{{{text|{{{1|}}}}}}
{{center/e}}{{#if:{{{text|{{{1|}}}}}}||{{category handler
| 1 = [[Category:Pages using center with no text argument]]
| main = 1
| page = 1
| translation = 1
| wikisource = 1
| nocat = {{{nocat|}}}
}}}}<noinclude>
{{documentation}}
</noinclude>
sajkpornjefuehvgvmqca73rttwl2dc
32195
31874
2026-04-22T02:15:03Z
Satdeep Gill
85
[[:en:Template:Center]] سے 1 نسخہ درآمد کیا گیا
31874
wikitext
text/x-wiki
#REDIRECT[[سانچہ:C]]
ihuwd8820xjf6qvskkvth770kocntmx
سانچہ:Col-begin
10
12899
32038
2024-04-28T00:04:07Z
en>Great Brightstar
0
32038
wikitext
text/x-wiki
<includeonly><templatestyles src="Col-begin/styles.css"/><div>
{| class="{{{class|}}} multicol" role="cols" style="{{#if:{{{small|}}}|font-size:90%; }}{{#if:{{{border|}}}|border: {{{border}}};}} {{#if:{{{bgColor|{{{bgcolor|}}}}}}|background:{{{bgColor|{{{bgcolor}}}}}};}} width:{{{width|100%!important}}}; {{{style|}}}"
|-
</includeonly><noinclude>{{documentation}}</noinclude>
ryqytjr582cvqbyhe36xap0q8muvm44
32039
31916
2026-04-22T02:14:13Z
Satdeep Gill
85
[[:en:Template:Col-begin]] سے 1 نسخہ درآمد کیا گیا
31916
wikitext
text/x-wiki
<templatestyles src="Col-begin/styles.css"/>
{| class="multicol {{{class|}}}" style="{{#if:{{{bgColor|}}}background-color: {{{bgColor}}}; }}width: {{{width|100%}}}"<noinclude>
|}
{{Documentation}}
</noinclude>
olnzvkt5n4al05mnp03kgabdtsj09ey
سانچہ:Col-begin/styles.css
10
12900
32046
2025-10-05T07:51:29Z
en>CalendulaAsteraceae
0
Protected "[[Template:Col-begin/styles.css]]": High traffic page or template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32046
sanitized-css
text/css
@media all and (max-width:720px) {
.multicol > tr > td,
.multicol > tbody > tr > td {
display:block !important;
width:100% !important;
padding:0 !important;
}
}
.multicol {
border:0;
border-collapse:collapse;
background-color:transparent;
color:inherit;
padding:0;
width:100%;
table-layout:fixed;
}
.multicol-align-left {
margin:0 auto 0 0;
}
.multicol-align-right {
margin:0 0 0 auto;
}
.multicol-align-center {
margin:0 auto;
}
.multicol > tr > td,
.multicol > tbody > tr > td {
vertical-align:top;
border:none;
border-inline-start:none;
border-inline-end:none;
}
.multicol-row td {
padding-right:10px;
}
.multicol-section td {
padding-right:10px;
}
.multicol-break {
padding-inline-start:10px;
padding-inline-end:10px;
}
c9angmlpe21luqzp63vh0mj3lkt0odx
32047
31917
2026-04-22T02:14:13Z
Satdeep Gill
85
[[:en:Template:Col-begin/styles.css]] سے 1 نسخہ درآمد کیا گیا
31917
sanitized-css
text/css
@media all and (max-width:720px) {
table.multicol > tr > td,
table.multicol > tbody > tr > td {
display:block;
width:100%;
padding:0;
}
}
table.multicol {
border: 0;
border-collapse: collapse;
background-color: transparent;
padding: 0;
}
table.multicol > tr > td,
table.multicol > tbody > tr > td {
vertical-align: top;
}
6q04hd4o9ljwhpuddiy4o6slepwsgbr
سانچہ:Col-end
10
12901
32040
2021-02-27T14:04:59Z
en>ShakespeareFan00
0
32040
wikitext
text/x-wiki
<includeonly>{{nopt}}
|}</div></includeonly><noinclude>
{{documentation}}
</noinclude>
bm4hgdkdrf4yz3ksjx3w0pbhvjzrjua
32041
31918
2026-04-22T02:14:13Z
Satdeep Gill
85
[[:en:Template:Col-end]] سے 1 نسخہ درآمد کیا گیا
31918
wikitext
text/x-wiki
<includeonly> 
|}</div></includeonly><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
k24bcp3cs0m8f59jwmhng1acd8tpifu
سانچہ:Documentation
10
12902
31943
2024-02-20T00:30:39Z
en>Uzume
0
stylesheet moved from [[Template:Documentation/styles.css]] to [[Module:Documentation/styles.css]] (via [[Module:Documentation/config#L-346]] cfg['templatestyles'] and [[Module:Documentation#L-166]])
31943
wikitext
text/x-wiki
{{#invoke:documentation|main}}
gu7dkwkxnrequjiuw38hbtjihjxr36x
31944
31919
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Template:Documentation]] سے 1 نسخہ درآمد کیا گیا
31919
wikitext
text/x-wiki
#رجوع_مکرر
[[سانچہ:دستاویز]]
clcvyqh0tziiv6lhbm1oyv0oedobfcf
میڈیاویکی:Proofreadpage index template
8
12904
31931
2022-11-05T17:42:19Z
en>Xover
0
Migrate all the remaining to the module.
31931
wikitext
text/x-wiki
<includeonly><templatestyles src="Module:Proofreadpage index template/styles.css" />
{{#invoke:Proofreadpage index template|main}}</includeonly><noinclude>
{{documentation|Template:Proofreadpage index template/doc}}
</noinclude>
0imjd0yqeyuq6eg1eh0gnin1ogpeh0g
31932
31931
2026-04-22T01:45:33Z
Satdeep Gill
85
[[:en:MediaWiki:Proofreadpage_index_template]] سے 1 نسخہ درآمد کیا گیا
31931
wikitext
text/x-wiki
<includeonly><templatestyles src="Module:Proofreadpage index template/styles.css" />
{{#invoke:Proofreadpage index template|main}}</includeonly><noinclude>
{{documentation|Template:Proofreadpage index template/doc}}
</noinclude>
0imjd0yqeyuq6eg1eh0gnin1ogpeh0g
ماڈیول:Yesno
828
12905
31933
2021-03-26T18:44:37Z
en>Xover
0
Protected "[[Module:Yesno]]": Core module which should only be changed through import from its upstream at enwp. ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
31933
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
swdskn7svew8i9wuydn9uj5l3r2ghcs
31934
31933
2026-04-22T01:45:33Z
Satdeep Gill
85
[[:en:Module:Yesno]] سے 1 نسخہ درآمد کیا گیا
31933
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
return function (val, default)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
-- following line.
val = type(val) == 'string' and val:lower() or val
if val == nil then
return nil
elseif val == true
or val == 'yes'
or val == 'y'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
return true
elseif val == false
or val == 'no'
or val == 'n'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
else
return default
end
end
swdskn7svew8i9wuydn9uj5l3r2ghcs
ماڈیول:Arguments
828
12906
31935
2025-03-10T07:21:37Z
en>CalendulaAsteraceae
0
tweak comment line breaks
31935
Scribunto
text/plain
--[=[
This module provides easy processing of arguments passed to Scribunto from #invoke.
It is intended for use by other Lua modules, and should not be called from #invoke directly.
]=]
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
ojpf6n6krtbq2o9ezlxv201kqkc2udp
31936
31935
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Module:Arguments]] سے 1 نسخہ درآمد کیا گیا
31935
Scribunto
text/plain
--[=[
This module provides easy processing of arguments passed to Scribunto from #invoke.
It is intended for use by other Lua modules, and should not be called from #invoke directly.
]=]
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local arguments = {}
-- Generate four different tidyVal functions, so that we don't have to check the options every time we call it.
local function tidyValDefault(key, val)
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val == '' then
return nil
else
return val
end
else
return val
end
end
local function tidyValTrimOnly(key, val)
if type(val) == 'string' then
return val:match('^%s*(.-)%s*$')
else
return val
end
end
local function tidyValRemoveBlanksOnly(key, val)
if type(val) == 'string' then
if val:find('%S') then
return val
else
return nil
end
else
return val
end
end
local function tidyValNoChange(key, val)
return val
end
local function matchesTitle(given, title)
local tp = type( given )
return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end
local translate_mt = { __index = function(t, k) return k end }
function arguments.getArgs(frame, options)
checkType('getArgs', 1, frame, 'table', true)
checkType('getArgs', 2, options, 'table', true)
frame = frame or {}
options = options or {}
--[[
-- Set up argument translation.
--]]
options.translate = options.translate or {}
if getmetatable(options.translate) == nil then
setmetatable(options.translate, translate_mt)
end
if options.backtranslate == nil then
options.backtranslate = {}
for k,v in pairs(options.translate) do
options.backtranslate[v] = k
end
end
if options.backtranslate and getmetatable(options.backtranslate) == nil then
setmetatable(options.backtranslate, {
__index = function(t, k)
if options.translate[k] ~= k then
return nil
else
return k
end
end
})
end
--[[
-- Get the argument tables. If we were passed a valid frame object, get the
-- frame arguments (fargs) and the parent frame arguments (pargs), depending
-- on the options set and on the parent frame's availability. If we weren't
-- passed a valid frame object, we are being called from another Lua module
-- or from the debug console, so assume that we were passed a table of args
-- directly, and assign it to a new variable (luaArgs).
--]]
local fargs, pargs, luaArgs
if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
if options.wrappers then
--[[
-- The wrappers option makes Module:Arguments look up arguments in
-- either the frame argument table or the parent argument table, but
-- not both. This means that users can use either the #invoke syntax
-- or a wrapper template without the loss of performance associated
-- with looking arguments up in both the frame and the parent frame.
-- Module:Arguments will look up arguments in the parent frame
-- if it finds the parent frame's title in options.wrapper;
-- otherwise it will look up arguments in the frame object passed
-- to getArgs.
--]]
local parent = frame:getParent()
if not parent then
fargs = frame.args
else
local title = parent:getTitle():gsub('/sandbox$', '')
local found = false
if matchesTitle(options.wrappers, title) then
found = true
elseif type(options.wrappers) == 'table' then
for _,v in pairs(options.wrappers) do
if matchesTitle(v, title) then
found = true
break
end
end
end
-- We test for false specifically here so that nil (the default) acts like true.
if found or options.frameOnly == false then
pargs = parent.args
end
if not found or options.parentOnly == false then
fargs = frame.args
end
end
else
-- options.wrapper isn't set, so check the other options.
if not options.parentOnly then
fargs = frame.args
end
if not options.frameOnly then
local parent = frame:getParent()
pargs = parent and parent.args or nil
end
end
if options.parentFirst then
fargs, pargs = pargs, fargs
end
else
luaArgs = frame
end
-- Set the order of precedence of the argument tables. If the variables are
-- nil, nothing will be added to the table, which is how we avoid clashes
-- between the frame/parent args and the Lua args.
local argTables = {fargs}
argTables[#argTables + 1] = pargs
argTables[#argTables + 1] = luaArgs
--[[
-- Generate the tidyVal function. If it has been specified by the user, we
-- use that; if not, we choose one of four functions depending on the
-- options chosen. This is so that we don't have to call the options table
-- every time the function is called.
--]]
local tidyVal = options.valueFunc
if tidyVal then
if type(tidyVal) ~= 'function' then
error(
"bad value assigned to option 'valueFunc'"
.. '(function expected, got '
.. type(tidyVal)
.. ')',
2
)
end
elseif options.trim ~= false then
if options.removeBlanks ~= false then
tidyVal = tidyValDefault
else
tidyVal = tidyValTrimOnly
end
else
if options.removeBlanks ~= false then
tidyVal = tidyValRemoveBlanksOnly
else
tidyVal = tidyValNoChange
end
end
--[[
-- Set up the args, metaArgs and nilArgs tables. args will be the one
-- accessed from functions, and metaArgs will hold the actual arguments. Nil
-- arguments are memoized in nilArgs, and the metatable connects all of them
-- together.
--]]
local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
setmetatable(args, metatable)
local function mergeArgs(tables)
--[[
-- Accepts multiple tables as input and merges their keys and values
-- into one table. If a value is already present it is not overwritten;
-- tables listed earlier have precedence. We are also memoizing nil
-- values, which can be overwritten if they are 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in pairs(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = 's'
else
metaArgs[key] = tidiedVal
end
end
end
end
end
--[[
-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
-- and are only fetched from the argument tables once. Fetching arguments
-- from the argument tables is the most resource-intensive step in this
-- module, so we try and avoid it where possible. For this reason, nil
-- arguments are also memoized, in the nilArgs table. Also, we keep a record
-- in the metatable of when pairs and ipairs have been called, so we do not
-- run pairs and ipairs on the argument tables more than once. We also do
-- not run ipairs on fargs and pargs if pairs has already been run, as all
-- the arguments will already have been copied over.
--]]
metatable.__index = function (t, key)
--[[
-- Fetches an argument when the args table is indexed. First we check
-- to see if the value is memoized, and if not we try and fetch it from
-- the argument tables. When we check memoization, we need to check
-- metaArgs before nilArgs, as both can be non-nil at the same time.
-- If the argument is not present in metaArgs, we also check whether
-- pairs has been run yet. If pairs has already been run, we return nil.
-- This is because all the arguments will have already been copied into
-- metaArgs by the mergeArgs function, meaning that any other arguments
-- must be nil.
--]]
if type(key) == 'string' then
key = options.translate[key]
end
local val = metaArgs[key]
if val ~= nil then
return val
elseif metatable.donePairs or nilArgs[key] then
return nil
end
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal ~= nil then
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = 'h'
return nil
end
metatable.__newindex = function (t, key, val)
-- This function is called when a module tries to add a new value to the
-- args table, or tries to change an existing value.
if type(key) == 'string' then
key = options.translate[key]
end
if options.readOnly then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; the table is read-only',
2
)
elseif options.noOverwrite and args[key] ~= nil then
error(
'could not write to argument table key "'
.. tostring(key)
.. '"; overwriting existing arguments is not permitted',
2
)
elseif val == nil then
--[[
-- If the argument is to be overwritten with nil, we need to erase
-- the value in metaArgs, so that __index, __pairs and __ipairs do
-- not use a previous existing value, if present; and we also need
-- to memoize the nil in nilArgs, so that the value isn't looked
-- up in the argument tables if it is accessed again.
--]]
metaArgs[key] = nil
nilArgs[key] = 'h'
else
metaArgs[key] = val
end
end
local function translatenext(invariant)
local k, v = next(invariant.t, invariant.k)
invariant.k = k
if k == nil then
return nil
elseif type(k) ~= 'string' or not options.backtranslate then
return k, v
else
local backtranslate = options.backtranslate[k]
if backtranslate == nil then
-- Skip this one. This is a tail call, so this won't cause stack overflow
return translatenext(invariant)
else
return backtranslate, v
end
end
end
metatable.__pairs = function ()
-- Called when pairs is run on the args table.
if not metatable.donePairs then
mergeArgs(argTables)
metatable.donePairs = true
end
return translatenext, { t = metaArgs }
end
local function inext(t, i)
-- This uses our __index metamethod
local v = t[i + 1]
if v ~= nil then
return i + 1, v
end
end
metatable.__ipairs = function (t)
-- Called when ipairs is run on the args table.
return inext, t, 0
end
return args
end
return arguments
ojpf6n6krtbq2o9ezlxv201kqkc2udp
ماڈیول:TableTools
828
12907
31937
2024-09-28T04:22:48Z
en>CalendulaAsteraceae
0
copy update from [[w:Module:TableTools]]
31937
Scribunto
text/plain
------------------------------------------------------------------------------------
-- TableTools --
-- --
-- This module includes a number of functions for dealing with Lua tables. --
-- It is a meta-module, meant to be called from other Lua modules, and should not --
-- be called directly from #invoke. --
------------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local p = {}
-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
function p.isPositiveInteger(v)
return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
end
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false if
-- not. Although it doesn't operate on tables, it is included here as it is useful
-- for determining whether a value can be a valid table key. Lua will generate an
-- error if a NaN is used as a table key.
------------------------------------------------------------------------------------
function p.isNan(v)
return type(v) == 'number' and v ~= v
end
------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
function p.shallowClone(t)
checkType('shallowClone', 1, t, 'table')
local ret = {}
for k, v in pairs(t) do
ret[k] = v
end
return ret
end
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
function p.removeDuplicates(arr)
checkType('removeDuplicates', 1, arr, 'table')
local isNan = p.isNan
local ret, exists = {}, {}
for _, v in ipairs(arr) do
if isNan(v) then
-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
ret[#ret + 1] = v
elseif not exists[v] then
ret[#ret + 1] = v
exists[v] = true
end
end
return ret
end
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
function p.numKeys(t)
checkType('numKeys', 1, t, 'table')
local isPositiveInteger = p.isPositiveInteger
local nums = {}
for k in pairs(t) do
if isPositiveInteger(k) then
nums[#nums + 1] = k
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return
-- {1, 3, 6}.
------------------------------------------------------------------------------------
function p.affixNums(t, prefix, suffix)
checkType('affixNums', 1, t, 'table')
checkType('affixNums', 2, prefix, 'string', true)
checkType('affixNums', 3, suffix, 'string', true)
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
end
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
local nums = {}
for k in pairs(t) do
if type(k) == 'string' then
local num = mw.ustring.match(k, pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table
-- of subtables in the format
-- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}.
-- Keys that don't end with an integer are stored in a subtable named "other". The
-- compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
function p.numData(t, compress)
checkType('numData', 1, t, 'table')
checkType('numData', 2, compress, 'boolean', true)
local ret = {}
for k, v in pairs(t) do
local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
if num then
num = tonumber(num)
local subtable = ret[num] or {}
if prefix == '' then
-- Positional parameters match the blank string; put them at the start of the subtable instead.
prefix = 1
end
subtable[prefix] = v
ret[num] = subtable
else
local subtable = ret.other or {}
subtable[k] = v
ret.other = subtable
end
end
if compress then
local other = ret.other
ret = p.compressSparseArray(ret)
ret.other = other
end
return ret
end
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
function p.compressSparseArray(t)
checkType('compressSparseArray', 1, t, 'table')
local ret = {}
local nums = p.numKeys(t)
for _, num in ipairs(nums) do
ret[#ret + 1] = t[num]
end
return ret
end
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
function p.sparseIpairs(t)
checkType('sparseIpairs', 1, t, 'table')
local nums = p.numKeys(t)
local i = 0
local lim = #nums
return function ()
i = i + 1
if i <= lim then
local key = nums[i]
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
function p.size(t)
checkType('size', 1, t, 'table')
local i = 0
for _ in pairs(t) do
i = i + 1
end
return i
end
local function defaultKeySort(item1, item2)
-- "number" < "string", so numbers will be sorted before strings.
local type1, type2 = type(item1), type(item2)
if type1 ~= type2 then
return type1 < type2
elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
return tostring(item1) < tostring(item2)
else
return item1 < item2
end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array of the keys in a table, sorted using either a default
-- comparison function or a custom keySort function.
------------------------------------------------------------------------------------
function p.keysToList(t, keySort, checked)
if not checked then
checkType('keysToList', 1, t, 'table')
checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'})
end
local arr = {}
local index = 1
for k in pairs(t) do
arr[index] = k
index = index + 1
end
if keySort ~= false then
keySort = type(keySort) == 'function' and keySort or defaultKeySort
table.sort(arr, keySort)
end
return arr
end
------------------------------------------------------------------------------------
-- sortedPairs
--
-- Iterates through a table, with the keys sorted using the keysToList function.
-- If there are only numerical keys, sparseIpairs is probably more efficient.
------------------------------------------------------------------------------------
function p.sortedPairs(t, keySort)
checkType('sortedPairs', 1, t, 'table')
checkType('sortedPairs', 2, keySort, 'function', true)
local arr = p.keysToList(t, keySort, true)
local i = 0
return function ()
i = i + 1
local key = arr[i]
if key ~= nil then
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
if type(v) ~= 'table' then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
if not pcall(pairs, v) then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
checkType("invert", 1, arr, "table")
local isNan = p.isNan
local map = {}
for i, v in ipairs(arr) do
if not isNan(v) then
map[v] = i
end
end
return map
end
------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
checkType("listToSet", 1, arr, "table")
local isNan = p.isNan
local set = {}
for _, v in ipairs(arr) do
if not isNan(v) then
set[v] = true
end
end
return set
end
------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
if type(orig) ~= "table" then
return orig
end
-- already_seen stores copies of tables indexed by the original table.
local copy = already_seen[orig]
if copy ~= nil then
return copy
end
copy = {}
already_seen[orig] = copy -- memoize before any recursion, to avoid infinite loops
for orig_key, orig_value in pairs(orig) do
copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
end
if includeMetatable then
local mt = getmetatable(orig)
if mt ~= nil then
setmetatable(copy, _deepCopy(mt, true, already_seen))
end
end
return copy
end
function p.deepCopy(orig, noMetatable, already_seen)
checkType("deepCopy", 3, already_seen, "table", true)
return _deepCopy(orig, not noMetatable, already_seen or {})
end
------------------------------------------------------------------------------------
-- sparseConcat
--
-- Concatenates all values in the table that are indexed by a number, in order.
-- sparseConcat{a, nil, c, d} => "acd"
-- sparseConcat{nil, b, c, d} => "bcd"
------------------------------------------------------------------------------------
function p.sparseConcat(t, sep, i, j)
local arr = {}
local arr_i = 0
for _, v in p.sparseIpairs(t) do
arr_i = arr_i + 1
arr[arr_i] = v
end
return table.concat(arr, sep, i, j)
end
------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. It is similar to the
-- operator #, but may return a different value when there are gaps in the array
-- portion of the table. Intended to be used on data loaded with mw.loadData. For
-- other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of the number
-- of unnamed template parameters, so use this function for frame.args.
------------------------------------------------------------------------------------
function p.length(t, prefix)
-- requiring module inline so that [[Module:Exponential search]] which is
-- only needed by this one function doesn't get millions of transclusions
local expSearch = require("Module:Exponential search")
checkType('length', 1, t, 'table')
checkType('length', 2, prefix, 'string', true)
return expSearch(function (i)
local key
if prefix then
key = prefix .. tostring(i)
else
key = i
end
return t[key] ~= nil
end) or 0
end
------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if searchElement is a member of the array, and false otherwise.
-- Equivalent to JavaScript array.includes(searchElement) or
-- array.includes(searchElement, fromIndex), except fromIndex is 1 indexed
------------------------------------------------------------------------------------
function p.inArray(array, searchElement, fromIndex)
checkType("inArray", 1, array, "table")
-- if searchElement is nil, error?
fromIndex = tonumber(fromIndex)
if fromIndex then
if (fromIndex < 0) then
fromIndex = #array + fromIndex + 1
end
if fromIndex < 1 then fromIndex = 1 end
for _, v in ipairs({unpack(array, fromIndex)}) do
if v == searchElement then
return true
end
end
else
for _, v in pairs(array) do
if v == searchElement then
return true
end
end
end
return false
end
------------------------------------------------------------------------------------
-- merge
--
-- Given the arrays, returns an array containing the elements of each input array
-- in sequence.
------------------------------------------------------------------------------------
function p.merge(...)
local arrays = {...}
local ret = {}
for i, arr in ipairs(arrays) do
checkType('merge', i, arr, 'table')
for _, v in ipairs(arr) do
ret[#ret + 1] = v
end
end
return ret
end
------------------------------------------------------------------------------------
-- extend
--
-- Extends the first array in place by appending all elements from the second
-- array.
------------------------------------------------------------------------------------
function p.extend(arr1, arr2)
checkType('extend', 1, arr1, 'table')
checkType('extend', 2, arr2, 'table')
for _, v in ipairs(arr2) do
arr1[#arr1 + 1] = v
end
end
return p
4n03zk6kcoeg4gz82mieeh94c1szcjy
31938
31937
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Module:TableTools]] سے 1 نسخہ درآمد کیا گیا
31937
Scribunto
text/plain
------------------------------------------------------------------------------------
-- TableTools --
-- --
-- This module includes a number of functions for dealing with Lua tables. --
-- It is a meta-module, meant to be called from other Lua modules, and should not --
-- be called directly from #invoke. --
------------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local p = {}
-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
function p.isPositiveInteger(v)
return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
end
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false if
-- not. Although it doesn't operate on tables, it is included here as it is useful
-- for determining whether a value can be a valid table key. Lua will generate an
-- error if a NaN is used as a table key.
------------------------------------------------------------------------------------
function p.isNan(v)
return type(v) == 'number' and v ~= v
end
------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
function p.shallowClone(t)
checkType('shallowClone', 1, t, 'table')
local ret = {}
for k, v in pairs(t) do
ret[k] = v
end
return ret
end
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
function p.removeDuplicates(arr)
checkType('removeDuplicates', 1, arr, 'table')
local isNan = p.isNan
local ret, exists = {}, {}
for _, v in ipairs(arr) do
if isNan(v) then
-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
ret[#ret + 1] = v
elseif not exists[v] then
ret[#ret + 1] = v
exists[v] = true
end
end
return ret
end
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
function p.numKeys(t)
checkType('numKeys', 1, t, 'table')
local isPositiveInteger = p.isPositiveInteger
local nums = {}
for k in pairs(t) do
if isPositiveInteger(k) then
nums[#nums + 1] = k
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return
-- {1, 3, 6}.
------------------------------------------------------------------------------------
function p.affixNums(t, prefix, suffix)
checkType('affixNums', 1, t, 'table')
checkType('affixNums', 2, prefix, 'string', true)
checkType('affixNums', 3, suffix, 'string', true)
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
end
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
local nums = {}
for k in pairs(t) do
if type(k) == 'string' then
local num = mw.ustring.match(k, pattern)
if num then
nums[#nums + 1] = tonumber(num)
end
end
end
table.sort(nums)
return nums
end
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table
-- of subtables in the format
-- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}.
-- Keys that don't end with an integer are stored in a subtable named "other". The
-- compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
function p.numData(t, compress)
checkType('numData', 1, t, 'table')
checkType('numData', 2, compress, 'boolean', true)
local ret = {}
for k, v in pairs(t) do
local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
if num then
num = tonumber(num)
local subtable = ret[num] or {}
if prefix == '' then
-- Positional parameters match the blank string; put them at the start of the subtable instead.
prefix = 1
end
subtable[prefix] = v
ret[num] = subtable
else
local subtable = ret.other or {}
subtable[k] = v
ret.other = subtable
end
end
if compress then
local other = ret.other
ret = p.compressSparseArray(ret)
ret.other = other
end
return ret
end
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
function p.compressSparseArray(t)
checkType('compressSparseArray', 1, t, 'table')
local ret = {}
local nums = p.numKeys(t)
for _, num in ipairs(nums) do
ret[#ret + 1] = t[num]
end
return ret
end
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
function p.sparseIpairs(t)
checkType('sparseIpairs', 1, t, 'table')
local nums = p.numKeys(t)
local i = 0
local lim = #nums
return function ()
i = i + 1
if i <= lim then
local key = nums[i]
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
function p.size(t)
checkType('size', 1, t, 'table')
local i = 0
for _ in pairs(t) do
i = i + 1
end
return i
end
local function defaultKeySort(item1, item2)
-- "number" < "string", so numbers will be sorted before strings.
local type1, type2 = type(item1), type(item2)
if type1 ~= type2 then
return type1 < type2
elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
return tostring(item1) < tostring(item2)
else
return item1 < item2
end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array of the keys in a table, sorted using either a default
-- comparison function or a custom keySort function.
------------------------------------------------------------------------------------
function p.keysToList(t, keySort, checked)
if not checked then
checkType('keysToList', 1, t, 'table')
checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'})
end
local arr = {}
local index = 1
for k in pairs(t) do
arr[index] = k
index = index + 1
end
if keySort ~= false then
keySort = type(keySort) == 'function' and keySort or defaultKeySort
table.sort(arr, keySort)
end
return arr
end
------------------------------------------------------------------------------------
-- sortedPairs
--
-- Iterates through a table, with the keys sorted using the keysToList function.
-- If there are only numerical keys, sparseIpairs is probably more efficient.
------------------------------------------------------------------------------------
function p.sortedPairs(t, keySort)
checkType('sortedPairs', 1, t, 'table')
checkType('sortedPairs', 2, keySort, 'function', true)
local arr = p.keysToList(t, keySort, true)
local i = 0
return function ()
i = i + 1
local key = arr[i]
if key ~= nil then
return key, t[key]
else
return nil, nil
end
end
end
------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
if type(v) ~= 'table' then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
if not pcall(pairs, v) then
return false
end
local i = 0
for _ in pairs(v) do
i = i + 1
if v[i] == nil then
return false
end
end
return true
end
------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
checkType("invert", 1, arr, "table")
local isNan = p.isNan
local map = {}
for i, v in ipairs(arr) do
if not isNan(v) then
map[v] = i
end
end
return map
end
------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
checkType("listToSet", 1, arr, "table")
local isNan = p.isNan
local set = {}
for _, v in ipairs(arr) do
if not isNan(v) then
set[v] = true
end
end
return set
end
------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
if type(orig) ~= "table" then
return orig
end
-- already_seen stores copies of tables indexed by the original table.
local copy = already_seen[orig]
if copy ~= nil then
return copy
end
copy = {}
already_seen[orig] = copy -- memoize before any recursion, to avoid infinite loops
for orig_key, orig_value in pairs(orig) do
copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
end
if includeMetatable then
local mt = getmetatable(orig)
if mt ~= nil then
setmetatable(copy, _deepCopy(mt, true, already_seen))
end
end
return copy
end
function p.deepCopy(orig, noMetatable, already_seen)
checkType("deepCopy", 3, already_seen, "table", true)
return _deepCopy(orig, not noMetatable, already_seen or {})
end
------------------------------------------------------------------------------------
-- sparseConcat
--
-- Concatenates all values in the table that are indexed by a number, in order.
-- sparseConcat{a, nil, c, d} => "acd"
-- sparseConcat{nil, b, c, d} => "bcd"
------------------------------------------------------------------------------------
function p.sparseConcat(t, sep, i, j)
local arr = {}
local arr_i = 0
for _, v in p.sparseIpairs(t) do
arr_i = arr_i + 1
arr[arr_i] = v
end
return table.concat(arr, sep, i, j)
end
------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. It is similar to the
-- operator #, but may return a different value when there are gaps in the array
-- portion of the table. Intended to be used on data loaded with mw.loadData. For
-- other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of the number
-- of unnamed template parameters, so use this function for frame.args.
------------------------------------------------------------------------------------
function p.length(t, prefix)
-- requiring module inline so that [[Module:Exponential search]] which is
-- only needed by this one function doesn't get millions of transclusions
local expSearch = require("Module:Exponential search")
checkType('length', 1, t, 'table')
checkType('length', 2, prefix, 'string', true)
return expSearch(function (i)
local key
if prefix then
key = prefix .. tostring(i)
else
key = i
end
return t[key] ~= nil
end) or 0
end
------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if searchElement is a member of the array, and false otherwise.
-- Equivalent to JavaScript array.includes(searchElement) or
-- array.includes(searchElement, fromIndex), except fromIndex is 1 indexed
------------------------------------------------------------------------------------
function p.inArray(array, searchElement, fromIndex)
checkType("inArray", 1, array, "table")
-- if searchElement is nil, error?
fromIndex = tonumber(fromIndex)
if fromIndex then
if (fromIndex < 0) then
fromIndex = #array + fromIndex + 1
end
if fromIndex < 1 then fromIndex = 1 end
for _, v in ipairs({unpack(array, fromIndex)}) do
if v == searchElement then
return true
end
end
else
for _, v in pairs(array) do
if v == searchElement then
return true
end
end
end
return false
end
------------------------------------------------------------------------------------
-- merge
--
-- Given the arrays, returns an array containing the elements of each input array
-- in sequence.
------------------------------------------------------------------------------------
function p.merge(...)
local arrays = {...}
local ret = {}
for i, arr in ipairs(arrays) do
checkType('merge', i, arr, 'table')
for _, v in ipairs(arr) do
ret[#ret + 1] = v
end
end
return ret
end
------------------------------------------------------------------------------------
-- extend
--
-- Extends the first array in place by appending all elements from the second
-- array.
------------------------------------------------------------------------------------
function p.extend(arr1, arr2)
checkType('extend', 1, arr1, 'table')
checkType('extend', 2, arr2, 'table')
for _, v in ipairs(arr2) do
arr1[#arr1 + 1] = v
end
end
return p
4n03zk6kcoeg4gz82mieeh94c1szcjy
ماڈیول:Message box
828
12908
31939
2025-01-01T20:03:45Z
en>Xover
0
add back in local pmbox logic
31939
Scribunto
text/plain
require('strict')
local getArgs
local yesno = require('Module:Yesno')
local lang = mw.language.getContentLanguage()
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
elseif ns == 104 then
obj.cfg = cfg.pmbox -- page namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
self.typeImageNeedsLink = typeData.imageNeedsLink
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Set image classes.
self.imageRightClass = args.imagerightclass or args.imageclass
self.imageLeftClass = args.imageleftclass or args.imageclass
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{ambox}}.
if self.useCollapsibleTextFields then
-- Get the self.issue value.
if self.isSmall and args.smalltext then
self.issue = args.smalltext
else
local sect
if args.sect == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. args.sect
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
-- Get the self.talk value.
local talk = args.talk
-- Show talk links on the template page or template subpages if the talk
-- parameter is blank.
if talk == ''
and self.templateTitle
and (
mw.title.equals(self.templateTitle, self.title)
or self.title:isSubpageOf(self.templateTitle)
)
then
talk = '#'
elseif talk == '' then
talk = nil
end
if talk then
-- If the talk value is a talk page, make a link to that page. Else
-- assume that it's a section heading, and make a link to the talk
-- page of the current page with that section heading.
local talkTitle = getTitleObject(talk)
local talkArgIsTalkPage = true
if not talkTitle or not talkTitle.isTalkPage then
talkArgIsTalkPage = false
talkTitle = getTitleObject(
self.title.text,
mw.site.namespaces[self.title.namespace].talk.id
)
end
if talkTitle and talkTitle.exists then
local talkText
if self.isSmall then
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
talkText = string.format('([[%s|talk]])', talkLink)
else
talkText = 'Relevant discussion may be found on'
if talkArgIsTalkPage then
talkText = string.format(
'%s [[%s|%s]].',
talkText,
talk,
talkTitle.prefixedText
)
else
talkText = string.format(
'%s the [[%s#%s|talk page]].',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
end
end
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
if args.date and args.date ~= '' then
date = args.date
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('F Y')
end
if date then
self.date = string.format(" <span class='date-container'><i>(<span class='date'>%s</span>)</i></span>", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
-- Left image settings.
local imageLeft = self.isSmall and args.smallimage or args.image
if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
or not cfg.imageCheckBlank and imageLeft ~= 'none'
then
self.imageLeft = imageLeft
if not imageLeft then
local imageSize = self.isSmall
and (cfg.imageSmallSize or '30x30px')
or '40x40px'
self.imageLeft = string.format('[[File:%s|%s%s|alt=]]', self.typeImage
or 'Information icon4.svg', imageSize, self.typeImageNeedsLink and "" or "|link=" )
end
end
-- Right image settings.
local imageRight = self.isSmall and args.smallimageright or args.imageright
if not (cfg.imageRightNone and imageRight == 'none') then
self.imageRight = imageRight
end
-- set templatestyles
self.base_templatestyles = cfg.templatestyles
self.templatestyles = args.templatestyles
end
function MessageBox:setMainspaceCategories()
local args = self.args
local cfg = self.cfg
if not cfg.allowMainspaceCategories then
return nil
end
local nums = {}
for _, prefix in ipairs{'cat', 'category', 'all'} do
args[prefix .. '1'] = args[prefix]
nums = union(nums, getArgNums(args, prefix))
end
-- The following is roughly equivalent to the old {{Ambox/category}}.
local date = args.date
date = type(date) == 'string' and date
local preposition = 'from'
for _, num in ipairs(nums) do
local mainCat = args['cat' .. tostring(num)]
or args['category' .. tostring(num)]
local allCat = args['all' .. tostring(num)]
mainCat = type(mainCat) == 'string' and mainCat
allCat = type(allCat) == 'string' and allCat
if mainCat and date and date ~= '' then
local catTitle = string.format('%s %s %s', mainCat, preposition, date)
self:addCat(0, catTitle)
catTitle = getTitleObject('Category:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, 'Articles with invalid date parameter in template')
end
elseif mainCat and (not date or date == '') then
self:addCat(0, mainCat)
end
if allCat then
self:addCat(0, allCat)
end
end
end
function MessageBox:setTemplateCategories()
local args = self.args
local cfg = self.cfg
-- Add template categories.
if cfg.templateCategory then
if cfg.templateCategoryRequireName then
if self.isTemplatePage then
self:addCat(10, cfg.templateCategory)
end
elseif not self.title.isSubpage then
self:addCat(10, cfg.templateCategory)
end
end
-- Add template error categories.
if cfg.templateErrorCategory then
local templateErrorCategory = cfg.templateErrorCategory
local templateCat, templateSort
if not self.name and not self.title.isSubpage then
templateCat = templateErrorCategory
elseif self.isTemplatePage then
local paramsToCheck = cfg.templateErrorParamsToCheck or {}
local count = 0
for i, param in ipairs(paramsToCheck) do
if not args[param] then
count = count + 1
end
end
if count > 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums > 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
end
if self.isSubstituted then
self:addCat('all', 'Pages with incorrectly substituted templates')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
local frame = mw.getCurrentFrame()
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.base_templatestyles },
})
-- Add support for a single custom templatestyles sheet. Undocumented as
-- need should be limited and many templates using mbox are substed; we
-- don't want to spread templatestyles sheets around to arbitrary places
if self.templatestyles then
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.templatestyles },
})
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div')
end
imageLeftCell
:addClass(self.imageLeftClass)
:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
end
textCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div')
end
imageRightCell
:addClass(self.imageRightClass)
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:addClass('mbox-invalid-type')
:wikitext(string.format(
'This message box is using an invalid "type=%s" parameter and needs fixing.',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)
l2lsrcywbr8gjtqec5b7gi7nazry5co
31940
31939
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Module:Message_box]] سے 1 نسخہ درآمد کیا گیا
31939
Scribunto
text/plain
require('strict')
local getArgs
local yesno = require('Module:Yesno')
local lang = mw.language.getContentLanguage()
local CONFIG_MODULE = 'Module:Message box/configuration'
local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getTitleObject(...)
-- Get the title object, passing the function through pcall
-- in case we are over the expensive function count limit.
local success, title = pcall(mw.title.new, ...)
if success then
return title
end
end
local function union(t1, t2)
-- Returns the union of two arrays.
local vals = {}
for i, v in ipairs(t1) do
vals[v] = true
end
for i, v in ipairs(t2) do
vals[v] = true
end
local ret = {}
for k in pairs(vals) do
table.insert(ret, k)
end
table.sort(ret)
return ret
end
local function getArgNums(args, prefix)
local nums = {}
for k, v in pairs(args) do
local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$')
if num then
table.insert(nums, tonumber(num))
end
end
table.sort(nums)
return nums
end
--------------------------------------------------------------------------------
-- Box class definition
--------------------------------------------------------------------------------
local MessageBox = {}
MessageBox.__index = MessageBox
function MessageBox.new(boxType, args, cfg)
args = args or {}
local obj = {}
-- Set the title object and the namespace.
obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()
-- Set the config for our box type.
obj.cfg = cfg[boxType]
if not obj.cfg then
local ns = obj.title.namespace
-- boxType is "mbox" or invalid input
if args.demospace and args.demospace ~= '' then
-- implement demospace parameter of mbox
local demospace = string.lower(args.demospace)
if DEMOSPACES[demospace] then
-- use template from DEMOSPACES
obj.cfg = cfg[DEMOSPACES[demospace]]
elseif string.find( demospace, 'talk' ) then
-- demo as a talk page
obj.cfg = cfg.tmbox
else
-- default to ombox
obj.cfg = cfg.ombox
end
elseif ns == 0 then
obj.cfg = cfg.ambox -- main namespace
elseif ns == 6 then
obj.cfg = cfg.imbox -- file namespace
elseif ns == 14 then
obj.cfg = cfg.cmbox -- category namespace
elseif ns == 104 then
obj.cfg = cfg.pmbox -- page namespace
else
local nsTable = mw.site.namespaces[ns]
if nsTable and nsTable.isTalk then
obj.cfg = cfg.tmbox -- any talk namespace
else
obj.cfg = cfg.ombox -- other namespaces or invalid input
end
end
end
-- Set the arguments, and remove all blank arguments except for the ones
-- listed in cfg.allowBlankParams.
do
local newArgs = {}
for k, v in pairs(args) do
if v ~= '' then
newArgs[k] = v
end
end
for i, param in ipairs(obj.cfg.allowBlankParams or {}) do
newArgs[param] = args[param]
end
obj.args = newArgs
end
-- Define internal data structure.
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
end
function MessageBox:addCat(ns, cat, sort)
if not cat then
return nil
end
if sort then
cat = string.format('[[Category:%s|%s]]', cat, sort)
else
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
end
function MessageBox:addClass(class)
if not class then
return nil
end
table.insert(self.classes, class)
end
function MessageBox:setParameters()
local args = self.args
local cfg = self.cfg
-- Get type data.
self.type = args.type
local typeData = cfg.types[self.type]
self.invalidTypeError = cfg.showInvalidTypeError
and self.type
and not typeData
typeData = typeData or cfg.types[cfg.default]
self.typeClass = typeData.class
self.typeImage = typeData.image
self.typeImageNeedsLink = typeData.imageNeedsLink
-- Find if the box has been wrongly substituted.
self.isSubstituted = cfg.substCheck and args.subst == 'SUBST'
-- Find whether we are using a small message box.
self.isSmall = cfg.allowSmall and (
cfg.smallParam and args.small == cfg.smallParam
or not cfg.smallParam and yesno(args.small)
)
-- Add attributes, classes and styles.
self.id = args.id
self.name = args.name
if self.name then
self:addClass('box-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
end
for _, class in ipairs(cfg.classes or {}) do
self:addClass(class)
end
if self.isSmall then
self:addClass(cfg.smallClass or 'mbox-small')
end
self:addClass(self.typeClass)
self:addClass(args.class)
self.style = args.style
self.attrs = args.attrs
-- Set text style.
self.textstyle = args.textstyle
-- Set image classes.
self.imageRightClass = args.imagerightclass or args.imageclass
self.imageLeftClass = args.imageleftclass or args.imageclass
-- Find if we are on the template page or not. This functionality is only
-- used if useCollapsibleTextFields is set, or if both cfg.templateCategory
-- and cfg.templateCategoryRequireName are set.
self.useCollapsibleTextFields = cfg.useCollapsibleTextFields
if self.useCollapsibleTextFields
or cfg.templateCategory
and cfg.templateCategoryRequireName
then
if self.name then
local templateName = mw.ustring.match(
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Template:' .. templateName
self.templateTitle = getTitleObject(templateName)
end
self.isTemplatePage = self.templateTitle
and mw.title.equals(self.title, self.templateTitle)
end
-- Process data for collapsible text fields. At the moment these are only
-- used in {{ambox}}.
if self.useCollapsibleTextFields then
-- Get the self.issue value.
if self.isSmall and args.smalltext then
self.issue = args.smalltext
else
local sect
if args.sect == '' then
sect = 'This ' .. (cfg.sectionDefault or 'page')
elseif type(args.sect) == 'string' then
sect = 'This ' .. args.sect
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
-- Get the self.talk value.
local talk = args.talk
-- Show talk links on the template page or template subpages if the talk
-- parameter is blank.
if talk == ''
and self.templateTitle
and (
mw.title.equals(self.templateTitle, self.title)
or self.title:isSubpageOf(self.templateTitle)
)
then
talk = '#'
elseif talk == '' then
talk = nil
end
if talk then
-- If the talk value is a talk page, make a link to that page. Else
-- assume that it's a section heading, and make a link to the talk
-- page of the current page with that section heading.
local talkTitle = getTitleObject(talk)
local talkArgIsTalkPage = true
if not talkTitle or not talkTitle.isTalkPage then
talkArgIsTalkPage = false
talkTitle = getTitleObject(
self.title.text,
mw.site.namespaces[self.title.namespace].talk.id
)
end
if talkTitle and talkTitle.exists then
local talkText
if self.isSmall then
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk)
talkText = string.format('([[%s|talk]])', talkLink)
else
talkText = 'Relevant discussion may be found on'
if talkArgIsTalkPage then
talkText = string.format(
'%s [[%s|%s]].',
talkText,
talk,
talkTitle.prefixedText
)
else
talkText = string.format(
'%s the [[%s#%s|talk page]].',
talkText,
talkTitle.prefixedText,
talk
)
end
end
self.talk = talkText
end
end
-- Get other values.
self.fix = args.fix ~= '' and args.fix or nil
local date
if args.date and args.date ~= '' then
date = args.date
elseif args.date == '' and self.isTemplatePage then
date = lang:formatDate('F Y')
end
if date then
self.date = string.format(" <span class='date-container'><i>(<span class='date'>%s</span>)</i></span>", date)
end
self.info = args.info
if yesno(args.removalnotice) then
self.removalNotice = cfg.removalNotice
end
end
-- Set the non-collapsible text field. At the moment this is used by all box
-- types other than ambox, and also by ambox when small=yes.
if self.isSmall then
self.text = args.smalltext or args.text
else
self.text = args.text
end
-- Set the below row.
self.below = cfg.below and args.below
-- General image settings.
self.imageCellDiv = not self.isSmall and cfg.imageCellDiv
self.imageEmptyCell = cfg.imageEmptyCell
-- Left image settings.
local imageLeft = self.isSmall and args.smallimage or args.image
if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none'
or not cfg.imageCheckBlank and imageLeft ~= 'none'
then
self.imageLeft = imageLeft
if not imageLeft then
local imageSize = self.isSmall
and (cfg.imageSmallSize or '30x30px')
or '40x40px'
self.imageLeft = string.format('[[File:%s|%s%s|alt=]]', self.typeImage
or 'Information icon4.svg', imageSize, self.typeImageNeedsLink and "" or "|link=" )
end
end
-- Right image settings.
local imageRight = self.isSmall and args.smallimageright or args.imageright
if not (cfg.imageRightNone and imageRight == 'none') then
self.imageRight = imageRight
end
-- set templatestyles
self.base_templatestyles = cfg.templatestyles
self.templatestyles = args.templatestyles
end
function MessageBox:setMainspaceCategories()
local args = self.args
local cfg = self.cfg
if not cfg.allowMainspaceCategories then
return nil
end
local nums = {}
for _, prefix in ipairs{'cat', 'category', 'all'} do
args[prefix .. '1'] = args[prefix]
nums = union(nums, getArgNums(args, prefix))
end
-- The following is roughly equivalent to the old {{Ambox/category}}.
local date = args.date
date = type(date) == 'string' and date
local preposition = 'from'
for _, num in ipairs(nums) do
local mainCat = args['cat' .. tostring(num)]
or args['category' .. tostring(num)]
local allCat = args['all' .. tostring(num)]
mainCat = type(mainCat) == 'string' and mainCat
allCat = type(allCat) == 'string' and allCat
if mainCat and date and date ~= '' then
local catTitle = string.format('%s %s %s', mainCat, preposition, date)
self:addCat(0, catTitle)
catTitle = getTitleObject('Category:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, 'Articles with invalid date parameter in template')
end
elseif mainCat and (not date or date == '') then
self:addCat(0, mainCat)
end
if allCat then
self:addCat(0, allCat)
end
end
end
function MessageBox:setTemplateCategories()
local args = self.args
local cfg = self.cfg
-- Add template categories.
if cfg.templateCategory then
if cfg.templateCategoryRequireName then
if self.isTemplatePage then
self:addCat(10, cfg.templateCategory)
end
elseif not self.title.isSubpage then
self:addCat(10, cfg.templateCategory)
end
end
-- Add template error categories.
if cfg.templateErrorCategory then
local templateErrorCategory = cfg.templateErrorCategory
local templateCat, templateSort
if not self.name and not self.title.isSubpage then
templateCat = templateErrorCategory
elseif self.isTemplatePage then
local paramsToCheck = cfg.templateErrorParamsToCheck or {}
local count = 0
for i, param in ipairs(paramsToCheck) do
if not args[param] then
count = count + 1
end
end
if count > 0 then
templateCat = templateErrorCategory
templateSort = tostring(count)
end
if self.categoryNums and #self.categoryNums > 0 then
templateCat = templateErrorCategory
templateSort = 'C'
end
end
self:addCat(10, templateCat, templateSort)
end
end
function MessageBox:setAllNamespaceCategories()
-- Set categories for all namespaces.
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
end
if self.isSubstituted then
self:addCat('all', 'Pages with incorrectly substituted templates')
end
end
function MessageBox:setCategories()
if self.title.namespace == 0 then
self:setMainspaceCategories()
elseif self.title.namespace == 10 then
self:setTemplateCategories()
end
self:setAllNamespaceCategories()
end
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
all = table.concat(self.categories.all or {}),
nocat = self.args.nocat,
page = self.args.page
}
end
function MessageBox:export()
local root = mw.html.create()
-- Add the subst check error.
if self.isSubstituted and self.name then
root:tag('b')
:addClass('error')
:wikitext(string.format(
'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.',
mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}')
))
end
local frame = mw.getCurrentFrame()
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.base_templatestyles },
})
-- Add support for a single custom templatestyles sheet. Undocumented as
-- need should be limited and many templates using mbox are substed; we
-- don't want to spread templatestyles sheets around to arbitrary places
if self.templatestyles then
root:wikitext(frame:extensionTag{
name = 'templatestyles',
args = { src = self.templatestyles },
})
end
-- Create the box table.
local boxTable = root:tag('table')
boxTable:attr('id', self.id or nil)
for i, class in ipairs(self.classes or {}) do
boxTable:addClass(class or nil)
end
boxTable
:cssText(self.style or nil)
:attr('role', 'presentation')
if self.attrs then
boxTable:attr(self.attrs)
end
-- Add the left-hand image.
local row = boxTable:tag('tr')
if self.imageLeft then
local imageLeftCell = row:tag('td'):addClass('mbox-image')
if self.imageCellDiv then
-- If we are using a div, redefine imageLeftCell so that the image
-- is inside it. Divs use style="width: 52px;", which limits the
-- image width to 52px. If any images in a div are wider than that,
-- they may overlap with the text or cause other display problems.
imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div')
end
imageLeftCell
:addClass(self.imageLeftClass)
:wikitext(self.imageLeft or nil)
elseif self.imageEmptyCell then
-- Some message boxes define an empty cell if no image is specified, and
-- some don't. The old template code in templates where empty cells are
-- specified gives the following hint: "No image. Cell with some width
-- or padding necessary for text cell to have 100% width."
row:tag('td')
:addClass('mbox-empty-cell')
end
-- Add the text.
local textCell = row:tag('td'):addClass('mbox-text')
if self.useCollapsibleTextFields then
-- The message box uses advanced text parameters that allow things to be
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellDiv = textCell:tag('div')
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
end
textCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
:wikitext(self.info and (' ' .. self.info) or nil)
end
if self.removalNotice then
textCellDiv:tag('span')
:addClass('hide-when-compact')
:tag('i')
:wikitext(string.format(" (%s)", self.removalNotice))
end
else
-- Default text formatting - anything goes.
textCell
:cssText(self.textstyle or nil)
:wikitext(self.text or nil)
end
-- Add the right-hand image.
if self.imageRight then
local imageRightCell = row:tag('td'):addClass('mbox-imageright')
if self.imageCellDiv then
-- If we are using a div, redefine imageRightCell so that the image
-- is inside it.
imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div')
end
imageRightCell
:addClass(self.imageRightClass)
:wikitext(self.imageRight or nil)
end
-- Add the below row.
if self.below then
boxTable:tag('tr')
:tag('td')
:attr('colspan', self.imageRight and '3' or '2')
:addClass('mbox-text')
:cssText(self.textstyle or nil)
:wikitext(self.below or nil)
end
-- Add error message for invalid type parameters.
if self.invalidTypeError then
root:tag('div')
:addClass('mbox-invalid-type')
:wikitext(string.format(
'This message box is using an invalid "type=%s" parameter and needs fixing.',
self.type or ''
))
end
-- Add categories.
root:wikitext(self:renderCategories() or nil)
return tostring(root)
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p, mt = {}, {}
function p._exportClasses()
-- For testing.
return {
MessageBox = MessageBox
}
end
function p.main(boxType, args, cfgTables)
local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))
box:setParameters()
box:setCategories()
return box:export()
end
function mt.__index(t, k)
return function (frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
end
end
return setmetatable(p, mt)
l2lsrcywbr8gjtqec5b7gi7nazry5co
ماڈیول:Message box/configuration
828
12909
31941
2025-01-01T19:58:36Z
en>Xover
0
add back in local pmbox config
31941
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Message box configuration --
-- --
-- This module contains configuration data for [[Module:Message box]]. --
--------------------------------------------------------------------------------
return {
ambox = {
types = {
speedy = {
class = 'ambox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ambox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ambox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ambox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ambox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ambox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ambox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {'metadata', 'ambox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = 'article',
allowMainspaceCategories = true,
templateCategory = 'Article message templates',
templateCategoryRequireName = true,
templateErrorCategory = 'Article message templates with missing parameters',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'},
removalNotice = '<small>[[Help:Maintenance template removal|Learn how and when to remove this message]]</small>',
templatestyles = 'Module:Message box/ambox.css'
},
cmbox = {
types = {
speedy = {
class = 'cmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'cmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'cmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'cmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'cmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'cmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'cmbox'},
imageEmptyCell = true,
templatestyles = 'Module:Message box/cmbox.css'
},
fmbox = {
types = {
warning = {
class = 'fmbox-warning',
image = 'Ambox warning pn.svg'
},
editnotice = {
class = 'fmbox-editnotice',
image = 'Information icon4.svg'
},
system = {
class = 'fmbox-system',
image = 'Information icon4.svg'
}
},
default = 'system',
showInvalidTypeError = true,
classes = {'fmbox'},
imageEmptyCell = false,
imageRightNone = false,
templatestyles = 'Module:Message box/fmbox.css'
},
imbox = {
types = {
speedy = {
class = 'imbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'imbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'imbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'imbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
license = {
class = 'imbox-license licensetpl',
image = 'Imbox-license.svg'
},
["license-related"] = {
class = 'imbox-license',
image = 'Imbox-license.svg'
},
featured = {
class = 'imbox-featured',
image = 'Cscr-featured.svg',
imageNeedsLink = true
},
notice = {
class = 'imbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'imbox'},
imageEmptyCell = true,
below = true,
templateCategory = 'File message boxes',
templatestyles = 'Module:Message box/imbox.css'
},
ombox = {
types = {
speedy = {
class = 'ombox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ombox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ombox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ombox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ombox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ombox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'ombox'},
allowSmall = true,
imageEmptyCell = true,
imageRightNone = true,
templatestyles = 'Module:Message box/ombox.css'
},
tmbox = {
types = {
speedy = {
class = 'tmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'tmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'tmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'tmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'tmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'tmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'tmbox'},
allowSmall = true,
imageRightNone = true,
imageEmptyCell = true,
templateCategory = 'Talk message boxes',
templatestyles = 'Module:Message box/tmbox.css'
},
pmbox = {
types = {
speedy = {
class = 'pmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'pmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'pmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'pmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'pmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'pmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'pmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {'metadata', 'pmbox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = 'article',
allowMainspaceCategories = true,
templateCategory = 'Article message templates',
templateCategoryRequireName = true,
templateErrorCategory = 'Article message templates with missing parameters',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'},
removalNotice = '<small>[[Help:Maintenance template removal|Learn how and when to remove this message]]</small>',
templatestyles = 'Module:Message box/pmbox.css'
}
}
3qvvx39zyxax7cfnv3b1hnv6iq2hfzz
31942
31941
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Module:Message_box/configuration]] سے 1 نسخہ درآمد کیا گیا
31941
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Message box configuration --
-- --
-- This module contains configuration data for [[Module:Message box]]. --
--------------------------------------------------------------------------------
return {
ambox = {
types = {
speedy = {
class = 'ambox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ambox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ambox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ambox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ambox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ambox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ambox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {'metadata', 'ambox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = 'article',
allowMainspaceCategories = true,
templateCategory = 'Article message templates',
templateCategoryRequireName = true,
templateErrorCategory = 'Article message templates with missing parameters',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'},
removalNotice = '<small>[[Help:Maintenance template removal|Learn how and when to remove this message]]</small>',
templatestyles = 'Module:Message box/ambox.css'
},
cmbox = {
types = {
speedy = {
class = 'cmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'cmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'cmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'cmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'cmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'cmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'cmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'cmbox'},
imageEmptyCell = true,
templatestyles = 'Module:Message box/cmbox.css'
},
fmbox = {
types = {
warning = {
class = 'fmbox-warning',
image = 'Ambox warning pn.svg'
},
editnotice = {
class = 'fmbox-editnotice',
image = 'Information icon4.svg'
},
system = {
class = 'fmbox-system',
image = 'Information icon4.svg'
}
},
default = 'system',
showInvalidTypeError = true,
classes = {'fmbox'},
imageEmptyCell = false,
imageRightNone = false,
templatestyles = 'Module:Message box/fmbox.css'
},
imbox = {
types = {
speedy = {
class = 'imbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'imbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'imbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'imbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
license = {
class = 'imbox-license licensetpl',
image = 'Imbox-license.svg'
},
["license-related"] = {
class = 'imbox-license',
image = 'Imbox-license.svg'
},
featured = {
class = 'imbox-featured',
image = 'Cscr-featured.svg',
imageNeedsLink = true
},
notice = {
class = 'imbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'imbox'},
imageEmptyCell = true,
below = true,
templateCategory = 'File message boxes',
templatestyles = 'Module:Message box/imbox.css'
},
ombox = {
types = {
speedy = {
class = 'ombox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'ombox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'ombox-content',
image = 'Ambox important.svg'
},
style = {
class = 'ombox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'ombox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'ombox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'ombox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'ombox'},
allowSmall = true,
imageEmptyCell = true,
imageRightNone = true,
templatestyles = 'Module:Message box/ombox.css'
},
tmbox = {
types = {
speedy = {
class = 'tmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'tmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'tmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'tmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'tmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'tmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'tmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
showInvalidTypeError = true,
classes = {'tmbox'},
allowSmall = true,
imageRightNone = true,
imageEmptyCell = true,
templateCategory = 'Talk message boxes',
templatestyles = 'Module:Message box/tmbox.css'
},
pmbox = {
types = {
speedy = {
class = 'pmbox-speedy',
image = 'Ambox warning pn.svg'
},
delete = {
class = 'pmbox-delete',
image = 'Ambox warning pn.svg'
},
content = {
class = 'pmbox-content',
image = 'Ambox important.svg'
},
style = {
class = 'pmbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'pmbox-move',
image = 'Merge-split-transwiki default.svg'
},
protection = {
class = 'pmbox-protection',
image = 'Semi-protection-shackle-keyhole.svg'
},
notice = {
class = 'pmbox-notice',
image = 'Information icon4.svg'
}
},
default = 'notice',
allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'},
allowSmall = true,
smallParam = 'left',
smallClass = 'mbox-small-left',
substCheck = true,
classes = {'metadata', 'pmbox'},
imageEmptyCell = true,
imageCheckBlank = true,
imageSmallSize = '20x20px',
imageCellDiv = true,
useCollapsibleTextFields = true,
imageRightNone = true,
sectionDefault = 'article',
allowMainspaceCategories = true,
templateCategory = 'Article message templates',
templateCategoryRequireName = true,
templateErrorCategory = 'Article message templates with missing parameters',
templateErrorParamsToCheck = {'issue', 'fix', 'subst'},
removalNotice = '<small>[[Help:Maintenance template removal|Learn how and when to remove this message]]</small>',
templatestyles = 'Module:Message box/pmbox.css'
}
}
3qvvx39zyxax7cfnv3b1hnv6iq2hfzz
ماڈیول:Documentation
828
12910
31945
2024-09-03T10:51:53Z
en>WOSlinker
0
add __EXPECTUNUSEDTEMPLATE__
31945
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
local format = mw.ustring.format
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return format('[[%s|%s]]', page, display)
else
return format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return format(
'<span class="%s">(%s)</span>',
message('toolbar-class'),
table.concat(ret, ' | ')
)
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.canonicalUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
-- 'module-sandbox-category' --> 'Module sandboxes'
-- 'other-sandbox-category' --> 'Sandboxes outside of template or module namespace'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = '__EXPECTUNUSEDTEMPLATE__'
local pagetype, sandboxCat
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
sandboxCat = message('sandbox-category')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
sandboxCat = message('module-sandbox-category')
else
pagetype = message('sandbox-notice-pagetype-other')
sandboxCat = message('other-sandbox-category')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(sandboxCat)
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
if editProt then
-- The page is edit-protected.
return require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
return require('Module:Protection banner')._main{
action = 'move', small = true
}
else
return nil
end
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
return {
title = title,
docTitle = docTitle,
-- View, display, edit, and purge links if /doc exists.
viewLinkDisplay = message('view-link-display'),
editLinkDisplay = message('edit-link-display'),
historyLinkDisplay = message('history-link-display'),
purgeLinkDisplay = message('purge-link-display'),
preload = preload,
createLinkDisplay = message('create-link-display')
}
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local docTitle = data.docTitle
-- yes, we do intend to purge the template page on which the documentation appears
local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay)
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)
return "[" .. viewLink .. "] [" .. editLink .. "] [" .. historyLink .. "] [" .. purgeLink .. "]"
else
local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
return "[" .. createLink .. "] [" .. purgeLink .. "]"
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
end
end
local box = mw.html.create('div')
-- 'documentation-metadata'
box:attr('role', 'note')
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editDisplay = message('edit-link-display')
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)
local historyDisplay = message('history-link-display')
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)
return message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
return message('create-module-doc-blurb', {createLink})
.. '<br />'
end
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
return makeCategoryLink(message('strange-usage-category'))
end
return ''
end
return p
ky7myqtha9rjaznz4jxomjtdpuanlqs
31946
31945
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Module:Documentation]] سے 1 نسخہ درآمد کیا گیا
31945
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
local format = mw.ustring.format
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return format('[[%s|%s]]', page, display)
else
return format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return format(
'<span class="%s">(%s)</span>',
message('toolbar-class'),
table.concat(ret, ' | ')
)
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.canonicalUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
-- 'module-sandbox-category' --> 'Module sandboxes'
-- 'other-sandbox-category' --> 'Sandboxes outside of template or module namespace'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = '__EXPECTUNUSEDTEMPLATE__'
local pagetype, sandboxCat
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
sandboxCat = message('sandbox-category')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
sandboxCat = message('module-sandbox-category')
else
pagetype = message('sandbox-notice-pagetype-other')
sandboxCat = message('other-sandbox-category')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(sandboxCat)
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
if editProt then
-- The page is edit-protected.
return require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
return require('Module:Protection banner')._main{
action = 'move', small = true
}
else
return nil
end
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
return {
title = title,
docTitle = docTitle,
-- View, display, edit, and purge links if /doc exists.
viewLinkDisplay = message('view-link-display'),
editLinkDisplay = message('edit-link-display'),
historyLinkDisplay = message('history-link-display'),
purgeLinkDisplay = message('purge-link-display'),
preload = preload,
createLinkDisplay = message('create-link-display')
}
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local docTitle = data.docTitle
-- yes, we do intend to purge the template page on which the documentation appears
local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay)
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)
return "[" .. viewLink .. "] [" .. editLink .. "] [" .. historyLink .. "] [" .. purgeLink .. "]"
else
local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
return "[" .. createLink .. "] [" .. purgeLink .. "]"
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
end
end
local box = mw.html.create('div')
-- 'documentation-metadata'
box:attr('role', 'note')
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editDisplay = message('edit-link-display')
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)
local historyDisplay = message('history-link-display')
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)
return message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
return message('create-module-doc-blurb', {createLink})
.. '<br />'
end
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
return makeCategoryLink(message('strange-usage-category'))
end
return ''
end
return p
ky7myqtha9rjaznz4jxomjtdpuanlqs
32010
2024-02-20T00:30:39Z
en>Uzume
0
stylesheet moved from [[Template:Documentation/styles.css]] to [[Module:Documentation/styles.css]] (via [[Module:Documentation/config#L-346]] cfg['templatestyles'] and [[Module:Documentation#L-166]])
32010
wikitext
text/x-wiki
{{#invoke:documentation|main}}
gu7dkwkxnrequjiuw38hbtjihjxr36x
32011
31946
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Template:Documentation]] سے 1 نسخہ درآمد کیا گیا
31945
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
local format = mw.ustring.format
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return format('[[%s|%s]]', page, display)
else
return format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return format(
'<span class="%s">(%s)</span>',
message('toolbar-class'),
table.concat(ret, ' | ')
)
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.canonicalUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
-- 'module-sandbox-category' --> 'Module sandboxes'
-- 'other-sandbox-category' --> 'Sandboxes outside of template or module namespace'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = '__EXPECTUNUSEDTEMPLATE__'
local pagetype, sandboxCat
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
sandboxCat = message('sandbox-category')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
sandboxCat = message('module-sandbox-category')
else
pagetype = message('sandbox-notice-pagetype-other')
sandboxCat = message('other-sandbox-category')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(sandboxCat)
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
if editProt then
-- The page is edit-protected.
return require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
return require('Module:Protection banner')._main{
action = 'move', small = true
}
else
return nil
end
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
return {
title = title,
docTitle = docTitle,
-- View, display, edit, and purge links if /doc exists.
viewLinkDisplay = message('view-link-display'),
editLinkDisplay = message('edit-link-display'),
historyLinkDisplay = message('history-link-display'),
purgeLinkDisplay = message('purge-link-display'),
preload = preload,
createLinkDisplay = message('create-link-display')
}
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local docTitle = data.docTitle
-- yes, we do intend to purge the template page on which the documentation appears
local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay)
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)
return "[" .. viewLink .. "] [" .. editLink .. "] [" .. historyLink .. "] [" .. purgeLink .. "]"
else
local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
return "[" .. createLink .. "] [" .. purgeLink .. "]"
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
end
end
local box = mw.html.create('div')
-- 'documentation-metadata'
box:attr('role', 'note')
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editDisplay = message('edit-link-display')
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)
local historyDisplay = message('history-link-display')
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)
return message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
return message('create-module-doc-blurb', {createLink})
.. '<br />'
end
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
return makeCategoryLink(message('strange-usage-category'))
end
return ''
end
return p
ky7myqtha9rjaznz4jxomjtdpuanlqs
ماڈیول:Documentation/config
828
12911
31947
2025-01-31T02:12:45Z
en>CalendulaAsteraceae
0
update config
31947
Scribunto
text/plain
----------------------------------------------------------------------------------------------------
--
-- Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local cfg = {} -- Do not edit this line.
----------------------------------------------------------------------------------------------------
-- Protection template configuration
----------------------------------------------------------------------------------------------------
-- cfg['protection-reason-edit']
-- The protection reason for edit-protected templates to pass to
-- [[Module:Protection banner]].
cfg['protection-reason-edit'] = 'template'
--[[
----------------------------------------------------------------------------------------------------
-- Sandbox notice configuration
--
-- On sandbox pages the module can display a template notifying users that the current page is a
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the
-- messages that the notices contains.
----------------------------------------------------------------------------------------------------
--]]
-- cfg['sandbox-notice-image']
-- The image displayed in the sandbox notice.
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- cfg['sandbox-notice-pagetype-template']
-- cfg['sandbox-notice-pagetype-module']
-- cfg['sandbox-notice-pagetype-other']
-- The page type of the sandbox page. The message that is displayed depends on the current subject
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or
-- cfg['sandbox-notice-diff-blurb'].
--]]
cfg['sandbox-notice-pagetype-template'] = '[[w:Wikipedia:Template test cases|template sandbox]] page'
cfg['sandbox-notice-pagetype-module'] = '[[w:Wikipedia:Template test cases|module sandbox]] page'
cfg['sandbox-notice-pagetype-other'] = 'sandbox page'
--[[
-- cfg['sandbox-notice-blurb']
-- cfg['sandbox-notice-diff-blurb']
-- cfg['sandbox-notice-diff-display']
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page
-- type, which is either cfg['sandbox-notice-pagetype-template'],
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between
-- the sandbox and the main template. The display value of the diff link is set by
-- cfg['sandbox-notice-compare-link-display'].
--]]
cfg['sandbox-notice-blurb'] = 'This is the $1 for $2.'
cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).'
cfg['sandbox-notice-compare-link-display'] = 'diff'
--[[
-- cfg['sandbox-notice-testcases-blurb']
-- cfg['sandbox-notice-testcases-link-display']
-- cfg['sandbox-notice-testcases-run-blurb']
-- cfg['sandbox-notice-testcases-run-link-display']
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test
-- cases page, and $2 is a link to the page to run it.
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test
-- cases.
--]]
cfg['sandbox-notice-testcases-blurb'] = 'See also the companion subpage for $1.'
cfg['sandbox-notice-testcases-link-display'] = 'test cases'
cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).'
cfg['sandbox-notice-testcases-run-link-display'] = 'run'
-- cfg['sandbox-category'] - A category to add to all template sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all module sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all sandboxe not in templates or modules.
cfg['sandbox-category'] = 'Template sandboxes'
cfg['module-sandbox-category'] = 'Module sandboxes'
cfg['other-sandbox-category'] = 'Sandboxes outside of template or module namespace'
----------------------------------------------------------------------------------------------------
-- Start box configuration
----------------------------------------------------------------------------------------------------
-- cfg['documentation-icon-wikitext']
-- The wikitext for the icon shown at the top of the template.
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- cfg['template-namespace-heading']
-- The heading shown in the template namespace.
cfg['template-namespace-heading'] = 'Template documentation'
-- cfg['module-namespace-heading']
-- The heading shown in the module namespace.
cfg['module-namespace-heading'] = 'Module documentation'
-- cfg['file-namespace-heading']
-- The heading shown in the file namespace.
cfg['file-namespace-heading'] = 'Summary'
-- cfg['other-namespaces-heading']
-- The heading shown in other namespaces.
cfg['other-namespaces-heading'] = 'Documentation'
-- cfg['view-link-display']
-- The text to display for "view" links.
cfg['view-link-display'] = 'view'
-- cfg['edit-link-display']
-- The text to display for "edit" links.
cfg['edit-link-display'] = 'edit'
-- cfg['history-link-display']
-- The text to display for "history" links.
cfg['history-link-display'] = 'history'
-- cfg['purge-link-display']
-- The text to display for "purge" links.
cfg['purge-link-display'] = 'purge'
-- cfg['create-link-display']
-- The text to display for "create" links.
cfg['create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Link box (end box) configuration
----------------------------------------------------------------------------------------------------
-- cfg['transcluded-from-blurb']
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.
cfg['transcluded-from-blurb'] = 'The above [[w:Wikipedia:Template documentation|documentation]] is [[Help:Transclusion|transcluded]] from $1.'
--[[
-- cfg['create-module-doc-blurb']
-- Notice displayed in the module namespace when the documentation subpage does not exist.
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the
-- display cfg['create-link-display'].
--]]
cfg['create-module-doc-blurb'] = 'You might want to $1 a documentation page for this [[Extension:Scribunto/Lua reference manual|Scribunto module]].'
----------------------------------------------------------------------------------------------------
-- Experiment blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['experiment-blurb-template']
-- cfg['experiment-blurb-module']
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.
-- It is only shown in the template and module namespaces. With the default English settings, it
-- might look like this:
--
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
--
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.
--
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending
-- on what namespace we are in.
--
-- Parameters:
--
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])
--
-- If the sandbox doesn't exist, it is in the format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])
--
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']
-- loads a default edit summary of cfg['mirror-edit-summary'].
--
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:
--
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])
--
-- If the test cases page doesn't exist, it is in the format:
--
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])
--
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current
-- namespace.
--]]
cfg['experiment-blurb-template'] = "Editors can experiment in this template's $1 and $2 pages."
cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."
----------------------------------------------------------------------------------------------------
-- Sandbox link configuration
----------------------------------------------------------------------------------------------------
-- cfg['sandbox-subpage']
-- The name of the template subpage typically used for sandboxes.
cfg['sandbox-subpage'] = 'sandbox'
-- cfg['template-sandbox-preload']
-- Preload file for template sandbox pages.
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'
-- cfg['module-sandbox-preload']
-- Preload file for Lua module sandbox pages.
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'
-- cfg['sandbox-link-display']
-- The text to display for "sandbox" links.
cfg['sandbox-link-display'] = 'sandbox'
-- cfg['sandbox-edit-link-display']
-- The text to display for sandbox "edit" links.
cfg['sandbox-edit-link-display'] = 'edit'
-- cfg['sandbox-create-link-display']
-- The text to display for sandbox "create" links.
cfg['sandbox-create-link-display'] = 'create'
-- cfg['compare-link-display']
-- The text to display for "compare" links.
cfg['compare-link-display'] = 'diff'
-- cfg['mirror-edit-summary']
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the
-- template page.
cfg['mirror-edit-summary'] = 'Create sandbox version of $1'
-- cfg['mirror-link-display']
-- The text to display for "mirror" links.
cfg['mirror-link-display'] = 'mirror'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Module:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'testcases'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = 'edit'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = 'run'
-- cfg['testcases-create-link-display']
-- The text to display for test cases "create" links.
cfg['testcases-create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Add categories blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['add-categories-blurb']
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a
-- link to the /doc subpage with a display value of cfg['doc-link-display'].
--]]
cfg['add-categories-blurb'] = 'Add categories to the $1 subpage.'
-- cfg['doc-link-display']
-- The text to display when linking to the /doc subpage.
cfg['doc-link-display'] = '/doc'
----------------------------------------------------------------------------------------------------
-- Subpages link configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['subpages-blurb']
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply
-- the link followed by a period, and the link display provides the actual text.
--]]
cfg['subpages-blurb'] = '$1.'
--[[
-- cfg['subpages-link-display']
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in
-- the template namespace, the module namespace, or another namespace.
--]]
cfg['subpages-link-display'] = 'Subpages of this $1'
-- cfg['template-pagetype']
-- The pagetype to display for template pages.
cfg['template-pagetype'] = 'template'
-- cfg['module-pagetype']
-- The pagetype to display for Lua module pages.
cfg['module-pagetype'] = 'module'
-- cfg['default-pagetype']
-- The pagetype to display for pages other than templates or Lua modules.
cfg['default-pagetype'] = 'page'
----------------------------------------------------------------------------------------------------
-- Doc link configuration
----------------------------------------------------------------------------------------------------
-- cfg['doc-subpage']
-- The name of the subpage typically used for documentation pages.
cfg['doc-subpage'] = 'doc'
-- cfg['docpage-preload']
-- Preload file for template documentation pages in all namespaces.
cfg['docpage-preload'] = 'Template:Documentation/preload'
-- cfg['module-preload']
-- Preload file for Lua module documentation pages.
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[w:Wikipedia:Village pump (technical)/Archive 117#Template documentation header problem]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- Tracking category configuration
----------------------------------------------------------------------------------------------------
-- cfg['display-strange-usage-category']
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage
-- or a /testcases subpage. This should be a boolean value (either true or false).
cfg['display-strange-usage-category'] = true
-- cfg['strange-usage-category']
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a
-- /doc subpage or a /testcases subpage.
cfg['strange-usage-category'] = 'Pages with strange documentation template usage'
--[[
----------------------------------------------------------------------------------------------------
-- End configuration
--
-- Don't edit anything below this line.
----------------------------------------------------------------------------------------------------
--]]
return cfg
a01jx74zvrm7lbg3cdt0yu3a699x8gg
31948
31947
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Module:Documentation/config]] سے 1 نسخہ درآمد کیا گیا
31947
Scribunto
text/plain
----------------------------------------------------------------------------------------------------
--
-- Configuration for Module:Documentation
--
-- Here you can set the values of the parameters and messages used in Module:Documentation to
-- localise it to your wiki and your language. Unless specified otherwise, values given here
-- should be string values.
----------------------------------------------------------------------------------------------------
local cfg = {} -- Do not edit this line.
----------------------------------------------------------------------------------------------------
-- Protection template configuration
----------------------------------------------------------------------------------------------------
-- cfg['protection-reason-edit']
-- The protection reason for edit-protected templates to pass to
-- [[Module:Protection banner]].
cfg['protection-reason-edit'] = 'template'
--[[
----------------------------------------------------------------------------------------------------
-- Sandbox notice configuration
--
-- On sandbox pages the module can display a template notifying users that the current page is a
-- sandbox, and the location of test cases pages, etc. The module decides whether the page is a
-- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the
-- messages that the notices contains.
----------------------------------------------------------------------------------------------------
--]]
-- cfg['sandbox-notice-image']
-- The image displayed in the sandbox notice.
cfg['sandbox-notice-image'] = '[[File:Sandbox.svg|50px|alt=|link=]]'
--[[
-- cfg['sandbox-notice-pagetype-template']
-- cfg['sandbox-notice-pagetype-module']
-- cfg['sandbox-notice-pagetype-other']
-- The page type of the sandbox page. The message that is displayed depends on the current subject
-- namespace. This message is used in either cfg['sandbox-notice-blurb'] or
-- cfg['sandbox-notice-diff-blurb'].
--]]
cfg['sandbox-notice-pagetype-template'] = '[[w:Wikipedia:Template test cases|template sandbox]] page'
cfg['sandbox-notice-pagetype-module'] = '[[w:Wikipedia:Template test cases|module sandbox]] page'
cfg['sandbox-notice-pagetype-other'] = 'sandbox page'
--[[
-- cfg['sandbox-notice-blurb']
-- cfg['sandbox-notice-diff-blurb']
-- cfg['sandbox-notice-diff-display']
-- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence
-- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page
-- type, which is either cfg['sandbox-notice-pagetype-template'],
-- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what
-- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between
-- the sandbox and the main template. The display value of the diff link is set by
-- cfg['sandbox-notice-compare-link-display'].
--]]
cfg['sandbox-notice-blurb'] = 'This is the $1 for $2.'
cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).'
cfg['sandbox-notice-compare-link-display'] = 'diff'
--[[
-- cfg['sandbox-notice-testcases-blurb']
-- cfg['sandbox-notice-testcases-link-display']
-- cfg['sandbox-notice-testcases-run-blurb']
-- cfg['sandbox-notice-testcases-run-link-display']
-- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit. $1 is a link to the test cases page.
-- cfg['sandbox-notice-testcases-link-display'] is the display value for that link.
-- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page
-- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test
-- cases page, and $2 is a link to the page to run it.
-- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test
-- cases.
--]]
cfg['sandbox-notice-testcases-blurb'] = 'See also the companion subpage for $1.'
cfg['sandbox-notice-testcases-link-display'] = 'test cases'
cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).'
cfg['sandbox-notice-testcases-run-link-display'] = 'run'
-- cfg['sandbox-category'] - A category to add to all template sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all module sandboxes.
-- cfg['module-sandbox-category'] - A category to add to all sandboxe not in templates or modules.
cfg['sandbox-category'] = 'Template sandboxes'
cfg['module-sandbox-category'] = 'Module sandboxes'
cfg['other-sandbox-category'] = 'Sandboxes outside of template or module namespace'
----------------------------------------------------------------------------------------------------
-- Start box configuration
----------------------------------------------------------------------------------------------------
-- cfg['documentation-icon-wikitext']
-- The wikitext for the icon shown at the top of the template.
cfg['documentation-icon-wikitext'] = '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- cfg['template-namespace-heading']
-- The heading shown in the template namespace.
cfg['template-namespace-heading'] = 'Template documentation'
-- cfg['module-namespace-heading']
-- The heading shown in the module namespace.
cfg['module-namespace-heading'] = 'Module documentation'
-- cfg['file-namespace-heading']
-- The heading shown in the file namespace.
cfg['file-namespace-heading'] = 'Summary'
-- cfg['other-namespaces-heading']
-- The heading shown in other namespaces.
cfg['other-namespaces-heading'] = 'Documentation'
-- cfg['view-link-display']
-- The text to display for "view" links.
cfg['view-link-display'] = 'view'
-- cfg['edit-link-display']
-- The text to display for "edit" links.
cfg['edit-link-display'] = 'edit'
-- cfg['history-link-display']
-- The text to display for "history" links.
cfg['history-link-display'] = 'history'
-- cfg['purge-link-display']
-- The text to display for "purge" links.
cfg['purge-link-display'] = 'purge'
-- cfg['create-link-display']
-- The text to display for "create" links.
cfg['create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Link box (end box) configuration
----------------------------------------------------------------------------------------------------
-- cfg['transcluded-from-blurb']
-- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page.
cfg['transcluded-from-blurb'] = 'The above [[w:Wikipedia:Template documentation|documentation]] is [[Help:Transclusion|transcluded]] from $1.'
--[[
-- cfg['create-module-doc-blurb']
-- Notice displayed in the module namespace when the documentation subpage does not exist.
-- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the
-- display cfg['create-link-display'].
--]]
cfg['create-module-doc-blurb'] = 'You might want to $1 a documentation page for this [[Extension:Scribunto/Lua reference manual|Scribunto module]].'
----------------------------------------------------------------------------------------------------
-- Experiment blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['experiment-blurb-template']
-- cfg['experiment-blurb-module']
-- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages.
-- It is only shown in the template and module namespaces. With the default English settings, it
-- might look like this:
--
-- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
--
-- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links.
--
-- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending
-- on what namespace we are in.
--
-- Parameters:
--
-- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display'])
--
-- If the sandbox doesn't exist, it is in the format:
--
-- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display'])
--
-- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload']
-- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display']
-- loads a default edit summary of cfg['mirror-edit-summary'].
--
-- $2 is a link to the test cases page. If the test cases page exists, it is in the following format:
--
-- cfg['testcases-link-display'] (cfg['testcases-edit-link-display'] | cfg['testcases-run-link-display'])
--
-- If the test cases page doesn't exist, it is in the format:
--
-- cfg['testcases-link-display'] (cfg['testcases-create-link-display'])
--
-- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the
-- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current
-- namespace.
--]]
cfg['experiment-blurb-template'] = "Editors can experiment in this template's $1 and $2 pages."
cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages."
----------------------------------------------------------------------------------------------------
-- Sandbox link configuration
----------------------------------------------------------------------------------------------------
-- cfg['sandbox-subpage']
-- The name of the template subpage typically used for sandboxes.
cfg['sandbox-subpage'] = 'sandbox'
-- cfg['template-sandbox-preload']
-- Preload file for template sandbox pages.
cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox'
-- cfg['module-sandbox-preload']
-- Preload file for Lua module sandbox pages.
cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox'
-- cfg['sandbox-link-display']
-- The text to display for "sandbox" links.
cfg['sandbox-link-display'] = 'sandbox'
-- cfg['sandbox-edit-link-display']
-- The text to display for sandbox "edit" links.
cfg['sandbox-edit-link-display'] = 'edit'
-- cfg['sandbox-create-link-display']
-- The text to display for sandbox "create" links.
cfg['sandbox-create-link-display'] = 'create'
-- cfg['compare-link-display']
-- The text to display for "compare" links.
cfg['compare-link-display'] = 'diff'
-- cfg['mirror-edit-summary']
-- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the
-- template page.
cfg['mirror-edit-summary'] = 'Create sandbox version of $1'
-- cfg['mirror-link-display']
-- The text to display for "mirror" links.
cfg['mirror-link-display'] = 'mirror'
-- cfg['mirror-link-preload']
-- The page to preload when a user clicks the "mirror" link.
cfg['mirror-link-preload'] = 'Template:Documentation/mirror'
----------------------------------------------------------------------------------------------------
-- Test cases link configuration
----------------------------------------------------------------------------------------------------
-- cfg['testcases-subpage']
-- The name of the template subpage typically used for test cases.
cfg['testcases-subpage'] = 'testcases'
-- cfg['template-testcases-preload']
-- Preload file for template test cases pages.
cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases'
-- cfg['module-testcases-preload']
-- Preload file for Lua module test cases pages.
cfg['module-testcases-preload'] = 'Module:Documentation/preload-module-testcases'
-- cfg['testcases-link-display']
-- The text to display for "testcases" links.
cfg['testcases-link-display'] = 'testcases'
-- cfg['testcases-edit-link-display']
-- The text to display for test cases "edit" links.
cfg['testcases-edit-link-display'] = 'edit'
-- cfg['testcases-run-link-display']
-- The text to display for test cases "run" links.
cfg['testcases-run-link-display'] = 'run'
-- cfg['testcases-create-link-display']
-- The text to display for test cases "create" links.
cfg['testcases-create-link-display'] = 'create'
----------------------------------------------------------------------------------------------------
-- Add categories blurb configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['add-categories-blurb']
-- Text to direct users to add categories to the /doc subpage. Not used if the "content" or
-- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a
-- link to the /doc subpage with a display value of cfg['doc-link-display'].
--]]
cfg['add-categories-blurb'] = 'Add categories to the $1 subpage.'
-- cfg['doc-link-display']
-- The text to display when linking to the /doc subpage.
cfg['doc-link-display'] = '/doc'
----------------------------------------------------------------------------------------------------
-- Subpages link configuration
----------------------------------------------------------------------------------------------------
--[[
-- cfg['subpages-blurb']
-- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a
-- display value of cfg['subpages-link-display']. In the English version this blurb is simply
-- the link followed by a period, and the link display provides the actual text.
--]]
cfg['subpages-blurb'] = '$1.'
--[[
-- cfg['subpages-link-display']
-- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'],
-- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in
-- the template namespace, the module namespace, or another namespace.
--]]
cfg['subpages-link-display'] = 'Subpages of this $1'
-- cfg['template-pagetype']
-- The pagetype to display for template pages.
cfg['template-pagetype'] = 'template'
-- cfg['module-pagetype']
-- The pagetype to display for Lua module pages.
cfg['module-pagetype'] = 'module'
-- cfg['default-pagetype']
-- The pagetype to display for pages other than templates or Lua modules.
cfg['default-pagetype'] = 'page'
----------------------------------------------------------------------------------------------------
-- Doc link configuration
----------------------------------------------------------------------------------------------------
-- cfg['doc-subpage']
-- The name of the subpage typically used for documentation pages.
cfg['doc-subpage'] = 'doc'
-- cfg['docpage-preload']
-- Preload file for template documentation pages in all namespaces.
cfg['docpage-preload'] = 'Template:Documentation/preload'
-- cfg['module-preload']
-- Preload file for Lua module documentation pages.
cfg['module-preload'] = 'Template:Documentation/preload-module-doc'
----------------------------------------------------------------------------------------------------
-- HTML and CSS configuration
----------------------------------------------------------------------------------------------------
-- cfg['templatestyles']
-- The name of the TemplateStyles page where CSS is kept.
-- Sandbox CSS will be at Module:Documentation/sandbox/styles.css when needed.
cfg['templatestyles'] = 'Module:Documentation/styles.css'
-- cfg['container']
-- Class which can be used to set flex or grid CSS on the
-- two child divs documentation and documentation-metadata
cfg['container'] = 'documentation-container'
-- cfg['main-div-classes']
-- Classes added to the main HTML "div" tag.
cfg['main-div-classes'] = 'documentation'
-- cfg['main-div-heading-class']
-- Class for the main heading for templates and modules and assoc. talk spaces
cfg['main-div-heading-class'] = 'documentation-heading'
-- cfg['start-box-class']
-- Class for the start box
cfg['start-box-class'] = 'documentation-startbox'
-- cfg['start-box-link-classes']
-- Classes used for the [view][edit][history] or [create] links in the start box.
-- mw-editsection-like is per [[w:Wikipedia:Village pump (technical)/Archive 117#Template documentation header problem]]
cfg['start-box-link-classes'] = 'mw-editsection-like plainlinks'
-- cfg['end-box-class']
-- Class for the end box.
cfg['end-box-class'] = 'documentation-metadata'
-- cfg['end-box-plainlinks']
-- Plainlinks
cfg['end-box-plainlinks'] = 'plainlinks'
-- cfg['toolbar-class']
-- Class added for toolbar links.
cfg['toolbar-class'] = 'documentation-toolbar'
-- cfg['clear']
-- Just used to clear things.
cfg['clear'] = 'documentation-clear'
----------------------------------------------------------------------------------------------------
-- Tracking category configuration
----------------------------------------------------------------------------------------------------
-- cfg['display-strange-usage-category']
-- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage
-- or a /testcases subpage. This should be a boolean value (either true or false).
cfg['display-strange-usage-category'] = true
-- cfg['strange-usage-category']
-- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a
-- /doc subpage or a /testcases subpage.
cfg['strange-usage-category'] = 'Pages with strange documentation template usage'
--[[
----------------------------------------------------------------------------------------------------
-- End configuration
--
-- Don't edit anything below this line.
----------------------------------------------------------------------------------------------------
--]]
return cfg
a01jx74zvrm7lbg3cdt0yu3a699x8gg
ماڈیول:List
828
12912
31949
2023-08-19T10:58:55Z
en>Xover
0
1 revision imported from [[:w:Module:List]]: re-sync from enWP
31949
Scribunto
text/plain
local libUtil = require('libraryUtil')
local checkType = libUtil.checkType
local mTableTools = require('Module:TableTools')
local p = {}
local listTypes = {
['bulleted'] = true,
['unbulleted'] = true,
['horizontal'] = true,
['ordered'] = true,
['horizontal_ordered'] = true
}
function p.makeListData(listType, args)
-- Constructs a data table to be passed to p.renderList.
local data = {}
-- Classes and TemplateStyles
data.classes = {}
data.templatestyles = ''
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Hlist/styles.css' }
}
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Plainlist/styles.css' }
}
end
table.insert(data.classes, args.class)
-- Main div style
data.style = args.style
-- Indent for horizontal lists
if listType == 'horizontal' or listType == 'horizontal_ordered' then
local indent = tonumber(args.indent)
indent = indent and indent * 1.6 or 0
if indent > 0 then
data.marginLeft = indent .. 'em'
end
end
-- List style types for ordered lists
-- This could be "1, 2, 3", "a, b, c", or a number of others. The list style
-- type is either set by the "type" attribute or the "list-style-type" CSS
-- property.
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listStyleType = args.list_style_type or args['list-style-type']
data.type = args['type']
-- Detect invalid type attributes and attempt to convert them to
-- list-style-type CSS properties.
if data.type
and not data.listStyleType
and not tostring(data.type):find('^%s*[1AaIi]%s*$')
then
data.listStyleType = data.type
data.type = nil
end
end
-- List tag type
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listTag = 'ol'
else
data.listTag = 'ul'
end
-- Start number for ordered lists
data.start = args.start
if listType == 'horizontal_ordered' then
-- Apply fix to get start numbers working with horizontal ordered lists.
local startNum = tonumber(data.start)
if startNum then
data.counterReset = 'listitem ' .. tostring(startNum - 1)
end
end
-- List style
-- ul_style and ol_style are included for backwards compatibility. No
-- distinction is made for ordered or unordered lists.
data.listStyle = args.list_style
-- List items
-- li_style is included for backwards compatibility. item_style was included
-- to be easier to understand for non-coders.
data.itemStyle = args.item_style or args.li_style
data.items = {}
for _, num in ipairs(mTableTools.numKeys(args)) do
local item = {}
item.content = args[num]
item.style = args['item' .. tostring(num) .. '_style']
or args['item_style' .. tostring(num)]
item.value = args['item' .. tostring(num) .. '_value']
or args['item_value' .. tostring(num)]
table.insert(data.items, item)
end
return data
end
function p.renderList(data)
-- Renders the list HTML.
-- Return the blank string if there are no list items.
if type(data.items) ~= 'table' or #data.items < 1 then
return ''
end
-- Render the main div tag.
local root = mw.html.create('div')
for _, class in ipairs(data.classes or {}) do
root:addClass(class)
end
root:css{['margin-left'] = data.marginLeft}
if data.style then
root:cssText(data.style)
end
-- Render the list tag.
local list = root:tag(data.listTag or 'ul')
list
:attr{start = data.start, type = data.type}
:css{
['counter-reset'] = data.counterReset,
['list-style-type'] = data.listStyleType
}
if data.listStyle then
list:cssText(data.listStyle)
end
-- Render the list items
for _, t in ipairs(data.items or {}) do
local item = list:tag('li')
if data.itemStyle then
item:cssText(data.itemStyle)
end
if t.style then
item:cssText(t.style)
end
item
:attr{value = t.value}
:wikitext(t.content)
end
return data.templatestyles .. tostring(root)
end
function p.renderTrackingCategories(args)
local isDeprecated = false -- Tracks deprecated parameters.
for k, v in pairs(args) do
k = tostring(k)
if k:find('^item_style%d+$') or k:find('^item_value%d+$') then
isDeprecated = true
break
end
end
local ret = ''
if isDeprecated then
ret = ret .. '[[Category:List templates with deprecated parameters]]'
end
return ret
end
function p.makeList(listType, args)
if not listType or not listTypes[listType] then
error(string.format(
"bad argument #1 to 'makeList' ('%s' is not a valid list type)",
tostring(listType)
), 2)
end
checkType('makeList', 2, args, 'table')
local data = p.makeListData(listType, args)
local list = p.renderList(data)
local trackingCategories = p.renderTrackingCategories(args)
return list .. trackingCategories
end
for listType in pairs(listTypes) do
p[listType] = function (frame)
local mArguments = require('Module:Arguments')
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
return nil
end
})
-- Copy all the arguments to a new table, for faster indexing.
local args = {}
for k, v in pairs(origArgs) do
args[k] = v
end
return p.makeList(listType, args)
end
end
return p
eac3701uhf1l3ofrnlsew8iet8x0xsq
31950
31949
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Module:List]] سے 1 نسخہ درآمد کیا گیا
31949
Scribunto
text/plain
local libUtil = require('libraryUtil')
local checkType = libUtil.checkType
local mTableTools = require('Module:TableTools')
local p = {}
local listTypes = {
['bulleted'] = true,
['unbulleted'] = true,
['horizontal'] = true,
['ordered'] = true,
['horizontal_ordered'] = true
}
function p.makeListData(listType, args)
-- Constructs a data table to be passed to p.renderList.
local data = {}
-- Classes and TemplateStyles
data.classes = {}
data.templatestyles = ''
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Hlist/styles.css' }
}
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
data.templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Plainlist/styles.css' }
}
end
table.insert(data.classes, args.class)
-- Main div style
data.style = args.style
-- Indent for horizontal lists
if listType == 'horizontal' or listType == 'horizontal_ordered' then
local indent = tonumber(args.indent)
indent = indent and indent * 1.6 or 0
if indent > 0 then
data.marginLeft = indent .. 'em'
end
end
-- List style types for ordered lists
-- This could be "1, 2, 3", "a, b, c", or a number of others. The list style
-- type is either set by the "type" attribute or the "list-style-type" CSS
-- property.
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listStyleType = args.list_style_type or args['list-style-type']
data.type = args['type']
-- Detect invalid type attributes and attempt to convert them to
-- list-style-type CSS properties.
if data.type
and not data.listStyleType
and not tostring(data.type):find('^%s*[1AaIi]%s*$')
then
data.listStyleType = data.type
data.type = nil
end
end
-- List tag type
if listType == 'ordered' or listType == 'horizontal_ordered' then
data.listTag = 'ol'
else
data.listTag = 'ul'
end
-- Start number for ordered lists
data.start = args.start
if listType == 'horizontal_ordered' then
-- Apply fix to get start numbers working with horizontal ordered lists.
local startNum = tonumber(data.start)
if startNum then
data.counterReset = 'listitem ' .. tostring(startNum - 1)
end
end
-- List style
-- ul_style and ol_style are included for backwards compatibility. No
-- distinction is made for ordered or unordered lists.
data.listStyle = args.list_style
-- List items
-- li_style is included for backwards compatibility. item_style was included
-- to be easier to understand for non-coders.
data.itemStyle = args.item_style or args.li_style
data.items = {}
for _, num in ipairs(mTableTools.numKeys(args)) do
local item = {}
item.content = args[num]
item.style = args['item' .. tostring(num) .. '_style']
or args['item_style' .. tostring(num)]
item.value = args['item' .. tostring(num) .. '_value']
or args['item_value' .. tostring(num)]
table.insert(data.items, item)
end
return data
end
function p.renderList(data)
-- Renders the list HTML.
-- Return the blank string if there are no list items.
if type(data.items) ~= 'table' or #data.items < 1 then
return ''
end
-- Render the main div tag.
local root = mw.html.create('div')
for _, class in ipairs(data.classes or {}) do
root:addClass(class)
end
root:css{['margin-left'] = data.marginLeft}
if data.style then
root:cssText(data.style)
end
-- Render the list tag.
local list = root:tag(data.listTag or 'ul')
list
:attr{start = data.start, type = data.type}
:css{
['counter-reset'] = data.counterReset,
['list-style-type'] = data.listStyleType
}
if data.listStyle then
list:cssText(data.listStyle)
end
-- Render the list items
for _, t in ipairs(data.items or {}) do
local item = list:tag('li')
if data.itemStyle then
item:cssText(data.itemStyle)
end
if t.style then
item:cssText(t.style)
end
item
:attr{value = t.value}
:wikitext(t.content)
end
return data.templatestyles .. tostring(root)
end
function p.renderTrackingCategories(args)
local isDeprecated = false -- Tracks deprecated parameters.
for k, v in pairs(args) do
k = tostring(k)
if k:find('^item_style%d+$') or k:find('^item_value%d+$') then
isDeprecated = true
break
end
end
local ret = ''
if isDeprecated then
ret = ret .. '[[Category:List templates with deprecated parameters]]'
end
return ret
end
function p.makeList(listType, args)
if not listType or not listTypes[listType] then
error(string.format(
"bad argument #1 to 'makeList' ('%s' is not a valid list type)",
tostring(listType)
), 2)
end
checkType('makeList', 2, args, 'table')
local data = p.makeListData(listType, args)
local list = p.renderList(data)
local trackingCategories = p.renderTrackingCategories(args)
return list .. trackingCategories
end
for listType in pairs(listTypes) do
p[listType] = function (frame)
local mArguments = require('Module:Arguments')
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
return nil
end
})
-- Copy all the arguments to a new table, for faster indexing.
local args = {}
for k, v in pairs(origArgs) do
args[k] = v
end
return p.makeList(listType, args)
end
end
return p
eac3701uhf1l3ofrnlsew8iet8x0xsq
سانچہ:Documentation subpage
10
12913
31951
2025-03-15T23:17:17Z
en>TG-article
0
31951
wikitext
text/x-wiki
<includeonly>{{#ifeq: {{lc:{{SUBPAGENAME}}}} | {{{override|doc}}}
| <!-- doc page -->
</includeonly>{{
#ifeq: {{{doc-notice|show}}} | show
| {{mbox
| type = notice
| image = [[File:Edit-copy green.svg|40px]]
| text =
'''This is a [[w:Wikipedia:Template documentation|documentation]] [[w:Wikipedia:Subpages|subpage]] for {{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}'''.<br />It contains usage information, [[w:Wikipedia:Categorization|categories]], and other content that is not part of the original {{ #if: {{{text2|}}} | {{{text2}}} | {{ #if: {{{text1|}}} | {{{text1}}} | {{ #ifeq: {{SUBJECTSPACE}} | {{ns:User}} | {{lc:{{SUBJECTSPACE}}}} template page | {{ #ifeq: {{SUBJECTSPACE}} |{{ns:}}|article|{{lc:{{SUBJECTSPACE}}}} page}}}}}}}}.
}}
}}{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}{{
#if: {{{inhibit|}}}
| <!-- skip -->
| <includeonly>{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}|[[Category:{{
#switch: {{SUBJECTSPACE}}
| {{ns:Template}} = Template
| {{ns:Module}} = Module
| {{ns:User}} = User
| #default = Wikisource
}} documentation pages]]|[[Category:Documentation subpages without corresponding pages]]}}</includeonly>
}}<includeonly>
| <!-- if not on a /doc subpage, do nothing -->
}}</includeonly><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
</noinclude>
87bhngfe58qqvlgz1l3a5xltdnndjgx
31952
31951
2026-04-22T01:45:34Z
Satdeep Gill
85
[[:en:Template:Documentation_subpage]] سے 1 نسخہ درآمد کیا گیا
31951
wikitext
text/x-wiki
<includeonly>{{#ifeq: {{lc:{{SUBPAGENAME}}}} | {{{override|doc}}}
| <!-- doc page -->
</includeonly>{{
#ifeq: {{{doc-notice|show}}} | show
| {{mbox
| type = notice
| image = [[File:Edit-copy green.svg|40px]]
| text =
'''This is a [[w:Wikipedia:Template documentation|documentation]] [[w:Wikipedia:Subpages|subpage]] for {{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}'''.<br />It contains usage information, [[w:Wikipedia:Categorization|categories]], and other content that is not part of the original {{ #if: {{{text2|}}} | {{{text2}}} | {{ #if: {{{text1|}}} | {{{text1}}} | {{ #ifeq: {{SUBJECTSPACE}} | {{ns:User}} | {{lc:{{SUBJECTSPACE}}}} template page | {{ #ifeq: {{SUBJECTSPACE}} |{{ns:}}|article|{{lc:{{SUBJECTSPACE}}}} page}}}}}}}}.
}}
}}{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}{{
#if: {{{inhibit|}}}
| <!-- skip -->
| <includeonly>{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}|[[Category:{{
#switch: {{SUBJECTSPACE}}
| {{ns:Template}} = Template
| {{ns:Module}} = Module
| {{ns:User}} = User
| #default = Wikisource
}} documentation pages]]|[[Category:Documentation subpages without corresponding pages]]}}</includeonly>
}}<includeonly>
| <!-- if not on a /doc subpage, do nothing -->
}}</includeonly><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
</noinclude>
87bhngfe58qqvlgz1l3a5xltdnndjgx
سانچہ:Mbox
10
12914
31953
2021-02-13T12:58:42Z
en>Xover
0
1 revision imported from [[:w:Template:Mbox]]: re-sync from enwp
31953
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
mpflpb6s8l8gaoxaeypyuqyu2w7vc7i
31954
31953
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Template:Mbox]] سے 1 نسخہ درآمد کیا گیا
31953
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
mpflpb6s8l8gaoxaeypyuqyu2w7vc7i
سانچہ:Uses TemplateStyles
10
12915
31955
2019-09-03T10:27:11Z
en>Xover
0
2 revisions imported from [[:w:Template:Uses_TemplateStyles]]: importing from enwp
31955
wikitext
text/x-wiki
<includeonly>{{#invoke:Uses TemplateStyles|main}}</includeonly><noinclude>
{{Uses TemplateStyles|Template:Uses TemplateStyles/example.css|nocat=true}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
eqhrm3aklele9wufyv66k58upan0j1w
31956
31955
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Template:Uses_TemplateStyles]] سے 1 نسخہ درآمد کیا گیا
31955
wikitext
text/x-wiki
<includeonly>{{#invoke:Uses TemplateStyles|main}}</includeonly><noinclude>
{{Uses TemplateStyles|Template:Uses TemplateStyles/example.css|nocat=true}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
eqhrm3aklele9wufyv66k58upan0j1w
ماڈیول:Uses TemplateStyles
828
12916
31957
2021-02-17T14:04:04Z
en>Billinghurst
0
Protected "[[Module:Uses TemplateStyles]]": High traffic page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
31957
Scribunto
text/plain
-- This module implements the {{Uses TemplateStyles}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local tStyles = mTableTools.compressSparseArray(args)
local box = p.renderBox(tStyles)
local trackingCategories = p.renderTrackingCategories(args, tStyles)
return box .. trackingCategories
end
function p.renderBox(tStyles)
local boxArgs = {}
if #tStyles < 1 then
boxArgs.text = '<strong class="error">Error: no TemplateStyles specified</strong>'
else
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local sandboxLink = nil
local tsTitle = mw.title.new(ts)
if tsTitle then
local tsSandboxTitle = mw.title.new(string.format('%s:%s/sandbox/%s', tsTitle.nsText, tsTitle.baseText, tsTitle.subpageText))
if tsSandboxTitle and tsSandboxTitle.exists then
sandboxLink = string.format(' ([[:%s|sandbox]])', tsSandboxTitle.prefixedText)
end
end
tStylesLinks[i] = string.format('[[:%s]]%s', ts, sandboxLink or '')
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = 'This ' ..
(mw.title.getCurrentTitle():inNamespaces(828,829) and 'module' or 'template') ..
' uses [[w:Wikipedia:TemplateStyles|TemplateStyles]]:\n' .. tStylesList
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Farm-Fresh css add.svg|32px|alt=CSS]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #tStyles < 1 then
cats[#cats + 1] = 'Uses TemplateStyles templates with errors'
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not subpageBlacklist[titleObj.subpageText]
then
local category = args.category
if not category then
category = category or 'Templates using TemplateStyles'
end
cats[#cats + 1] = category
if not yesno(args.noprotcat) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for i, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if tsProt ~= currentProt and not addedLevelCat then
cats[#cats + 1] = "Templates using TemplateStyles with a different protection level"
end
if tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find("{{pp-") then
cats[#cats + 1] = "Templates using TemplateStyles without padlocks"
addedPadlockCat = true
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p
8vt8oei5798fbradi88ngef952fzgrm
31958
31957
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Module:Uses_TemplateStyles]] سے 1 نسخہ درآمد کیا گیا
31957
Scribunto
text/plain
-- This module implements the {{Uses TemplateStyles}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local tStyles = mTableTools.compressSparseArray(args)
local box = p.renderBox(tStyles)
local trackingCategories = p.renderTrackingCategories(args, tStyles)
return box .. trackingCategories
end
function p.renderBox(tStyles)
local boxArgs = {}
if #tStyles < 1 then
boxArgs.text = '<strong class="error">Error: no TemplateStyles specified</strong>'
else
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local sandboxLink = nil
local tsTitle = mw.title.new(ts)
if tsTitle then
local tsSandboxTitle = mw.title.new(string.format('%s:%s/sandbox/%s', tsTitle.nsText, tsTitle.baseText, tsTitle.subpageText))
if tsSandboxTitle and tsSandboxTitle.exists then
sandboxLink = string.format(' ([[:%s|sandbox]])', tsSandboxTitle.prefixedText)
end
end
tStylesLinks[i] = string.format('[[:%s]]%s', ts, sandboxLink or '')
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = 'This ' ..
(mw.title.getCurrentTitle():inNamespaces(828,829) and 'module' or 'template') ..
' uses [[w:Wikipedia:TemplateStyles|TemplateStyles]]:\n' .. tStylesList
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Farm-Fresh css add.svg|32px|alt=CSS]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #tStyles < 1 then
cats[#cats + 1] = 'Uses TemplateStyles templates with errors'
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not subpageBlacklist[titleObj.subpageText]
then
local category = args.category
if not category then
category = category or 'Templates using TemplateStyles'
end
cats[#cats + 1] = category
if not yesno(args.noprotcat) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for i, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if tsProt ~= currentProt and not addedLevelCat then
cats[#cats + 1] = "Templates using TemplateStyles with a different protection level"
end
if tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find("{{pp-") then
cats[#cats + 1] = "Templates using TemplateStyles without padlocks"
addedPadlockCat = true
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p
8vt8oei5798fbradi88ngef952fzgrm
32014
2019-09-03T10:27:11Z
en>Xover
0
2 revisions imported from [[:w:Template:Uses_TemplateStyles]]: importing from enwp
32014
wikitext
text/x-wiki
<includeonly>{{#invoke:Uses TemplateStyles|main}}</includeonly><noinclude>
{{Uses TemplateStyles|Template:Uses TemplateStyles/example.css|nocat=true}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
eqhrm3aklele9wufyv66k58upan0j1w
32015
31958
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Template:Uses_TemplateStyles]] سے 1 نسخہ درآمد کیا گیا
31957
Scribunto
text/plain
-- This module implements the {{Uses TemplateStyles}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local tStyles = mTableTools.compressSparseArray(args)
local box = p.renderBox(tStyles)
local trackingCategories = p.renderTrackingCategories(args, tStyles)
return box .. trackingCategories
end
function p.renderBox(tStyles)
local boxArgs = {}
if #tStyles < 1 then
boxArgs.text = '<strong class="error">Error: no TemplateStyles specified</strong>'
else
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local sandboxLink = nil
local tsTitle = mw.title.new(ts)
if tsTitle then
local tsSandboxTitle = mw.title.new(string.format('%s:%s/sandbox/%s', tsTitle.nsText, tsTitle.baseText, tsTitle.subpageText))
if tsSandboxTitle and tsSandboxTitle.exists then
sandboxLink = string.format(' ([[:%s|sandbox]])', tsSandboxTitle.prefixedText)
end
end
tStylesLinks[i] = string.format('[[:%s]]%s', ts, sandboxLink or '')
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = 'This ' ..
(mw.title.getCurrentTitle():inNamespaces(828,829) and 'module' or 'template') ..
' uses [[w:Wikipedia:TemplateStyles|TemplateStyles]]:\n' .. tStylesList
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Farm-Fresh css add.svg|32px|alt=CSS]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #tStyles < 1 then
cats[#cats + 1] = 'Uses TemplateStyles templates with errors'
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not subpageBlacklist[titleObj.subpageText]
then
local category = args.category
if not category then
category = category or 'Templates using TemplateStyles'
end
cats[#cats + 1] = category
if not yesno(args.noprotcat) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for i, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if tsProt ~= currentProt and not addedLevelCat then
cats[#cats + 1] = "Templates using TemplateStyles with a different protection level"
end
if tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find("{{pp-") then
cats[#cats + 1] = "Templates using TemplateStyles without padlocks"
addedPadlockCat = true
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p
8vt8oei5798fbradi88ngef952fzgrm
سانچہ:High-use
10
12917
31959
2024-06-25T19:51:05Z
en>CalendulaAsteraceae
0
add parameter
31959
wikitext
text/x-wiki
{{#invoke:High-use|main|1={{{1|}}}|2={{{2|}}}|info={{{info|}}}|demo={{{demo|}}}|form={{{form|}}}|expiry={{{expiry|}}}|system={{{system|}}}}}<noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! -->
</noinclude>
j29sm6019piulvmp7rcudlkhl1yuxmv
31960
31959
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Template:High-use]] سے 1 نسخہ درآمد کیا گیا
31959
wikitext
text/x-wiki
{{#invoke:High-use|main|1={{{1|}}}|2={{{2|}}}|info={{{info|}}}|demo={{{demo|}}}|form={{{form|}}}|expiry={{{expiry|}}}|system={{{system|}}}}}<noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage; interwiki links go to Wikidata, thank you! -->
</noinclude>
j29sm6019piulvmp7rcudlkhl1yuxmv
سانچہ:Lua
10
12918
31961
2019-09-03T10:33:17Z
en>Xover
0
58 revisions imported from [[:w:Template:Lua]]: importing from enwp
31961
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pnmjp3f3fl321yf2jpg5syebi412n7b
31962
31961
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Template:Lua]] سے 1 نسخہ درآمد کیا گیا
31961
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pnmjp3f3fl321yf2jpg5syebi412n7b
ماڈیول:High-use
828
12919
31963
2025-10-09T04:52:47Z
en>CalendulaAsteraceae
0
add refactored code
31963
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
-- local _fetch = require('Module:Transclusion_count')._fetch -- _fetch looks at the 'demo' argument
local yesno = require('Module:Yesno')
local lang_obj = mw.getContentLanguage() -- this here because the language object is used multiple places in the module
local large_count_cutoff = 100000
local approx_num_total_pages = 4736000
local user_subpage_info_page = 'w:Wikipedia:User pages#SUB'
local sandbox_module_page = 'Module:Sandbox'
local system_messages_cat = 'Pages used in system messages needing protection'
local sandbox_word = 'sandbox'
local testcases_word = 'testcases'
local doc_word = 'doc'
local function count_from_args(args)
if tonumber(args.count) then -- check if function has already been used
return tonumber(args.count) -- early exit if so
end
local count
--[=[
if yesno(args['fetch']) ~= false then
count = _fetch(args) -- fetch transclusion count
end
]=]
-- use explicitly-provided count when fetch fails
if count == nil and args[1] ~= nil and args[1] ~= '' then
-- convert local language number string to a number understandable by Lua
count = mw.ustring.gsub(args[1], '+$', '')
count = lang_obj:parseFormattedNumber(args[1])
end
-- in case someone writes a non-positive number
if count and count > 0 then
return count
end
return nil
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
local function risk_boolean(args)
if args.risk == true or args.risk == false then
return args.risk
elseif args[1] == 'risk' then
return true
else
local count = count_from_args(args)
if count and count >= large_count_cutoff then
return true
end
end
return false
end
-- function retained for backwards compatibility
function p._risk(args)
return risk_boolean(args) and 'risk' or ''
end
-- function retained for backwards compatibility
function p.risk(frame)
return p._risk(getArgs(frame))
end
-- count and no_percent arguments retained for backwards compatibility
function p._num(args, count, no_percent)
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- Build output string
local return_value = ''
if args.count == nil and args.risk then
return 'a very large number of'
elseif args.count == nil then
return 'many'
else
-- Use 2 significant figures for smaller numbers and 3 for larger ones
local sigfig = 2
if args.count >= large_count_cutoff then
sigfig = 3
end
-- Prepare to round to appropriate number of sigfigs
local f = math.floor(math.log10(args.count)) - sigfig + 1
-- Round and insert 'approximately' or '+' when appropriate
if yesno(args[2]) == true or (type(args[1]) == 'string' and (mw.ustring.sub(args[1], -1) == '+')) then
-- Round down
return_value = string.format('%s+', lang_obj:formatNum(math.floor( (args.count / 10^(f)) ) * (10^(f))) )
else
-- Round to nearest
return_value = string.format('approximately %s', lang_obj:formatNum(math.floor( (args.count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
no_percent = yesno(no_percent or args['no-percent'])
if args.count and args.count >= approx_num_total_pages/100 and not no_percent then
local num_total_pages = mw.getCurrentFrame():callParserFunction('NUMBEROFPAGES', 'R')
local total_percent = math.floor( ( ( args.count/num_total_pages ) * 100) + 0.5)
if total_percent >= 1 then
return_value = string.format('%s pages, or roughly %s%% of all', return_value, total_percent)
end
end
end
return return_value
end
-- used by [[Template:Stub documentation]] and other pages
-- count argument retained for backwards compatibility
function p.num(frame, count)
return p._num(getArgs(frame), count)
end
-- count argument retained for backwards compatibility
function p._text(args, count)
--[=[
Only show the information about how this template gets updated
if someone is actually editing the page and maybe trying to update the count.
]=]
local bot_text = (mw.getCurrentFrame():preprocess('{{REVISIONID}}') == '') and ("\n\n----\n'''Preview message''':" .. ' Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]]).') or ''
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- trim /doc, /sandbox and /testcases
local title = args.title or (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
if title.subpageText == doc_word or title.subpageText == sandbox_word or title.subpageText == testcases_word then
title = title.basePageTitle
end
-- use /testcases of base template
local testcases_page = mw.title.new(title.prefixedText .. '/' .. testcases_word)
-- exists is expensive
while testcases_page.basePageTitle.isSubpage and not testcases_page.exists do
testcases_page = mw.title.new(testcases_page.basePageTitle.basePageTitle.prefixedText .. '/' .. testcases_word)
end
local systemMessages = (args['system'] or '') ~= ''
-- This retrieves the project URL automatically to simplify localization.
local templateCount = ('on [https://linkcount.toolforge.org/?project=%s&page=%s#transclusions %s pages]'):format(
title:fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p._num(args))
local used_on_text = "'''This " .. (title:inNamespace('Module') and 'Lua module' or 'template') .. ' is used '
if systemMessages then
used_on_text = used_on_text .. args['system'] ..
((args.count and args.count > 2000) and ("''', and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
end
local sandbox_text = ('%s\'s [[%s/sandbox|/sandbox]] or [[%s|/testcases]] subpages, or in your own [[%s]]. '):format(
title:inNamespace('Module') and 'module' or 'template',
title.fullText,
testcases_page.fullText,
title:inNamespace('Module') and (sandbox_module_page .. '|module sandbox') or (user_subpage_info_page .. '|user subpage')
)
local infoArg = args['info'] ~= '' and args['info']
if (systemMessages or args.risk) then
local info = '.'
if systemMessages then
info = info .. '<br />Changes to it can cause immediate changes to the ' .. mw.site.namespaces.Project.name .. ' user interface.'
end
if infoArg then
info = info .. '<br />' .. infoArg
end
sandbox_text = info .. '<br /> To avoid major disruption' ..
(args.count and args.count >= large_count_cutoff and ' and server load' or '') .. -- should this use args.risk?
', any changes should be tested in the ' .. sandbox_text ..
'The tested changes can be added to this page in a single edit. '
else
sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..
'hanges may be widely noticed. Test changes in the ' .. sandbox_text
end
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
if args[2] ~= nil and args[2] ~= '' and yesno(args[2]) == nil then
discussion_text = string.format('%sat [[%s]]', discussion_text, args[2])
else
discussion_text = string.format('%son the [[%s|talk page]]', discussion_text, title.talkPageTitle.fullText)
end
return used_on_text .. sandbox_text .. discussion_text .. ' before implementing them.' .. bot_text
end
-- used by [[Template:R from high-use template]]
-- count argument retained for backwards compatibility
function p.text(frame, count)
return p._text(getArgs(frame), count)
end
-- nocat argument retained for backwards compatibility
function p._main(args, nocat)
args.count = count_from_args(args)
args.risk = risk_boolean(args)
args.title = (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
local image = 'Ambox warning yellow.svg'
local type_param = 'style'
local epilogue = ''
if args['system'] and args['system'] ~= '' then
image = 'Ambox important.svg'
type_param = 'content'
if yesno(nocat or args['nocat']) ~= true and not args.title.isRedirect then
local protection_action = (args.title:inNamespace('File') and 'upload') or 'edit'
local protection_level = require('Module:Effective protection level')._main(protection_action, args.title.fullText)
if protection_level ~= 'sysop' and protection_level ~= 'templateeditor' and protection_level ~= 'interfaceadmin' then
epilogue = mw.getCurrentFrame():expandTemplate {
title = 'sandbox other',
args = {
[2] = '[[Category:' .. system_messages_cat .. ']]'
}
}
end
end
elseif args.risk then
image = 'Ambox warning orange.svg'
type_param = 'content'
end
image = '[[File:' .. image .. '|40px|alt=Warning|link=]]'
if args['form'] == 'editnotice' then
return mw.getCurrentFrame():expandTemplate{
title = 'editnotice',
args = {
['image'] = image,
['text'] = p._text(args),
['expiry'] = (args['expiry'] or '')
}
} .. epilogue
else
return require('Module:Message box').main('ombox', {
type = type_param,
image = image,
text = p._text(args),
expiry = (args['expiry'] or '')
}) .. epilogue
end
end
function p.main(frame)
return p._main(getArgs(frame))
end
return p
gcio7xpngwgu6yvip0rcxdacqigrh0a
31964
31963
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Module:High-use]] سے 1 نسخہ درآمد کیا گیا
31963
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
-- local _fetch = require('Module:Transclusion_count')._fetch -- _fetch looks at the 'demo' argument
local yesno = require('Module:Yesno')
local lang_obj = mw.getContentLanguage() -- this here because the language object is used multiple places in the module
local large_count_cutoff = 100000
local approx_num_total_pages = 4736000
local user_subpage_info_page = 'w:Wikipedia:User pages#SUB'
local sandbox_module_page = 'Module:Sandbox'
local system_messages_cat = 'Pages used in system messages needing protection'
local sandbox_word = 'sandbox'
local testcases_word = 'testcases'
local doc_word = 'doc'
local function count_from_args(args)
if tonumber(args.count) then -- check if function has already been used
return tonumber(args.count) -- early exit if so
end
local count
--[=[
if yesno(args['fetch']) ~= false then
count = _fetch(args) -- fetch transclusion count
end
]=]
-- use explicitly-provided count when fetch fails
if count == nil and args[1] ~= nil and args[1] ~= '' then
-- convert local language number string to a number understandable by Lua
count = mw.ustring.gsub(args[1], '+$', '')
count = lang_obj:parseFormattedNumber(args[1])
end
-- in case someone writes a non-positive number
if count and count > 0 then
return count
end
return nil
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
local function risk_boolean(args)
if args.risk == true or args.risk == false then
return args.risk
elseif args[1] == 'risk' then
return true
else
local count = count_from_args(args)
if count and count >= large_count_cutoff then
return true
end
end
return false
end
-- function retained for backwards compatibility
function p._risk(args)
return risk_boolean(args) and 'risk' or ''
end
-- function retained for backwards compatibility
function p.risk(frame)
return p._risk(getArgs(frame))
end
-- count and no_percent arguments retained for backwards compatibility
function p._num(args, count, no_percent)
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- Build output string
local return_value = ''
if args.count == nil and args.risk then
return 'a very large number of'
elseif args.count == nil then
return 'many'
else
-- Use 2 significant figures for smaller numbers and 3 for larger ones
local sigfig = 2
if args.count >= large_count_cutoff then
sigfig = 3
end
-- Prepare to round to appropriate number of sigfigs
local f = math.floor(math.log10(args.count)) - sigfig + 1
-- Round and insert 'approximately' or '+' when appropriate
if yesno(args[2]) == true or (type(args[1]) == 'string' and (mw.ustring.sub(args[1], -1) == '+')) then
-- Round down
return_value = string.format('%s+', lang_obj:formatNum(math.floor( (args.count / 10^(f)) ) * (10^(f))) )
else
-- Round to nearest
return_value = string.format('approximately %s', lang_obj:formatNum(math.floor( (args.count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
no_percent = yesno(no_percent or args['no-percent'])
if args.count and args.count >= approx_num_total_pages/100 and not no_percent then
local num_total_pages = mw.getCurrentFrame():callParserFunction('NUMBEROFPAGES', 'R')
local total_percent = math.floor( ( ( args.count/num_total_pages ) * 100) + 0.5)
if total_percent >= 1 then
return_value = string.format('%s pages, or roughly %s%% of all', return_value, total_percent)
end
end
end
return return_value
end
-- used by [[Template:Stub documentation]] and other pages
-- count argument retained for backwards compatibility
function p.num(frame, count)
return p._num(getArgs(frame), count)
end
-- count argument retained for backwards compatibility
function p._text(args, count)
--[=[
Only show the information about how this template gets updated
if someone is actually editing the page and maybe trying to update the count.
]=]
local bot_text = (mw.getCurrentFrame():preprocess('{{REVISIONID}}') == '') and ("\n\n----\n'''Preview message''':" .. ' Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]]).') or ''
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- trim /doc, /sandbox and /testcases
local title = args.title or (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
if title.subpageText == doc_word or title.subpageText == sandbox_word or title.subpageText == testcases_word then
title = title.basePageTitle
end
-- use /testcases of base template
local testcases_page = mw.title.new(title.prefixedText .. '/' .. testcases_word)
-- exists is expensive
while testcases_page.basePageTitle.isSubpage and not testcases_page.exists do
testcases_page = mw.title.new(testcases_page.basePageTitle.basePageTitle.prefixedText .. '/' .. testcases_word)
end
local systemMessages = (args['system'] or '') ~= ''
-- This retrieves the project URL automatically to simplify localization.
local templateCount = ('on [https://linkcount.toolforge.org/?project=%s&page=%s#transclusions %s pages]'):format(
title:fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p._num(args))
local used_on_text = "'''This " .. (title:inNamespace('Module') and 'Lua module' or 'template') .. ' is used '
if systemMessages then
used_on_text = used_on_text .. args['system'] ..
((args.count and args.count > 2000) and ("''', and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
end
local sandbox_text = ('%s\'s [[%s/sandbox|/sandbox]] or [[%s|/testcases]] subpages, or in your own [[%s]]. '):format(
title:inNamespace('Module') and 'module' or 'template',
title.fullText,
testcases_page.fullText,
title:inNamespace('Module') and (sandbox_module_page .. '|module sandbox') or (user_subpage_info_page .. '|user subpage')
)
local infoArg = args['info'] ~= '' and args['info']
if (systemMessages or args.risk) then
local info = '.'
if systemMessages then
info = info .. '<br />Changes to it can cause immediate changes to the ' .. mw.site.namespaces.Project.name .. ' user interface.'
end
if infoArg then
info = info .. '<br />' .. infoArg
end
sandbox_text = info .. '<br /> To avoid major disruption' ..
(args.count and args.count >= large_count_cutoff and ' and server load' or '') .. -- should this use args.risk?
', any changes should be tested in the ' .. sandbox_text ..
'The tested changes can be added to this page in a single edit. '
else
sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..
'hanges may be widely noticed. Test changes in the ' .. sandbox_text
end
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
if args[2] ~= nil and args[2] ~= '' and yesno(args[2]) == nil then
discussion_text = string.format('%sat [[%s]]', discussion_text, args[2])
else
discussion_text = string.format('%son the [[%s|talk page]]', discussion_text, title.talkPageTitle.fullText)
end
return used_on_text .. sandbox_text .. discussion_text .. ' before implementing them.' .. bot_text
end
-- used by [[Template:R from high-use template]]
-- count argument retained for backwards compatibility
function p.text(frame, count)
return p._text(getArgs(frame), count)
end
-- nocat argument retained for backwards compatibility
function p._main(args, nocat)
args.count = count_from_args(args)
args.risk = risk_boolean(args)
args.title = (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
local image = 'Ambox warning yellow.svg'
local type_param = 'style'
local epilogue = ''
if args['system'] and args['system'] ~= '' then
image = 'Ambox important.svg'
type_param = 'content'
if yesno(nocat or args['nocat']) ~= true and not args.title.isRedirect then
local protection_action = (args.title:inNamespace('File') and 'upload') or 'edit'
local protection_level = require('Module:Effective protection level')._main(protection_action, args.title.fullText)
if protection_level ~= 'sysop' and protection_level ~= 'templateeditor' and protection_level ~= 'interfaceadmin' then
epilogue = mw.getCurrentFrame():expandTemplate {
title = 'sandbox other',
args = {
[2] = '[[Category:' .. system_messages_cat .. ']]'
}
}
end
end
elseif args.risk then
image = 'Ambox warning orange.svg'
type_param = 'content'
end
image = '[[File:' .. image .. '|40px|alt=Warning|link=]]'
if args['form'] == 'editnotice' then
return mw.getCurrentFrame():expandTemplate{
title = 'editnotice',
args = {
['image'] = image,
['text'] = p._text(args),
['expiry'] = (args['expiry'] or '')
}
} .. epilogue
else
return require('Module:Message box').main('ombox', {
type = type_param,
image = image,
text = p._text(args),
expiry = (args['expiry'] or '')
}) .. epilogue
end
end
function p.main(frame)
return p._main(getArgs(frame))
end
return p
gcio7xpngwgu6yvip0rcxdacqigrh0a
ماڈیول:Lua banner
828
12920
31965
2024-09-01T15:05:01Z
en>عُثمان
0
link to lua page specifically (not disambiguation)
31965
Scribunto
text/plain
-- This module implements the {{lua}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local modules = mTableTools.compressSparseArray(args)
local box = p.renderBox(modules)
local trackingCategories = p.renderTrackingCategories(args, modules)
return box .. trackingCategories
end
function p.renderBox(modules)
local boxArgs = {}
if #modules < 1 then
boxArgs.text = '<strong class="error">Error: no modules specified</strong>'
else
local moduleLinks = {}
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
local maybeSandbox = mw.title.new(module .. '/sandbox')
if maybeSandbox and maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
end
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" then
title = title.basePageTitle
end
if title.contentModel == "Scribunto" then
boxArgs.text = 'This module depends on the following other modules:' .. moduleList
else
boxArgs.text = 'This template uses [[Wikipedia:Lua (programming language)|Lua]]:\n' .. moduleList
end
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Lua-Logo.svg|30px|alt=|link=]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, modules, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #modules < 1 then
cats[#cats + 1] = 'Lua templates with errors'
end
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if not subpageBlacklist[titleObj.subpageText] then
local protCatName
if titleObj.namespace == 10 then
local category = args.category
if not category then
local categories = {
['Module:String'] = 'Templates based on the String Lua module',
['Module:Math'] = 'Templates based on the Math Lua module',
['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module',
['Module:Citation/CS1'] = 'Templates based on the Citation/CS1 Lua module'
}
category = modules[1] and categories[modules[1]]
category = category or 'Lua-based templates'
end
cats[#cats + 1] = category
protCatName = "Templates using under-protected Lua modules"
elseif titleObj.namespace == 828 then
protCatName = "Modules depending on under-protected modules"
end
if not args.noprotcat and protCatName then
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
local currentProt
if titleObj.id ~= 0 then
-- id is 0 (page does not exist) if am previewing before creating a template.
currentProt = titleObj.protectionLevels["edit"][1]
end
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
if module ~= "WP:libraryUtil" then
local moduleTitle = mw.title.new(module)
local moduleProt = moduleTitle and moduleTitle.protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
cats[#cats + 1] = protCatName
break
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p
eni2mgpiwp36o8i8kv9dhk6gv6h8qpn
31966
31965
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Module:Lua_banner]] سے 1 نسخہ درآمد کیا گیا
31965
Scribunto
text/plain
-- This module implements the {{lua}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local modules = mTableTools.compressSparseArray(args)
local box = p.renderBox(modules)
local trackingCategories = p.renderTrackingCategories(args, modules)
return box .. trackingCategories
end
function p.renderBox(modules)
local boxArgs = {}
if #modules < 1 then
boxArgs.text = '<strong class="error">Error: no modules specified</strong>'
else
local moduleLinks = {}
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
local maybeSandbox = mw.title.new(module .. '/sandbox')
if maybeSandbox and maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
end
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" then
title = title.basePageTitle
end
if title.contentModel == "Scribunto" then
boxArgs.text = 'This module depends on the following other modules:' .. moduleList
else
boxArgs.text = 'This template uses [[Wikipedia:Lua (programming language)|Lua]]:\n' .. moduleList
end
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Lua-Logo.svg|30px|alt=|link=]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, modules, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #modules < 1 then
cats[#cats + 1] = 'Lua templates with errors'
end
-- Lua templates category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if not subpageBlacklist[titleObj.subpageText] then
local protCatName
if titleObj.namespace == 10 then
local category = args.category
if not category then
local categories = {
['Module:String'] = 'Templates based on the String Lua module',
['Module:Math'] = 'Templates based on the Math Lua module',
['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module',
['Module:Citation/CS1'] = 'Templates based on the Citation/CS1 Lua module'
}
category = modules[1] and categories[modules[1]]
category = category or 'Lua-based templates'
end
cats[#cats + 1] = category
protCatName = "Templates using under-protected Lua modules"
elseif titleObj.namespace == 828 then
protCatName = "Modules depending on under-protected modules"
end
if not args.noprotcat and protCatName then
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
local currentProt
if titleObj.id ~= 0 then
-- id is 0 (page does not exist) if am previewing before creating a template.
currentProt = titleObj.protectionLevels["edit"][1]
end
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
if module ~= "WP:libraryUtil" then
local moduleTitle = mw.title.new(module)
local moduleProt = moduleTitle and moduleTitle.protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
cats[#cats + 1] = protCatName
break
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p
eni2mgpiwp36o8i8kv9dhk6gv6h8qpn
سانچہ:Notice
10
12921
31967
2025-01-03T09:24:06Z
en>Xover
0
use mbox, and allow explicit text param
31967
wikitext
text/x-wiki
{{mbox|text={{{text|{{{1|}}}}}}}}<noinclude>
{{documentation}}
</noinclude>
h3muiiqzdl1c8doco8zggun8kp6df02
31968
31967
2026-04-22T01:45:35Z
Satdeep Gill
85
[[:en:Template:Notice]] سے 1 نسخہ درآمد کیا گیا
31967
wikitext
text/x-wiki
{{mbox|text={{{text|{{{1|}}}}}}}}<noinclude>
{{documentation}}
</noinclude>
h3muiiqzdl1c8doco8zggun8kp6df02
سانچہ:Proofreadpage index template/doc
10
12922
31969
2025-08-27T03:36:05Z
en>CalendulaAsteraceae
0
Undo revision [[Special:Diff/15302781|15302781]] by [[Special:Contributions/CalendulaAsteraceae|CalendulaAsteraceae]] ([[User talk:CalendulaAsteraceae|talk]])
31969
wikitext
text/x-wiki
{{Documentation subpage|[[Mediawiki:Proofreadpage index template]]}}
{{Lua|Module:Proofreadpage index template}}
{{templatestyles|Module:Proofreadpage index template/styles.css}}
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->
=== Usage ===
{{notice|You should not use this template manually on any page. It is used automatically by the Wikisource software.}}
{{high use|36123}}
This is the template used by the ProofreadPage extension to construct the index page from the data entered in the edit form.
The parameters that are shown in the edit field and passed in are set up in [[Mediawiki:Proofreadpage index data config]] as JSON.
=== See also ===
* [[Mediawiki:Proofreadpage index data config]]
<includeonly>
<!-- PLEASE ADD CATEGORIES BELOW THIS LINE AND INTERWIKIS IN WIKIDATA, THANKS -->
[[Category:Index templates| ]]
</includeonly>
9oaf2a9dtdpvf5rnsdj66abjum4jxjq
31970
31969
2026-04-22T01:45:36Z
Satdeep Gill
85
[[:en:Template:Proofreadpage_index_template/doc]] سے 1 نسخہ درآمد کیا گیا
31969
wikitext
text/x-wiki
{{Documentation subpage|[[Mediawiki:Proofreadpage index template]]}}
{{Lua|Module:Proofreadpage index template}}
{{templatestyles|Module:Proofreadpage index template/styles.css}}
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->
=== Usage ===
{{notice|You should not use this template manually on any page. It is used automatically by the Wikisource software.}}
{{high use|36123}}
This is the template used by the ProofreadPage extension to construct the index page from the data entered in the edit form.
The parameters that are shown in the edit field and passed in are set up in [[Mediawiki:Proofreadpage index data config]] as JSON.
=== See also ===
* [[Mediawiki:Proofreadpage index data config]]
<includeonly>
<!-- PLEASE ADD CATEGORIES BELOW THIS LINE AND INTERWIKIS IN WIKIDATA, THANKS -->
[[Category:Index templates| ]]
</includeonly>
9oaf2a9dtdpvf5rnsdj66abjum4jxjq
سانچہ:High use
10
12923
31971
2024-06-10T02:26:41Z
en>CalendulaAsteraceae
0
Redirected page to [[Template:High-use]]
31971
wikitext
text/x-wiki
#redirect[[Template:High-use]]
d6wsjk1f917k4krnr2v7ss46ij30qjk
31972
31971
2026-04-22T01:45:36Z
Satdeep Gill
85
[[:en:Template:High_use]] سے 1 نسخہ درآمد کیا گیا
31971
wikitext
text/x-wiki
#redirect[[Template:High-use]]
d6wsjk1f917k4krnr2v7ss46ij30qjk
ماڈیول:Message box/ombox.css
828
12924
31973
2025-03-17T03:02:10Z
en>CalendulaAsteraceae
0
31973
sanitized-css
text/css
.ombox {
margin: 4px 0;
border-collapse: collapse;
border: 1px solid #a2a9b1; /* Default "notice" gray */
background-color: var(--background-color-neutral-subtle, #f8f9fa);
box-sizing: border-box;
color: var(--color-base, #202122);
}
/* For the "small=yes" option. */
.ombox.mbox-small {
font-size: 88%;
line-height: 1.25em;
}
.ombox-speedy {
border: 2px solid #b32424; /* Red */
background-color: #fee7e6; /* Pink */
}
.ombox-delete {
border: 2px solid #b32424; /* Red */
}
.ombox-content {
border: 1px solid #f28500; /* Orange */
}
.ombox-style {
border: 1px solid #fc3; /* Yellow */
}
.ombox-move {
border: 1px solid #9932cc; /* Purple */
}
.ombox-protection {
border: 2px solid #a2a9b1; /* Gray-gold */
}
.ombox .mbox-text {
border: none;
/* @noflip */
padding: 0.25em 0.9em;
width: 100%;
}
.ombox .mbox-image {
border: none;
/* @noflip */
padding: 2px 0 2px 0.9em;
text-align: center;
}
.ombox .mbox-imageright {
border: none;
/* @noflip */
padding: 2px 0.9em 2px 0;
text-align: center;
}
/* An empty narrow cell */
.ombox .mbox-empty-cell {
border: none;
padding: 0;
width: 1px;
}
.ombox .mbox-invalid-type {
text-align: center;
}
@media (min-width: 720px) {
.ombox {
margin: 4px 10%;
}
.ombox.mbox-small {
/* @noflip */
clear: right;
/* @noflip */
float: right;
/* @noflip */
margin: 4px 0 4px 1em;
width: 238px;
}
}
/** T367463 */
body.skin--responsive table.ombox img {
max-width: none !important;
}
@media screen {
html.skin-theme-clientpref-night .ombox-speedy {
background-color: #310402; /* Dark red, same hue/saturation as light */
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .ombox-speedy {
background-color: #310402; /* Dark red, same hue/saturation as light */
}
}
5gv8lkpvzcasyypj8kwtvyoliam8iq0
31974
31973
2026-04-22T01:45:36Z
Satdeep Gill
85
[[:en:Module:Message_box/ombox.css]] سے 1 نسخہ درآمد کیا گیا
31973
sanitized-css
text/css
.ombox {
margin: 4px 0;
border-collapse: collapse;
border: 1px solid #a2a9b1; /* Default "notice" gray */
background-color: var(--background-color-neutral-subtle, #f8f9fa);
box-sizing: border-box;
color: var(--color-base, #202122);
}
/* For the "small=yes" option. */
.ombox.mbox-small {
font-size: 88%;
line-height: 1.25em;
}
.ombox-speedy {
border: 2px solid #b32424; /* Red */
background-color: #fee7e6; /* Pink */
}
.ombox-delete {
border: 2px solid #b32424; /* Red */
}
.ombox-content {
border: 1px solid #f28500; /* Orange */
}
.ombox-style {
border: 1px solid #fc3; /* Yellow */
}
.ombox-move {
border: 1px solid #9932cc; /* Purple */
}
.ombox-protection {
border: 2px solid #a2a9b1; /* Gray-gold */
}
.ombox .mbox-text {
border: none;
/* @noflip */
padding: 0.25em 0.9em;
width: 100%;
}
.ombox .mbox-image {
border: none;
/* @noflip */
padding: 2px 0 2px 0.9em;
text-align: center;
}
.ombox .mbox-imageright {
border: none;
/* @noflip */
padding: 2px 0.9em 2px 0;
text-align: center;
}
/* An empty narrow cell */
.ombox .mbox-empty-cell {
border: none;
padding: 0;
width: 1px;
}
.ombox .mbox-invalid-type {
text-align: center;
}
@media (min-width: 720px) {
.ombox {
margin: 4px 10%;
}
.ombox.mbox-small {
/* @noflip */
clear: right;
/* @noflip */
float: right;
/* @noflip */
margin: 4px 0 4px 1em;
width: 238px;
}
}
/** T367463 */
body.skin--responsive table.ombox img {
max-width: none !important;
}
@media screen {
html.skin-theme-clientpref-night .ombox-speedy {
background-color: #310402; /* Dark red, same hue/saturation as light */
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .ombox-speedy {
background-color: #310402; /* Dark red, same hue/saturation as light */
}
}
5gv8lkpvzcasyypj8kwtvyoliam8iq0
سانچہ:Templatestyles
10
12925
31975
2023-01-22T10:27:50Z
en>CalendulaAsteraceae
0
Redirected page to [[Template:Uses TemplateStyles]]
31975
wikitext
text/x-wiki
#redirect[[Template:Uses TemplateStyles]]
8f0rgi2mtcp9knbw1fqytk72jlrxkks
31976
31975
2026-04-22T01:45:36Z
Satdeep Gill
85
[[:en:Template:Templatestyles]] سے 1 نسخہ درآمد کیا گیا
31975
wikitext
text/x-wiki
#redirect[[Template:Uses TemplateStyles]]
8f0rgi2mtcp9knbw1fqytk72jlrxkks
ماڈیول:Documentation/styles.css
828
12926
31977
2025-01-31T02:16:52Z
en>CalendulaAsteraceae
0
simplify dark-mode friendliness by using existing variables
31977
sanitized-css
text/css
.documentation,
.documentation-metadata {
border: 1px solid var(--border-color-base, #a2a9b1);
background-color: var(--background-color-success-subtle, #ecfcf4);
color:inherit;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
font-style: italic;
padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}
k52i2u8oq2ylrdnu4uw0zkc3si0w87a
31978
31977
2026-04-22T01:45:36Z
Satdeep Gill
85
[[:en:Module:Documentation/styles.css]] سے 1 نسخہ درآمد کیا گیا
31977
sanitized-css
text/css
.documentation,
.documentation-metadata {
border: 1px solid var(--border-color-base, #a2a9b1);
background-color: var(--background-color-success-subtle, #ecfcf4);
color:inherit;
clear: both;
}
.documentation {
margin: 1em 0 0 0;
padding: 1em;
}
.documentation-metadata {
margin: 0.2em 0; /* same margin left-right as .documentation */
font-style: italic;
padding: 0.4em 1em; /* same padding left-right as .documentation */
}
.documentation-startbox {
padding-bottom: 3px;
border-bottom: 1px solid #aaa;
margin-bottom: 1ex;
}
.documentation-heading {
font-weight: bold;
font-size: 125%;
}
.documentation-clear { /* Don't want things to stick out where they shouldn't. */
clear: both;
}
.documentation-toolbar {
font-style: normal;
font-size: 85%;
}
k52i2u8oq2ylrdnu4uw0zkc3si0w87a
سانچہ:Proofreadpage index template
10
12927
31979
2024-03-19T03:37:19Z
en>CalendulaAsteraceae
0
fix link
31979
wikitext
text/x-wiki
{{deprecated|See the replacement: [[MediaWiki:Proofreadpage index template]]}}<includeonly><templatestyles src="Module:Proofreadpage index template/styles.css" />
{{#invoke:Proofreadpage index template|main}}</includeonly><noinclude>
{{documentation|Template:Proofreadpage index template/doc}}
</noinclude>
4ng3vgmuvshvb6wr9k83fhz4saj53kj
31980
31979
2026-04-22T01:47:49Z
Satdeep Gill
85
[[:en:Template:Proofreadpage_index_template]] سے 1 نسخہ درآمد کیا گیا
31979
wikitext
text/x-wiki
{{deprecated|See the replacement: [[MediaWiki:Proofreadpage index template]]}}<includeonly><templatestyles src="Module:Proofreadpage index template/styles.css" />
{{#invoke:Proofreadpage index template|main}}</includeonly><noinclude>
{{documentation|Template:Proofreadpage index template/doc}}
</noinclude>
4ng3vgmuvshvb6wr9k83fhz4saj53kj
ماڈیول:Proofreadpage index template/styles.css
828
12928
31981
2025-03-11T18:35:37Z
en>CalendulaAsteraceae
0
add text colors
31981
sanitized-css
text/css
/* Styles for Index: namespace pages */
#ws-index-container {
display: table;
border-spacing: 1px 1px;
box-sizing: border-box;
width: 100%;
}
#ws-index-main-cell {
padding: 0;
vertical-align: top;
}
#ws-index-main-table {
display: inline-table;
border-collapse: collapse;
border-spacing: 0 0;
box-sizing: border-box;
width: 100%;
}
#ws-index-cover-container {
float: left;
margin: .5em .25em .5em 0;
}
#ws-index-metadata {
border-collapse: separate;
border-spacing: 2px 2px;
box-sizing: border-box;
empty-cells: show;
}
.ws-index-label {
padding-right: .5em;
text-align: right;
vertical-align: top;
}
.ws-index-value {
vertical-align: top;
}
#ws-index-pagelist-container {
margin-right: .75em;
}
#ws-index-pagelist {
text-align: justify;
}
#ws-index-pagelist-container em {
font-weight: bold;
font-style: normal;
}
#ws-index-pagelist-legend {
font-size: 83%;
white-space: nowrap;
}
#ws-index-remarks {
padding: 0 .25em;
vertical-align: top;
width: 30%;
}
#ws-index-remarks-empty {
display: none;
padding: 0;
vertical-align: top;
}
/* Experimental new-style index markup below this line. */
/*
* Normal index styling mimicing the old layout.
*/
/* The main container */
.ws-index-container {
display: grid;
box-sizing: border-box;
max-width: 100%;
grid-template-areas:
"cover metadata remarks"
"pagelist pagelist remarks"
". . remarks";
grid-template-columns: 250px 1fr 30%;
grid-gap: 1em;
}
.ws-index-cover-container {
grid-area: cover;
}
.ws-index-metadata-container {
grid-area: metadata;
}
.ws-index-pagelist-container {
grid-area: pagelist;
}
.ws-index-pagelist-heading {
padding-bottom: .5em;
white-space: pre-wrap;
font-weight: bold;
}
.ws-index-pagelist-heading-legend {
font-size: 83%;
font-weight: normal;
}
.ws-index-remarks-container {
grid-area: remarks;
}
/*
* Demo index styling demonstrating some possibilities.
*/
/* The main container */
.ws-tng.ws-index-container {
display: grid;
box-sizing: border-box;
max-width: 100%;
grid-template-areas:
"cover"
"metadata"
"pagelist"
"remarks";
grid-template-columns: 100%;
grid-gap: 1em;
background: #fafafa;
color: #202122;
}
.ws-tng .ws-index-cover-container {
grid-area: cover;
}
.ws-tng .ws-index-metadata-container {
grid-area: metadata;
}
.ws-tng .ws-index-metadata {
width: 100%;
}
.ws-tng .ws-index-pagelist-container {
grid-area: pagelist;
}
.ws-tng .ws-index-pagelist-heading {
padding-bottom: .5em;
white-space: pre-wrap;
font-weight: bold;
}
.ws-tng .ws-index-pagelist-heading-legend {
font-size: 83%;
font-weight: normal;
}
.ws-tng .ws-index-remarks-container {
grid-area: remarks;
background: white;
color: #202122;
}
@media (min-width: 700px) {
.ws-tng.ws-index-container {
grid-template-areas:
"metadata cover"
"pagelist pagelist"
"remarks remarks";
grid-template-columns: 1fr fit-content(250px);
grid-gap: 2em;
}
}
@media (min-width: 1000px) {
.ws-tng.ws-index-container {
grid-template-areas:
"metadata cover remarks"
"pagelist pagelist remarks"
". . remarks";
grid-template-columns: 1fr fit-content(250px) fit-content(30%);
grid-gap: 3em;
/* box-shadow: rgba(50, 50, 93, 0.25) 0 6px 12px -2px, rgba(0, 0, 0, 0.3) 0 3px 7px -3px; */
/* filter: drop-shadow(0.6rem 0.6rem 1rem rgba(20, 20, 180, 0.8)); */
padding: 6em;
background-image: url(//upload.wikimedia.org/wikipedia/commons/e/eb/Pinckney_Marcius-Simons%2C_endleaf_1_verso--endleaf_2_recto%2C_extra-illustrated_copy_of_A_Midsummer_Night%27s_Dream.png);
background-origin: border-box;
background-size: 100% 100%;
}
.ws-tng .ws-index-remarks-container {
box-shadow: inset rgba(50, 50, 93, 0.25) 0 10px 10px -5px;
background-color: white;
color: #202122;
padding: .5em;
}
.ws-tng .ws-index-pagelist-container {
background-color: rgba(255, 255, 255, 0.9);
color: #202122;
}
.ws-tng .ws-index-metadata {
/* background-image:
linear-gradient(180deg, white 3rem, #F0A4A4 calc(3rem), #F0A4A4 calc(3rem + 2px), transparent 1px),
repeating-linear-gradient(0deg, transparent, transparent 1.5rem, #DDD 1px, #DDD calc(1.5rem + 1px)); */
/* box-shadow: 1px 1px 3px rgba(0, 0, 0, .25); */
border-collapse: collapse;
}
.ws-tng .ws-index-row {
border-bottom: 1px solid #DDD;
}
.ws-tng .ws-index-row:first-child {
border-bottom: 2px solid #F0A4A4;
}
.ws-tng .ws-index-metadata-container {
height: fit-content(250px);
width: fit-content(400px);
justify-self: center;
align-self: center;
box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
background: white;
color: #202122;
}
.ws-tng .ws-index-cover-container {
width: 300px;
}
.ws-tng .ws-index-cover-container img {
margin: 0 auto;
filter: drop-shadow(10px 10px 5px #000);
}
}
31aawm0ssryjl72e86lqnq21bip34qb
31982
31981
2026-04-22T01:48:36Z
Satdeep Gill
85
[[:en:Module:Proofreadpage_index_template/styles.css]] سے 1 نسخہ درآمد کیا گیا
31981
sanitized-css
text/css
/* Styles for Index: namespace pages */
#ws-index-container {
display: table;
border-spacing: 1px 1px;
box-sizing: border-box;
width: 100%;
}
#ws-index-main-cell {
padding: 0;
vertical-align: top;
}
#ws-index-main-table {
display: inline-table;
border-collapse: collapse;
border-spacing: 0 0;
box-sizing: border-box;
width: 100%;
}
#ws-index-cover-container {
float: left;
margin: .5em .25em .5em 0;
}
#ws-index-metadata {
border-collapse: separate;
border-spacing: 2px 2px;
box-sizing: border-box;
empty-cells: show;
}
.ws-index-label {
padding-right: .5em;
text-align: right;
vertical-align: top;
}
.ws-index-value {
vertical-align: top;
}
#ws-index-pagelist-container {
margin-right: .75em;
}
#ws-index-pagelist {
text-align: justify;
}
#ws-index-pagelist-container em {
font-weight: bold;
font-style: normal;
}
#ws-index-pagelist-legend {
font-size: 83%;
white-space: nowrap;
}
#ws-index-remarks {
padding: 0 .25em;
vertical-align: top;
width: 30%;
}
#ws-index-remarks-empty {
display: none;
padding: 0;
vertical-align: top;
}
/* Experimental new-style index markup below this line. */
/*
* Normal index styling mimicing the old layout.
*/
/* The main container */
.ws-index-container {
display: grid;
box-sizing: border-box;
max-width: 100%;
grid-template-areas:
"cover metadata remarks"
"pagelist pagelist remarks"
". . remarks";
grid-template-columns: 250px 1fr 30%;
grid-gap: 1em;
}
.ws-index-cover-container {
grid-area: cover;
}
.ws-index-metadata-container {
grid-area: metadata;
}
.ws-index-pagelist-container {
grid-area: pagelist;
}
.ws-index-pagelist-heading {
padding-bottom: .5em;
white-space: pre-wrap;
font-weight: bold;
}
.ws-index-pagelist-heading-legend {
font-size: 83%;
font-weight: normal;
}
.ws-index-remarks-container {
grid-area: remarks;
}
/*
* Demo index styling demonstrating some possibilities.
*/
/* The main container */
.ws-tng.ws-index-container {
display: grid;
box-sizing: border-box;
max-width: 100%;
grid-template-areas:
"cover"
"metadata"
"pagelist"
"remarks";
grid-template-columns: 100%;
grid-gap: 1em;
background: #fafafa;
color: #202122;
}
.ws-tng .ws-index-cover-container {
grid-area: cover;
}
.ws-tng .ws-index-metadata-container {
grid-area: metadata;
}
.ws-tng .ws-index-metadata {
width: 100%;
}
.ws-tng .ws-index-pagelist-container {
grid-area: pagelist;
}
.ws-tng .ws-index-pagelist-heading {
padding-bottom: .5em;
white-space: pre-wrap;
font-weight: bold;
}
.ws-tng .ws-index-pagelist-heading-legend {
font-size: 83%;
font-weight: normal;
}
.ws-tng .ws-index-remarks-container {
grid-area: remarks;
background: white;
color: #202122;
}
@media (min-width: 700px) {
.ws-tng.ws-index-container {
grid-template-areas:
"metadata cover"
"pagelist pagelist"
"remarks remarks";
grid-template-columns: 1fr fit-content(250px);
grid-gap: 2em;
}
}
@media (min-width: 1000px) {
.ws-tng.ws-index-container {
grid-template-areas:
"metadata cover remarks"
"pagelist pagelist remarks"
". . remarks";
grid-template-columns: 1fr fit-content(250px) fit-content(30%);
grid-gap: 3em;
/* box-shadow: rgba(50, 50, 93, 0.25) 0 6px 12px -2px, rgba(0, 0, 0, 0.3) 0 3px 7px -3px; */
/* filter: drop-shadow(0.6rem 0.6rem 1rem rgba(20, 20, 180, 0.8)); */
padding: 6em;
background-image: url(//upload.wikimedia.org/wikipedia/commons/e/eb/Pinckney_Marcius-Simons%2C_endleaf_1_verso--endleaf_2_recto%2C_extra-illustrated_copy_of_A_Midsummer_Night%27s_Dream.png);
background-origin: border-box;
background-size: 100% 100%;
}
.ws-tng .ws-index-remarks-container {
box-shadow: inset rgba(50, 50, 93, 0.25) 0 10px 10px -5px;
background-color: white;
color: #202122;
padding: .5em;
}
.ws-tng .ws-index-pagelist-container {
background-color: rgba(255, 255, 255, 0.9);
color: #202122;
}
.ws-tng .ws-index-metadata {
/* background-image:
linear-gradient(180deg, white 3rem, #F0A4A4 calc(3rem), #F0A4A4 calc(3rem + 2px), transparent 1px),
repeating-linear-gradient(0deg, transparent, transparent 1.5rem, #DDD 1px, #DDD calc(1.5rem + 1px)); */
/* box-shadow: 1px 1px 3px rgba(0, 0, 0, .25); */
border-collapse: collapse;
}
.ws-tng .ws-index-row {
border-bottom: 1px solid #DDD;
}
.ws-tng .ws-index-row:first-child {
border-bottom: 2px solid #F0A4A4;
}
.ws-tng .ws-index-metadata-container {
height: fit-content(250px);
width: fit-content(400px);
justify-self: center;
align-self: center;
box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.75);
background: white;
color: #202122;
}
.ws-tng .ws-index-cover-container {
width: 300px;
}
.ws-tng .ws-index-cover-container img {
margin: 0 auto;
filter: drop-shadow(10px 10px 5px #000);
}
}
31aawm0ssryjl72e86lqnq21bip34qb
ماڈیول:Proofreadpage index template
828
12929
31984
2026-04-04T14:23:24Z
en>Alien333
0
remove the (UTC)-cropping due to it putting just a question without answers in the talkremarks; consequently reduce the max-height from 9.5em to 5.5em due to more long stuff probably more appearing with this
31984
Scribunto
text/plain
--[=[
This is a module to implement logic for [[MediaWiki:Proofreadpage index template]]
]=]
local getArgs = require('Module:Arguments').getArgs
local messageBox = require('Module:Message box')
local ISO_639 = require('Module:ISO 639')
local error_text = require('Module:Error')['error']
local category_handler = require('Module:Category handler')._main
local p = {} -- p stands for package
local cfg = require('Module:Proofreadpage index template/config')
local attribution_data = require('Module:Header/attribution data')
local function process_args(args)
-- Set any defaults
for k, v in pairs(cfg.defaults) do
if args[k] == nil then
args[k] = cfg.defaults[k]
end
end
args.source_type = cfg['cover_cats']['file_types'][args['Source']]
args.pageTitle = (args.pageTitle and mw.title.new(args.pageTitle)) or mw.title.getCurrentTitle()
args.fileTitle = mw.title.makeTitle('File', args.pageTitle.rootText)
args.talkPageTitle = args.pageTitle.talkPageTitle
args.file_exists = args.fileTitle.file.exists -- Expensive, so only compute once
return args
end
local function construct_cat(cat)
return '[[Category:' .. cat .. ']]'
end
local function construct_cat_link(cat, text)
return '[[:Category:' .. cat .. '|' .. (text or cat) .. ']]'
end
-- Construct a basic "field" row
local function construct_field(id, content)
if id == nil or content == nil then
return nil
elseif not cfg.headings[id] then
error(cfg.missing_heading_id(id))
end
local tr = mw.html.create('tr')
:attr('id', 'ws-index-' .. id .. '-row')
:addClass('ws-index-row')
:tag('th')
:attr('scope', 'row')
:attr('id', 'ws-index-' .. id .. '-label')
:addClass('ws-index-label')
:wikitext(cfg.headings[id]['txt'])
:done()
:tag('td')
:attr('id', 'ws-index-' .. id .. '-value')
:addClass('ws-index-value')
:wikitext(content)
:allDone()
return tr
end
local function construct_status_field(args, statusArgs)
local key = statusArgs.key
local lower_key = string.lower(key)
local config_key = statusArgs.config_key or lower_key
local index_status = args[key] or '_missing'
local sd = cfg[config_key][index_status] or cfg[config_key]['_default']
local index_status_message = sd['txt']
if type(index_status_message) == 'function' then
index_status_message = index_status_message(index_status)
end
if sd['error'] then
index_status_message = error_text({['message'] = index_status_message, ['tag'] = 'span'})
else
index_status_message = construct_cat_link(sd['cat'], index_status_message)
end
return {row = construct_field(lower_key, index_status_message), cat = construct_cat(sd['cat'])}
end
--[=[
Create indicator markup based on config
Loads the config module and creates indicator extension tags after pattern
<indicator name="foo">[[File:Foo.svg|20px|link=bar|caption|alt=Alt text.]]</indcator>
]=]
local function construct_indicator(args, iArgs)
if not (iArgs.include or cfg.indicator_defaults.include)(args) then
return nil
end
local indicator_parts = {
iArgs.image or cfg.indicator_defaults.image,
iArgs.width or cfg.indicator_defaults.width
}
local alt = iArgs.alt or cfg.indicator_defaults.alt
table.insert(indicator_parts, alt and 'alt=' .. alt)
local link = iArgs.link or cfg.indicator_defaults.link
if type(link) == 'function' then
link = link(args)
end
table.insert(indicator_parts, link and 'link=' .. link)
local caption = iArgs.caption or cfg.indicator_defaults.caption
if type(caption) == 'function' then
caption = caption(args)
end
table.insert(indicator_parts, caption)
return mw.getCurrentFrame():extensionTag{
['name'] = 'indicator',
['content'] = '[[' .. table.concat(indicator_parts, '|') .. ']]',
['args'] = {
['name'] = iArgs.name or cfg.indicator_defaults.name
}
}
end
local function _metadata(args)
local metadatatable = mw.html.create('table')
:attr('id', 'ws-index-metadata')
local cats = {}
local indicators = {}
if args['Title'] then
metadatatable:node(construct_field('title', table.concat({args['Title'], args['Volume']}, ', ')))
else
metadatatable:node(construct_field('title', args['Volume'] or ''))
end
local simple_args = {}
for i, v in ipairs(attribution_data) do
local noun = v.noun
table.insert(simple_args, {string.upper(string.sub(noun, 1, 1)) .. string.sub(noun, 2)})
end
table.insert(simple_args, {'Year'})
table.insert(simple_args, {'Publisher'})
table.insert(simple_args, {'Address', 'place'})
for i, v in ipairs(simple_args) do
metadatatable:node(construct_field(v[2] or string.lower(v[1]), args[v[1]]))
end
-- Categorize image-based indexes
if args.source_type and cfg['cover_cats'][args.source_type] then
table.insert(cats, construct_cat(cfg['cover_cats'][args.source_type]))
elseif not args.source_type then
table.insert(cats, construct_cat(cfg['cover_cats']['unknown']))
end
local source = args['Source']
if args.file_exists then
source = '[[:' .. args.fileTitle.fullText .. '|' .. source .. ']]'
else
-- Add a tracking category
table.insert(cats, construct_cat(cfg.cover_cats.missing))
end
metadatatable:node(construct_field('source', source))
-- Progress
local progress_data = construct_status_field(args, {['key'] = 'Progress', ['config_key'] = 'status'})
metadatatable:node(progress_data.row)
table.insert(cats, progress_data.cat)
-- Transclusion status
local transclusion_data = construct_status_field(args, {['key'] = 'Transclusion'})
metadatatable:node(transclusion_data.row)
table.insert(cats, transclusion_data.cat)
local vdate = args['Validation_date']
if vdate then
local vcat = cfg['validation_cats']['dated'](vdate)
metadatatable:node(construct_field('validation_date', construct_cat_link(vcat, vdate)))
table.insert(cats, construct_cat(vcat))
elseif args['Progress'] == 'T' then
table.insert(cats, construct_cat(cfg['validation_cats']['undated']))
end
local info_args = {'ISBN', 'OCLC', 'LCCN', 'ARK', --[=['National Archives',]=] 'DOI'}
for i, v in ipairs(info_args) do
local val = args[v]
if val then
local lower_key = string.lower(v)
local link_fn = cfg.url_gens[lower_key]
if link_fn then
metadatatable:node(construct_field(lower_key, link_fn(val, val)))
end
end
end
metadatatable:node(construct_field('volumes', args['Volumes']))
-- Language categorisations
if args.Language then
local langs = mw.text.split(args.Language, ',%s*', false)
for _, l in ipairs(langs) do
local lang = mw.text.trim(l)
if lang ~= '' then
table.insert(cats, construct_cat(cfg['language_cats']['single'](ISO_639.language_name(lang))))
end
end
if #langs > 1 then
table.insert(cats, construct_cat(cfg['language_cats']['multi']))
end
end
return {['table'] = metadatatable, cats = table.concat(cats), indicators = table.concat(indicators)}
end
--[=[
Get the image to use as the cover image for this index
If the Image parameter contains an integer, it refers to a page in a DjVu/PDF and can be used directly
Otherwise, it may be a full image specification that we can use directly,
or just an image filename that we can construct an image specification for
]=]
local function default_cover_image(link)
return '[[' .. cfg.cover.image .. '|' .. cfg.cover.width .. '|link=' .. link .. '|class=ws-cover]]'
end
local function _cover(args)
local image_number = tonumber(args['Image'])
-- check for timestamps
if args['Image'] and not image_number and args.source_type == 'audiovisual' and mw.ustring.match(args['Image'], '^%d+[%d:]*$') then
image_number = args['Image']
end
local image_spec
local cats = {}
if not image_number and args['Image'] and mw.ustring.find(args['Image'], '^%[%[') then
-- Image param is not a (page) number and looks like a full image specification
image_spec = args['Image']
if args.source_type ~= 'image' then
-- Add a tracking category
table.insert(cats, construct_cat(cfg.cover_cats.fullspec))
end
elseif not image_number and args['Image'] and mw.ustring.find(args['Image'], '%.%w+$') then
-- Image param is not a (page) number and is probably a filename with or without File: prefix
image_spec = args['Image']
local image_prefixes = {
mw.site.namespaces.File.name,
mw.site.namespaces.File.canonicalName
}
for i, alias in ipairs(mw.site.namespaces.File.aliases) do
table.insert(image_prefixes, alias)
end
for i, prefix in ipairs(image_prefixes) do
image_spec = mw.ustring.gsub(image_spec, '^' .. prefix .. ':', '')
image_spec = mw.ustring.gsub(image_spec, '^' .. string.lower(prefix) .. ':', '')
end
image_spec = '[[File:' .. image_spec .. '|' .. cfg.cover.width .. '|class=ws-cover]]'
if args.source_type ~= 'image' then
-- Add a tracking category
table.insert(cats, construct_cat(cfg.cover_cats.fullspec))
end
elseif args.source_type == 'multipage' and args.file_exists then
-- It's a DjVu/PDF-backed index, so we fetch the cover image from a page in the (multipage) file
image_spec = '[[' .. args.fileTitle.prefixedText .. '|' .. cfg.cover.width .. '|page=' .. (image_number or 1) .. '|class=ws-cover]]'
elseif args.source_type == 'audiovisual' and args.file_exists then
-- It's an audio/video-backed index, so we fetch the cover image from a thumbnail time
image_spec = '[[' .. args.fileTitle.prefixedText .. '|' .. cfg.cover.width .. '|thumbtime=' .. (image_number or 0) .. '|class=ws-cover]]'
elseif args.file_exists then
-- It's either an image-based index or some unknown type, so we use the file
image_spec = '[[' .. args.fileTitle.prefixedText .. '|' .. cfg.cover.width .. '|class=ws-cover]]'
else
-- Our associated file doesn't exist, so we use a placeholder
local image_link = args.fileTitle.prefixedText
if mw.ustring.find(args.fileTitle.rootText, '^.*%.%w+') == nil then
image_link = 'Special:Upload'
end
image_spec = default_cover_image(image_link)
end
return image_spec .. table.concat(cats)
end
-- Also implements [[Template:Index talk remarks]]
function p._index_talk_remarks(args)
if not args.talkPageTitle then
args.pageTitle = (args.pageTitle and mw.title.new(args.pageTitle)) or mw.title.getCurrentTitle()
args.talkPageTitle = args.pageTitle.talkPageTitle
end
local text = cfg['talkremarks']['text'](args)
local cat = category_handler({construct_cat(cfg['talkremarks']['cat'])}) or ''
local notes = ''
if args.notes then
-- 5.5em is small enough, and has the convenience of probably showing the top of a line when there are too many
notes = mw.html.create('div')
:addClass('ombox-content')
:css({
['text-align'] = 'left',
['max-height'] = '5.5em',
['overflow'] = 'scroll',
['padding'] = '0.25em',
['margin'] = '0.25em',
['border-style'] = 'dashed'
})
:newline()
:wikitext(args.notes .. cat)
:newline()
:allDone()
end
return messageBox.main('ombox', {
['type'] = 'content',
['image'] = '[[File:Ambox important.svg|24px]]',
['style'] = 'box-sizing:border-box;margin:-0.93em auto 0.0em;text-align:center;width:100%;',
['textstyle'] = 'font-size:93%;text-decoration:none;',
['text'] = text .. tostring(notes)
})
end
function p.index_talk_remarks(frame)
return p._index_talk_remarks(getArgs(frame))
end
-- Main function
local function _main(args)
args = process_args(args)
local talkremarks = ''
local talk_page_exists = args.talkPageTitle.exists -- Expensive
if talk_page_exists and not args.notes then
local content = args.talkPageTitle.content
for _, keyword in ipairs(cfg.talkremarks.keywords) do
local pattern
if keyword.alone then -- Only whitespace around
pattern = '==( *' .. keyword.pattern .. ' *)=='
else -- Allow for other content besides the keyword
pattern = '==([^=%n]*' .. keyword.pattern .. '[^=%n]*)=='
end
-- Capture section header
local section = mw.ustring.match(content, pattern)
if section then
-- Specifically transclude the section
local section_text = mw.getCurrentFrame():callParserFunction('#lsth', args.talkPageTitle.prefixedText, mw.text.trim(section))
args.notes = section_text
break
end
end
end
if talk_page_exists then
talkremarks = p._index_talk_remarks(args)
end
local metadata_data = _metadata(args)
local sortkey = mw.getCurrentFrame():callParserFunction('DEFAULTSORT', {args['Key'] or args.pageTitle.text})
local is = {}
for _, v in pairs(cfg.indicators) do
table.insert(is, construct_indicator(args, v))
end
table.insert(is, metadata_data.indicators)
local indicators = table.concat(is)
local outertable = mw.html.create('table')
:attr('id', 'ws-index-container')
local outertable_tr = outertable:tag('tr')
outertable_tr
:tag('td')
:attr('id', 'ws-index-main-cell')
:tag('table')
:attr('id', 'ws-index-main-table')
:tag('tr'):tag('td')
:tag('div')
:attr('id', 'ws-index-cover-container')
:wikitext(_cover(args))
:done()
:node(metadata_data['table'])
:done()
:tag('tr'):tag('td'):tag('div')
:attr('id', 'ws-index-pagelist-container')
:addClass('mw-collapsible')
:tag('em'):wikitext(cfg.pagelist.pages.txt):done()
:wikitext(' ')
:tag('span')
:attr('id', 'ws-index-pagelist-legend')
:wikitext(cfg.pagelist.legend.txt)
:done()
:tag('div')
:attr('id', 'ws-index-pagelist')
:addClass('index-pagelist mw-collapsible-content')
:newline()
:wikitext(args['Pages'] and mw.text.trim(args['Pages']))
:newline()
if args['Remarks'] then
outertable_tr:tag('td')
:attr('id', 'ws-index-remarks')
:newline()
:wikitext(mw.getCurrentFrame():preprocess(args['Remarks']))
else
outertable_tr:tag('td')
:attr('id', 'ws-index-remarks-empty')
end
return talkremarks .. indicators .. tostring(outertable) .. metadata_data.cats .. sortkey
end
function p.main(frame)
return _main(getArgs(frame))
end
return p
qel72vrcalz8vdmdarq30y1kswrsckb
31985
31984
2026-04-22T01:49:19Z
Satdeep Gill
85
[[:en:Module:Proofreadpage_index_template]] سے 1 نسخہ درآمد کیا گیا
31984
Scribunto
text/plain
--[=[
This is a module to implement logic for [[MediaWiki:Proofreadpage index template]]
]=]
local getArgs = require('Module:Arguments').getArgs
local messageBox = require('Module:Message box')
local ISO_639 = require('Module:ISO 639')
local error_text = require('Module:Error')['error']
local category_handler = require('Module:Category handler')._main
local p = {} -- p stands for package
local cfg = require('Module:Proofreadpage index template/config')
local attribution_data = require('Module:Header/attribution data')
local function process_args(args)
-- Set any defaults
for k, v in pairs(cfg.defaults) do
if args[k] == nil then
args[k] = cfg.defaults[k]
end
end
args.source_type = cfg['cover_cats']['file_types'][args['Source']]
args.pageTitle = (args.pageTitle and mw.title.new(args.pageTitle)) or mw.title.getCurrentTitle()
args.fileTitle = mw.title.makeTitle('File', args.pageTitle.rootText)
args.talkPageTitle = args.pageTitle.talkPageTitle
args.file_exists = args.fileTitle.file.exists -- Expensive, so only compute once
return args
end
local function construct_cat(cat)
return '[[Category:' .. cat .. ']]'
end
local function construct_cat_link(cat, text)
return '[[:Category:' .. cat .. '|' .. (text or cat) .. ']]'
end
-- Construct a basic "field" row
local function construct_field(id, content)
if id == nil or content == nil then
return nil
elseif not cfg.headings[id] then
error(cfg.missing_heading_id(id))
end
local tr = mw.html.create('tr')
:attr('id', 'ws-index-' .. id .. '-row')
:addClass('ws-index-row')
:tag('th')
:attr('scope', 'row')
:attr('id', 'ws-index-' .. id .. '-label')
:addClass('ws-index-label')
:wikitext(cfg.headings[id]['txt'])
:done()
:tag('td')
:attr('id', 'ws-index-' .. id .. '-value')
:addClass('ws-index-value')
:wikitext(content)
:allDone()
return tr
end
local function construct_status_field(args, statusArgs)
local key = statusArgs.key
local lower_key = string.lower(key)
local config_key = statusArgs.config_key or lower_key
local index_status = args[key] or '_missing'
local sd = cfg[config_key][index_status] or cfg[config_key]['_default']
local index_status_message = sd['txt']
if type(index_status_message) == 'function' then
index_status_message = index_status_message(index_status)
end
if sd['error'] then
index_status_message = error_text({['message'] = index_status_message, ['tag'] = 'span'})
else
index_status_message = construct_cat_link(sd['cat'], index_status_message)
end
return {row = construct_field(lower_key, index_status_message), cat = construct_cat(sd['cat'])}
end
--[=[
Create indicator markup based on config
Loads the config module and creates indicator extension tags after pattern
<indicator name="foo">[[File:Foo.svg|20px|link=bar|caption|alt=Alt text.]]</indcator>
]=]
local function construct_indicator(args, iArgs)
if not (iArgs.include or cfg.indicator_defaults.include)(args) then
return nil
end
local indicator_parts = {
iArgs.image or cfg.indicator_defaults.image,
iArgs.width or cfg.indicator_defaults.width
}
local alt = iArgs.alt or cfg.indicator_defaults.alt
table.insert(indicator_parts, alt and 'alt=' .. alt)
local link = iArgs.link or cfg.indicator_defaults.link
if type(link) == 'function' then
link = link(args)
end
table.insert(indicator_parts, link and 'link=' .. link)
local caption = iArgs.caption or cfg.indicator_defaults.caption
if type(caption) == 'function' then
caption = caption(args)
end
table.insert(indicator_parts, caption)
return mw.getCurrentFrame():extensionTag{
['name'] = 'indicator',
['content'] = '[[' .. table.concat(indicator_parts, '|') .. ']]',
['args'] = {
['name'] = iArgs.name or cfg.indicator_defaults.name
}
}
end
local function _metadata(args)
local metadatatable = mw.html.create('table')
:attr('id', 'ws-index-metadata')
local cats = {}
local indicators = {}
if args['Title'] then
metadatatable:node(construct_field('title', table.concat({args['Title'], args['Volume']}, ', ')))
else
metadatatable:node(construct_field('title', args['Volume'] or ''))
end
local simple_args = {}
for i, v in ipairs(attribution_data) do
local noun = v.noun
table.insert(simple_args, {string.upper(string.sub(noun, 1, 1)) .. string.sub(noun, 2)})
end
table.insert(simple_args, {'Year'})
table.insert(simple_args, {'Publisher'})
table.insert(simple_args, {'Address', 'place'})
for i, v in ipairs(simple_args) do
metadatatable:node(construct_field(v[2] or string.lower(v[1]), args[v[1]]))
end
-- Categorize image-based indexes
if args.source_type and cfg['cover_cats'][args.source_type] then
table.insert(cats, construct_cat(cfg['cover_cats'][args.source_type]))
elseif not args.source_type then
table.insert(cats, construct_cat(cfg['cover_cats']['unknown']))
end
local source = args['Source']
if args.file_exists then
source = '[[:' .. args.fileTitle.fullText .. '|' .. source .. ']]'
else
-- Add a tracking category
table.insert(cats, construct_cat(cfg.cover_cats.missing))
end
metadatatable:node(construct_field('source', source))
-- Progress
local progress_data = construct_status_field(args, {['key'] = 'Progress', ['config_key'] = 'status'})
metadatatable:node(progress_data.row)
table.insert(cats, progress_data.cat)
-- Transclusion status
local transclusion_data = construct_status_field(args, {['key'] = 'Transclusion'})
metadatatable:node(transclusion_data.row)
table.insert(cats, transclusion_data.cat)
local vdate = args['Validation_date']
if vdate then
local vcat = cfg['validation_cats']['dated'](vdate)
metadatatable:node(construct_field('validation_date', construct_cat_link(vcat, vdate)))
table.insert(cats, construct_cat(vcat))
elseif args['Progress'] == 'T' then
table.insert(cats, construct_cat(cfg['validation_cats']['undated']))
end
local info_args = {'ISBN', 'OCLC', 'LCCN', 'ARK', --[=['National Archives',]=] 'DOI'}
for i, v in ipairs(info_args) do
local val = args[v]
if val then
local lower_key = string.lower(v)
local link_fn = cfg.url_gens[lower_key]
if link_fn then
metadatatable:node(construct_field(lower_key, link_fn(val, val)))
end
end
end
metadatatable:node(construct_field('volumes', args['Volumes']))
-- Language categorisations
if args.Language then
local langs = mw.text.split(args.Language, ',%s*', false)
for _, l in ipairs(langs) do
local lang = mw.text.trim(l)
if lang ~= '' then
table.insert(cats, construct_cat(cfg['language_cats']['single'](ISO_639.language_name(lang))))
end
end
if #langs > 1 then
table.insert(cats, construct_cat(cfg['language_cats']['multi']))
end
end
return {['table'] = metadatatable, cats = table.concat(cats), indicators = table.concat(indicators)}
end
--[=[
Get the image to use as the cover image for this index
If the Image parameter contains an integer, it refers to a page in a DjVu/PDF and can be used directly
Otherwise, it may be a full image specification that we can use directly,
or just an image filename that we can construct an image specification for
]=]
local function default_cover_image(link)
return '[[' .. cfg.cover.image .. '|' .. cfg.cover.width .. '|link=' .. link .. '|class=ws-cover]]'
end
local function _cover(args)
local image_number = tonumber(args['Image'])
-- check for timestamps
if args['Image'] and not image_number and args.source_type == 'audiovisual' and mw.ustring.match(args['Image'], '^%d+[%d:]*$') then
image_number = args['Image']
end
local image_spec
local cats = {}
if not image_number and args['Image'] and mw.ustring.find(args['Image'], '^%[%[') then
-- Image param is not a (page) number and looks like a full image specification
image_spec = args['Image']
if args.source_type ~= 'image' then
-- Add a tracking category
table.insert(cats, construct_cat(cfg.cover_cats.fullspec))
end
elseif not image_number and args['Image'] and mw.ustring.find(args['Image'], '%.%w+$') then
-- Image param is not a (page) number and is probably a filename with or without File: prefix
image_spec = args['Image']
local image_prefixes = {
mw.site.namespaces.File.name,
mw.site.namespaces.File.canonicalName
}
for i, alias in ipairs(mw.site.namespaces.File.aliases) do
table.insert(image_prefixes, alias)
end
for i, prefix in ipairs(image_prefixes) do
image_spec = mw.ustring.gsub(image_spec, '^' .. prefix .. ':', '')
image_spec = mw.ustring.gsub(image_spec, '^' .. string.lower(prefix) .. ':', '')
end
image_spec = '[[File:' .. image_spec .. '|' .. cfg.cover.width .. '|class=ws-cover]]'
if args.source_type ~= 'image' then
-- Add a tracking category
table.insert(cats, construct_cat(cfg.cover_cats.fullspec))
end
elseif args.source_type == 'multipage' and args.file_exists then
-- It's a DjVu/PDF-backed index, so we fetch the cover image from a page in the (multipage) file
image_spec = '[[' .. args.fileTitle.prefixedText .. '|' .. cfg.cover.width .. '|page=' .. (image_number or 1) .. '|class=ws-cover]]'
elseif args.source_type == 'audiovisual' and args.file_exists then
-- It's an audio/video-backed index, so we fetch the cover image from a thumbnail time
image_spec = '[[' .. args.fileTitle.prefixedText .. '|' .. cfg.cover.width .. '|thumbtime=' .. (image_number or 0) .. '|class=ws-cover]]'
elseif args.file_exists then
-- It's either an image-based index or some unknown type, so we use the file
image_spec = '[[' .. args.fileTitle.prefixedText .. '|' .. cfg.cover.width .. '|class=ws-cover]]'
else
-- Our associated file doesn't exist, so we use a placeholder
local image_link = args.fileTitle.prefixedText
if mw.ustring.find(args.fileTitle.rootText, '^.*%.%w+') == nil then
image_link = 'Special:Upload'
end
image_spec = default_cover_image(image_link)
end
return image_spec .. table.concat(cats)
end
-- Also implements [[Template:Index talk remarks]]
function p._index_talk_remarks(args)
if not args.talkPageTitle then
args.pageTitle = (args.pageTitle and mw.title.new(args.pageTitle)) or mw.title.getCurrentTitle()
args.talkPageTitle = args.pageTitle.talkPageTitle
end
local text = cfg['talkremarks']['text'](args)
local cat = category_handler({construct_cat(cfg['talkremarks']['cat'])}) or ''
local notes = ''
if args.notes then
-- 5.5em is small enough, and has the convenience of probably showing the top of a line when there are too many
notes = mw.html.create('div')
:addClass('ombox-content')
:css({
['text-align'] = 'left',
['max-height'] = '5.5em',
['overflow'] = 'scroll',
['padding'] = '0.25em',
['margin'] = '0.25em',
['border-style'] = 'dashed'
})
:newline()
:wikitext(args.notes .. cat)
:newline()
:allDone()
end
return messageBox.main('ombox', {
['type'] = 'content',
['image'] = '[[File:Ambox important.svg|24px]]',
['style'] = 'box-sizing:border-box;margin:-0.93em auto 0.0em;text-align:center;width:100%;',
['textstyle'] = 'font-size:93%;text-decoration:none;',
['text'] = text .. tostring(notes)
})
end
function p.index_talk_remarks(frame)
return p._index_talk_remarks(getArgs(frame))
end
-- Main function
local function _main(args)
args = process_args(args)
local talkremarks = ''
local talk_page_exists = args.talkPageTitle.exists -- Expensive
if talk_page_exists and not args.notes then
local content = args.talkPageTitle.content
for _, keyword in ipairs(cfg.talkremarks.keywords) do
local pattern
if keyword.alone then -- Only whitespace around
pattern = '==( *' .. keyword.pattern .. ' *)=='
else -- Allow for other content besides the keyword
pattern = '==([^=%n]*' .. keyword.pattern .. '[^=%n]*)=='
end
-- Capture section header
local section = mw.ustring.match(content, pattern)
if section then
-- Specifically transclude the section
local section_text = mw.getCurrentFrame():callParserFunction('#lsth', args.talkPageTitle.prefixedText, mw.text.trim(section))
args.notes = section_text
break
end
end
end
if talk_page_exists then
talkremarks = p._index_talk_remarks(args)
end
local metadata_data = _metadata(args)
local sortkey = mw.getCurrentFrame():callParserFunction('DEFAULTSORT', {args['Key'] or args.pageTitle.text})
local is = {}
for _, v in pairs(cfg.indicators) do
table.insert(is, construct_indicator(args, v))
end
table.insert(is, metadata_data.indicators)
local indicators = table.concat(is)
local outertable = mw.html.create('table')
:attr('id', 'ws-index-container')
local outertable_tr = outertable:tag('tr')
outertable_tr
:tag('td')
:attr('id', 'ws-index-main-cell')
:tag('table')
:attr('id', 'ws-index-main-table')
:tag('tr'):tag('td')
:tag('div')
:attr('id', 'ws-index-cover-container')
:wikitext(_cover(args))
:done()
:node(metadata_data['table'])
:done()
:tag('tr'):tag('td'):tag('div')
:attr('id', 'ws-index-pagelist-container')
:addClass('mw-collapsible')
:tag('em'):wikitext(cfg.pagelist.pages.txt):done()
:wikitext(' ')
:tag('span')
:attr('id', 'ws-index-pagelist-legend')
:wikitext(cfg.pagelist.legend.txt)
:done()
:tag('div')
:attr('id', 'ws-index-pagelist')
:addClass('index-pagelist mw-collapsible-content')
:newline()
:wikitext(args['Pages'] and mw.text.trim(args['Pages']))
:newline()
if args['Remarks'] then
outertable_tr:tag('td')
:attr('id', 'ws-index-remarks')
:newline()
:wikitext(mw.getCurrentFrame():preprocess(args['Remarks']))
else
outertable_tr:tag('td')
:attr('id', 'ws-index-remarks-empty')
end
return talkremarks .. indicators .. tostring(outertable) .. metadata_data.cats .. sortkey
end
function p.main(frame)
return _main(getArgs(frame))
end
return p
qel72vrcalz8vdmdarq30y1kswrsckb
ماڈیول:ISO 639
828
12930
31986
2024-03-25T03:04:12Z
en>CalendulaAsteraceae
0
simplify nil check
31986
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local warn = require('Module:Warning')
local languageNameOverrides = mw.loadData('Module:ISO 639/overrides')
--[=[
Get the language name, in English, for a given ISO 639 (-1, -2 or -3) code
Returns nil if the language is not in the lookup tables.
]=]
function p.language_name(code, failValue)
-- Only continue if we get passed a non-empty string for the code param
if code == nil or code == '' then
warn('No ISO code provided to [[Module:ISO 639]]')
return failValue
elseif type(code) ~= 'string' then
warn('ISO code \"' .. tostring(code) .. '\" is not a string')
return failValue
end
-- If we have a local override, apply it
local language = languageNameOverrides[code]
-- Otherwise, ask MediaWiki for the language name in English for this code
if language == nil or language == '' then
language = mw.language.fetchLanguageName(code, 'en')
end
-- If we got no name from MediaWiki and have no override for this code,
-- load the big honkin' local lookup table and check there.
if language == nil or language == '' then
local localLanguageNames = mw.loadData('Module:ISO 639/local')
language = localLanguageNames[code]
end
-- If we found a non-empty lang name we return it.
if language ~= nil and language ~= '' then
return language
end
-- otherwise we return the failure value
warn('ISO code \"' .. code .. '\" not recognized by [[Module:ISO 639]]')
return failValue
end
--[=[
Implements [[Template:ISO 639 name]]
]=]
function p.ISO_639_name(frame)
local args = getArgs(frame)
return p.language_name(args[1] or args.code, '[[Category:' .. 'ISO 639 name template errors' .. ']]')
end
return p
3tr0b4bhq6112dvnq0at9vsygu80pd6
31987
31986
2026-04-22T01:49:44Z
Satdeep Gill
85
[[:en:Module:ISO_639]] سے 1 نسخہ درآمد کیا گیا
31986
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local warn = require('Module:Warning')
local languageNameOverrides = mw.loadData('Module:ISO 639/overrides')
--[=[
Get the language name, in English, for a given ISO 639 (-1, -2 or -3) code
Returns nil if the language is not in the lookup tables.
]=]
function p.language_name(code, failValue)
-- Only continue if we get passed a non-empty string for the code param
if code == nil or code == '' then
warn('No ISO code provided to [[Module:ISO 639]]')
return failValue
elseif type(code) ~= 'string' then
warn('ISO code \"' .. tostring(code) .. '\" is not a string')
return failValue
end
-- If we have a local override, apply it
local language = languageNameOverrides[code]
-- Otherwise, ask MediaWiki for the language name in English for this code
if language == nil or language == '' then
language = mw.language.fetchLanguageName(code, 'en')
end
-- If we got no name from MediaWiki and have no override for this code,
-- load the big honkin' local lookup table and check there.
if language == nil or language == '' then
local localLanguageNames = mw.loadData('Module:ISO 639/local')
language = localLanguageNames[code]
end
-- If we found a non-empty lang name we return it.
if language ~= nil and language ~= '' then
return language
end
-- otherwise we return the failure value
warn('ISO code \"' .. code .. '\" not recognized by [[Module:ISO 639]]')
return failValue
end
--[=[
Implements [[Template:ISO 639 name]]
]=]
function p.ISO_639_name(frame)
local args = getArgs(frame)
return p.language_name(args[1] or args.code, '[[Category:' .. 'ISO 639 name template errors' .. ']]')
end
return p
3tr0b4bhq6112dvnq0at9vsygu80pd6
سانچہ:Tl
10
12931
31988
2024-01-11T01:58:58Z
en>Stefán Örvar Sigmundsson
0
31988
wikitext
text/x-wiki
{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>
{{Documentation}}
</noinclude>
to2ps0zqptfuck4l0vfbvm4g4odf2yg
31989
31988
2026-04-22T01:49:48Z
Satdeep Gill
85
[[:en:Template:Tl]] سے 1 نسخہ درآمد کیا گیا
31988
wikitext
text/x-wiki
{{[[Template:{{{1}}}|{{{1}}}]]}}<noinclude>
{{Documentation}}
</noinclude>
to2ps0zqptfuck4l0vfbvm4g4odf2yg
سانچہ:ISO 639 name
10
12932
31990
2024-03-17T02:13:03Z
en>CalendulaAsteraceae
0
use [[Module:ISO 639]]
31990
wikitext
text/x-wiki
<includeonly>{{#invoke:ISO_639|ISO_639_name}}</includeonly><noinclude>{{documentation}}</noinclude>
gsfj5o9udpgv02z4ex5bwe05lb219yu
31991
31990
2026-04-22T01:49:48Z
Satdeep Gill
85
[[:en:Template:ISO_639_name]] سے 1 نسخہ درآمد کیا گیا
31990
wikitext
text/x-wiki
<includeonly>{{#invoke:ISO_639|ISO_639_name}}</includeonly><noinclude>{{documentation}}</noinclude>
gsfj5o9udpgv02z4ex5bwe05lb219yu
ماڈیول:Effective protection expiry
828
12933
31992
2021-02-17T14:02:09Z
en>Billinghurst
0
Protected "[[Module:Effective protection expiry]]": High traffic page or template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
31992
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
i1wms02y1w048cq6uttka18a5pjzp63
31993
31992
2026-04-22T01:49:48Z
Satdeep Gill
85
[[:en:Module:Effective_protection_expiry]] سے 1 نسخہ درآمد کیا گیا
31992
Scribunto
text/plain
local p = {}
-- Returns the expiry of a restriction of an action on a given title, or unknown if it cannot be known.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local stabilitySettings = mw.ext.FlaggedRevs.getStabilitySettings(title)
return stabilitySettings and stabilitySettings.expiry or 'unknown'
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
local rawExpiry = mw.getCurrentFrame():callParserFunction('PROTECTIONEXPIRY', action, pagename)
if rawExpiry == 'infinity' then
return 'infinity'
elseif rawExpiry == '' then
return 'unknown'
else
local year, month, day, hour, minute, second = rawExpiry:match(
'^(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)$'
)
if year then
return string.format(
'%s-%s-%sT%s:%s:%s',
year, month, day, hour, minute, second
)
else
error('internal error in Module:Effective protection expiry; malformed expiry timestamp')
end
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
i1wms02y1w048cq6uttka18a5pjzp63
ماڈیول:Effective protection level
828
12934
31994
2020-08-20T11:28:30Z
en>Billinghurst
0
8 revisions imported from [[:w:Module:Effective_protection_level]]
31994
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
o3wd8v4s0af0nabjp4xwsgqxlffn3mz
31995
31994
2026-04-22T01:49:48Z
Satdeep Gill
85
[[:en:Module:Effective_protection_level]] سے 1 نسخہ درآمد کیا گیا
31994
Scribunto
text/plain
local p = {}
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p._main(action, pagename)
local title
if type(pagename) == 'table' and pagename.prefixedText then
title = pagename
elseif pagename then
title = mw.title.new(pagename)
else
title = mw.title.getCurrentTitle()
end
pagename = title.prefixedText
if action == 'autoreview' then
local level = mw.ext.FlaggedRevs.getStabilitySettings(title)
level = level and level.autoreview
if level == 'review' then
return 'reviewer'
elseif level ~= '' then
return level
else
return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review
end
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
return 'interfaceadmin'
else -- any non-JS/CSS MediaWiki page
return 'sysop'
end
elseif title.namespace == 2 and title.isSubpage then
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page
return 'interfaceadmin'
elseif title.contentModel == 'json' then -- user JSON page
return 'sysop'
end
end
local level = title.protectionLevels[action] and title.protectionLevels[action][1]
if level == 'sysop' or level == 'editprotected' then
return 'sysop'
elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
return 'sysop'
elseif level == 'templateeditor' then
return 'templateeditor'
elseif action == 'move' then
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move.
if blacklistentry and not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif title.namespace == 6 then
return 'filemover'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
end
local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
if blacklistentry then
if not blacklistentry.params.autoconfirmed then
return 'templateeditor'
elseif level == 'extendedconfirmed' then
return 'extendedconfirmed'
else
return 'autoconfirmed'
end
elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
return 'autoconfirmed'
elseif level then
return level
elseif action == 'upload' then
return 'autoconfirmed'
elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts
return 'user'
else
return '*'
end
end
setmetatable(p, { __index = function(t, k)
return function(frame)
return t._main(k, frame.args[1])
end
end })
return p
o3wd8v4s0af0nabjp4xwsgqxlffn3mz
ماڈیول:File link
828
12935
31996
2020-08-20T11:28:31Z
en>Billinghurst
0
3 revisions imported from [[:w:Module:File_link]]
31996
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"type error in '%s' parameter of '_main' (expected string, got %s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("'file' parameter missing from [[Template:File link]]", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
bzc22v133v9z5yc4aisazripn6l94p8
31997
31996
2026-04-22T01:49:48Z
Satdeep Gill
85
[[:en:Module:File_link]] سے 1 نسخہ درآمد کیا گیا
31996
Scribunto
text/plain
-- This module provides a library for formatting file wikilinks.
local yesno = require('Module:Yesno')
local checkType = require('libraryUtil').checkType
local p = {}
function p._main(args)
checkType('_main', 1, args, 'table')
-- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our
-- own function to get the right error level.
local function checkArg(key, val, level)
if type(val) ~= 'string' then
error(string.format(
"type error in '%s' parameter of '_main' (expected string, got %s)",
key, type(val)
), level)
end
end
local ret = {}
-- Adds a positional parameter to the buffer.
local function addPositional(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = val
end
-- Adds a named parameter to the buffer. We assume that the parameter name
-- is the same as the argument key.
local function addNamed(key)
local val = args[key]
if not val then
return nil
end
checkArg(key, val, 4)
ret[#ret + 1] = key .. '=' .. val
end
-- Filename
checkArg('file', args.file, 3)
ret[#ret + 1] = 'File:' .. args.file
-- Format
if args.format then
checkArg('format', args.format)
if args.formatfile then
checkArg('formatfile', args.formatfile)
ret[#ret + 1] = args.format .. '=' .. args.formatfile
else
ret[#ret + 1] = args.format
end
end
-- Border
if yesno(args.border) then
ret[#ret + 1] = 'border'
end
addPositional('location')
addPositional('alignment')
addPositional('size')
addNamed('upright')
addNamed('link')
addNamed('alt')
addNamed('page')
addNamed('class')
addNamed('lang')
addNamed('start')
addNamed('end')
addNamed('thumbtime')
addPositional('caption')
return string.format('[[%s]]', table.concat(ret, '|'))
end
function p.main(frame)
local origArgs = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:File link'
})
if not origArgs.file then
error("'file' parameter missing from [[Template:File link]]", 0)
end
-- Copy the arguments that were passed to a new table to avoid looking up
-- every possible parameter in the frame object.
local args = {}
for k, v in pairs(origArgs) do
-- Make _BLANK a special argument to add a blank parameter. For use in
-- conditional templates etc. it is useful for blank arguments to be
-- ignored, but we still need a way to specify them so that we can do
-- things like [[File:Example.png|link=]].
if v == '_BLANK' then
v = ''
end
args[k] = v
end
return p._main(args)
end
return p
bzc22v133v9z5yc4aisazripn6l94p8
ماڈیول:Protection banner
828
12936
31998
2022-10-21T09:38:27Z
en>WOSlinker
0
use require('strict') instead of require('Module:No globals')
31998
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('strict')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'Module:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
local cfg = self._cfg
local title = self.title
-- Exit if the page is not protected.
if not self:isProtected() then
return ''
end
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:isProtected()
or type(expiry) == 'number' and expiry < os.time()
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = { self:makeProtectionCategory() }
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return require('Module:Vandal-m')._main{
self._args.user or self._protectionObj.title.baseText
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
obj._imageFilename = imageFilename
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageWidth or 20) .. 'px',
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 40
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 20
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)]
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:isProtected() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
hraihk42yzei1k32e7gw7rwjvn9igeg
31999
31998
2026-04-22T01:49:48Z
Satdeep Gill
85
[[:en:Module:Protection_banner]] سے 1 نسخہ درآمد کیا گیا
31998
Scribunto
text/plain
-- This module implements {{pp-meta}} and its daughter templates such as
-- {{pp-dispute}}, {{pp-vandalism}} and {{pp-sock}}.
-- Initialise necessary modules.
require('strict')
local makeFileLink = require('Module:File link')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionExpiry = require('Module:Effective protection expiry')._main
local yesno = require('Module:Yesno')
-- Lazily initialise modules and objects we don't always need.
local getArgs, makeMessageBox, lang
-- Set constants.
local CONFIG_MODULE = 'Module:Protection banner/config'
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function makeCategoryLink(cat, sort)
if cat then
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name,
cat,
sort
)
end
end
-- Validation function for the expiry and the protection date
local function validateDate(dateString, dateType)
if not lang then
lang = mw.language.getContentLanguage()
end
local success, result = pcall(lang.formatDate, lang, 'U', dateString)
if success then
result = tonumber(result)
if result then
return result
end
end
error(string.format(
'invalid %s: %s',
dateType,
tostring(dateString)
), 4)
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
-- Given a directed graph formatted as node -> table of direct successors,
-- get a table of all nodes reachable from a given node (though always
-- including the given node).
local function getReachableNodes(graph, start)
local toWalk, retval = {[start] = true}, {}
while true do
-- Can't use pairs() since we're adding and removing things as we're iterating
local k = next(toWalk) -- This always gets the "first" key
if k == nil then
return retval
end
toWalk[k] = nil
retval[k] = true
for _,v in ipairs(graph[k]) do
if not retval[v] then
toWalk[v] = true
end
end
end
end
--------------------------------------------------------------------------------
-- Protection class
--------------------------------------------------------------------------------
local Protection = {}
Protection.__index = Protection
Protection.supportedActions = {
edit = true,
move = true,
autoreview = true,
upload = true
}
Protection.bannerConfigFields = {
'text',
'explanation',
'tooltip',
'alt',
'link',
'image'
}
function Protection.new(args, cfg, title)
local obj = {}
obj._cfg = cfg
obj.title = title or mw.title.getCurrentTitle()
-- Set action
if not args.action then
obj.action = 'edit'
elseif Protection.supportedActions[args.action] then
obj.action = args.action
else
error(string.format(
'invalid action: %s',
tostring(args.action)
), 3)
end
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
obj.level = '*'
end
-- Set expiry
local effectiveExpiry = effectiveProtectionExpiry(obj.action, obj.title)
if effectiveExpiry == 'infinity' then
obj.expiry = 'indef'
elseif effectiveExpiry ~= 'unknown' then
obj.expiry = validateDate(effectiveExpiry, 'expiry date')
end
-- Set reason
if args[1] then
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 3)
end
end
-- Set protection date
if args.date then
obj.protectionDate = validateDate(args.date, 'protection date')
end
-- Set banner config
do
obj.bannerConfig = {}
local configTables = {}
if cfg.banners[obj.action] then
configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason]
end
if cfg.defaultBanners[obj.action] then
configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level]
configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default
end
configTables[#configTables + 1] = cfg.masterBanner
for i, field in ipairs(Protection.bannerConfigFields) do
for j, t in ipairs(configTables) do
if t[field] then
obj.bannerConfig[field] = t[field]
break
end
end
end
end
return setmetatable(obj, Protection)
end
function Protection:isProtected()
return self.level ~= '*'
end
function Protection:isTemporary()
return type(self.expiry) == 'number'
end
function Protection:makeProtectionCategory()
local cfg = self._cfg
local title = self.title
-- Exit if the page is not protected.
if not self:isProtected() then
return ''
end
-- Get the expiry key fragment.
local expiryFragment
if self.expiry == 'indef' then
expiryFragment = self.expiry
elseif type(self.expiry) == 'number' then
expiryFragment = 'temp'
end
-- Get the namespace key fragment.
local namespaceFragment = cfg.categoryNamespaceKeys[title.namespace]
if not namespaceFragment and title.namespace % 2 == 1 then
namespaceFragment = 'talk'
end
-- Define the order that key fragments are tested in. This is done with an
-- array of tables containing the value to be tested, along with its
-- position in the cfg.protectionCategories table.
local order = {
{val = expiryFragment, keypos = 1},
{val = namespaceFragment, keypos = 2},
{val = self.reason, keypos = 3},
{val = self.level, keypos = 4},
{val = self.action, keypos = 5}
}
--[[
-- The old protection templates used an ad-hoc protection category system,
-- with some templates prioritising namespaces in their categories, and
-- others prioritising the protection reason. To emulate this in this module
-- we use the config table cfg.reasonsWithNamespacePriority to set the
-- reasons for which namespaces have priority over protection reason.
-- If we are dealing with one of those reasons, move the namespace table to
-- the end of the order table, i.e. give it highest priority. If not, the
-- reason should have highest priority, so move that to the end of the table
-- instead.
--]]
table.insert(order, table.remove(order, self.reason and cfg.reasonsWithNamespacePriority[self.reason] and 2 or 3))
--[[
-- Define the attempt order. Inactive subtables (subtables with nil "value"
-- fields) are moved to the end, where they will later be given the key
-- "all". This is to cut down on the number of table lookups in
-- cfg.protectionCategories, which grows exponentially with the number of
-- non-nil keys. We keep track of the number of active subtables with the
-- noActive parameter.
--]]
local noActive, attemptOrder
do
local active, inactive = {}, {}
for i, t in ipairs(order) do
if t.val then
active[#active + 1] = t
else
inactive[#inactive + 1] = t
end
end
noActive = #active
attemptOrder = active
for i, t in ipairs(inactive) do
attemptOrder[#attemptOrder + 1] = t
end
end
--[[
-- Check increasingly generic key combinations until we find a match. If a
-- specific category exists for the combination of key fragments we are
-- given, that match will be found first. If not, we keep trying different
-- key fragment combinations until we match using the key
-- "all-all-all-all-all".
--
-- To generate the keys, we index the key subtables using a binary matrix
-- with indexes i and j. j is only calculated up to the number of active
-- subtables. For example, if there were three active subtables, the matrix
-- would look like this, with 0 corresponding to the key fragment "all", and
-- 1 corresponding to other key fragments.
--
-- j 1 2 3
-- i
-- 1 1 1 1
-- 2 0 1 1
-- 3 1 0 1
-- 4 0 0 1
-- 5 1 1 0
-- 6 0 1 0
-- 7 1 0 0
-- 8 0 0 0
--
-- Values of j higher than the number of active subtables are set
-- to the string "all".
--
-- A key for cfg.protectionCategories is constructed for each value of i.
-- The position of the value in the key is determined by the keypos field in
-- each subtable.
--]]
local cats = cfg.protectionCategories
for i = 1, 2^noActive do
local key = {}
for j, t in ipairs(attemptOrder) do
if j > noActive then
key[t.keypos] = 'all'
else
local quotient = i / 2 ^ (j - 1)
quotient = math.ceil(quotient)
if quotient % 2 == 1 then
key[t.keypos] = t.val
else
key[t.keypos] = 'all'
end
end
end
key = table.concat(key, '|')
local attempt = cats[key]
if attempt then
return makeCategoryLink(attempt, title.text)
end
end
return ''
end
function Protection:isIncorrect()
local expiry = self.expiry
return not self:isProtected()
or type(expiry) == 'number' and expiry < os.time()
end
function Protection:isTemplateProtectedNonTemplate()
local action, namespace = self.action, self.title.namespace
return self.level == 'templateeditor'
and (
(action ~= 'edit' and action ~= 'move')
or (namespace ~= 10 and namespace ~= 828)
)
end
function Protection:makeCategoryLinks()
local msg = self._cfg.msg
local ret = { self:makeProtectionCategory() }
if self:isIncorrect() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-incorrect'],
self.title.text
)
end
if self:isTemplateProtectedNonTemplate() then
ret[#ret + 1] = makeCategoryLink(
msg['tracking-category-template'],
self.title.text
)
end
return table.concat(ret)
end
--------------------------------------------------------------------------------
-- Blurb class
--------------------------------------------------------------------------------
local Blurb = {}
Blurb.__index = Blurb
Blurb.bannerTextFields = {
text = true,
explanation = true,
tooltip = true,
alt = true,
link = true
}
function Blurb.new(protectionObj, args, cfg)
return setmetatable({
_cfg = cfg,
_protectionObj = protectionObj,
_args = args
}, Blurb)
end
-- Private methods --
function Blurb:_formatDate(num)
-- Formats a Unix timestamp into dd Month, YYYY format.
lang = lang or mw.language.getContentLanguage()
local success, date = pcall(
lang.formatDate,
lang,
self._cfg.msg['expiry-date-format'] or 'j F Y',
'@' .. tostring(num)
)
if success then
return date
end
end
function Blurb:_getExpandedMessage(msgKey)
return self:_substituteParameters(self._cfg.msg[msgKey])
end
function Blurb:_substituteParameters(msg)
if not self._params then
local parameterFuncs = {}
parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter
parameterFuncs.EDITREQUEST = self._makeEditRequestParameter
parameterFuncs.EXPIRY = self._makeExpiryParameter
parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter
parameterFuncs.IMAGELINK = self._makeImageLinkParameter
parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter
parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter
parameterFuncs.PAGETYPE = self._makePagetypeParameter
parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter
parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter
parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter
parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter
parameterFuncs.TALKPAGE = self._makeTalkPageParameter
parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter
parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter
parameterFuncs.VANDAL = self._makeVandalTemplateParameter
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
msg = msg:gsub('${(%u+)}', self._params)
return msg
end
function Blurb:_makeCurrentVersionParameter()
-- A link to the page history or the move log, depending on the kind of
-- protection.
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'move' then
-- We need the move log link.
return makeFullUrl(
'Special:Log',
{type = 'move', page = pagename},
self:_getExpandedMessage('current-version-move-display')
)
else
-- We need the history link.
return makeFullUrl(
pagename,
{action = 'history'},
self:_getExpandedMessage('current-version-edit-display')
)
end
end
function Blurb:_makeEditRequestParameter()
local mEditRequest = require('Module:Submit an edit request')
local action = self._protectionObj.action
local level = self._protectionObj.level
-- Get the edit request type.
local requestType
if action == 'edit' then
if level == 'autoconfirmed' then
requestType = 'semi'
elseif level == 'extendedconfirmed' then
requestType = 'extended'
elseif level == 'templateeditor' then
requestType = 'template'
end
end
requestType = requestType or 'full'
-- Get the display value.
local display = self:_getExpandedMessage('edit-request-display')
return mEditRequest._link{type = requestType, display = display}
end
function Blurb:_makeExpiryParameter()
local expiry = self._protectionObj.expiry
if type(expiry) == 'number' then
return self:_formatDate(expiry)
else
return expiry
end
end
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local level = self._protectionObj.level
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
-- Find the message in the explanation blurb table and substitute any
-- parameters.
local explanations = self._cfg.explanationBlurbs
local msg
if explanations[action][level] and explanations[action][level][talkKey] then
msg = explanations[action][level][talkKey]
elseif explanations[action][level] and explanations[action][level].default then
msg = explanations[action][level].default
elseif explanations[action].default and explanations[action].default[talkKey] then
msg = explanations[action].default[talkKey]
elseif explanations[action].default and explanations[action].default.default then
msg = explanations[action].default.default
else
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeImageLinkParameter()
local imageLinks = self._cfg.imageLinks
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if imageLinks[action][level] then
msg = imageLinks[action][level]
elseif imageLinks[action].default then
msg = imageLinks[action].default
else
msg = imageLinks.edit.default
end
return self:_substituteParameters(msg)
end
function Blurb:_makeIntroBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-blurb-expiry')
else
return self:_getExpandedMessage('intro-blurb-noexpiry')
end
end
function Blurb:_makeIntroFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('intro-fragment-expiry')
else
return self:_getExpandedMessage('intro-fragment-noexpiry')
end
end
function Blurb:_makePagetypeParameter()
local pagetypes = self._cfg.pagetypes
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
function Blurb:_makeProtectionBlurbParameter()
local protectionBlurbs = self._cfg.protectionBlurbs
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionBlurbs[action][level] then
msg = protectionBlurbs[action][level]
elseif protectionBlurbs[action].default then
msg = protectionBlurbs[action].default
elseif protectionBlurbs.edit.default then
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionDateParameter()
local protectionDate = self._protectionObj.protectionDate
if type(protectionDate) == 'number' then
return self:_formatDate(protectionDate)
else
return protectionDate
end
end
function Blurb:_makeProtectionLevelParameter()
local protectionLevels = self._cfg.protectionLevels
local action = self._protectionObj.action
local level = self._protectionObj.level
local msg
if protectionLevels[action][level] then
msg = protectionLevels[action][level]
elseif protectionLevels[action].default then
msg = protectionLevels[action].default
elseif protectionLevels.edit.default then
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
end
function Blurb:_makeProtectionLogParameter()
local pagename = self._protectionObj.title.prefixedText
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
return makeFullUrl(
'Special:Log',
{type = 'stable', page = pagename},
self:_getExpandedMessage('pc-log-display')
)
else
-- We need the protection log.
return makeFullUrl(
'Special:Log',
{type = 'protect', page = pagename},
self:_getExpandedMessage('protection-log-display')
)
end
end
function Blurb:_makeTalkPageParameter()
return string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[self._protectionObj.title.namespace].talk.name,
self._protectionObj.title.text,
self._args.section or 'top',
self:_getExpandedMessage('talk-page-link-display')
)
end
function Blurb:_makeTooltipBlurbParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-blurb-expiry')
else
return self:_getExpandedMessage('tooltip-blurb-noexpiry')
end
end
function Blurb:_makeTooltipFragmentParameter()
if self._protectionObj:isTemporary() then
return self:_getExpandedMessage('tooltip-fragment-expiry')
else
return self:_getExpandedMessage('tooltip-fragment-noexpiry')
end
end
function Blurb:_makeVandalTemplateParameter()
return require('Module:Vandal-m')._main{
self._args.user or self._protectionObj.title.baseText
}
end
-- Public methods --
function Blurb:makeBannerText(key)
-- Validate input.
if not key or not Blurb.bannerTextFields[key] then
error(string.format(
'"%s" is not a valid banner config field',
tostring(key)
), 2)
end
-- Generate the text.
local msg = self._protectionObj.bannerConfig[key]
if type(msg) == 'string' then
return self:_substituteParameters(msg)
elseif type(msg) == 'function' then
msg = msg(self._protectionObj, self._args)
if type(msg) ~= 'string' then
error(string.format(
'bad output from banner config function with key "%s"'
.. ' (expected string, got %s)',
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
end
end
--------------------------------------------------------------------------------
-- BannerTemplate class
--------------------------------------------------------------------------------
local BannerTemplate = {}
BannerTemplate.__index = BannerTemplate
function BannerTemplate.new(protectionObj, cfg)
local obj = {}
obj._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
obj._imageFilename = imageFilename
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local level = protectionObj.level
local namespace = protectionObj.title.namespace
local reason = protectionObj.reason
-- Deal with special cases first.
if (
namespace == 10
or namespace == 828
or reason and obj._cfg.indefImageReasons[reason]
)
and action == 'edit'
and level == 'sysop'
and not protectionObj:isTemporary()
then
-- Fully protected modules and templates get the special red "indef"
-- padlock.
obj._imageFilename = obj._cfg.msg['image-filename-indef']
else
-- Deal with regular protection types.
local images = obj._cfg.images
if images[action] then
if images[action][level] then
obj._imageFilename = images[action][level]
elseif images[action].default then
obj._imageFilename = images[action].default
end
end
end
end
return setmetatable(obj, BannerTemplate)
end
function BannerTemplate:renderImage()
local filename = self._imageFilename
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
return makeFileLink{
file = filename,
size = (self.imageWidth or 20) .. 'px',
alt = self._imageAlt,
link = self._imageLink,
caption = self.imageCaption
}
end
--------------------------------------------------------------------------------
-- Banner class
--------------------------------------------------------------------------------
local Banner = setmetatable({}, BannerTemplate)
Banner.__index = Banner
function Banner.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 40
obj.imageCaption = blurbObj:makeBannerText('alt') -- Large banners use the alt text for the tooltip.
obj._reasonText = blurbObj:makeBannerText('text')
obj._explanationText = blurbObj:makeBannerText('explanation')
obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
return setmetatable(obj, Banner)
end
function Banner:__tostring()
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
page = self._page,
type = 'protection',
image = self:renderImage(),
text = string.format(
"'''%s'''%s",
reasonText,
explanationText and '<br />' .. explanationText or ''
)
}
return makeMessageBox('mbox', mbargs)
end
--------------------------------------------------------------------------------
-- Padlock class
--------------------------------------------------------------------------------
local Padlock = setmetatable({}, BannerTemplate)
Padlock.__index = Padlock
function Padlock.new(protectionObj, blurbObj, cfg)
local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb.
obj.imageWidth = 20
obj.imageCaption = blurbObj:makeBannerText('tooltip')
obj._imageAlt = blurbObj:makeBannerText('alt')
obj._imageLink = blurbObj:makeBannerText('link')
obj._indicatorName = cfg.padlockIndicatorNames[protectionObj.action]
or cfg.padlockIndicatorNames.default
or 'pp-default'
return setmetatable(obj, Padlock)
end
function Padlock:__tostring()
local frame = mw.getCurrentFrame()
-- The nowiki tag helps prevent whitespace at the top of articles.
return frame:extensionTag{name = 'nowiki'} .. frame:extensionTag{
name = 'indicator',
args = {name = self._indicatorName},
content = self:renderImage()
}
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- This is used for testing purposes.
return {
Protection = Protection,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
}
end
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require(CONFIG_MODULE)
local protectionObj = Protection.new(args, cfg, title)
local ret = {}
-- If a page's edit protection is equally or more restrictive than its
-- protection from some other action, then don't bother displaying anything
-- for the other action (except categories).
if protectionObj.action == 'edit' or
args.demolevel or
not getReachableNodes(
cfg.hierarchy,
protectionObj.level
)[effectiveProtectionLevel('edit', protectionObj.title)]
then
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
-- Render the banner
if protectionObj:isProtected() then
ret[#ret + 1] = tostring(
(yesno(args.small) and Padlock or Banner)
.new(protectionObj, blurbObj, cfg)
)
end
end
-- Render the categories
if yesno(args.category) ~= false then
ret[#ret + 1] = protectionObj:makeCategoryLinks()
end
return table.concat(ret)
end
function p.main(frame, cfg)
cfg = cfg or require(CONFIG_MODULE)
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')]
-- Find user args, and use the parent frame if we are being called from a
-- wrapper template.
getArgs = getArgs or require('Module:Arguments').getArgs
local userArgs = getArgs(frame, {
parentOnly = defaultArgs,
frameOnly = not defaultArgs
})
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
for k, v in pairs(userArgs) do
args[k] = v
end
return p._main(args, cfg)
end
return p
hraihk42yzei1k32e7gw7rwjvn9igeg
ماڈیول:Protection banner/config
828
12937
32000
2023-06-08T06:24:58Z
en>Beeswaxcandle
0
Protected "[[Module:Protection banner/config]]": High traffic page or template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32000
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If
-- protection is indefinite or is not set, this is the blank string.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = 'Page ${PROTECTIONLEVEL}'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, and autoreview subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
autoconfirmed = {
alt = 'Page protected with pending changes level 1',
tooltip = 'All edits by unregistered and new users are subject to review',
image = 'Padlock-silver-light.svg'
},
default = {
alt = 'Page protected with pending changes level 2',
tooltip = 'All edits by users who are not reviewers or administrators are'
.. ' subject to review',
}
}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, and autoreview subtables.
banners = {
edit = {
blp = {
description = 'For pages protected to promote compliance with the'
.. ' [[:w:Wikipedia:Biographies of living persons'
.. '|biographies of living persons]] policy.',
text = '${INTROFRAGMENT} to promote compliance with'
.. ' [[:w:Wikipedia:Biographies of living persons'
.. "|Wikipedia's policy on the biographies"
.. ' of living people]].',
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
.. ' biographies of living people',
},
dmca = {
description = 'For pages protected by the Wikimedia Foundation'
.. ' due to Digital Millennium Copyright Act takedown requests.',
explanation = function (protectionObj, args)
local ret = 'Pursuant to a rights owner notice under the Digital'
.. ' Millennium Copyright Act (DMCA) regarding some content'
.. ' in this article, the Wikimedia Foundation acted under'
.. ' applicable law and took down and restricted the content'
.. ' in question.'
if args.notice then
ret = ret .. ' A copy of the received notice can be found here: '
.. args.notice .. '.'
end
ret = ret .. ' For more information, including websites discussing'
.. ' how to file a counter-notice, please see'
.. " [[m:Office actions]] and the article's ${TALKPAGE}."
.. "'''Do not remove this template from the article until the"
.. " restrictions are withdrawn'''."
return ret
end,
image = 'Padlock-black.svg',
},
dispute = {
description = 'For pages protected due to editing disputes.',
text = function (protectionObj, args)
-- Find the value of "disputes".
local display = 'disputes'
local disputes
if args.section then
disputes = string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[protectionObj.title.namespace].talk.name,
protectionObj.title.text,
args.section,
display
)
else
disputes = display
end
-- Make the blurb, depending on the expiry.
local msg
if type(protectionObj.expiry) == 'number' then
msg = '${INTROFRAGMENT} or until editing %s have been resolved.'
else
msg = '${INTROFRAGMENT} until editing %s have been resolved.'
end
return string.format(msg, disputes)
end,
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPFRAGMENT} due to editing disputes',
},
mainpage = {
description = 'For pages protected for being displayed on the [[Main Page]].',
text = 'This file is currently'
.. ' [[:w:Wiki:This page is protected|protected]] from'
.. ' editing because it is currently or will soon be displayed'
.. ' on the [[Main Page]].',
explanation = 'Images on the Main Page are protected due to their high'
.. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
.. '<br /><span style="font-size:90%;">'
.. "'''Administrators:''' Once this image is definitely off the Main Page,"
.. ' please unprotect this file, or reduce to semi-protection,'
.. ' as appropriate.</span>',
},
office = {
description = 'For pages protected by the Wikimedia Foundation.',
text = function (protectionObj, args)
local ret = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[m:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.'
if protectionObj.protectionDate then
ret = ret .. ' It has been protected since ${PROTECTIONDATE}.'
end
return ret
end,
explanation = "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not remove protection from this"
.. " page unless you are authorized by the Wikimedia Foundation to do"
.. " so.'''",
image = 'Padlock-black.svg',
},
reset = {
description = 'For pages protected by the Wikimedia Foundation and'
.. ' "reset" to a bare-bones version.',
text = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[m:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.protectionDate then
ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was'
else
ret = ret .. 'This ${PAGETYPE} has been'
end
ret = ret .. ' reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[:w:WP:NPOV|Neutral Point of View]] and [[:w:WP:V|Verifiability]].'
.. ' Standard Wikipedia policies will apply to its rewriting—which'
.. ' will eventually be open to all editors—and will be strictly'
.. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while'
.. ' it is being rebuilt.\n\n'
.. 'Any insertion of material directly from'
.. ' pre-protection revisions of the ${PAGETYPE} will be removed, as'
.. ' will any material added to the ${PAGETYPE} that is not properly'
.. ' sourced. The associated talk page(s) were also cleared on the'
.. " same date.\n\n"
.. "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not override"
.. " this action, and do not remove protection from this page,"
.. " unless you are authorized by the Wikimedia Foundation"
.. " to do so. No editor may remove this notice.'''"
return ret
end,
image = 'Padlock-black.svg',
},
sock = {
description = 'For pages protected due to'
.. ' [[:w:Wikipedia:Sock puppetry|sock puppetry]].',
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
.. ' [[Wikisource:Blocking policy|blocked]] or'
.. ' [[:w:Wikipedia:Banning policy|banned users]]'
.. ' from editing it.',
tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
.. ' editing it',
},
template = {
description = 'For [[:w:Wikipedia:High-risk templates|high-risk]]'
.. ' templates and Lua modules.',
text = 'This is a permanently [[:w:Help:Protection|protected]] ${PAGETYPE},'
.. ' as it is [[:w:Wikipedia:High-risk templates|high-risk]].',
explanation = 'Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask an'
.. ' [[Wikisource:Administrators|administrator]] or'
.. ' [[:w:Wikipedia:Template editor|template editor]] to make an edit if'
.. ' it is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by'
.. ' [[:w:Wikipedia:Consensus|consensus]]. You can also'
.. ' [[Wikisource:Administrators' noticeboard|request]] that the page be'
.. ' unprotected.',
tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}'
.. ' to prevent vandalism',
alt = 'Permanently protected ${PAGETYPE}',
},
usertalk = {
description = 'For pages protected against disruptive edits by a'
.. ' particular user.',
text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
.. ' such as abusing the'
.. ' {{[[Template:unblock|unblock]]}} template.',
explanation = 'If you cannot edit this user talk page and you need to'
.. ' make a change or leave a message, you can'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Current requests for edits to a protected page'
.. '|request an edit]],'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]],'
.. ' [[Special:Userlogin|log in]],'
.. ' or [[Special:UserLogin/signup|create an account]].',
},
vandalism = {
description = 'For pages protected against'
.. ' [[:w:Wikipedia:Vandalism|vandalism]].',
text = '${INTROFRAGMENT} due to [[Wikipedia:Vandalism|vandalism]].',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.level == 'sysop' then
ret = ret .. "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. '
end
return ret .. '${EXPLANATIONBLURB}'
end,
tooltip = '${TOOLTIPFRAGMENT} due to vandalism',
}
},
move = {
dispute = {
description = 'For pages protected against page moves due to'
.. ' disputes over the page title.',
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
image = 'Padlock-olive.svg'
},
vandalism = {
description = 'For pages protected against'
.. ' [[:w:Wikipedia:Vandalism#Page-move vandalism'
.. ' |page-move vandalism]].'
}
},
autoreview = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
protectionBlurbs = {
edit = {
default = 'This ${PAGETYPE} is currently [[:w:Help:Protection|'
.. 'protected]] from editing',
autoconfirmed = 'Editing of this ${PAGETYPE} by [[:w:Wikipedia:User access'
.. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered'
.. ' users|unregistered]] users is currently [[:w:Help:Protection|disabled]]'
},
move = {
default = 'This ${PAGETYPE} is currently [[:w:Help:Protection|protected]]'
.. ' from [[:w:Help:Moving a page|page moves]]'
},
autoreview = {
autoconfirmed = 'All edits made to this ${PAGETYPE} by'
.. ' [[:w:Wikipedia:User access levels#New users|new]] or'
.. ' [[:w:Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[:w:Wikipedia:Pending changes|subject to review]]',
default = 'All edits made to this ${PAGETYPE} by users who are not'
.. ' [[:w:Wikipedia:Reviewing|reviewers]] or'
.. ' [[:w:Wikipedia:Administrators|administrators]] are currently'
.. ' [[:w:Wikipedia:Pending changes|subject to review]]'
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
},
default = {
subject = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikisource:Administrators|administrator]] to make an edit if it'
.. ' is [[:w:Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]]. You may also [[Wikipedia:Requests for'
.. ' page protection#Page (un)protection requests'
.. '|request]] that this page be unprotected.',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' You may [[Wikipedia:Requests for page'
.. ' protection#Current requests for edits to a protected page|request an'
.. ' edit]] to this page, or [[Wikipedia:Requests for'
.. ' page protection#Page (un)protection requests'
.. '|ask]] for it to be unprotected.'
}
},
move = {
default = {
subject = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves on the'
.. ' ${TALKPAGE} or at [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikisource:Administrators' noticeboard|request]] that the page be'
.. ' unprotected.',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves at'
.. ' [[:w:Wikipedia:Requested moves]]. You can also'
.. ' [[Wikisource:Administrators' noticeboard|request]] that the page be'
.. ' unprotected.'
}
},
autoreview = {
default = {
reviewer = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} will not be visible to readers'
.. ' until they are accepted by a reviewer or an administrator.'
.. ' To avoid the need for your edits to be reviewed, you may'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]]. Experienced editors may also'
.. ' request the [[:w:Wikipedia:Reviewing|reviewer user right]].',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and proteciton level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
protectionLevels = {
edit = {
default = 'protected',
templateeditor = 'template-protected',
autoconfirmed = 'semi-protected',
},
move = {
default = 'move-protected'
},
autoreview = {
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Padlock.svg',
templateeditor = 'Padlock-pink.svg',
autoconfirmed = 'Padlock-silver.svg'
},
move = {
default = 'Padlock-olive.svg',
},
autoreview = {
autoconfirmed = 'Padlock-silver-light.svg',
default = 'Padlock-orange.svg'
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
imageLinks = {
edit = {
default = 'Wikisource:Protection policy#full',
templateeditor = 'Wikisource:Protection policy#template',
autoconfirmed = 'Wikisource:Protection policy#semi'
},
move = {
default = 'Wikisource:Protection policy#move'
},
autoreview = {
autoconfirmed = 'Wikisource:Protection policy#pc1',
reviewer = 'Wikisource:Protection policy#pc2'
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
autoreview = 'pp-autoreview',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = 'Wikisource protected pages',
['all|all|office|all|all'] = 'Wikisource Office-protected pages',
['all|all|reset|all|all'] = 'Wikisource Office-protected pages',
['all|all|dmca|all|all'] = 'Wikisource Office-protected pages',
['all|all|mainpage|all|all'] = 'Protected main page images',
['all|template|all|all|edit'] = 'Wikisource protected templates',
['all|all|all|autoconfirmed|edit'] = 'Wikisource semi-protected pages',
['indef|all|all|autoconfirmed|edit'] = 'Wikisource indefinitely semi-protected pages',
['all|all|blp|autoconfirmed|edit'] = 'Wikisource indefinitely semi-protected biographies of living people',
['temp|all|blp|autoconfirmed|edit'] = 'Wikisource temporarily semi-protected biographies of living people',
['all|all|dispute|autoconfirmed|edit'] = 'Wikisource pages semi-protected due to dispute',
['all|all|sock|autoconfirmed|edit'] = 'Wikisource pages semi-protected from banned users',
['all|all|vandalism|autoconfirmed|edit'] = 'Wikisource pages semi-protected against vandalism',
['all|category|all|autoconfirmed|edit'] = 'Wikisource semi-protected categories',
['all|file|all|autoconfirmed|edit'] = 'Semi-protected images',
['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals',
['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages',
['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages',
['all|template|all|autoconfirmed|edit'] = 'Wikisource semi-protected templates',
['all|user|all|autoconfirmed|edit'] = 'Wikisource semi-protected user and user talk pages',
['all|all|blp|sysop|edit'] = 'Wikisource indefinitely protected biographies of living people',
['temp|all|blp|sysop|edit'] = 'Wikisource temporarily protected biographies of living people',
['all|all|dispute|sysop|edit'] = 'Wikisource pages protected due to dispute',
['all|all|sock|sysop|edit'] = 'Wikisource pages protected from banned users',
['all|all|vandalism|sysop|edit'] = 'Wikisource pages protected against vandalism',
['all|category|all|sysop|edit'] = 'Wikisource protected categories',
['all|file|all|sysop|edit'] = 'Protected images',
['all|project|all|sysop|edit'] = 'Protected project pages',
['all|talk|all|sysop|edit'] = 'Protected talk pages',
['all|template|all|sysop|edit'] = 'Wikisource protected templates',
['all|user|all|sysop|edit'] = 'Wikisource protected user and user talk pages',
['all|module|all|all|edit'] = 'Wikisource protected modules',
['all|module|all|autoconfirmed|edit'] = 'Wikisource semi-protected modules',
['all|all|all|sysop|move'] = 'Wikisource move-protected pages',
['indef|all|all|sysop|move'] = 'Wikisource indefinitely move-protected pages',
['all|all|dispute|sysop|move'] = 'Wikisource pages move-protected due to dispute',
['all|all|vandalism|sysop|move'] = 'Wikisource pages move-protected due to vandalism',
['all|portal|all|sysop|move'] = 'Wikisource move-protected portals',
['all|portal|all|sysop|move'] = 'Wikisource move-protected portals',
['all|project|all|sysop|move'] = 'Wikisource move-protected project pages',
['all|talk|all|sysop|move'] = 'Wikisource move-protected talk pages',
['all|template|all|sysop|move'] = 'Wikisource move-protected templates',
['all|user|all|sysop|move'] = 'Wikisource move-protected user and user talk pages',
['all|all|all|autoconfirmed|autoreview'] = 'Wikisource pending changes protected pages (level 1)',
['all|all|all|reviewer|autoreview'] = 'Wikisource pending changes protected pages (level 2)',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
[0] = 'article',
[6] = 'file',
[10] = 'template',
[14] = 'category',
[828] = 'module',
default = 'page'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
autoconfirmed = {'reviewer', 'filemover', 'templateeditor'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. The arguments cannot be overwritten by the
-- user.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:Pp-pc2'] = {action = 'autoreview', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {expiry = 'indef', small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.',
['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.',
['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.',
['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},',
['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = 'protection log',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = 'current title',
['current-version-edit-display'] = 'current version',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'talk page',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'F j, Y',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = 'Wikisource pages with incorrect protection templates',
['tracking-category-expiry'] = 'Wikisource protected pages without expiry',
['tracking-category-template'] = 'Wikisource template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Padlock-red.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
dqytxu4xu9xz8tdzmug6wvbznb0cdlg
32001
32000
2026-04-22T01:49:48Z
Satdeep Gill
85
[[:en:Module:Protection_banner/config]] سے 1 نسخہ درآمد کیا گیا
32000
Scribunto
text/plain
-- This module provides configuration data for [[Module:Protection banner]].
return {
--------------------------------------------------------------------------------
--
-- BANNER DATA
--
--------------------------------------------------------------------------------
--[[
-- Banner data consists of six fields:
-- * text - the main protection text that appears at the top of protection
-- banners.
-- * explanation - the text that appears below the main protection text, used
-- to explain the details of the protection.
-- * tooltip - the tooltip text you see when you move the mouse over a small
-- padlock icon.
-- * link - the page that the small padlock icon links to.
-- * alt - the alt text for the small padlock icon. This is also used as tooltip
-- text for the large protection banners.
-- * image - the padlock image used in both protection banners and small padlock
-- icons.
--
-- The module checks in three separate tables to find a value for each field.
-- First it checks the banners table, which has values specific to the reason
-- for the page being protected. Then the module checks the defaultBanners
-- table, which has values specific to each protection level. Finally, the
-- module checks the masterBanner table, which holds data for protection
-- templates to use if no data has been found in the previous two tables.
--
-- The values in the banner data can take parameters. These are specified
-- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name
-- enclosed in curly braces).
--
-- Available parameters:
--
-- ${CURRENTVERSION} - a link to the page history or the move log, with the
-- display message "current-version-edit-display" or
-- "current-version-move-display".
--
-- ${EDITREQUEST} - a link to create an edit request for the current page.
--
-- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If
-- protection is indefinite or is not set, this is the blank string.
--
-- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes
-- on the talk page; you may submit a request to ask an administrator to make
-- an edit if it is minor or supported by consensus."
--
-- ${IMAGELINK} - a link to set the image to, depending on the protection
-- action and protection level.
--
-- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry
-- is set. E.g. "Editing of this page by new or unregistered users is currently
-- disabled until dd Month YYYY."
--
-- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation
-- so that it can be used in run-on sentences.
--
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template".
-- Defined in the cfg.pagetypes table.
--
-- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g.
-- "Editing of this page by new or unregistered users is currently disabled"
--
-- ${PROTECTIONDATE} - the protection date, if it has been supplied to the
-- template.
--
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or
-- "semi-protected".
--
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log,
-- depending on the protection action.
--
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links
-- straight to that talk page section.
--
-- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to
-- create a blurb like "This template is semi-protected", or "This article is
-- move-protected until DD Month YYYY".
--
-- ${VANDAL} - links for the specified username (or the root page name)
-- using Module:Vandal-m.
--
-- Functions
--
-- For advanced users, it is possible to use Lua functions instead of strings
-- in the banner config tables. Using functions gives flexibility that is not
-- possible just by using parameters. Functions take two arguments, the
-- protection object and the template arguments, and they must output a string.
--
-- For example:
--
-- text = function (protectionObj, args)
-- if protectionObj.level == 'autoconfirmed' then
-- return 'foo'
-- else
-- return 'bar'
-- end
-- end
--
-- Some protection object properties and methods that may be useful:
-- protectionObj.action - the protection action
-- protectionObj.level - the protection level
-- protectionObj.reason - the protection reason
-- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set
-- to indefinite, and the protection time in unix time if temporary.
-- protectionObj.protectionDate - the protection date in unix time, or nil if
-- unspecified.
-- protectionObj.bannerConfig - the banner config found by the module. Beware
-- of editing the config field used by the function, as it could create an
-- infinite loop.
-- protectionObj:isProtected - returns a boolean showing whether the page is
-- protected.
-- protectionObj:isTemporary - returns a boolean showing whether the expiry is
-- temporary.
-- protectionObj:isIncorrect - returns a boolean showing whether the protection
-- template is incorrect.
--]]
-- The master banner data, used if no values have been found in banners or
-- defaultBanners.
masterBanner = {
text = '${INTROBLURB}',
explanation = '${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPBLURB}',
link = '${IMAGELINK}',
alt = 'Page ${PROTECTIONLEVEL}'
},
-- The default banner data. This holds banner data for different protection
-- levels.
-- *required* - this table needs edit, move, and autoreview subtables.
defaultBanners = {
edit = {},
move = {},
autoreview = {
autoconfirmed = {
alt = 'Page protected with pending changes level 1',
tooltip = 'All edits by unregistered and new users are subject to review',
image = 'Padlock-silver-light.svg'
},
default = {
alt = 'Page protected with pending changes level 2',
tooltip = 'All edits by users who are not reviewers or administrators are'
.. ' subject to review',
}
}
},
-- The banner data. This holds banner data for different protection reasons.
-- In fact, the reasons specified in this table control which reasons are
-- valid inputs to the first positional parameter.
--
-- There is also a non-standard "description" field that can be used for items
-- in this table. This is a description of the protection reason for use in the
-- module documentation.
--
-- *required* - this table needs edit, move, and autoreview subtables.
banners = {
edit = {
blp = {
description = 'For pages protected to promote compliance with the'
.. ' [[:w:Wikipedia:Biographies of living persons'
.. '|biographies of living persons]] policy.',
text = '${INTROFRAGMENT} to promote compliance with'
.. ' [[:w:Wikipedia:Biographies of living persons'
.. "|Wikipedia's policy on the biographies"
.. ' of living people]].',
tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on'
.. ' biographies of living people',
},
dmca = {
description = 'For pages protected by the Wikimedia Foundation'
.. ' due to Digital Millennium Copyright Act takedown requests.',
explanation = function (protectionObj, args)
local ret = 'Pursuant to a rights owner notice under the Digital'
.. ' Millennium Copyright Act (DMCA) regarding some content'
.. ' in this article, the Wikimedia Foundation acted under'
.. ' applicable law and took down and restricted the content'
.. ' in question.'
if args.notice then
ret = ret .. ' A copy of the received notice can be found here: '
.. args.notice .. '.'
end
ret = ret .. ' For more information, including websites discussing'
.. ' how to file a counter-notice, please see'
.. " [[m:Office actions]] and the article's ${TALKPAGE}."
.. "'''Do not remove this template from the article until the"
.. " restrictions are withdrawn'''."
return ret
end,
image = 'Padlock-black.svg',
},
dispute = {
description = 'For pages protected due to editing disputes.',
text = function (protectionObj, args)
-- Find the value of "disputes".
local display = 'disputes'
local disputes
if args.section then
disputes = string.format(
'[[%s:%s#%s|%s]]',
mw.site.namespaces[protectionObj.title.namespace].talk.name,
protectionObj.title.text,
args.section,
display
)
else
disputes = display
end
-- Make the blurb, depending on the expiry.
local msg
if type(protectionObj.expiry) == 'number' then
msg = '${INTROFRAGMENT} or until editing %s have been resolved.'
else
msg = '${INTROFRAGMENT} until editing %s have been resolved.'
end
return string.format(msg, disputes)
end,
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
tooltip = '${TOOLTIPFRAGMENT} due to editing disputes',
},
mainpage = {
description = 'For pages protected for being displayed on the [[Main Page]].',
text = 'This file is currently'
.. ' [[:w:Wiki:This page is protected|protected]] from'
.. ' editing because it is currently or will soon be displayed'
.. ' on the [[Main Page]].',
explanation = 'Images on the Main Page are protected due to their high'
.. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.'
.. '<br /><span style="font-size:90%;">'
.. "'''Administrators:''' Once this image is definitely off the Main Page,"
.. ' please unprotect this file, or reduce to semi-protection,'
.. ' as appropriate.</span>',
},
office = {
description = 'For pages protected by the Wikimedia Foundation.',
text = function (protectionObj, args)
local ret = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[m:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.'
if protectionObj.protectionDate then
ret = ret .. ' It has been protected since ${PROTECTIONDATE}.'
end
return ret
end,
explanation = "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not remove protection from this"
.. " page unless you are authorized by the Wikimedia Foundation to do"
.. " so.'''",
image = 'Padlock-black.svg',
},
reset = {
description = 'For pages protected by the Wikimedia Foundation and'
.. ' "reset" to a bare-bones version.',
text = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[m:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.protectionDate then
ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was'
else
ret = ret .. 'This ${PAGETYPE} has been'
end
ret = ret .. ' reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[:w:WP:NPOV|Neutral Point of View]] and [[:w:WP:V|Verifiability]].'
.. ' Standard Wikipedia policies will apply to its rewriting—which'
.. ' will eventually be open to all editors—and will be strictly'
.. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while'
.. ' it is being rebuilt.\n\n'
.. 'Any insertion of material directly from'
.. ' pre-protection revisions of the ${PAGETYPE} will be removed, as'
.. ' will any material added to the ${PAGETYPE} that is not properly'
.. ' sourced. The associated talk page(s) were also cleared on the'
.. " same date.\n\n"
.. "If you can edit this page, please discuss all changes and"
.. " additions on the ${TALKPAGE} first. '''Do not override"
.. " this action, and do not remove protection from this page,"
.. " unless you are authorized by the Wikimedia Foundation"
.. " to do so. No editor may remove this notice.'''"
return ret
end,
image = 'Padlock-black.svg',
},
sock = {
description = 'For pages protected due to'
.. ' [[:w:Wikipedia:Sock puppetry|sock puppetry]].',
text = '${INTROFRAGMENT} to prevent [[Wikipedia:Sock puppetry|sock puppets]] of'
.. ' [[Wikisource:Blocking policy|blocked]] or'
.. ' [[:w:Wikipedia:Banning policy|banned users]]'
.. ' from editing it.',
tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from'
.. ' editing it',
},
template = {
description = 'For [[:w:Wikipedia:High-risk templates|high-risk]]'
.. ' templates and Lua modules.',
text = 'This is a permanently [[:w:Help:Protection|protected]] ${PAGETYPE},'
.. ' as it is [[:w:Wikipedia:High-risk templates|high-risk]].',
explanation = 'Please discuss any changes on the ${TALKPAGE}; you may'
.. ' ${EDITREQUEST} to ask an'
.. ' [[Wikisource:Administrators|administrator]] or'
.. ' [[:w:Wikipedia:Template editor|template editor]] to make an edit if'
.. ' it is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by'
.. ' [[:w:Wikipedia:Consensus|consensus]]. You can also'
.. ' [[Wikisource:Administrators' noticeboard|request]] that the page be'
.. ' unprotected.',
tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}'
.. ' to prevent vandalism',
alt = 'Permanently protected ${PAGETYPE}',
},
usertalk = {
description = 'For pages protected against disruptive edits by a'
.. ' particular user.',
text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,'
.. ' such as abusing the'
.. ' {{[[Template:unblock|unblock]]}} template.',
explanation = 'If you cannot edit this user talk page and you need to'
.. ' make a change or leave a message, you can'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Current requests for edits to a protected page'
.. '|request an edit]],'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]],'
.. ' [[Special:Userlogin|log in]],'
.. ' or [[Special:UserLogin/signup|create an account]].',
},
vandalism = {
description = 'For pages protected against'
.. ' [[:w:Wikipedia:Vandalism|vandalism]].',
text = '${INTROFRAGMENT} due to [[Wikipedia:Vandalism|vandalism]].',
explanation = function (protectionObj, args)
local ret = ''
if protectionObj.level == 'sysop' then
ret = ret .. "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. '
end
return ret .. '${EXPLANATIONBLURB}'
end,
tooltip = '${TOOLTIPFRAGMENT} due to vandalism',
}
},
move = {
dispute = {
description = 'For pages protected against page moves due to'
.. ' disputes over the page title.',
explanation = "This protection is '''not''' an endorsement of the"
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}',
image = 'Padlock-olive.svg'
},
vandalism = {
description = 'For pages protected against'
.. ' [[:w:Wikipedia:Vandalism#Page-move vandalism'
.. ' |page-move vandalism]].'
}
},
autoreview = {}
},
--------------------------------------------------------------------------------
--
-- GENERAL DATA TABLES
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Protection blurbs
--------------------------------------------------------------------------------
-- This table produces the protection blurbs available with the
-- ${PROTECTIONBLURB} parameter. It is sorted by protection action and
-- protection level, and is checked by the module in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
protectionBlurbs = {
edit = {
default = 'This ${PAGETYPE} is currently [[:w:Help:Protection|'
.. 'protected]] from editing',
autoconfirmed = 'Editing of this ${PAGETYPE} by [[:w:Wikipedia:User access'
.. ' levels#New users|new]] or [[Wikipedia:User access levels#Unregistered'
.. ' users|unregistered]] users is currently [[:w:Help:Protection|disabled]]'
},
move = {
default = 'This ${PAGETYPE} is currently [[:w:Help:Protection|protected]]'
.. ' from [[:w:Help:Moving a page|page moves]]'
},
autoreview = {
autoconfirmed = 'All edits made to this ${PAGETYPE} by'
.. ' [[:w:Wikipedia:User access levels#New users|new]] or'
.. ' [[:w:Wikipedia:User access levels#Unregistered users|unregistered]]'
.. ' users are currently'
.. ' [[:w:Wikipedia:Pending changes|subject to review]]',
default = 'All edits made to this ${PAGETYPE} by users who are not'
.. ' [[:w:Wikipedia:Reviewing|reviewers]] or'
.. ' [[:w:Wikipedia:Administrators|administrators]] are currently'
.. ' [[:w:Wikipedia:Pending changes|subject to review]]'
}
},
--------------------------------------------------------------------------------
-- Explanation blurbs
--------------------------------------------------------------------------------
-- This table produces the explanation blurbs available with the
-- ${EXPLANATIONBLURB} parameter. It is sorted by protection action,
-- protection level, and whether the page is a talk page or not. If the page is
-- a talk page it will have a talk key of "talk"; otherwise it will have a talk
-- key of "subject". The table is checked in the following order:
-- 1. page's protection action, page's protection level, page's talk key
-- 2. page's protection action, page's protection level, default talk key
-- 3. page's protection action, default protection level, page's talk key
-- 4. page's protection action, default protection level, default talk key
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
explanationBlurbs = {
edit = {
autoconfirmed = {
subject = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details. If you'
.. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].',
},
default = {
subject = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikisource:Administrators|administrator]] to make an edit if it'
.. ' is [[:w:Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]]. You may also [[Wikipedia:Requests for'
.. ' page protection#Page (un)protection requests'
.. '|request]] that this page be unprotected.',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' You may [[Wikipedia:Requests for page'
.. ' protection#Current requests for edits to a protected page|request an'
.. ' edit]] to this page, or [[Wikipedia:Requests for'
.. ' page protection#Page (un)protection requests'
.. '|ask]] for it to be unprotected.'
}
},
move = {
default = {
subject = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves on the'
.. ' ${TALKPAGE} or at [[Wikipedia:Requested moves]]. You can also'
.. ' [[Wikisource:Administrators' noticeboard|request]] that the page be'
.. ' unprotected.',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' The page may still be edited but cannot be moved'
.. ' until unprotected. Please discuss any suggested moves at'
.. ' [[:w:Wikipedia:Requested moves]]. You can also'
.. ' [[Wikisource:Administrators' noticeboard|request]] that the page be'
.. ' unprotected.'
}
},
autoreview = {
default = {
reviewer = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} will not be visible to readers'
.. ' until they are accepted by a reviewer or an administrator.'
.. ' To avoid the need for your edits to be reviewed, you may'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]]. Experienced editors may also'
.. ' request the [[:w:Wikipedia:Reviewing|reviewer user right]].',
default = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Edits to this ${PAGETYPE} by new and unregistered users'
.. ' will not be visible to readers until they are accepted by'
.. ' a reviewer. To avoid the need for your edits to be'
.. ' reviewed, you may'
.. ' [[Wikisource:Administrators' noticeboard'
.. '#Page (un)protection requests'
.. '|request unprotection]], [[Special:Userlogin|log in]], or'
.. ' [[Special:UserLogin/signup|create an account]].'
},
}
},
--------------------------------------------------------------------------------
-- Protection levels
--------------------------------------------------------------------------------
-- This table provides the data for the ${PROTECTIONLEVEL} parameter, which
-- produces a short label for different protection levels. It is sorted by
-- protection action and proteciton level, and is checked in the following
-- order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
protectionLevels = {
edit = {
default = 'protected',
templateeditor = 'template-protected',
autoconfirmed = 'semi-protected',
},
move = {
default = 'move-protected'
},
autoreview = {
}
},
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- This table lists different padlock images for each protection action and
-- protection level. It is used if an image is not specified in any of the
-- banner data tables, and if the page does not satisfy the conditions for using
-- the ['image-filename-indef'] image. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
images = {
edit = {
default = 'Padlock.svg',
templateeditor = 'Padlock-pink.svg',
autoconfirmed = 'Padlock-silver.svg'
},
move = {
default = 'Padlock-olive.svg',
},
autoreview = {
autoconfirmed = 'Padlock-silver-light.svg',
default = 'Padlock-orange.svg'
}
},
-- Pages with a reason specified in this table will show the special "indef"
-- padlock, defined in the 'image-filename-indef' message, if no expiry is set.
indefImageReasons = {
template = true
},
--------------------------------------------------------------------------------
-- Image links
--------------------------------------------------------------------------------
-- This table provides the data for the ${IMAGELINK} parameter, which gets
-- the image link for small padlock icons based on the page's protection action
-- and protection level. It is checked in the following order:
-- 1. page's protection action, page's protection level
-- 2. page's protection action, default protection level
-- 3. "edit" protection action, default protection level
--
-- It is possible to use banner parameters inside this table.
-- *required* - this table needs edit, move, and autoreview subtables.
imageLinks = {
edit = {
default = 'Wikisource:Protection policy#full',
templateeditor = 'Wikisource:Protection policy#template',
autoconfirmed = 'Wikisource:Protection policy#semi'
},
move = {
default = 'Wikisource:Protection policy#move'
},
autoreview = {
autoconfirmed = 'Wikisource:Protection policy#pc1',
reviewer = 'Wikisource:Protection policy#pc2'
}
},
--------------------------------------------------------------------------------
-- Padlock indicator names
--------------------------------------------------------------------------------
-- This table provides the "name" attribute for the <indicator> extension tag
-- with which small padlock icons are generated. All indicator tags on a page
-- are displayed in alphabetical order based on this attribute, and with
-- indicator tags with duplicate names, the last tag on the page wins.
-- The attribute is chosen based on the protection action; table keys must be a
-- protection action name or the string "default".
padlockIndicatorNames = {
autoreview = 'pp-autoreview',
default = 'pp-default'
},
--------------------------------------------------------------------------------
-- Protection categories
--------------------------------------------------------------------------------
--[[
-- The protection categories are stored in the protectionCategories table.
-- Keys to this table are made up of the following strings:
--
-- 1. the expiry date
-- 2. the namespace
-- 3. the protection reason (e.g. "dispute" or "vandalism")
-- 4. the protection level (e.g. "sysop" or "autoconfirmed")
-- 5. the action (e.g. "edit" or "move")
--
-- When the module looks up a category in the table, first it will will check to
-- see a key exists that corresponds to all five parameters. For example, a
-- user page semi-protected from vandalism for two weeks would have the key
-- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module
-- changes the first part of the key to "all" and checks the table again. It
-- keeps checking increasingly generic key combinations until it finds the
-- field, or until it reaches the key "all-all-all-all-all".
--
-- The module uses a binary matrix to determine the order in which to search.
-- This is best demonstrated by a table. In this table, the "0" values
-- represent "all", and the "1" values represent the original data (e.g.
-- "indef" or "file" or "vandalism").
--
-- expiry namespace reason level action
-- order
-- 1 1 1 1 1 1
-- 2 0 1 1 1 1
-- 3 1 0 1 1 1
-- 4 0 0 1 1 1
-- 5 1 1 0 1 1
-- 6 0 1 0 1 1
-- 7 1 0 0 1 1
-- 8 0 0 0 1 1
-- 9 1 1 1 0 1
-- 10 0 1 1 0 1
-- 11 1 0 1 0 1
-- 12 0 0 1 0 1
-- 13 1 1 0 0 1
-- 14 0 1 0 0 1
-- 15 1 0 0 0 1
-- 16 0 0 0 0 1
-- 17 1 1 1 1 0
-- 18 0 1 1 1 0
-- 19 1 0 1 1 0
-- 20 0 0 1 1 0
-- 21 1 1 0 1 0
-- 22 0 1 0 1 0
-- 23 1 0 0 1 0
-- 24 0 0 0 1 0
-- 25 1 1 1 0 0
-- 26 0 1 1 0 0
-- 27 1 0 1 0 0
-- 28 0 0 1 0 0
-- 29 1 1 0 0 0
-- 30 0 1 0 0 0
-- 31 1 0 0 0 0
-- 32 0 0 0 0 0
--
-- In this scheme the action has the highest priority, as it is the last
-- to change, and the expiry has the least priority, as it changes the most.
-- The priorities of the expiry, the protection level and the action are
-- fixed, but the priorities of the reason and the namespace can be swapped
-- through the use of the cfg.bannerDataNamespaceHasPriority table.
--]]
-- If the reason specified to the template is listed in this table,
-- namespace data will take priority over reason data in the protectionCategories
-- table.
reasonsWithNamespacePriority = {
vandalism = true,
},
-- The string to use as a namespace key for the protectionCategories table for each
-- namespace number.
categoryNamespaceKeys = {
[ 2] = 'user',
[ 3] = 'user',
[ 4] = 'project',
[ 6] = 'file',
[ 8] = 'mediawiki',
[ 10] = 'template',
[ 12] = 'project',
[ 14] = 'category',
[100] = 'portal',
[828] = 'module',
},
protectionCategories = {
['all|all|all|all|all'] = 'Wikisource protected pages',
['all|all|office|all|all'] = 'Wikisource Office-protected pages',
['all|all|reset|all|all'] = 'Wikisource Office-protected pages',
['all|all|dmca|all|all'] = 'Wikisource Office-protected pages',
['all|all|mainpage|all|all'] = 'Protected main page images',
['all|template|all|all|edit'] = 'Wikisource protected templates',
['all|all|all|autoconfirmed|edit'] = 'Wikisource semi-protected pages',
['indef|all|all|autoconfirmed|edit'] = 'Wikisource indefinitely semi-protected pages',
['all|all|blp|autoconfirmed|edit'] = 'Wikisource indefinitely semi-protected biographies of living people',
['temp|all|blp|autoconfirmed|edit'] = 'Wikisource temporarily semi-protected biographies of living people',
['all|all|dispute|autoconfirmed|edit'] = 'Wikisource pages semi-protected due to dispute',
['all|all|sock|autoconfirmed|edit'] = 'Wikisource pages semi-protected from banned users',
['all|all|vandalism|autoconfirmed|edit'] = 'Wikisource pages semi-protected against vandalism',
['all|category|all|autoconfirmed|edit'] = 'Wikisource semi-protected categories',
['all|file|all|autoconfirmed|edit'] = 'Semi-protected images',
['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals',
['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages',
['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages',
['all|template|all|autoconfirmed|edit'] = 'Wikisource semi-protected templates',
['all|user|all|autoconfirmed|edit'] = 'Wikisource semi-protected user and user talk pages',
['all|all|blp|sysop|edit'] = 'Wikisource indefinitely protected biographies of living people',
['temp|all|blp|sysop|edit'] = 'Wikisource temporarily protected biographies of living people',
['all|all|dispute|sysop|edit'] = 'Wikisource pages protected due to dispute',
['all|all|sock|sysop|edit'] = 'Wikisource pages protected from banned users',
['all|all|vandalism|sysop|edit'] = 'Wikisource pages protected against vandalism',
['all|category|all|sysop|edit'] = 'Wikisource protected categories',
['all|file|all|sysop|edit'] = 'Protected images',
['all|project|all|sysop|edit'] = 'Protected project pages',
['all|talk|all|sysop|edit'] = 'Protected talk pages',
['all|template|all|sysop|edit'] = 'Wikisource protected templates',
['all|user|all|sysop|edit'] = 'Wikisource protected user and user talk pages',
['all|module|all|all|edit'] = 'Wikisource protected modules',
['all|module|all|autoconfirmed|edit'] = 'Wikisource semi-protected modules',
['all|all|all|sysop|move'] = 'Wikisource move-protected pages',
['indef|all|all|sysop|move'] = 'Wikisource indefinitely move-protected pages',
['all|all|dispute|sysop|move'] = 'Wikisource pages move-protected due to dispute',
['all|all|vandalism|sysop|move'] = 'Wikisource pages move-protected due to vandalism',
['all|portal|all|sysop|move'] = 'Wikisource move-protected portals',
['all|portal|all|sysop|move'] = 'Wikisource move-protected portals',
['all|project|all|sysop|move'] = 'Wikisource move-protected project pages',
['all|talk|all|sysop|move'] = 'Wikisource move-protected talk pages',
['all|template|all|sysop|move'] = 'Wikisource move-protected templates',
['all|user|all|sysop|move'] = 'Wikisource move-protected user and user talk pages',
['all|all|all|autoconfirmed|autoreview'] = 'Wikisource pending changes protected pages (level 1)',
['all|all|all|reviewer|autoreview'] = 'Wikisource pending changes protected pages (level 2)',
},
--------------------------------------------------------------------------------
-- Expiry category config
--------------------------------------------------------------------------------
-- This table configures the expiry category behaviour for each protection
-- action.
-- * If set to true, setting that action will always categorise the page if
-- an expiry parameter is not set.
-- * If set to false, setting that action will never categorise the page.
-- * If set to nil, the module will categorise the page if:
-- 1) an expiry parameter is not set, and
-- 2) a reason is provided, and
-- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck
-- table.
expiryCheckActions = {
edit = nil,
move = false,
autoreview = true
},
reasonsWithoutExpiryCheck = {
blp = true,
template = true,
},
--------------------------------------------------------------------------------
-- Pagetypes
--------------------------------------------------------------------------------
-- This table produces the page types available with the ${PAGETYPE} parameter.
-- Keys are namespace numbers, or the string "default" for the default value.
pagetypes = {
[0] = 'article',
[6] = 'file',
[10] = 'template',
[14] = 'category',
[828] = 'module',
default = 'page'
},
--------------------------------------------------------------------------------
-- Strings marking indefinite protection
--------------------------------------------------------------------------------
-- This table contains values passed to the expiry parameter that mean the page
-- is protected indefinitely.
indefStrings = {
['indef'] = true,
['indefinite'] = true,
['indefinitely'] = true,
['infinite'] = true,
},
--------------------------------------------------------------------------------
-- Group hierarchy
--------------------------------------------------------------------------------
-- This table maps each group to all groups that have a superset of the original
-- group's page editing permissions.
hierarchy = {
sysop = {},
reviewer = {'sysop'},
filemover = {'sysop'},
templateeditor = {'sysop'},
autoconfirmed = {'reviewer', 'filemover', 'templateeditor'},
user = {'autoconfirmed'},
['*'] = {'user'}
},
--------------------------------------------------------------------------------
-- Wrapper templates and their default arguments
--------------------------------------------------------------------------------
-- This table contains wrapper templates used with the module, and their
-- default arguments. Templates specified in this table should contain the
-- following invocation, and no other template content:
--
-- {{#invoke:Protection banner|main}}
--
-- If other content is desired, it can be added between
-- <noinclude>...</noinclude> tags.
--
-- When a user calls one of these wrapper templates, they will use the
-- default arguments automatically. The arguments cannot be overwritten by the
-- user.
wrappers = {
['Template:Pp'] = {},
['Template:Pp-blp'] = {'blp'},
-- we don't need Template:Pp-create
['Template:Pp-dispute'] = {'dispute'},
['Template:Pp-main-page'] = {'mainpage'},
['Template:Pp-move'] = {action = 'move'},
['Template:Pp-move-dispute'] = {'dispute', action = 'move'},
-- we don't need Template:Pp-move-indef
['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'},
['Template:Pp-office'] = {'office'},
['Template:Pp-office-dmca'] = {'dmca'},
['Template:Pp-pc1'] = {action = 'autoreview', small = true},
['Template:Pp-pc2'] = {action = 'autoreview', small = true},
['Template:Pp-reset'] = {'reset'},
['Template:Pp-semi-indef'] = {expiry = 'indef', small = true},
['Template:Pp-sock'] = {'sock'},
['Template:Pp-template'] = {'template', small = true},
['Template:Pp-usertalk'] = {'usertalk'},
['Template:Pp-vandalism'] = {'vandalism'},
},
--------------------------------------------------------------------------------
--
-- MESSAGES
--
--------------------------------------------------------------------------------
msg = {
--------------------------------------------------------------------------------
-- Intro blurb and intro fragment
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${INTROBLURB} and
-- ${INTROFRAGMENT} parameters. If the protection is temporary they use the
-- intro-blurb-expiry or intro-fragment-expiry, and if not they use
-- intro-blurb-noexpiry or intro-fragment-noexpiry.
-- It is possible to use banner parameters in these messages.
['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.',
['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.',
['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},',
['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}',
--------------------------------------------------------------------------------
-- Tooltip blurb
--------------------------------------------------------------------------------
-- These messages specify what is produced by the ${TOOLTIPBLURB} parameter.
-- If the protection is temporary the tooltip-blurb-expiry message is used, and
-- if not the tooltip-blurb-noexpiry message is used.
-- It is possible to use banner parameters in these messages.
['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.',
['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.',
['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},',
['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}',
--------------------------------------------------------------------------------
-- Special explanation blurb
--------------------------------------------------------------------------------
-- An explanation blurb for pages that cannot be unprotected, e.g. for pages
-- in the MediaWiki namespace.
-- It is possible to use banner parameters in this message.
['explanation-blurb-nounprotect'] = 'See the [[Wikisource:Protection policy|'
.. 'protection policy]] and ${PROTECTIONLOG} for more details.'
.. ' Please discuss any changes on the ${TALKPAGE}; you'
.. ' may ${EDITREQUEST} to ask an'
.. ' [[Wikipedia:Administrators|administrator]] to make an edit if it'
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit'
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus'
.. '|consensus]].',
--------------------------------------------------------------------------------
-- Protection log display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the protection log link
-- or the pending changes log link produced by the ${PROTECTIONLOG} parameter.
-- It is possible to use banner parameters in these messages.
['protection-log-display'] = 'protection log',
['pc-log-display'] = 'pending changes log',
--------------------------------------------------------------------------------
-- Current version display values
--------------------------------------------------------------------------------
-- These messages determine the display values for the page history link
-- or the move log link produced by the ${CURRENTVERSION} parameter.
-- It is possible to use banner parameters in these messages.
['current-version-move-display'] = 'current title',
['current-version-edit-display'] = 'current version',
--------------------------------------------------------------------------------
-- Talk page
--------------------------------------------------------------------------------
-- This message determines the display value of the talk page link produced
-- with the ${TALKPAGE} parameter.
-- It is possible to use banner parameters in this message.
['talk-page-link-display'] = 'talk page',
--------------------------------------------------------------------------------
-- Edit requests
--------------------------------------------------------------------------------
-- This message determines the display value of the edit request link produced
-- with the ${EDITREQUEST} parameter.
-- It is possible to use banner parameters in this message.
['edit-request-display'] = 'submit an edit request',
--------------------------------------------------------------------------------
-- Expiry date format
--------------------------------------------------------------------------------
-- This is the format for the blurb expiry date. It should be valid input for
-- the first parameter of the #time parser function.
['expiry-date-format'] = 'F j, Y',
--------------------------------------------------------------------------------
-- Tracking categories
--------------------------------------------------------------------------------
-- These messages determine which tracking categories the module outputs.
['tracking-category-incorrect'] = 'Wikisource pages with incorrect protection templates',
['tracking-category-expiry'] = 'Wikisource protected pages without expiry',
['tracking-category-template'] = 'Wikisource template-protected pages other than templates and modules',
--------------------------------------------------------------------------------
-- Images
--------------------------------------------------------------------------------
-- These are images that are not defined by their protection action and protection level.
['image-filename-indef'] = 'Padlock-red.svg',
['image-filename-default'] = 'Transparent.gif',
--------------------------------------------------------------------------------
-- End messages
--------------------------------------------------------------------------------
}
--------------------------------------------------------------------------------
-- End configuration
--------------------------------------------------------------------------------
}
dqytxu4xu9xz8tdzmug6wvbznb0cdlg
ماڈیول:ISO 639/doc
828
12938
32002
2025-02-19T05:00:34Z
en>CalendulaAsteraceae
0
/* language_name */
32002
wikitext
text/x-wiki
{{lua|Module:Arguments|Module:Warning|Module:ISO 639/overrides|Module:ISO 639/local}}
Some general language code functions:
=== language_name ===
Gets the English language name for a code (ISO 639-1, -2 or -3).
* <code>en</code> → {{ISO 639 name|en}}
* <code>enm</code> → {{ISO 639 name|enm}}
* <code>ang</code> → {{ISO 639 name|ang}}
* <code>sco</code> → {{ISO 639 name|sco}}
* <code>fr</code> → {{ISO 639 name|fr}}
* <code>el</code> → {{ISO 639 name|el}}
* <code>grc</code> → {{ISO 639 name|grc}}
* <code>lzh</code> → {{ISO 639 name|lzh}}
Usage:
<syntaxhighlight lang="lua">
local language_name = require('Module:ISO 639')
language_name(code)
</syntaxhighlight>
=== ISO_639_name ===
Wraps <code>language_name</code> for {{tl|ISO 639 name}} and provides error messages. Errors are tracked in [[:Category:ISO 639 name template errors]].
Usage:
<syntaxhighlight lang="lua">
local ISO_639_name = require('Module:ISO 639')._ISO_639_name
ISO_639_name({code})
ISO_639_name({code = code})
</syntaxhighlight>
<syntaxhighlight lang="wikitext">{{#invoke:ISO 639|ISO_639_name|code}}</syntaxhighlight>
kuz62b0h6bbk7q8n85uq1hkbiinuh0l
32003
32002
2026-04-22T01:49:49Z
Satdeep Gill
85
[[:en:Module:ISO_639/doc]] سے 1 نسخہ درآمد کیا گیا
32002
wikitext
text/x-wiki
{{lua|Module:Arguments|Module:Warning|Module:ISO 639/overrides|Module:ISO 639/local}}
Some general language code functions:
=== language_name ===
Gets the English language name for a code (ISO 639-1, -2 or -3).
* <code>en</code> → {{ISO 639 name|en}}
* <code>enm</code> → {{ISO 639 name|enm}}
* <code>ang</code> → {{ISO 639 name|ang}}
* <code>sco</code> → {{ISO 639 name|sco}}
* <code>fr</code> → {{ISO 639 name|fr}}
* <code>el</code> → {{ISO 639 name|el}}
* <code>grc</code> → {{ISO 639 name|grc}}
* <code>lzh</code> → {{ISO 639 name|lzh}}
Usage:
<syntaxhighlight lang="lua">
local language_name = require('Module:ISO 639')
language_name(code)
</syntaxhighlight>
=== ISO_639_name ===
Wraps <code>language_name</code> for {{tl|ISO 639 name}} and provides error messages. Errors are tracked in [[:Category:ISO 639 name template errors]].
Usage:
<syntaxhighlight lang="lua">
local ISO_639_name = require('Module:ISO 639')._ISO_639_name
ISO_639_name({code})
ISO_639_name({code = code})
</syntaxhighlight>
<syntaxhighlight lang="wikitext">{{#invoke:ISO 639|ISO_639_name|code}}</syntaxhighlight>
kuz62b0h6bbk7q8n85uq1hkbiinuh0l
ماڈیول:Warning
828
12939
32004
2024-03-31T19:53:38Z
en>CalendulaAsteraceae
0
Protected "[[Module:Warning]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32004
Scribunto
text/plain
local libraryUtil = require('libraryUtil')
local wrapper = "%s" -- wikitext formatting
local msg_loc = "Lua warning in %s at line %d: %s."
local msg = "Lua warning: %s."
return function (message, level)
libraryUtil.checkType('warn', 2, level, 'number', true)
level = level or 1
if level > 0 then
local _, location = pcall(error, '', level+2)
if location ~= '' then
location = mw.text.split(location:sub(1,-3), ':%f[%d]')
message = msg_loc:format(location[1], location[2], message)
else
message = msg:format(message)
end
else
message = msg:format(message)
end
mw.addWarning(wrapper:format(message))
end
6n5nxfk4xtrlul0szoxeogpa9uj1ggn
32005
32004
2026-04-22T01:49:49Z
Satdeep Gill
85
[[:en:Module:Warning]] سے 1 نسخہ درآمد کیا گیا
32004
Scribunto
text/plain
local libraryUtil = require('libraryUtil')
local wrapper = "%s" -- wikitext formatting
local msg_loc = "Lua warning in %s at line %d: %s."
local msg = "Lua warning: %s."
return function (message, level)
libraryUtil.checkType('warn', 2, level, 'number', true)
level = level or 1
if level > 0 then
local _, location = pcall(error, '', level+2)
if location ~= '' then
location = mw.text.split(location:sub(1,-3), ':%f[%d]')
message = msg_loc:format(location[1], location[2], message)
else
message = msg:format(message)
end
else
message = msg:format(message)
end
mw.addWarning(wrapper:format(message))
end
6n5nxfk4xtrlul0szoxeogpa9uj1ggn
ماڈیول:ISO 639/overrides
828
12940
32006
2024-08-22T17:08:28Z
en>CalendulaAsteraceae
0
add override
32006
Scribunto
text/plain
return {
["ab"] = "Abkhaz",
["acm"] = "Mesopotamian Arabic",
["als"] = "Tosk Albanian",
["bn"] = "Bengali",
["bpy"] = "Bishnupriya Manipuri",
["cdo"] = "Min Dong",
["cu"] = "Church Slavonic",
["dga"] = "Southern Dagaare",
["diq"] = "Dimli",
["dv"] = "Dhivehi",
["fiu-vro"] = "Võro",
["frp"] = "Franco-Provençal",
["gcr"] = "Guianese Creole",
["gur"] = "Farefare",
["ii"] = "Nuosu",
["kaa"] = "Karakalpak",
["kj"] = "Kwanyama",
["krj"] = "Karay-a",
["kus"] = "Kusaal",
["lad"] = "Judaeo-Spanish",
["lg"] = "Luganda",
["map-bms"] = "Banyumasan",
["nah"] = "Nahuatl",
["nan"] = "Southern Min",
["new"] = "Newar",
["nit"] = "Naiki",
["nqo"] = "N'Ko",
["nrm"] = "Narom",
["ny"] = "Chewa",
["nys"] = "Noongar",
["pi"] = "Pāli",
["pih"] = "Pitkern",
["rif"] = "Tmazight",
["rki"] = "Rakhine",
["st"] = "Sotho",
["tay"] = "Atayal",
["trv"] = "Seediq",
["vmf"] = "East Franconian",
["wal"] = "Wolaitta",
["zh-min-nan"] = "Southern Min"
}
thn706ro24wcxcx8wd6f0rlhfux9u0q
32007
32006
2026-04-22T01:49:49Z
Satdeep Gill
85
[[:en:Module:ISO_639/overrides]] سے 1 نسخہ درآمد کیا گیا
32006
Scribunto
text/plain
return {
["ab"] = "Abkhaz",
["acm"] = "Mesopotamian Arabic",
["als"] = "Tosk Albanian",
["bn"] = "Bengali",
["bpy"] = "Bishnupriya Manipuri",
["cdo"] = "Min Dong",
["cu"] = "Church Slavonic",
["dga"] = "Southern Dagaare",
["diq"] = "Dimli",
["dv"] = "Dhivehi",
["fiu-vro"] = "Võro",
["frp"] = "Franco-Provençal",
["gcr"] = "Guianese Creole",
["gur"] = "Farefare",
["ii"] = "Nuosu",
["kaa"] = "Karakalpak",
["kj"] = "Kwanyama",
["krj"] = "Karay-a",
["kus"] = "Kusaal",
["lad"] = "Judaeo-Spanish",
["lg"] = "Luganda",
["map-bms"] = "Banyumasan",
["nah"] = "Nahuatl",
["nan"] = "Southern Min",
["new"] = "Newar",
["nit"] = "Naiki",
["nqo"] = "N'Ko",
["nrm"] = "Narom",
["ny"] = "Chewa",
["nys"] = "Noongar",
["pi"] = "Pāli",
["pih"] = "Pitkern",
["rif"] = "Tmazight",
["rki"] = "Rakhine",
["st"] = "Sotho",
["tay"] = "Atayal",
["trv"] = "Seediq",
["vmf"] = "East Franconian",
["wal"] = "Wolaitta",
["zh-min-nan"] = "Southern Min"
}
thn706ro24wcxcx8wd6f0rlhfux9u0q
ماڈیول:Category handler
828
12941
32008
2024-03-31T19:59:21Z
en>CalendulaAsteraceae
0
Protected "[[Module:Category handler]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32008
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- CATEGORY HANDLER --
-- --
-- This module implements the {{category handler}} template in Lua, --
-- with a few improvements: all namespaces and all namespace aliases --
-- are supported, and namespace names are detected automatically for --
-- the local wiki. This module requires [[Module:Namespace detect]] --
-- and [[Module:Yesno]] to be available on the local wiki. It can be --
-- configured for different wikis by altering the values in --
-- [[Module:Category handler/config]], and pages can be blacklisted --
-- from categorisation by using [[Module:Category handler/blacklist]]. --
-- --
--------------------------------------------------------------------------------
-- Load required modules
local yesno = require('Module:Yesno')
-- Lazily load things we don't always need
local mShared, mappings
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function trimWhitespace(s, removeBlanks)
if type(s) ~= 'string' then
return s
end
s = s:match('^%s*(.-)%s*$')
if removeBlanks then
if s ~= '' then
return s
else
return nil
end
else
return s
end
end
--------------------------------------------------------------------------------
-- CategoryHandler class
--------------------------------------------------------------------------------
local CategoryHandler = {}
CategoryHandler.__index = CategoryHandler
function CategoryHandler.new(data, args)
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename = obj:parameter('demopage')
local success, titleObj
if pagename then
success, titleObj = pcall(mw.title.new, pagename)
end
if success and titleObj then
obj.title = titleObj
if titleObj == mw.title.getCurrentTitle() then
obj._usesCurrentTitle = true
end
else
obj.title = mw.title.getCurrentTitle()
obj._usesCurrentTitle = true
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = obj:parameter(key)
value = trimWhitespace(value, true)
obj['_' .. key] = yesno(value)
end
do
local subpage = obj:parameter('subpage')
local category2 = obj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
end
if type(category2) == 'string' then
subpage = mw.ustring.lower(category2)
end
obj._subpage = trimWhitespace(subpage, true)
obj._category2 = trimWhitespace(category2) -- don't remove blank values
end
return obj
end
function CategoryHandler:parameter(key)
local parameterNames = self._data.parameters[key]
local pntype = type(parameterNames)
if pntype == 'string' or pntype == 'number' then
return self._args[parameterNames]
elseif pntype == 'table' then
for _, name in ipairs(parameterNames) do
local value = self._args[name]
if value ~= nil then
return value
end
end
return nil
else
error(string.format(
'invalid config key "%s"',
tostring(key)
), 2)
end
end
function CategoryHandler:isSuppressedByArguments()
return
-- See if a category suppression argument has been set.
self._nocat == true
or self._categories == false
or (
self._category2
and self._category2 ~= self._data.category2Yes
and self._category2 ~= self._data.category2Negative
)
-- Check whether we are on a subpage, and see if categories are
-- suppressed based on our subpage status.
or self._subpage == self._data.subpageNo and self.title.isSubpage
or self._subpage == self._data.subpageOnly and not self.title.isSubpage
end
function CategoryHandler:shouldSkipBlacklistCheck()
-- Check whether the category suppression arguments indicate we
-- should skip the blacklist check.
return self._nocat == false
or self._categories == true
or self._category2 == self._data.category2Yes
end
function CategoryHandler:matchesBlacklist()
if self._usesCurrentTitle then
return self._data.currentTitleMatchesBlacklist
else
mShared = mShared or require('Module:Category handler/shared')
return mShared.matchesBlacklist(
self.title.prefixedText,
mw.loadData('Module:Category handler/blacklist')
)
end
end
function CategoryHandler:isSuppressed()
-- Find if categories are suppressed by either the arguments or by
-- matching the blacklist.
return self:isSuppressedByArguments()
or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist()
end
function CategoryHandler:getNamespaceParameters()
if self._usesCurrentTitle then
return self._data.currentTitleNamespaceParameters
else
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
return mShared.getNamespaceParameters(
self.title,
mappings
)
end
end
function CategoryHandler:namespaceParametersExist()
-- Find whether any namespace parameters have been specified.
-- We use the order "all" --> namespace params --> "other" as this is what
-- the old template did.
if self:parameter('all') then
return true
end
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
for ns, params in pairs(mappings) do
for i, param in ipairs(params) do
if self._args[param] then
return true
end
end
end
if self:parameter('other') then
return true
end
return false
end
function CategoryHandler:getCategories()
local params = self:getNamespaceParameters()
local nsCategory
for i, param in ipairs(params) do
local value = self._args[param]
if value ~= nil then
nsCategory = value
break
end
end
if nsCategory ~= nil or self:namespaceParametersExist() then
-- Namespace parameters exist - advanced usage.
if nsCategory == nil then
nsCategory = self:parameter('other')
end
local ret = {self:parameter('all')}
local numParam = tonumber(nsCategory)
if numParam and numParam >= 1 and math.floor(numParam) == numParam then
-- nsCategory is an integer
ret[#ret + 1] = self._args[numParam]
else
ret[#ret + 1] = nsCategory
end
if #ret < 1 then
return nil
else
return table.concat(ret)
end
elseif self._data.defaultNamespaces[self.title.namespace] then
-- Namespace parameters don't exist, simple usage.
return self._args[1]
end
return nil
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- Used for testing purposes.
return {
CategoryHandler = CategoryHandler
}
end
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler.new(data, args)
if handler:isSuppressed() then
return nil
end
return handler:getCategories()
end
function p.main(frame, data)
data = data or mw.loadData('Module:Category handler/data')
local args = require('Module:Arguments').getArgs(frame, {
wrappers = data.wrappers,
valueFunc = function (k, v)
v = trimWhitespace(v)
if type(k) == 'number' then
if v ~= '' then
return v
else
return nil
end
else
return v
end
end
})
return p._main(args, data)
end
return p
letwavu3yvlayfzew66uuwixmwebq5b
32009
32008
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Module:Category_handler]] سے 1 نسخہ درآمد کیا گیا
32008
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- CATEGORY HANDLER --
-- --
-- This module implements the {{category handler}} template in Lua, --
-- with a few improvements: all namespaces and all namespace aliases --
-- are supported, and namespace names are detected automatically for --
-- the local wiki. This module requires [[Module:Namespace detect]] --
-- and [[Module:Yesno]] to be available on the local wiki. It can be --
-- configured for different wikis by altering the values in --
-- [[Module:Category handler/config]], and pages can be blacklisted --
-- from categorisation by using [[Module:Category handler/blacklist]]. --
-- --
--------------------------------------------------------------------------------
-- Load required modules
local yesno = require('Module:Yesno')
-- Lazily load things we don't always need
local mShared, mappings
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function trimWhitespace(s, removeBlanks)
if type(s) ~= 'string' then
return s
end
s = s:match('^%s*(.-)%s*$')
if removeBlanks then
if s ~= '' then
return s
else
return nil
end
else
return s
end
end
--------------------------------------------------------------------------------
-- CategoryHandler class
--------------------------------------------------------------------------------
local CategoryHandler = {}
CategoryHandler.__index = CategoryHandler
function CategoryHandler.new(data, args)
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename = obj:parameter('demopage')
local success, titleObj
if pagename then
success, titleObj = pcall(mw.title.new, pagename)
end
if success and titleObj then
obj.title = titleObj
if titleObj == mw.title.getCurrentTitle() then
obj._usesCurrentTitle = true
end
else
obj.title = mw.title.getCurrentTitle()
obj._usesCurrentTitle = true
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = obj:parameter(key)
value = trimWhitespace(value, true)
obj['_' .. key] = yesno(value)
end
do
local subpage = obj:parameter('subpage')
local category2 = obj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
end
if type(category2) == 'string' then
subpage = mw.ustring.lower(category2)
end
obj._subpage = trimWhitespace(subpage, true)
obj._category2 = trimWhitespace(category2) -- don't remove blank values
end
return obj
end
function CategoryHandler:parameter(key)
local parameterNames = self._data.parameters[key]
local pntype = type(parameterNames)
if pntype == 'string' or pntype == 'number' then
return self._args[parameterNames]
elseif pntype == 'table' then
for _, name in ipairs(parameterNames) do
local value = self._args[name]
if value ~= nil then
return value
end
end
return nil
else
error(string.format(
'invalid config key "%s"',
tostring(key)
), 2)
end
end
function CategoryHandler:isSuppressedByArguments()
return
-- See if a category suppression argument has been set.
self._nocat == true
or self._categories == false
or (
self._category2
and self._category2 ~= self._data.category2Yes
and self._category2 ~= self._data.category2Negative
)
-- Check whether we are on a subpage, and see if categories are
-- suppressed based on our subpage status.
or self._subpage == self._data.subpageNo and self.title.isSubpage
or self._subpage == self._data.subpageOnly and not self.title.isSubpage
end
function CategoryHandler:shouldSkipBlacklistCheck()
-- Check whether the category suppression arguments indicate we
-- should skip the blacklist check.
return self._nocat == false
or self._categories == true
or self._category2 == self._data.category2Yes
end
function CategoryHandler:matchesBlacklist()
if self._usesCurrentTitle then
return self._data.currentTitleMatchesBlacklist
else
mShared = mShared or require('Module:Category handler/shared')
return mShared.matchesBlacklist(
self.title.prefixedText,
mw.loadData('Module:Category handler/blacklist')
)
end
end
function CategoryHandler:isSuppressed()
-- Find if categories are suppressed by either the arguments or by
-- matching the blacklist.
return self:isSuppressedByArguments()
or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist()
end
function CategoryHandler:getNamespaceParameters()
if self._usesCurrentTitle then
return self._data.currentTitleNamespaceParameters
else
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
return mShared.getNamespaceParameters(
self.title,
mappings
)
end
end
function CategoryHandler:namespaceParametersExist()
-- Find whether any namespace parameters have been specified.
-- We use the order "all" --> namespace params --> "other" as this is what
-- the old template did.
if self:parameter('all') then
return true
end
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
for ns, params in pairs(mappings) do
for i, param in ipairs(params) do
if self._args[param] then
return true
end
end
end
if self:parameter('other') then
return true
end
return false
end
function CategoryHandler:getCategories()
local params = self:getNamespaceParameters()
local nsCategory
for i, param in ipairs(params) do
local value = self._args[param]
if value ~= nil then
nsCategory = value
break
end
end
if nsCategory ~= nil or self:namespaceParametersExist() then
-- Namespace parameters exist - advanced usage.
if nsCategory == nil then
nsCategory = self:parameter('other')
end
local ret = {self:parameter('all')}
local numParam = tonumber(nsCategory)
if numParam and numParam >= 1 and math.floor(numParam) == numParam then
-- nsCategory is an integer
ret[#ret + 1] = self._args[numParam]
else
ret[#ret + 1] = nsCategory
end
if #ret < 1 then
return nil
else
return table.concat(ret)
end
elseif self._data.defaultNamespaces[self.title.namespace] then
-- Namespace parameters don't exist, simple usage.
return self._args[1]
end
return nil
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- Used for testing purposes.
return {
CategoryHandler = CategoryHandler
}
end
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler.new(data, args)
if handler:isSuppressed() then
return nil
end
return handler:getCategories()
end
function p.main(frame, data)
data = data or mw.loadData('Module:Category handler/data')
local args = require('Module:Arguments').getArgs(frame, {
wrappers = data.wrappers,
valueFunc = function (k, v)
v = trimWhitespace(v)
if type(k) == 'number' then
if v ~= '' then
return v
else
return nil
end
else
return v
end
end
})
return p._main(args, data)
end
return p
letwavu3yvlayfzew66uuwixmwebq5b
ماڈیول:Error
828
12942
32012
2025-01-19T09:04:15Z
en>CalendulaAsteraceae
0
improve default value of tag
32012
Scribunto
text/plain
local p = {}
local function _error(args)
local tag = mw.ustring.lower(tostring(args.tag or 'strong'))
-- Work out what html tag we should use.
if not (tag == 'p' or tag == 'span' or tag == 'div') then
tag = 'strong'
end
-- Generate the html.
return tostring(mw.html.create(tag)
:addClass('error')
:wikitext(tostring(args.message or args[1] or error('no message specified', 2)))
)
end
function p.error(frame)
local args
if type(frame.args) == 'table' then
--[=[
We're being called via #invoke.
The args are passed through to the module from the template page,
so use the args that were passed into the template.
]=]
args = frame.args
else
--[=[
We're being called from another module or from the debug console,
so assume the args are passed in directly.
]=]
args = frame
end
--[=[
If the message parameter is present but blank, change it to nil.
]=]
if args.message == '' then
args.message = nil
end
return _error(args)
end
return p
a1gea716qmg6nkngecd84mcx7lrtpgc
32013
32012
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Module:Error]] سے 1 نسخہ درآمد کیا گیا
32012
Scribunto
text/plain
local p = {}
local function _error(args)
local tag = mw.ustring.lower(tostring(args.tag or 'strong'))
-- Work out what html tag we should use.
if not (tag == 'p' or tag == 'span' or tag == 'div') then
tag = 'strong'
end
-- Generate the html.
return tostring(mw.html.create(tag)
:addClass('error')
:wikitext(tostring(args.message or args[1] or error('no message specified', 2)))
)
end
function p.error(frame)
local args
if type(frame.args) == 'table' then
--[=[
We're being called via #invoke.
The args are passed through to the module from the template page,
so use the args that were passed into the template.
]=]
args = frame.args
else
--[=[
We're being called from another module or from the debug console,
so assume the args are passed in directly.
]=]
args = frame
end
--[=[
If the message parameter is present but blank, change it to nil.
]=]
if args.message == '' then
args.message = nil
end
return _error(args)
end
return p
a1gea716qmg6nkngecd84mcx7lrtpgc
ماڈیول:Lua
828
12943
32016
2019-09-03T10:33:17Z
en>Xover
0
58 revisions imported from [[:w:Template:Lua]]: importing from enwp
32016
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pnmjp3f3fl321yf2jpg5syebi412n7b
32017
32016
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Template:Lua]] سے 1 نسخہ درآمد کیا گیا
32016
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pnmjp3f3fl321yf2jpg5syebi412n7b
ماڈیول:Proofreadpage index template/doc
828
12944
32018
2025-08-28T21:42:10Z
en>CalendulaAsteraceae
0
32018
wikitext
text/x-wiki
{{lua|Module:Arguments|Module:Message box|Module:ISO 639|Module:Index talk remarks|Module:Error|Module:Header/attribution data|Module:Category handler|Module:Proofreadpage index template/config}}
{{templatestyles|Module:Proofreadpage index template/styles.css}}
This is a module to implement logic for [[MediaWiki:Proofreadpage index template]]. See test cases at [[Template:Proofreadpage index template/testcases]].
<noinclude>[[Category:External links on protected pages]]</noinclude>
r6e9cyqhselylr4lox62anfw2593ulq
32019
32018
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Module:Proofreadpage_index_template/doc]] سے 1 نسخہ درآمد کیا گیا
32018
wikitext
text/x-wiki
{{lua|Module:Arguments|Module:Message box|Module:ISO 639|Module:Index talk remarks|Module:Error|Module:Header/attribution data|Module:Category handler|Module:Proofreadpage index template/config}}
{{templatestyles|Module:Proofreadpage index template/styles.css}}
This is a module to implement logic for [[MediaWiki:Proofreadpage index template]]. See test cases at [[Template:Proofreadpage index template/testcases]].
<noinclude>[[Category:External links on protected pages]]</noinclude>
r6e9cyqhselylr4lox62anfw2593ulq
ماڈیول:Proofreadpage index template/config
828
12945
32020
2026-02-10T16:56:46Z
en>Alien333
0
32020
Scribunto
text/plain
local function any_case(str)
return str:gsub('.', function (chr)
if chr:match('%a') then -- letters
return '[' .. chr:lower() .. chr:upper() .. ']'
else
return chr -- leave as-is
end
end)
end
return {
['defaults'] = {
['Source'] = '_empty_',
},
['pagelist'] = {
['pages'] = {
['txt'] = 'Pages'
},
['legend'] = {
['txt'] = '(key to [[Help:Page Status|Page Status]])'
}
},
['cover'] = {
['width'] = '250px',
['image'] = 'File:Placeholder book.svg'
},
['missing_heading_id'] = function (id)
return 'Can\'t find heading for ID: ' .. id
end,
['headings'] = {
['title'] = {
['txt'] = 'Title'
},
['progress'] = {
['txt'] = 'Progress'
},
['transclusion'] = {
['txt'] = 'Transclusion'
},
['validation_date'] = {
['txt'] = 'Validated in'
},
['source'] = {
['txt'] = 'Source'
},
['place'] = {
['txt'] = 'Location'
},
['year'] = {
['txt'] = 'Year'
},
['publisher'] = {
['txt'] = 'Publisher'
},
['author'] = {
['txt'] = 'Author'
},
['editor'] = {
['txt'] = 'Editor'
},
['translator'] = {
['txt'] = 'Translator'
},
['illustrator'] = {
['txt'] = 'Illustrator'
},
['volumes'] = {
['txt'] = 'Volumes'
},
['isbn'] = {
['txt'] = 'ISBN'
},
['oclc'] = {
['txt'] = 'OCLC'
},
['lccn'] = {
['txt'] = 'LCCN'
},
['ark'] = {
['txt'] = 'ARK'
},
--[=[
['National Archives'] = {
['txt'] = 'National Archives'
},
]=]
['doi'] = {
['txt'] = 'DOI'
}
},
['status'] = {
['T'] = {
['cat'] = 'Index Validated',
['txt'] = 'Done—All pages of the work proper are validated',
},
['V'] = {
['cat'] = 'Index Proofread',
['txt'] = 'Proofread—All pages of the work proper are proofread, but not all are validated',
},
['C'] = {
['cat'] = 'Index Not-Proofread',
['txt'] = 'To be proofread',
},
['MS'] = {
['cat'] = 'Index - Ready for Match and Split',
['txt'] = 'Ready for Match and Split',
},
['OCR'] = {
['cat'] = 'Index - Text Layer Requested',
['txt'] = 'Source file needs an OCR text layer',
},
['L'] = {
['cat'] = 'Index - File to fix',
['txt'] = 'Source file must be fixed before proofreading',
['error'] = true,
},
['X'] = {
['cat'] = 'Index - File to check',
['txt'] = 'Create a pagelist for the source file before commencing proofreading (to verify file is correct)',
['error'] = true
},
['_missing'] = {
['cat'] = 'Index - Unknown progress',
['txt'] = 'Missing progress (template error)',
['error'] = true,
},
['_default'] = {
['cat'] = 'Index - Unknown progress',
['txt'] = function (index_status)
return 'Unknown progress: ' .. index_status .. ' (template error)'
end,
['error'] = true,
}
},
['transclusion'] = {
['yes'] = {
['cat'] = 'Fully transcluded',
['txt'] = 'Fully transcluded',
['help'] = 'The work is fully transcluded, including front and end matter and images'
},
['notimg'] = {
['cat'] = 'Images not fully transcluded',
['txt'] = 'Images not fully transcluded',
['help'] = 'The work is fully transcluded, but that some images are still missing or need improvement',
},
['notadv'] = {
['cat'] = 'Advertising not transcluded',
['txt'] = 'Advertising not transcluded',
['help'] = 'The main body of the work is properly transcluded, though front- or end-matter advertising material is not'
},
['held'] = {
['cat'] = 'Transclusion on hold',
['txt'] = 'Transclusion on hold',
['help'] = 'There is a problem with transcluding the work (which should be explained on the talk page)'
},
['check'] = {
['cat'] = 'Transclusion check required',
['txt'] = 'Transclusion check required',
['help'] = 'The transclusion of the work is incomplete or needs checking'
},
['no'] = {
['cat'] = 'Index not transcluded',
['txt'] = 'Index not transcluded or unreviewed',
['help'] = 'This work is not transcluded or has not been reviewed for transclusion'
},
['_missing'] = {
['cat'] = 'Index not transcluded',
['txt'] = 'Missing transclusion status (template error)',
['error'] = true,
},
['_default'] = {
['cat'] = 'Index not transcluded',
['txt'] = function (index_status)
return 'Unknown transclusion status: ' .. index_status .. ' (template error)'
end,
['error'] = true,
}
},
['language_cats'] = {
['single'] = function(lang)
return 'Index pages of works originally in ' .. (lang or 'an unknown language')
end,
['multi'] = 'Index pages of works originally in multiple languages'
},
['cover_cats'] = {
['file_types'] = {
['jpg'] = 'image',
['png'] = 'image',
['gif'] = 'image',
['tif'] = 'image',
['ogg'] = 'audiovisual',
['ogv'] = 'audiovisual',
['webm'] = 'audiovisual',
['_empty_'] = 'unknown',
['pdf'] = 'multipage',
['djvu'] = 'multipage'
},
['image'] = 'Image based indexes',
['audiovisual'] = 'Audio-visual based indexes',
['unknown'] = 'Indexes of unknown type',
['missing'] = 'Indexes with missing files',
['fullspec'] = 'Non-image-based indexes with fully-specified cover image'
},
['validation_cats'] = {
['dated'] = function(vdate)
return 'Indexes validated in ' .. vdate
end,
['undated'] = 'Indexes validated with no date'
},
['indicators'] = {
['pagegame'] = {
['name'] = 'WS Page Game',
['image'] = 'File:OOjs UI icon page number.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('toolforge:ws-page-game', {['wikisource'] = 'en', ['index'] = mw.uri.encode(args.fileTitle.rootText), ['lang'] = 'en'}))
end,
['caption'] = 'Wikisource Page Game (step-by-step pagelist builder)'
},
['purge'] = {
['name'] = 'purge file',
['image'] = 'File:OOjs UI icon reload.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('commons:File:' .. args.fileTitle.rootText, {['action'] = 'purge'}))
end,
['caption'] = 'Purge file'
},
['book2scroll'] = {
['name'] = 'book2scroll',
['image'] = 'File:Library-logo.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('toolforge:book2scroll', {['lang'] = 'en', ['file'] = mw.uri.encode(args.fileTitle.rootText)}))
end,
['caption'] = 'Open in Book2Scroll'
},
['bookreader'] = {
['name'] = 'bookreader',
['image'] = 'File:BookReader-favicon.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('toolforge:bookreader/en/' .. mw.uri.encode(args.fileTitle.rootText)))
end,
['caption'] = 'Open file in BookReader'
},
['validated'] = {
['name'] = 'validated-index-date',
['image'] = 'File:Yes Check Circle.svg',
['link'] = function (args)
local vdate = args['Validation_date']
return vdate and tostring(mw.uri.fullUrl('Category:Indexes validated in ' .. vdate)) or ''
end,
['caption'] = function (args)
local vdate = args['Validation_date']
return vdate and 'Validated in ' .. vdate or nil
end,
['alt'] = 'Validated index page.',
['width'] = '15px',
['include'] = function (args)
return args['Validation_date'] ~= nil
end
}
},
['indicator_defaults'] = {
['width'] = '20px',
['include'] = function (args)
return true
end
},
['url_gens'] = {
['isbn'] = function(id, text)
return require('Module:ISBN')._ISBN({id})
end,
['oclc'] = function(id, text)
return '[https://www.worldcat.org/oclc/' .. mw.uri.encode(id, 'PATH') .. ' ' .. text .. ']'
end,
['ark'] = function(id, text)
return '[https://n2t.net/' .. mw.uri.encode(id, 'QUERY') .. ' ' .. text .. ']'
end,
['doi'] = function(id, text)
return '[https://doi.org/' .. mw.uri.encode(id, 'PATH') .. ' ' .. text .. ']'
end
},
['talkremarks'] = {
['text'] = function(args)
return 'Formatting guidelines specific to this work may have already been established. Please check this [[' .. args.talkPageTitle.prefixedText .. '|Index\'s discussion page]] and follow any such conventions.'
end,
['cat'] = 'Pages using index talk remarks with notes parameter',
['keywords'] = {
{
['pattern'] = any_case('notes?'),
['alone'] = true
},
{
['pattern'] = any_case('quick notes?'),
['alone'] = false
},
{
['pattern'] = any_case('proofr?e?a?d?ing notes?'), -- proofreading notes, proofing note, &c
['alone'] = false
},
{
['pattern'] = any_case('style notes?'),
['alone'] = false
},
{
['pattern'] = any_case('layout notes?'),
['alone'] = false
},
{
['pattern'] = any_case('formatting conventions?'),
['alone'] = false
},
{
['pattern'] = any_case('formatt?i?n?g?'), -- formatting, format
['alone'] = true
},
{
['pattern'] = any_case('conventions?'),
['alone'] = true
},
{
['pattern'] = any_case('layouts?'),
['alone'] = true
},
{
['pattern'] = any_case('quotes'),
['alone'] = true
},
{
['pattern'] = any_case('quotation marks'),
['alone'] = false
},
{
['pattern'] = any_case('typography'),
['alone'] = false
},
{
['pattern'] = any_case('spelling'),
['alone'] = false
},
{
['pattern'] = any_case('style guide'),
['alone'] = false
},
{
['pattern'] = any_case('guidelines?'),
['alone'] = false
},
{
['pattern'] = any_case('missing pages?'),
['alone'] = true
},
{
['pattern'] = any_case('long[ %-]s'), -- of course
['alone'] = true
},
},
['timestamp'] = {
['pattern'] = '%(UTC%)',
['text'] = '(UTC)'
}
}
}
tl27c7dnpnsq1ju5yccb8dqwwywiug4
32021
32020
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Module:Proofreadpage_index_template/config]] سے 1 نسخہ درآمد کیا گیا
32020
Scribunto
text/plain
local function any_case(str)
return str:gsub('.', function (chr)
if chr:match('%a') then -- letters
return '[' .. chr:lower() .. chr:upper() .. ']'
else
return chr -- leave as-is
end
end)
end
return {
['defaults'] = {
['Source'] = '_empty_',
},
['pagelist'] = {
['pages'] = {
['txt'] = 'Pages'
},
['legend'] = {
['txt'] = '(key to [[Help:Page Status|Page Status]])'
}
},
['cover'] = {
['width'] = '250px',
['image'] = 'File:Placeholder book.svg'
},
['missing_heading_id'] = function (id)
return 'Can\'t find heading for ID: ' .. id
end,
['headings'] = {
['title'] = {
['txt'] = 'Title'
},
['progress'] = {
['txt'] = 'Progress'
},
['transclusion'] = {
['txt'] = 'Transclusion'
},
['validation_date'] = {
['txt'] = 'Validated in'
},
['source'] = {
['txt'] = 'Source'
},
['place'] = {
['txt'] = 'Location'
},
['year'] = {
['txt'] = 'Year'
},
['publisher'] = {
['txt'] = 'Publisher'
},
['author'] = {
['txt'] = 'Author'
},
['editor'] = {
['txt'] = 'Editor'
},
['translator'] = {
['txt'] = 'Translator'
},
['illustrator'] = {
['txt'] = 'Illustrator'
},
['volumes'] = {
['txt'] = 'Volumes'
},
['isbn'] = {
['txt'] = 'ISBN'
},
['oclc'] = {
['txt'] = 'OCLC'
},
['lccn'] = {
['txt'] = 'LCCN'
},
['ark'] = {
['txt'] = 'ARK'
},
--[=[
['National Archives'] = {
['txt'] = 'National Archives'
},
]=]
['doi'] = {
['txt'] = 'DOI'
}
},
['status'] = {
['T'] = {
['cat'] = 'Index Validated',
['txt'] = 'Done—All pages of the work proper are validated',
},
['V'] = {
['cat'] = 'Index Proofread',
['txt'] = 'Proofread—All pages of the work proper are proofread, but not all are validated',
},
['C'] = {
['cat'] = 'Index Not-Proofread',
['txt'] = 'To be proofread',
},
['MS'] = {
['cat'] = 'Index - Ready for Match and Split',
['txt'] = 'Ready for Match and Split',
},
['OCR'] = {
['cat'] = 'Index - Text Layer Requested',
['txt'] = 'Source file needs an OCR text layer',
},
['L'] = {
['cat'] = 'Index - File to fix',
['txt'] = 'Source file must be fixed before proofreading',
['error'] = true,
},
['X'] = {
['cat'] = 'Index - File to check',
['txt'] = 'Create a pagelist for the source file before commencing proofreading (to verify file is correct)',
['error'] = true
},
['_missing'] = {
['cat'] = 'Index - Unknown progress',
['txt'] = 'Missing progress (template error)',
['error'] = true,
},
['_default'] = {
['cat'] = 'Index - Unknown progress',
['txt'] = function (index_status)
return 'Unknown progress: ' .. index_status .. ' (template error)'
end,
['error'] = true,
}
},
['transclusion'] = {
['yes'] = {
['cat'] = 'Fully transcluded',
['txt'] = 'Fully transcluded',
['help'] = 'The work is fully transcluded, including front and end matter and images'
},
['notimg'] = {
['cat'] = 'Images not fully transcluded',
['txt'] = 'Images not fully transcluded',
['help'] = 'The work is fully transcluded, but that some images are still missing or need improvement',
},
['notadv'] = {
['cat'] = 'Advertising not transcluded',
['txt'] = 'Advertising not transcluded',
['help'] = 'The main body of the work is properly transcluded, though front- or end-matter advertising material is not'
},
['held'] = {
['cat'] = 'Transclusion on hold',
['txt'] = 'Transclusion on hold',
['help'] = 'There is a problem with transcluding the work (which should be explained on the talk page)'
},
['check'] = {
['cat'] = 'Transclusion check required',
['txt'] = 'Transclusion check required',
['help'] = 'The transclusion of the work is incomplete or needs checking'
},
['no'] = {
['cat'] = 'Index not transcluded',
['txt'] = 'Index not transcluded or unreviewed',
['help'] = 'This work is not transcluded or has not been reviewed for transclusion'
},
['_missing'] = {
['cat'] = 'Index not transcluded',
['txt'] = 'Missing transclusion status (template error)',
['error'] = true,
},
['_default'] = {
['cat'] = 'Index not transcluded',
['txt'] = function (index_status)
return 'Unknown transclusion status: ' .. index_status .. ' (template error)'
end,
['error'] = true,
}
},
['language_cats'] = {
['single'] = function(lang)
return 'Index pages of works originally in ' .. (lang or 'an unknown language')
end,
['multi'] = 'Index pages of works originally in multiple languages'
},
['cover_cats'] = {
['file_types'] = {
['jpg'] = 'image',
['png'] = 'image',
['gif'] = 'image',
['tif'] = 'image',
['ogg'] = 'audiovisual',
['ogv'] = 'audiovisual',
['webm'] = 'audiovisual',
['_empty_'] = 'unknown',
['pdf'] = 'multipage',
['djvu'] = 'multipage'
},
['image'] = 'Image based indexes',
['audiovisual'] = 'Audio-visual based indexes',
['unknown'] = 'Indexes of unknown type',
['missing'] = 'Indexes with missing files',
['fullspec'] = 'Non-image-based indexes with fully-specified cover image'
},
['validation_cats'] = {
['dated'] = function(vdate)
return 'Indexes validated in ' .. vdate
end,
['undated'] = 'Indexes validated with no date'
},
['indicators'] = {
['pagegame'] = {
['name'] = 'WS Page Game',
['image'] = 'File:OOjs UI icon page number.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('toolforge:ws-page-game', {['wikisource'] = 'en', ['index'] = mw.uri.encode(args.fileTitle.rootText), ['lang'] = 'en'}))
end,
['caption'] = 'Wikisource Page Game (step-by-step pagelist builder)'
},
['purge'] = {
['name'] = 'purge file',
['image'] = 'File:OOjs UI icon reload.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('commons:File:' .. args.fileTitle.rootText, {['action'] = 'purge'}))
end,
['caption'] = 'Purge file'
},
['book2scroll'] = {
['name'] = 'book2scroll',
['image'] = 'File:Library-logo.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('toolforge:book2scroll', {['lang'] = 'en', ['file'] = mw.uri.encode(args.fileTitle.rootText)}))
end,
['caption'] = 'Open in Book2Scroll'
},
['bookreader'] = {
['name'] = 'bookreader',
['image'] = 'File:BookReader-favicon.svg',
['link'] = function(args)
return tostring(mw.uri.fullUrl('toolforge:bookreader/en/' .. mw.uri.encode(args.fileTitle.rootText)))
end,
['caption'] = 'Open file in BookReader'
},
['validated'] = {
['name'] = 'validated-index-date',
['image'] = 'File:Yes Check Circle.svg',
['link'] = function (args)
local vdate = args['Validation_date']
return vdate and tostring(mw.uri.fullUrl('Category:Indexes validated in ' .. vdate)) or ''
end,
['caption'] = function (args)
local vdate = args['Validation_date']
return vdate and 'Validated in ' .. vdate or nil
end,
['alt'] = 'Validated index page.',
['width'] = '15px',
['include'] = function (args)
return args['Validation_date'] ~= nil
end
}
},
['indicator_defaults'] = {
['width'] = '20px',
['include'] = function (args)
return true
end
},
['url_gens'] = {
['isbn'] = function(id, text)
return require('Module:ISBN')._ISBN({id})
end,
['oclc'] = function(id, text)
return '[https://www.worldcat.org/oclc/' .. mw.uri.encode(id, 'PATH') .. ' ' .. text .. ']'
end,
['ark'] = function(id, text)
return '[https://n2t.net/' .. mw.uri.encode(id, 'QUERY') .. ' ' .. text .. ']'
end,
['doi'] = function(id, text)
return '[https://doi.org/' .. mw.uri.encode(id, 'PATH') .. ' ' .. text .. ']'
end
},
['talkremarks'] = {
['text'] = function(args)
return 'Formatting guidelines specific to this work may have already been established. Please check this [[' .. args.talkPageTitle.prefixedText .. '|Index\'s discussion page]] and follow any such conventions.'
end,
['cat'] = 'Pages using index talk remarks with notes parameter',
['keywords'] = {
{
['pattern'] = any_case('notes?'),
['alone'] = true
},
{
['pattern'] = any_case('quick notes?'),
['alone'] = false
},
{
['pattern'] = any_case('proofr?e?a?d?ing notes?'), -- proofreading notes, proofing note, &c
['alone'] = false
},
{
['pattern'] = any_case('style notes?'),
['alone'] = false
},
{
['pattern'] = any_case('layout notes?'),
['alone'] = false
},
{
['pattern'] = any_case('formatting conventions?'),
['alone'] = false
},
{
['pattern'] = any_case('formatt?i?n?g?'), -- formatting, format
['alone'] = true
},
{
['pattern'] = any_case('conventions?'),
['alone'] = true
},
{
['pattern'] = any_case('layouts?'),
['alone'] = true
},
{
['pattern'] = any_case('quotes'),
['alone'] = true
},
{
['pattern'] = any_case('quotation marks'),
['alone'] = false
},
{
['pattern'] = any_case('typography'),
['alone'] = false
},
{
['pattern'] = any_case('spelling'),
['alone'] = false
},
{
['pattern'] = any_case('style guide'),
['alone'] = false
},
{
['pattern'] = any_case('guidelines?'),
['alone'] = false
},
{
['pattern'] = any_case('missing pages?'),
['alone'] = true
},
{
['pattern'] = any_case('long[ %-]s'), -- of course
['alone'] = true
},
},
['timestamp'] = {
['pattern'] = '%(UTC%)',
['text'] = '(UTC)'
}
}
}
tl27c7dnpnsq1ju5yccb8dqwwywiug4
ماڈیول:Templatestyles
828
12946
32022
2023-01-22T10:27:50Z
en>CalendulaAsteraceae
0
Redirected page to [[Template:Uses TemplateStyles]]
32022
wikitext
text/x-wiki
#redirect[[Template:Uses TemplateStyles]]
8f0rgi2mtcp9knbw1fqytk72jlrxkks
32023
32022
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Template:Templatestyles]] سے 1 نسخہ درآمد کیا گیا
32022
wikitext
text/x-wiki
#redirect[[Template:Uses TemplateStyles]]
8f0rgi2mtcp9knbw1fqytk72jlrxkks
ماڈیول:Header/attribution data
828
12947
32024
2025-09-30T05:59:19Z
en>CalendulaAsteraceae
0
add language_prefix
32024
Scribunto
text/plain
require('strict')
local function anon(text)
text = text or 'Anonymous'
local cat = ''
if mw.title.getCurrentTitle():inNamespaces(0, 114) then
cat = '[[Category:' .. 'Works by unknown authors' .. ']]'
end
return '[[Portal:Anonymous texts|' .. text .. ']]' .. cat
end
local function anon_nocat(text)
return '[[Portal:Anonymous texts|' .. (text or 'Anonymous') .. ']]'
end
local contrib_types = {
{noun = 'author', prefix = 'by'},
{noun = 'attributed to', prefix = 'attributed to', special_cases = {}},
{noun = 'adapter', prefix = 'adapted by'},
{noun = 'abridger', prefix = 'abridged by'},
{noun = 'illustrator', prefix = 'illustrated by'},
{noun = 'director', prefix = 'directed by'},
{noun = 'lyricist', prefix = 'lyrics by'},
{noun = 'librettist', prefix = 'libretto by'},
{
noun = 'book by',
prefix = 'book by',
special_cases = {
['?'] = 'unknown author',
['unknown'] = 'unknown author',
['not mentioned'] = 'unknown author',
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various authors'
}
},
{noun = 'composer', prefix = 'composed by'},
{noun = 'arranger', prefix = 'arranged by'},
{
noun = 'translator',
prefix = 'translated by',
language_prefix = function(language_name)
return 'translated from ' .. language_name .. ' by'
end,
special_cases = {
['?'] = 'unknown translator',
['unknown'] = 'unknown translator',
['not mentioned'] = 'unknown translator',
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various translators',
['wikisource'] = '[[Wikisource:Translations|Wikisource]]'
}
},
{
noun = 'editor',
prefix = 'edited by',
special_cases = {
['?'] = 'unknown editor',
['unknown'] = 'unknown editor',
['not mentioned'] = 'unknown editor',
['anon'] = anon_nocat,
['anonymous'] = anon_nocat,
['various'] = 'various editors'
}
},
{noun = 'compiler', prefix = 'compiled by'}
}
for i = 1, #contrib_types do
local noun = contrib_types[i]['noun']
contrib_types[i]['param_name'] = contrib_types[i]['param_name'] or string.gsub(noun, ' ', '-')
contrib_types[i]['special_cases'] = contrib_types[i]['special_cases'] or {
['?'] = 'unknown ' .. noun,
['unknown'] = 'unknown ' .. noun,
['not mentioned'] = 'unknown ' .. noun,
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various ' .. noun .. 's'
}
contrib_types[i]['index'] = i
end
return contrib_types
kzp83yz3wocvt12zr5er7cmq3w7ojlz
32025
32024
2026-04-22T01:50:23Z
Satdeep Gill
85
[[:en:Module:Header/attribution_data]] سے 1 نسخہ درآمد کیا گیا
32024
Scribunto
text/plain
require('strict')
local function anon(text)
text = text or 'Anonymous'
local cat = ''
if mw.title.getCurrentTitle():inNamespaces(0, 114) then
cat = '[[Category:' .. 'Works by unknown authors' .. ']]'
end
return '[[Portal:Anonymous texts|' .. text .. ']]' .. cat
end
local function anon_nocat(text)
return '[[Portal:Anonymous texts|' .. (text or 'Anonymous') .. ']]'
end
local contrib_types = {
{noun = 'author', prefix = 'by'},
{noun = 'attributed to', prefix = 'attributed to', special_cases = {}},
{noun = 'adapter', prefix = 'adapted by'},
{noun = 'abridger', prefix = 'abridged by'},
{noun = 'illustrator', prefix = 'illustrated by'},
{noun = 'director', prefix = 'directed by'},
{noun = 'lyricist', prefix = 'lyrics by'},
{noun = 'librettist', prefix = 'libretto by'},
{
noun = 'book by',
prefix = 'book by',
special_cases = {
['?'] = 'unknown author',
['unknown'] = 'unknown author',
['not mentioned'] = 'unknown author',
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various authors'
}
},
{noun = 'composer', prefix = 'composed by'},
{noun = 'arranger', prefix = 'arranged by'},
{
noun = 'translator',
prefix = 'translated by',
language_prefix = function(language_name)
return 'translated from ' .. language_name .. ' by'
end,
special_cases = {
['?'] = 'unknown translator',
['unknown'] = 'unknown translator',
['not mentioned'] = 'unknown translator',
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various translators',
['wikisource'] = '[[Wikisource:Translations|Wikisource]]'
}
},
{
noun = 'editor',
prefix = 'edited by',
special_cases = {
['?'] = 'unknown editor',
['unknown'] = 'unknown editor',
['not mentioned'] = 'unknown editor',
['anon'] = anon_nocat,
['anonymous'] = anon_nocat,
['various'] = 'various editors'
}
},
{noun = 'compiler', prefix = 'compiled by'}
}
for i = 1, #contrib_types do
local noun = contrib_types[i]['noun']
contrib_types[i]['param_name'] = contrib_types[i]['param_name'] or string.gsub(noun, ' ', '-')
contrib_types[i]['special_cases'] = contrib_types[i]['special_cases'] or {
['?'] = 'unknown ' .. noun,
['unknown'] = 'unknown ' .. noun,
['not mentioned'] = 'unknown ' .. noun,
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various ' .. noun .. 's'
}
contrib_types[i]['index'] = i
end
return contrib_types
kzp83yz3wocvt12zr5er7cmq3w7ojlz
میڈیاویکی:Proofreadpage index data config.json
8
12948
32026
2025-10-02T00:41:56Z
en>CalendulaAsteraceae
0
try not passing language to header
32026
json
application/json
{
"Type": {
"type": "string",
"size": 1,
"default": "",
"label": "Type",
"header": true,
"values": {
"book": "Book",
"journal": "Journal",
"collection": "Collection",
"phdthesis": "Thesis",
"dictionary": "Dictionary",
"film": "Film"
},
"help": "Type of the book",
"data": "type"
},
"Title": {
"type": "page",
"size": 1,
"default": "",
"label": "Title",
"header": true,
"data": "title",
"help": "The title of the work. Link to the top-level mainspace page (even if this is a sub-volume)"
},
"Language": {
"type": "langcode",
"size": 1,
"default": "en",
"header": false,
"data": "language",
"help": "The original languages of the work, separated by commas. Use the ISO 639 codes for the languages. For example, en, fr, de, it, la. Middle English is enm, Old English is ang, Classical Greek is grc"
},
"Volume": {
"type": "string",
"size": 1,
"default": "",
"label": "Volume",
"header": false,
"help": "The volume of the book if this is part of a multi-volume series. Should link to the volume in mainspace."
},
"Author": {
"type": "page",
"size": 1,
"default": "",
"label": "Author",
"header": true,
"data": "author",
"delimiter": ";",
"help": ""
},
"Translator": {
"type": "page",
"size": 1,
"default": "",
"label": "Translator",
"header": true,
"data": "translator",
"delimiter": ";",
"help": ""
},
"Editor": {
"type": "string",
"size": 1,
"default": "",
"label": "Editor",
"header": true,
"data": "editor",
"delimiter": ";",
"help": ""
},
"Illustrator": {
"type": "page",
"size": 1,
"default": "",
"label": "Illustrator",
"header": true,
"data": "illustrator",
"delimiter": ";",
"help": ""
},
"School": {
"type": "string",
"size": 1,
"default": "",
"label": "School",
"header": false,
"data": "school",
"help": ""
},
"Publisher": {
"type": "string",
"size": 1,
"default": "",
"label": "Publisher",
"header": true,
"data": "publisher",
"help": "The publisher of the book",
"delimiter": [
";",
"asn"
]
},
"Address": {
"type": "string",
"size": 1,
"default": "",
"label": "Location",
"header": true,
"data": "place",
"delimiter": ";",
"help": "Location of the publisher, usually a city."
},
"Year": {
"type": "string",
"size": 1,
"default": "",
"label": "Year of publication",
"header": true,
"data": "year",
"help": "The year of publication of THIS edition (not the first edition of the work in general)"
},
"Key": {
"type": "string",
"size": 1,
"default": "",
"label": "Sort key",
"header": false,
"help": ""
},
"ISBN": {
"type": "isbn",
"size": 1,
"default": "",
"label": "International Standard Book Number",
"header": false,
"data": "identifier",
"help": ""
},
"OCLC": {
"type": "oclc",
"size": 1,
"default": "",
"label": "OCLC",
"header": false,
"data": "identifier",
"help": ""
},
"LCCN": {
"type": "lccn",
"size": 1,
"default": "",
"label": "LCCN",
"header": false,
"data": "identifier",
"help": ""
},
"BNF_ARK": {
"type": "ark",
"size": 1,
"default": "",
"label": "ARK from BNF",
"header": false,
"data": "identifier",
"naan": 12148,
"help": ""
},
"ARC": {
"type": "arc",
"size": 1,
"default": "",
"label": "National Archives identifier",
"header": false,
"data": "identifier",
"help": ""
},
"DOI": {
"type": "doi",
"size": 1,
"default": "",
"label": "DOI",
"header": false,
"data": "identifier",
"help": "Digital Object Identifier"
},
"Source": {
"type": "string",
"size": 1,
"default": "",
"label": "Scans",
"header": false,
"help": "",
"values": {
"_empty_": "other",
"djvu": "djvu",
"pdf": "pdf",
"jpg": "jpg",
"png": "png",
"gif": "gif",
"tif": "tif",
"ogg": "ogg",
"ogv": "ogv",
"webm": "webm"
}
},
"Image": {
"type": "string",
"size": 1,
"default": "1",
"label": "Cover image",
"header": false,
"help": "The number of the page to use as the image on this page"
},
"Progress": {
"type": "string",
"size": 1,
"default": "X",
"label": "Progress",
"header": false,
"values": {
"T": "Done (all validated)",
"V": "To be validated",
"C": "To be proofread",
"MS": "Ready for Match \u0026 Split",
"OCR": "Source file needs an OCR text layer",
"L": "Source file is incorrect (missing pages, unordered pages, etc)",
"X": "Pagelist needed (to verify file is complete and correct before commencing proofreading)"
},
"data": "progress",
"help": "The proofreading status of this book (this refers to the status within the Page namespace)",
"js": true
},
"Transclusion": {
"type": "string",
"size": 1,
"default": "no",
"label": "Tranclusion status",
"header": false,
"values": {
"no": "Not yet transcluded",
"check": "Needs checking and/or fixing",
"yes": "Fully transcluded",
"notadv": "Advertising not transcluded",
"notimg": "Images not fully transcluded",
"held": "Transclusion on hold - explain on talk page"
},
"js": true
},
"Validation_date": {
"type": "string",
"size": 1,
"label": "Validation date",
"header": false,
"help": "The date of final validation of this book, in the form \"January 2020\""
},
"Pages": {
"type": "string/line",
"size": 15,
"default": "\u003Cpagelist /\u003E",
"label": "Pages",
"header": false,
"help": "",
"data": "pagelist"
},
"Volumes": {
"type": "string/line",
"size": 5,
"default": "",
"label": "",
"header": false,
"help": ""
},
"Remarks": {
"type": "string/line",
"size": 15,
"default": "",
"label": "Table of Contents",
"header": true,
"help": ""
},
"Width": {
"type": "number",
"size": 1,
"default": "",
"label": "Scan resolution in edit mode",
"header": false,
"help": ""
},
"Header": {
"type": "string",
"size": 1,
"default": "",
"label": "Header",
"header": true,
"help": "",
"js": true
},
"Footer": {
"type": "string",
"size": 1,
"default": "\n",
"label": "Footer",
"header": true,
"help": "",
"js": true
},
"Notes": {
"type": "string/line",
"hidden": true,
"header": true
},
"wikidata": {
"type": "wikibase-itemid",
"size": 1,
"default": "",
"label": "Wikidata ID",
"help": "The ID of the edition entity at Wikidata matching this file",
"header": true,
"data": "wikibase-itemid",
"hidden": true
},
"wikipedia": {
"type": "string",
"hidden": true,
"header": true
},
"commons": {
"type": "string",
"hidden": true,
"header": true
},
"commonscat": {
"type": "string",
"hidden": true,
"header": true
},
"wikiquote": {
"type": "string",
"hidden": true,
"header": true
},
"wikinews": {
"type": "string",
"hidden": true,
"header": true
},
"wiktionary": {
"type": "string",
"hidden": true,
"header": true
},
"wikibooks": {
"type": "string",
"hidden": true,
"header": true
},
"wikiversity": {
"type": "string",
"hidden": true,
"header": true
},
"wikispecies": {
"type": "string",
"hidden": true,
"header": true
},
"meta": {
"type": "string",
"hidden": true,
"header": true
},
"portal": {
"type": "string",
"hidden": true,
"header": true
},
"tmplver": {
"type": "string",
"label": "Template version",
"header": false,
"help": "Technical switch used for migration. Do not use."
},
"section-year": {
"type": "string",
"hidden": true,
"header": true
},
"section-illustrator": {
"type": "string",
"hidden": true,
"header": true
},
"section-translator": {
"type": "string",
"hidden": true,
"header": true
},
"section-author": {
"type": "string",
"hidden": true,
"header": true
}
}
nl693wfnyzhx38xoyt13zagqi6rxsm8
32027
32026
2026-04-22T02:12:18Z
Satdeep Gill
85
[[:en:MediaWiki:Proofreadpage_index_data_config.json]] سے 1 نسخہ درآمد کیا گیا
32026
json
application/json
{
"Type": {
"type": "string",
"size": 1,
"default": "",
"label": "Type",
"header": true,
"values": {
"book": "Book",
"journal": "Journal",
"collection": "Collection",
"phdthesis": "Thesis",
"dictionary": "Dictionary",
"film": "Film"
},
"help": "Type of the book",
"data": "type"
},
"Title": {
"type": "page",
"size": 1,
"default": "",
"label": "Title",
"header": true,
"data": "title",
"help": "The title of the work. Link to the top-level mainspace page (even if this is a sub-volume)"
},
"Language": {
"type": "langcode",
"size": 1,
"default": "en",
"header": false,
"data": "language",
"help": "The original languages of the work, separated by commas. Use the ISO 639 codes for the languages. For example, en, fr, de, it, la. Middle English is enm, Old English is ang, Classical Greek is grc"
},
"Volume": {
"type": "string",
"size": 1,
"default": "",
"label": "Volume",
"header": false,
"help": "The volume of the book if this is part of a multi-volume series. Should link to the volume in mainspace."
},
"Author": {
"type": "page",
"size": 1,
"default": "",
"label": "Author",
"header": true,
"data": "author",
"delimiter": ";",
"help": ""
},
"Translator": {
"type": "page",
"size": 1,
"default": "",
"label": "Translator",
"header": true,
"data": "translator",
"delimiter": ";",
"help": ""
},
"Editor": {
"type": "string",
"size": 1,
"default": "",
"label": "Editor",
"header": true,
"data": "editor",
"delimiter": ";",
"help": ""
},
"Illustrator": {
"type": "page",
"size": 1,
"default": "",
"label": "Illustrator",
"header": true,
"data": "illustrator",
"delimiter": ";",
"help": ""
},
"School": {
"type": "string",
"size": 1,
"default": "",
"label": "School",
"header": false,
"data": "school",
"help": ""
},
"Publisher": {
"type": "string",
"size": 1,
"default": "",
"label": "Publisher",
"header": true,
"data": "publisher",
"help": "The publisher of the book",
"delimiter": [
";",
"asn"
]
},
"Address": {
"type": "string",
"size": 1,
"default": "",
"label": "Location",
"header": true,
"data": "place",
"delimiter": ";",
"help": "Location of the publisher, usually a city."
},
"Year": {
"type": "string",
"size": 1,
"default": "",
"label": "Year of publication",
"header": true,
"data": "year",
"help": "The year of publication of THIS edition (not the first edition of the work in general)"
},
"Key": {
"type": "string",
"size": 1,
"default": "",
"label": "Sort key",
"header": false,
"help": ""
},
"ISBN": {
"type": "isbn",
"size": 1,
"default": "",
"label": "International Standard Book Number",
"header": false,
"data": "identifier",
"help": ""
},
"OCLC": {
"type": "oclc",
"size": 1,
"default": "",
"label": "OCLC",
"header": false,
"data": "identifier",
"help": ""
},
"LCCN": {
"type": "lccn",
"size": 1,
"default": "",
"label": "LCCN",
"header": false,
"data": "identifier",
"help": ""
},
"BNF_ARK": {
"type": "ark",
"size": 1,
"default": "",
"label": "ARK from BNF",
"header": false,
"data": "identifier",
"naan": 12148,
"help": ""
},
"ARC": {
"type": "arc",
"size": 1,
"default": "",
"label": "National Archives identifier",
"header": false,
"data": "identifier",
"help": ""
},
"DOI": {
"type": "doi",
"size": 1,
"default": "",
"label": "DOI",
"header": false,
"data": "identifier",
"help": "Digital Object Identifier"
},
"Source": {
"type": "string",
"size": 1,
"default": "",
"label": "Scans",
"header": false,
"help": "",
"values": {
"_empty_": "other",
"djvu": "djvu",
"pdf": "pdf",
"jpg": "jpg",
"png": "png",
"gif": "gif",
"tif": "tif",
"ogg": "ogg",
"ogv": "ogv",
"webm": "webm"
}
},
"Image": {
"type": "string",
"size": 1,
"default": "1",
"label": "Cover image",
"header": false,
"help": "The number of the page to use as the image on this page"
},
"Progress": {
"type": "string",
"size": 1,
"default": "X",
"label": "Progress",
"header": false,
"values": {
"T": "Done (all validated)",
"V": "To be validated",
"C": "To be proofread",
"MS": "Ready for Match \u0026 Split",
"OCR": "Source file needs an OCR text layer",
"L": "Source file is incorrect (missing pages, unordered pages, etc)",
"X": "Pagelist needed (to verify file is complete and correct before commencing proofreading)"
},
"data": "progress",
"help": "The proofreading status of this book (this refers to the status within the Page namespace)",
"js": true
},
"Transclusion": {
"type": "string",
"size": 1,
"default": "no",
"label": "Tranclusion status",
"header": false,
"values": {
"no": "Not yet transcluded",
"check": "Needs checking and/or fixing",
"yes": "Fully transcluded",
"notadv": "Advertising not transcluded",
"notimg": "Images not fully transcluded",
"held": "Transclusion on hold - explain on talk page"
},
"js": true
},
"Validation_date": {
"type": "string",
"size": 1,
"label": "Validation date",
"header": false,
"help": "The date of final validation of this book, in the form \"January 2020\""
},
"Pages": {
"type": "string/line",
"size": 15,
"default": "\u003Cpagelist /\u003E",
"label": "Pages",
"header": false,
"help": "",
"data": "pagelist"
},
"Volumes": {
"type": "string/line",
"size": 5,
"default": "",
"label": "",
"header": false,
"help": ""
},
"Remarks": {
"type": "string/line",
"size": 15,
"default": "",
"label": "Table of Contents",
"header": true,
"help": ""
},
"Width": {
"type": "number",
"size": 1,
"default": "",
"label": "Scan resolution in edit mode",
"header": false,
"help": ""
},
"Header": {
"type": "string",
"size": 1,
"default": "",
"label": "Header",
"header": true,
"help": "",
"js": true
},
"Footer": {
"type": "string",
"size": 1,
"default": "\n",
"label": "Footer",
"header": true,
"help": "",
"js": true
},
"Notes": {
"type": "string/line",
"hidden": true,
"header": true
},
"wikidata": {
"type": "wikibase-itemid",
"size": 1,
"default": "",
"label": "Wikidata ID",
"help": "The ID of the edition entity at Wikidata matching this file",
"header": true,
"data": "wikibase-itemid",
"hidden": true
},
"wikipedia": {
"type": "string",
"hidden": true,
"header": true
},
"commons": {
"type": "string",
"hidden": true,
"header": true
},
"commonscat": {
"type": "string",
"hidden": true,
"header": true
},
"wikiquote": {
"type": "string",
"hidden": true,
"header": true
},
"wikinews": {
"type": "string",
"hidden": true,
"header": true
},
"wiktionary": {
"type": "string",
"hidden": true,
"header": true
},
"wikibooks": {
"type": "string",
"hidden": true,
"header": true
},
"wikiversity": {
"type": "string",
"hidden": true,
"header": true
},
"wikispecies": {
"type": "string",
"hidden": true,
"header": true
},
"meta": {
"type": "string",
"hidden": true,
"header": true
},
"portal": {
"type": "string",
"hidden": true,
"header": true
},
"tmplver": {
"type": "string",
"label": "Template version",
"header": false,
"help": "Technical switch used for migration. Do not use."
},
"section-year": {
"type": "string",
"hidden": true,
"header": true
},
"section-illustrator": {
"type": "string",
"hidden": true,
"header": true
},
"section-translator": {
"type": "string",
"hidden": true,
"header": true
},
"section-author": {
"type": "string",
"hidden": true,
"header": true
}
}
nl693wfnyzhx38xoyt13zagqi6rxsm8
سانچہ:Col-break
10
12949
32030
2024-04-28T12:10:30Z
en>ShakespeareFan00
0
32030
wikitext
text/x-wiki
{{nopt}}
{{!}}{{optional style|width={{{width|}}}|text-align={{{align|}}}|vertical-align={{{valign|}}}|padding-left={{{gap|}}}|style={{{style|}}}}}{{!}}<noinclude>
{{Documentation}}
</noinclude>
clui28egxa0lrvapq1611dwdv6eym33
32031
32030
2026-04-22T02:14:12Z
Satdeep Gill
85
[[:en:Template:Col-break]] سے 1 نسخہ درآمد کیا گیا
32030
wikitext
text/x-wiki
{{nopt}}
{{!}}{{optional style|width={{{width|}}}|text-align={{{align|}}}|vertical-align={{{valign|}}}|padding-left={{{gap|}}}|style={{{style|}}}}}{{!}}<noinclude>
{{Documentation}}
</noinclude>
clui28egxa0lrvapq1611dwdv6eym33
سانچہ:Optional style
10
12950
32032
2021-09-20T11:50:21Z
en>Inductiveload
0
Changed protection settings for "[[Template:Optional style]]": High traffic page or template/module: Used to produce front-page content ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32032
wikitext
text/x-wiki
<includeonly>{{#invoke:Optional style|optional_style}}</includeonly><noinclude>
{{documentation}}
</noinclude>
aweo9tkpi8hnt98cye25kwjw4c3tjg8
32033
32032
2026-04-22T02:14:12Z
Satdeep Gill
85
[[:en:Template:Optional_style]] سے 1 نسخہ درآمد کیا گیا
32032
wikitext
text/x-wiki
<includeonly>{{#invoke:Optional style|optional_style}}</includeonly><noinclude>
{{documentation}}
</noinclude>
aweo9tkpi8hnt98cye25kwjw4c3tjg8
ماڈیول:Optional style
828
12951
32034
2025-01-08T06:48:12Z
en>CalendulaAsteraceae
0
remove unused variable
32034
Scribunto
text/plain
--[=[
Simple module to construct a style attribute
with an undefined number (including zero) of CSS properties
]=]
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
--[=[
Construct the string from the given table of property:values
]=]
function p.make_style_string(properties)
local out = ''
for k, v in pairs(properties) do
if k ~= 'style' and v~= '' then
out = out .. k .. ':' .. v .. ';'
end
end
if properties.style ~= nil and properties.style ~= '' then
out = out .. properties.style
end
if out == '' then
return ''
end
return 'style="' .. out .. '"'
end
--[=[
The main entry function from templates
Arguments are taken from both frame and parent argument lists
]=]
function p.optional_style(frame)
local args = getArgs(frame)
return p.make_style_string(args)
end
return p
bjc6zjm95k6ugtrdv4y75vmrnkw19gn
32035
32034
2026-04-22T02:14:12Z
Satdeep Gill
85
[[:en:Module:Optional_style]] سے 1 نسخہ درآمد کیا گیا
32034
Scribunto
text/plain
--[=[
Simple module to construct a style attribute
with an undefined number (including zero) of CSS properties
]=]
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
--[=[
Construct the string from the given table of property:values
]=]
function p.make_style_string(properties)
local out = ''
for k, v in pairs(properties) do
if k ~= 'style' and v~= '' then
out = out .. k .. ':' .. v .. ';'
end
end
if properties.style ~= nil and properties.style ~= '' then
out = out .. properties.style
end
if out == '' then
return ''
end
return 'style="' .. out .. '"'
end
--[=[
The main entry function from templates
Arguments are taken from both frame and parent argument lists
]=]
function p.optional_style(frame)
local args = getArgs(frame)
return p.make_style_string(args)
end
return p
bjc6zjm95k6ugtrdv4y75vmrnkw19gn
سانچہ:Nopt
10
12952
32036
2022-03-08T11:56:49Z
en>ShakespeareFan00
0
Undo revision 12204104 by [[Special:Contributions/Theknightwho|Theknightwho]] ([[User talk:Theknightwho|talk]]) That doesn't work, it generates a huge number of Lint-erroris
32036
wikitext
text/x-wiki
<onlyinclude><!-- {{nop}} action for a table --></onlyinclude>
{{documentation}}
axle6md4aljaevl5o0igdtfidpry7nk
32037
32036
2026-04-22T02:14:12Z
Satdeep Gill
85
[[:en:Template:Nopt]] سے 1 نسخہ درآمد کیا گیا
32036
wikitext
text/x-wiki
<onlyinclude><!-- {{nop}} action for a table --></onlyinclude>
{{documentation}}
axle6md4aljaevl5o0igdtfidpry7nk
سانچہ:Col-begin/doc
10
12953
32042
2022-05-27T17:30:38Z
en>Xover
0
/* See also */ rm obsoleted link
32042
wikitext
text/x-wiki
{{documentation subpage}}
This [[Wikipedia:Template|template]] is a [[Wikipedia:Avoid self-references|self-reference]] and so is part of the Wikipedia project rather than the encyclopedic content.
==Usage==
A border of 2px (1px width on each side) corresponds to a 5%. Therefore, with a 2px border — for example, as in [[Wikipedia:Tutorial (Wrap-up and more info)]] — the width needs to be 95% for the table to fit within the screen. Since it's possible that some tables might not have a border, correction on the individual page could be made after substitution. Another way to create a two column table is like this:
{|
|
<pre>
{{col-begin|width=95%}}
|-
|
Left column
|
Right column
|}</div><!-- because there is a DIV in the opening template. -->
</pre>
|}
{{col-begin}}
<!--
{{col-1-of-4}}
{{tl|Col-begin}}
{{tl|Col-2}}
Column 1 here
{{tl|Col-2}}
Column 2 here
{{tl|Col-end}}
{{col-2-of-4}}
{{tl|Col-begin}}
{{tl|Col-3}}
Column 1 here
{{tl|Col-3}}
Column 2 here
{{tl|Col-3}}
Column 3 here
{{tl|Col-end}}
{{col-3-of-4}}
{{tl|Col-begin}}
{{tl|Col-4}}
Column 1 here
{{tl|Col-4}}
Column 2 here
{{tl|Col-4}}
Column 3 here
{{tl|Col-4}}
Column 4 here
{{tl|Col-end}}
{{col-4-of-4}}
and so on, up to {{tl|Col-7}}
-->
{{col-end}}
{{col-begin}}
<!--
{{col-1-of-4}}
{{[[Template:Col-begin|Col-begin]]|class=references-small}}
{{tl|Col-break}}
Column 1 here
{{tl|Col-break}}
Column 2 here
{{tl|Col-break}}
Column 3 here
{{tl|Col-break}}
Column 4 here
{{tl|Col-break}}
Column 5 here
{{tl|Col-break}}
Column 6 here
{{tl|Col-end}}
{{col-2-of-4}}
{{tl|Top}}
Column 1 here
{{tl|Mid}}
Column 2 here
{{tl|Bottom}}
{{col-3-of-4}}
{{[[Template:Columns-start|Columns-start]]|num=3}}
Column 1 here
{{tl|Column}}
Column 2 here
{{tl|Column}}
Column 3 here
{{tl|Columns-end}}
{{col-4-of-4}}
-->
{{tl|Multicol}}
Column 1 here
{{tl|Multicol-break}}
Column 2 here
{{tl|Multicol-break}}
Column 3 here
{{tl|Multicol-break}}
Column 4 here
{{tl|Multicol-end}}
{{col-end}}
==Examples==
See [[Template:Col-break/examples|Col-break/examples]]
==See also==
* {{tl|Col-begin}} ({{tl|Col-start}}), {{tl|Col-begin-small}}
<!--** {{tl|Col-2}} <small>({{tl|Col-1-of-2}}, {{tl|Col-2-of-2}})</small>
** {{tl|Col-3}} <small>({{tl|Col-1-of-3}}, {{tl|Col-2-of-3}}, {{tl|Col-3-of-3}})</small>
** {{tl|Col-4}} <small>({{tl|Col-1-of-4}}, {{tl|Col-2-of-4}}, {{tl|Col-3-of-4}}, {{tl|Col-4-of-4}})</small>
** {{tl|Col-5}} <small>({{tl|Col-1-of-5}}, {{tl|Col-2-of-5}}, {{tl|Col-3-of-5}}, {{tl|Col-4-of-5}}, {{tl|Col-5-of-5}})</small>-->
** {{tl|Col-6}} <small>({{tl|Col-1-of-6}}<!-- , {{tl|Col-2-of-6}}, {{tl|Col-3-of-6}}, {{tl|Col-4-of-6}}, {{tl|Col-5-of-6}}, {{tl|Col-6-of-6}}) --></small>
<!--** {{tl|Col-7}}-->
** {{tl|Col-break}}
* {{tl|Col-end}}
<!--* {{tl|Top}}, {{tl|Mid}}, {{tl|Bottom}}
* {{tl|Columns-start}}, {{tl|Column}}, {{tl|Columns-end}}-->
* {{tl|Multicol}}, {{tl|Multicol-break}}, {{tl|Multicol-end}}
<!--* {{tl|Div col}}, {{tl|Div col end}}
* [[Wikipedia talk:Manual of Style/Archive 35#Columns in articles]]-->
==External links==
* [http://www.htmlcodetutorial.com/_MULTICOL.html MULTICOL HTML tag]
* [http://developer.mozilla.org/en/docs/CSS3_Columns CSS3 Columns], -moz-column-count
<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[Category:Table and column templates|{{SUBJECTPAGENAME}}]]
</includeonly>
<noinclude>[[Category:Template documentation|{{PAGENAME}}]]
<includeonly>
<!-- ADD INTERWIKIS BELOW THIS LINE -->
[[zh:Template:Col-begin]]
</includeonly>
7p2gn21koy59w6cv41q2gs9k3njm40p
32043
32042
2026-04-22T02:14:13Z
Satdeep Gill
85
[[:en:Template:Col-begin/doc]] سے 1 نسخہ درآمد کیا گیا
32042
wikitext
text/x-wiki
{{documentation subpage}}
This [[Wikipedia:Template|template]] is a [[Wikipedia:Avoid self-references|self-reference]] and so is part of the Wikipedia project rather than the encyclopedic content.
==Usage==
A border of 2px (1px width on each side) corresponds to a 5%. Therefore, with a 2px border — for example, as in [[Wikipedia:Tutorial (Wrap-up and more info)]] — the width needs to be 95% for the table to fit within the screen. Since it's possible that some tables might not have a border, correction on the individual page could be made after substitution. Another way to create a two column table is like this:
{|
|
<pre>
{{col-begin|width=95%}}
|-
|
Left column
|
Right column
|}</div><!-- because there is a DIV in the opening template. -->
</pre>
|}
{{col-begin}}
<!--
{{col-1-of-4}}
{{tl|Col-begin}}
{{tl|Col-2}}
Column 1 here
{{tl|Col-2}}
Column 2 here
{{tl|Col-end}}
{{col-2-of-4}}
{{tl|Col-begin}}
{{tl|Col-3}}
Column 1 here
{{tl|Col-3}}
Column 2 here
{{tl|Col-3}}
Column 3 here
{{tl|Col-end}}
{{col-3-of-4}}
{{tl|Col-begin}}
{{tl|Col-4}}
Column 1 here
{{tl|Col-4}}
Column 2 here
{{tl|Col-4}}
Column 3 here
{{tl|Col-4}}
Column 4 here
{{tl|Col-end}}
{{col-4-of-4}}
and so on, up to {{tl|Col-7}}
-->
{{col-end}}
{{col-begin}}
<!--
{{col-1-of-4}}
{{[[Template:Col-begin|Col-begin]]|class=references-small}}
{{tl|Col-break}}
Column 1 here
{{tl|Col-break}}
Column 2 here
{{tl|Col-break}}
Column 3 here
{{tl|Col-break}}
Column 4 here
{{tl|Col-break}}
Column 5 here
{{tl|Col-break}}
Column 6 here
{{tl|Col-end}}
{{col-2-of-4}}
{{tl|Top}}
Column 1 here
{{tl|Mid}}
Column 2 here
{{tl|Bottom}}
{{col-3-of-4}}
{{[[Template:Columns-start|Columns-start]]|num=3}}
Column 1 here
{{tl|Column}}
Column 2 here
{{tl|Column}}
Column 3 here
{{tl|Columns-end}}
{{col-4-of-4}}
-->
{{tl|Multicol}}
Column 1 here
{{tl|Multicol-break}}
Column 2 here
{{tl|Multicol-break}}
Column 3 here
{{tl|Multicol-break}}
Column 4 here
{{tl|Multicol-end}}
{{col-end}}
==Examples==
See [[Template:Col-break/examples|Col-break/examples]]
==See also==
* {{tl|Col-begin}} ({{tl|Col-start}}), {{tl|Col-begin-small}}
<!--** {{tl|Col-2}} <small>({{tl|Col-1-of-2}}, {{tl|Col-2-of-2}})</small>
** {{tl|Col-3}} <small>({{tl|Col-1-of-3}}, {{tl|Col-2-of-3}}, {{tl|Col-3-of-3}})</small>
** {{tl|Col-4}} <small>({{tl|Col-1-of-4}}, {{tl|Col-2-of-4}}, {{tl|Col-3-of-4}}, {{tl|Col-4-of-4}})</small>
** {{tl|Col-5}} <small>({{tl|Col-1-of-5}}, {{tl|Col-2-of-5}}, {{tl|Col-3-of-5}}, {{tl|Col-4-of-5}}, {{tl|Col-5-of-5}})</small>-->
** {{tl|Col-6}} <small>({{tl|Col-1-of-6}}<!-- , {{tl|Col-2-of-6}}, {{tl|Col-3-of-6}}, {{tl|Col-4-of-6}}, {{tl|Col-5-of-6}}, {{tl|Col-6-of-6}}) --></small>
<!--** {{tl|Col-7}}-->
** {{tl|Col-break}}
* {{tl|Col-end}}
<!--* {{tl|Top}}, {{tl|Mid}}, {{tl|Bottom}}
* {{tl|Columns-start}}, {{tl|Column}}, {{tl|Columns-end}}-->
* {{tl|Multicol}}, {{tl|Multicol-break}}, {{tl|Multicol-end}}
<!--* {{tl|Div col}}, {{tl|Div col end}}
* [[Wikipedia talk:Manual of Style/Archive 35#Columns in articles]]-->
==External links==
* [http://www.htmlcodetutorial.com/_MULTICOL.html MULTICOL HTML tag]
* [http://developer.mozilla.org/en/docs/CSS3_Columns CSS3 Columns], -moz-column-count
<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[Category:Table and column templates|{{SUBJECTPAGENAME}}]]
</includeonly>
<noinclude>[[Category:Template documentation|{{PAGENAME}}]]
<includeonly>
<!-- ADD INTERWIKIS BELOW THIS LINE -->
[[zh:Template:Col-begin]]
</includeonly>
7p2gn21koy59w6cv41q2gs9k3njm40p
سانچہ:Col-break/doc
10
12954
32044
2019-01-10T01:22:05Z
en>Great Brightstar
0
Redirected page to [[Template:Col-begin/doc]]
32044
wikitext
text/x-wiki
#Redirect [[Template:Col-begin/doc]]
50uwnytqwnhkpif63t44m1nknmjyzpi
32045
32044
2026-04-22T02:14:13Z
Satdeep Gill
85
[[:en:Template:Col-break/doc]] سے 1 نسخہ درآمد کیا گیا
32044
wikitext
text/x-wiki
#Redirect [[Template:Col-begin/doc]]
50uwnytqwnhkpif63t44m1nknmjyzpi
سانچہ:Header
10
12955
32048
2025-07-10T11:29:52Z
en>Alien333
0
Changed protection settings for "[[Template:Header]]": used on nearly all mainspace pages; also now it's module-based there are no reasons for it to be edited ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32048
wikitext
text/x-wiki
{{#invoke:Header|header}}<noinclude>{{documentation}}</noinclude>
3c7xajt1xyvh97ikxcbuic0yozommxv
32049
32048
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Template:Header]] سے 1 نسخہ درآمد کیا گیا
32048
wikitext
text/x-wiki
{{#invoke:Header|header}}<noinclude>{{documentation}}</noinclude>
3c7xajt1xyvh97ikxcbuic0yozommxv
سانچہ:Smallrefs
10
12956
32050
2024-11-07T13:21:42Z
en>ShakespeareFan00
0
32050
wikitext
text/x-wiki
<templatestyles src="Smallrefs/styles.css" /><!--
# classes:
# * prp-pages-output is added to classes to allow the scoped Index-specific TemplateStyles to also apply to these references
# * wst-smallrefs-ruled adds a "standard" top-rule
# add a blank line before the div to prevent merging with ends of tables, etc
-->
<div class="prp-pages-output"><!--
This extra div is needed because Index Styles are
over-specified with descendant selectors: .wst-smallrefs
has to be a descendant, not sibling, of .prp-pages-output
which in turn has to be a descendant of mw-parser-output.
It's a bad design, but that's where we're at.
--><div class="reflist wst-smallrefs {{#if:{{{rule|}}}|wst-smallrefs-ruled}} {{{class|}}}" style="{{#if:{{{fs|{{{1|}}}}}}|font-size:{{{fs|{{{1|83%}}}}}};}} {{#if:{{{lh|{{{2|}}}}}}|line-height:{{{lh|{{{2|1.25}}}}}};}} {{#if: {{{columns|}}}|column-count:{{{columns}}};}}">
{{#tag:references|{{{refs|{{{refx|}}}}}}|group={{{group|}}}}}
</div>
</div>{{#if:{{{fs|{{{1|}}}}}}|[[Category:Pages using smallrefs with font-size]]}}{{#if:{{{lh|{{{2|}}}}}}|[[Category:Pages using smallrefs with line-height]]}}<noinclude>
{{Documentation}}
</noinclude>
7qnvajtwo85yecoo2xogf67k2dh32qb
32051
32050
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Template:Smallrefs]] سے 1 نسخہ درآمد کیا گیا
32050
wikitext
text/x-wiki
<templatestyles src="Smallrefs/styles.css" /><!--
# classes:
# * prp-pages-output is added to classes to allow the scoped Index-specific TemplateStyles to also apply to these references
# * wst-smallrefs-ruled adds a "standard" top-rule
# add a blank line before the div to prevent merging with ends of tables, etc
-->
<div class="prp-pages-output"><!--
This extra div is needed because Index Styles are
over-specified with descendant selectors: .wst-smallrefs
has to be a descendant, not sibling, of .prp-pages-output
which in turn has to be a descendant of mw-parser-output.
It's a bad design, but that's where we're at.
--><div class="reflist wst-smallrefs {{#if:{{{rule|}}}|wst-smallrefs-ruled}} {{{class|}}}" style="{{#if:{{{fs|{{{1|}}}}}}|font-size:{{{fs|{{{1|83%}}}}}};}} {{#if:{{{lh|{{{2|}}}}}}|line-height:{{{lh|{{{2|1.25}}}}}};}} {{#if: {{{columns|}}}|column-count:{{{columns}}};}}">
{{#tag:references|{{{refs|{{{refx|}}}}}}|group={{{group|}}}}}
</div>
</div>{{#if:{{{fs|{{{1|}}}}}}|[[Category:Pages using smallrefs with font-size]]}}{{#if:{{{lh|{{{2|}}}}}}|[[Category:Pages using smallrefs with line-height]]}}<noinclude>
{{Documentation}}
</noinclude>
7qnvajtwo85yecoo2xogf67k2dh32qb
سانچہ:Smallrefs/styles.css
10
12957
32052
2025-03-09T14:42:42Z
en>ShakespeareFan00
0
Apologies for the interruption, but this page had appeared on a list of those containing a markup error - Dark mode border color
32052
sanitized-css
text/css
.wst-smallrefs {
font-size: 83%;
clear: both;
line-height: 1.25;
/* see below for what this is */
margin-top: 0.3em;
}
/* remove the top margin because it only works in the first column.
* instead move to the parent container to affect all columns */
.wst-smallrefs ol.references {
margin-top: 0;
}
.wst-smallrefs-ruled {
border-top: 1px solid;
padding-top: 0.3em;
}
.wst-smallrefs ol.references.uksi{
margin-top: 0;
list-style-type:lower-alpha;
}
.wst-smallrefs ol.references.uksi li::marker{
font-weight:bold;
}
373onpd47lhr6oku1mblilny7ho0pfb
32053
32052
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Template:Smallrefs/styles.css]] سے 1 نسخہ درآمد کیا گیا
32052
sanitized-css
text/css
.wst-smallrefs {
font-size: 83%;
clear: both;
line-height: 1.25;
/* see below for what this is */
margin-top: 0.3em;
}
/* remove the top margin because it only works in the first column.
* instead move to the parent container to affect all columns */
.wst-smallrefs ol.references {
margin-top: 0;
}
.wst-smallrefs-ruled {
border-top: 1px solid;
padding-top: 0.3em;
}
.wst-smallrefs ol.references.uksi{
margin-top: 0;
list-style-type:lower-alpha;
}
.wst-smallrefs ol.references.uksi li::marker{
font-weight:bold;
}
373onpd47lhr6oku1mblilny7ho0pfb
سانچہ:Smaller
10
12958
32054
2025-08-12T03:57:01Z
en>CalendulaAsteraceae
0
32054
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=83%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
lsg4si0le8kkjxte0w09k16dd4703bn
32055
32054
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Template:Smaller]] سے 1 نسخہ درآمد کیا گیا
32054
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=83%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
lsg4si0le8kkjxte0w09k16dd4703bn
سانچہ:Div end
10
12959
32056
2019-12-14T16:48:57Z
en>EncycloPetey
0
Protected "[[Template:Div end]]": High traffic page or template ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32056
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{documentation}}
</noinclude>
4svdptpks693oo75dst5prxxduoz5on
32057
32056
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Template:Div_end]] سے 1 نسخہ درآمد کیا گیا
32056
wikitext
text/x-wiki
<includeonly></div></includeonly><noinclude>
{{documentation}}
</noinclude>
4svdptpks693oo75dst5prxxduoz5on
ماڈیول:Edition
828
12960
32058
2024-03-31T19:50:41Z
en>CalendulaAsteraceae
0
Changed protection settings for "[[Module:Edition]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite))
32058
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Organisation of this module: the exports are listed at the bottom; their
-- direct functions are just above there, and supporting functions are higher
-- up.
--
-- Please add testcases before modifying anything.
--
--------------------------------------------------------------------------------
require('strict')
local instanceOfProp = 'P31'
local authorProp = 'P50'
local editionOrTranslationOfProp = 'P629'
local equivalentClassProp = 'P1709'
local topicsMainWikimediaPortalProp = 'P1151';
--------------------------------------------------------------------------------
-- Insert a value into a table, but not if it's already there.
local function tableInsertUnique( theTable, value )
for _, item in pairs( theTable ) do
if item == value then
-- Already present
return
end
end
-- Otherwise, add the new value.
table.insert( theTable, value )
end
--------------------------------------------------------------------------------
-- For the given author item, find the Wikisource sitelink. If there isn't one,
-- check to see if there the author has a topicsMainWikimediaPortal statement,
-- and then see if that portal has a sitelink instead.
local function get_author_sitelink( authorItem )
local siteLink = authorItem:getSitelink( mw.language.getContentLanguage().code .. 'wikisource' )
if ( siteLink ~= nil ) then
return siteLink
end
local portalStatements = authorItem:getBestStatements( topicsMainWikimediaPortalProp )
for _, mainPortal in pairs( portalStatements ) do
local mainPortalId = mainPortal['mainsnak']['datavalue']['value']['id']
local mainPortalItem = mw.wikibase.getEntity( mainPortalId )
siteLink = mainPortalItem:getSitelink( mw.language.getContentLanguage().code .. 'wikisource' )
end
return siteLink
end
--------------------------------------------------------------------------------
-- Get the schema.org URL for the itemtype of the given item.
local function getSchemaorgItemtype( item )
local schemaPrefix = 'http://schema.org/'
for _, instanceOf in pairs( item:getBestStatements( instanceOfProp ) ) do
local instanceOfId = instanceOf['mainsnak']['datavalue']['value']['id']
local instanceOfItem = mw.wikibase.getEntity( instanceOfId )
-- Now go through each of the instance-of item's class statements,
-- seeing if we can find a matching schema.org URL.
for _, equivClass in pairs( instanceOfItem:getBestStatements( equivalentClassProp ) ) do
local val = equivClass['mainsnak']['datavalue']['value']
if string.sub( val, 1, #schemaPrefix ) == schemaPrefix then
-- This is a schema.org URL.
return val
end
end
end
-- If we've not figured it out by now, give up with the default.
return schemaPrefix .. 'Thing'
end
--------------------------------------------------------------------------------
-- Create the HTML (including wikitext link) for all provided authors,
-- and add it to the given authorLinks table (for later concatenation).
local function process_authors( authorLinks, authors )
if authors == nil or #authors == 0 then
return
end
for _, author in pairs( authors ) do
local authorId = author['mainsnak']['datavalue']['value']['id']
local authorItem = mw.wikibase.getEntity( authorId )
local siteLink = get_author_sitelink( authorItem )
local authorName = authorItem:getLabel()
if siteLink ~= nil then
authorName = mw.title.new( siteLink ).text
end
local authorHtml = mw.html.create('span')
:attr('itemprop', 'author')
:attr('itemscope', '')
:attr('itemtype', getSchemaorgItemtype( authorItem ) )
local authorNameHtml = authorHtml:tag( 'span' )
authorNameHtml:attr( 'itemprop', 'name' )
:wikitext( authorName )
local authorHtmlStr = tostring( authorHtml )
if siteLink == nil then
tableInsertUnique( authorLinks, authorHtmlStr )
else
tableInsertUnique( authorLinks, '[[' .. siteLink .. '|' .. authorHtmlStr .. ']]' )
end
end
end
--------------------------------------------------------------------------------
-- Get an Item based on what's passed in the 'wikidata' or 'page' parameters of
-- the args, or the current page's ID otherwise.
local function getItem( args )
local id = nil
-- If args is a table with an appropriate element, use it.
if type( args ) == 'table' then
if args.wikidata ~= '' and args.wikidata ~= nil then
id = args.wikidata
elseif args.wikidata_id ~= '' and args.wikidata_id ~= nil then
id = args.wikidata_id
elseif args.page ~= '' and args.page ~= nil then
local title = mw.title.new( args.page )
id = mw.wikibase.getEntityIdForTitle( title.nsText .. title.text )
-- If no entity for this page, maybe it's a subpage and we should look for the root page's entity.
if id == nil then
id = mw.wikibase.getEntityIdForTitle( title.nsText .. title.rootText )
end
end
end
if type( args ) == 'string' and args ~= '' then
id = args
end
return mw.wikibase.getEntity( id )
end
--------------------------------------------------------------------------------
-- Exported method.
--
local function author_list( args )
local item = getItem( args )
if item == nil then
return ''
end
local authorLinks = {}
-- Collect the authors of this item.
local authors = item:getBestStatements( authorProp )
process_authors( authorLinks, authors )
-- Also collect the authors of the parent work.
local works = item:getBestStatements( editionOrTranslationOfProp )
for _, work in pairs( works ) do
local workId = work['mainsnak']['datavalue']['value']['id']
local workItem = mw.wikibase.getEntity( workId )
authors = workItem:getBestStatements( authorProp )
if #authors > 0 then
process_authors( authorLinks, authors )
end
end
-- Output the final list of links.
local outHtml = mw.html.create()
local separator = args.separator or ', '
local last_separator = args.last_separator or ', and '
local i = 1
for _, link in pairs( authorLinks ) do
outHtml:wikitext( link )
if i == ( #authorLinks - 1 ) then
outHtml:wikitext( last_separator )
elseif #authorLinks > 1 and i ~= #authorLinks then
outHtml:wikitext( separator )
end
i = i + 1
end
return tostring( outHtml )
end
--------------------------------------------------------------------------------
-- Exported method.
--
local function inline( args )
local item = getItem( args )
local outHtml = mw.html.create()
if ( item == nil ) then
outHtml:wikitext( '<span class="error">Unable to determine the Wikidata item to use</span>' )
return tostring( outHtml )
end
-- Make sure it's an edition.
local editionOrTranslationOfStmts = item:getBestStatements( editionOrTranslationOfProp )
if #editionOrTranslationOfStmts == 0 then
outHtml:wikitext( '<span class="error">' .. item.id .. ' is not an edition or translation of a work (missing P629)</span>' )
return tostring( outHtml )
end
-- Title/label.
local title = item:getSitelink( 'enwikisource' )
local label = item:getLabel( 'en' )
local hasWikisourcePage = false
if title == nil or title == '' then
title = label
else
hasWikisourcePage = true
title = '[[' .. title .. '|' .. label .. ']]'
end
outHtml:wikitext( title .. ' ' );
-- Publication date
local publicationDate = item:formatPropertyValues( 'P577' )
outHtml:wikitext( '(' .. publicationDate.value .. ') ' )
-- Authors
if args.hideauthors == nil or args.hideauthors == '' then
local authorList = author_list( args )
if authorList ~= '' then
outHtml:wikitext( ' by ' .. authorList .. ' ' )
end
end
-- Scanned file on Wikimedia Commons.
if not hasWikisourcePage then
-- Add links to Index page or Commons file.
local hasIndexOrCommonsLink = false
local scannedFileOnWikimediaCommons = 'P996'
local scannedFileOnWikimediaCommonsStmts = item:getBestStatements( scannedFileOnWikimediaCommons )
for _, stmt in pairs( scannedFileOnWikimediaCommonsStmts ) do
local commonsFilename = stmt['mainsnak']['datavalue']['value']
outHtml:wikitext( ' ' .. mw.getCurrentFrame():expandTemplate{ title = 'Small scan link', args = { commonsFilename } } )
hasIndexOrCommonsLink = true;
end
-- Add link to the IA item if no links were added above.
if not hasIndexOrCommonsLink then
local internetArchiveIdProp = 'P724'
local internetArchiveIdStmts = item:getBestStatements( internetArchiveIdProp )
for _, stmt in pairs( internetArchiveIdStmts ) do
local internetArchiveId = stmt['mainsnak']['datavalue']['value']
outHtml:wikitext( ' ' .. mw.getCurrentFrame():expandTemplate{ title = 'IA small link', args = { internetArchiveId } } )
end
end
end
-- Wikidata and Wikipedia links.
local img = '[[File:Wikidata-books-task-force-logo.svg|20px|alt=Wikidata books task force logo|link=d:' .. item.id .. '|View on Wikidata]]'
outHtml:wikitext( img )
return tostring( outHtml )
end
--------------------------------------------------------------------------------
-- Exported method. Get wikitext for displaying an edition's badges from Wikidata.
-- To get an indicator, pass args.indicator = true
-- Testing: =p.badge({args={wikidata='Q75043199'}})
--
local function badge( args )
local item = getItem( args )
if not ( item and item.sitelinks and item.sitelinks.enwikisource and item.sitelinks.enwikisource.badges ) then
return ''
end
local badges = item.sitelinks.enwikisource.badges
local out = ''
for _, badge in pairs( badges ) do
local badgeOut = ''
local badgeItem = mw.wikibase.getEntity( badge )
local badgeName = ''
local wikisourceBadgeClass = 'Q75042035'
if badgeItem.claims.P31[1].mainsnak.datavalue.value.id == wikisourceBadgeClass and badgeItem.claims.P18 ~= nil then
local imageName = badgeItem.claims.P18[1].mainsnak.datavalue.value
if mw.wikibase.getLabel( badge ) ~= nil then
badgeName = mw.wikibase.getLabel( badge )
end
badgeOut = '<span class="indicator-badge">[[File:' .. imageName .. '|16px|link=Help:Text status|' .. badgeName .. ']]</span>'
if args.indicator ~= nil then
badgeOut = '<indicator name="wikisource-badge-' .. badgeName .. '">' .. badgeOut .. '</indicator>'
end
if args.category ~= nil and badgeItem.claims.P910 ~= nil then
local categoryQid = badgeItem.claims.P910[1].mainsnak.datavalue.value.id
local category = mw.wikibase.getEntity( categoryQid )
badgeOut = badgeOut .. '[[' .. category.sitelinks.enwikisource.title .. ']]'
end
out = out .. badgeOut
end
end
return mw.getCurrentFrame():preprocess( out )
end
--------------------------------------------------------------------------------
-- Exported method.
local function authority_control( args )
local item = getItem( args )
-- Gather every 'external-id' statement.
local out = mw.html.create( '' )
for propertyId,claims in pairs( item.claims) do
local propItem = getItem( propertyId )
for _,claim in pairs( claims ) do
if claim.mainsnak.datatype == 'external-id' then
local propLabel = propItem:getLabel()
if not propLabel then
if propItem.aliases.en and propItem.aliases.en[1].value then
propLabel = propItem.aliases.en[1].value
else
propLabel = propertyId
end
end
out:wikitext( '* [[d:Special:EntityPage/'.. propertyId .. '|' .. propLabel .. ']]: ' .. claim.mainsnak.datavalue.value .. '\n' )
end
end
end
return tostring( out )
end
--------------------------------------------------------------------------------
-- Export all public functions.
return {
-- =p.author_list({args={wikidata='Q28913867'}})
author_list = function( frame ) return author_list( frame.args ) end;
-- =p.inline({args={wikidata_id='Q28913867'}})
inline = function( frame ) return inline( frame.args ) end;
-- =p.badge({args={wikidata='Q28020002'}})
badge = function( frame ) return badge( frame.args ) end;
-- =p.authority_control({args={wikidata='Q19035838'}})
authority_control = function( frame ) return authority_control( frame.args ) end;
}
k1vza9jbs6j4dfxyxlxqbxi6ftyq0kt
32059
32058
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Module:Edition]] سے 1 نسخہ درآمد کیا گیا
32058
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Organisation of this module: the exports are listed at the bottom; their
-- direct functions are just above there, and supporting functions are higher
-- up.
--
-- Please add testcases before modifying anything.
--
--------------------------------------------------------------------------------
require('strict')
local instanceOfProp = 'P31'
local authorProp = 'P50'
local editionOrTranslationOfProp = 'P629'
local equivalentClassProp = 'P1709'
local topicsMainWikimediaPortalProp = 'P1151';
--------------------------------------------------------------------------------
-- Insert a value into a table, but not if it's already there.
local function tableInsertUnique( theTable, value )
for _, item in pairs( theTable ) do
if item == value then
-- Already present
return
end
end
-- Otherwise, add the new value.
table.insert( theTable, value )
end
--------------------------------------------------------------------------------
-- For the given author item, find the Wikisource sitelink. If there isn't one,
-- check to see if there the author has a topicsMainWikimediaPortal statement,
-- and then see if that portal has a sitelink instead.
local function get_author_sitelink( authorItem )
local siteLink = authorItem:getSitelink( mw.language.getContentLanguage().code .. 'wikisource' )
if ( siteLink ~= nil ) then
return siteLink
end
local portalStatements = authorItem:getBestStatements( topicsMainWikimediaPortalProp )
for _, mainPortal in pairs( portalStatements ) do
local mainPortalId = mainPortal['mainsnak']['datavalue']['value']['id']
local mainPortalItem = mw.wikibase.getEntity( mainPortalId )
siteLink = mainPortalItem:getSitelink( mw.language.getContentLanguage().code .. 'wikisource' )
end
return siteLink
end
--------------------------------------------------------------------------------
-- Get the schema.org URL for the itemtype of the given item.
local function getSchemaorgItemtype( item )
local schemaPrefix = 'http://schema.org/'
for _, instanceOf in pairs( item:getBestStatements( instanceOfProp ) ) do
local instanceOfId = instanceOf['mainsnak']['datavalue']['value']['id']
local instanceOfItem = mw.wikibase.getEntity( instanceOfId )
-- Now go through each of the instance-of item's class statements,
-- seeing if we can find a matching schema.org URL.
for _, equivClass in pairs( instanceOfItem:getBestStatements( equivalentClassProp ) ) do
local val = equivClass['mainsnak']['datavalue']['value']
if string.sub( val, 1, #schemaPrefix ) == schemaPrefix then
-- This is a schema.org URL.
return val
end
end
end
-- If we've not figured it out by now, give up with the default.
return schemaPrefix .. 'Thing'
end
--------------------------------------------------------------------------------
-- Create the HTML (including wikitext link) for all provided authors,
-- and add it to the given authorLinks table (for later concatenation).
local function process_authors( authorLinks, authors )
if authors == nil or #authors == 0 then
return
end
for _, author in pairs( authors ) do
local authorId = author['mainsnak']['datavalue']['value']['id']
local authorItem = mw.wikibase.getEntity( authorId )
local siteLink = get_author_sitelink( authorItem )
local authorName = authorItem:getLabel()
if siteLink ~= nil then
authorName = mw.title.new( siteLink ).text
end
local authorHtml = mw.html.create('span')
:attr('itemprop', 'author')
:attr('itemscope', '')
:attr('itemtype', getSchemaorgItemtype( authorItem ) )
local authorNameHtml = authorHtml:tag( 'span' )
authorNameHtml:attr( 'itemprop', 'name' )
:wikitext( authorName )
local authorHtmlStr = tostring( authorHtml )
if siteLink == nil then
tableInsertUnique( authorLinks, authorHtmlStr )
else
tableInsertUnique( authorLinks, '[[' .. siteLink .. '|' .. authorHtmlStr .. ']]' )
end
end
end
--------------------------------------------------------------------------------
-- Get an Item based on what's passed in the 'wikidata' or 'page' parameters of
-- the args, or the current page's ID otherwise.
local function getItem( args )
local id = nil
-- If args is a table with an appropriate element, use it.
if type( args ) == 'table' then
if args.wikidata ~= '' and args.wikidata ~= nil then
id = args.wikidata
elseif args.wikidata_id ~= '' and args.wikidata_id ~= nil then
id = args.wikidata_id
elseif args.page ~= '' and args.page ~= nil then
local title = mw.title.new( args.page )
id = mw.wikibase.getEntityIdForTitle( title.nsText .. title.text )
-- If no entity for this page, maybe it's a subpage and we should look for the root page's entity.
if id == nil then
id = mw.wikibase.getEntityIdForTitle( title.nsText .. title.rootText )
end
end
end
if type( args ) == 'string' and args ~= '' then
id = args
end
return mw.wikibase.getEntity( id )
end
--------------------------------------------------------------------------------
-- Exported method.
--
local function author_list( args )
local item = getItem( args )
if item == nil then
return ''
end
local authorLinks = {}
-- Collect the authors of this item.
local authors = item:getBestStatements( authorProp )
process_authors( authorLinks, authors )
-- Also collect the authors of the parent work.
local works = item:getBestStatements( editionOrTranslationOfProp )
for _, work in pairs( works ) do
local workId = work['mainsnak']['datavalue']['value']['id']
local workItem = mw.wikibase.getEntity( workId )
authors = workItem:getBestStatements( authorProp )
if #authors > 0 then
process_authors( authorLinks, authors )
end
end
-- Output the final list of links.
local outHtml = mw.html.create()
local separator = args.separator or ', '
local last_separator = args.last_separator or ', and '
local i = 1
for _, link in pairs( authorLinks ) do
outHtml:wikitext( link )
if i == ( #authorLinks - 1 ) then
outHtml:wikitext( last_separator )
elseif #authorLinks > 1 and i ~= #authorLinks then
outHtml:wikitext( separator )
end
i = i + 1
end
return tostring( outHtml )
end
--------------------------------------------------------------------------------
-- Exported method.
--
local function inline( args )
local item = getItem( args )
local outHtml = mw.html.create()
if ( item == nil ) then
outHtml:wikitext( '<span class="error">Unable to determine the Wikidata item to use</span>' )
return tostring( outHtml )
end
-- Make sure it's an edition.
local editionOrTranslationOfStmts = item:getBestStatements( editionOrTranslationOfProp )
if #editionOrTranslationOfStmts == 0 then
outHtml:wikitext( '<span class="error">' .. item.id .. ' is not an edition or translation of a work (missing P629)</span>' )
return tostring( outHtml )
end
-- Title/label.
local title = item:getSitelink( 'enwikisource' )
local label = item:getLabel( 'en' )
local hasWikisourcePage = false
if title == nil or title == '' then
title = label
else
hasWikisourcePage = true
title = '[[' .. title .. '|' .. label .. ']]'
end
outHtml:wikitext( title .. ' ' );
-- Publication date
local publicationDate = item:formatPropertyValues( 'P577' )
outHtml:wikitext( '(' .. publicationDate.value .. ') ' )
-- Authors
if args.hideauthors == nil or args.hideauthors == '' then
local authorList = author_list( args )
if authorList ~= '' then
outHtml:wikitext( ' by ' .. authorList .. ' ' )
end
end
-- Scanned file on Wikimedia Commons.
if not hasWikisourcePage then
-- Add links to Index page or Commons file.
local hasIndexOrCommonsLink = false
local scannedFileOnWikimediaCommons = 'P996'
local scannedFileOnWikimediaCommonsStmts = item:getBestStatements( scannedFileOnWikimediaCommons )
for _, stmt in pairs( scannedFileOnWikimediaCommonsStmts ) do
local commonsFilename = stmt['mainsnak']['datavalue']['value']
outHtml:wikitext( ' ' .. mw.getCurrentFrame():expandTemplate{ title = 'Small scan link', args = { commonsFilename } } )
hasIndexOrCommonsLink = true;
end
-- Add link to the IA item if no links were added above.
if not hasIndexOrCommonsLink then
local internetArchiveIdProp = 'P724'
local internetArchiveIdStmts = item:getBestStatements( internetArchiveIdProp )
for _, stmt in pairs( internetArchiveIdStmts ) do
local internetArchiveId = stmt['mainsnak']['datavalue']['value']
outHtml:wikitext( ' ' .. mw.getCurrentFrame():expandTemplate{ title = 'IA small link', args = { internetArchiveId } } )
end
end
end
-- Wikidata and Wikipedia links.
local img = '[[File:Wikidata-books-task-force-logo.svg|20px|alt=Wikidata books task force logo|link=d:' .. item.id .. '|View on Wikidata]]'
outHtml:wikitext( img )
return tostring( outHtml )
end
--------------------------------------------------------------------------------
-- Exported method. Get wikitext for displaying an edition's badges from Wikidata.
-- To get an indicator, pass args.indicator = true
-- Testing: =p.badge({args={wikidata='Q75043199'}})
--
local function badge( args )
local item = getItem( args )
if not ( item and item.sitelinks and item.sitelinks.enwikisource and item.sitelinks.enwikisource.badges ) then
return ''
end
local badges = item.sitelinks.enwikisource.badges
local out = ''
for _, badge in pairs( badges ) do
local badgeOut = ''
local badgeItem = mw.wikibase.getEntity( badge )
local badgeName = ''
local wikisourceBadgeClass = 'Q75042035'
if badgeItem.claims.P31[1].mainsnak.datavalue.value.id == wikisourceBadgeClass and badgeItem.claims.P18 ~= nil then
local imageName = badgeItem.claims.P18[1].mainsnak.datavalue.value
if mw.wikibase.getLabel( badge ) ~= nil then
badgeName = mw.wikibase.getLabel( badge )
end
badgeOut = '<span class="indicator-badge">[[File:' .. imageName .. '|16px|link=Help:Text status|' .. badgeName .. ']]</span>'
if args.indicator ~= nil then
badgeOut = '<indicator name="wikisource-badge-' .. badgeName .. '">' .. badgeOut .. '</indicator>'
end
if args.category ~= nil and badgeItem.claims.P910 ~= nil then
local categoryQid = badgeItem.claims.P910[1].mainsnak.datavalue.value.id
local category = mw.wikibase.getEntity( categoryQid )
badgeOut = badgeOut .. '[[' .. category.sitelinks.enwikisource.title .. ']]'
end
out = out .. badgeOut
end
end
return mw.getCurrentFrame():preprocess( out )
end
--------------------------------------------------------------------------------
-- Exported method.
local function authority_control( args )
local item = getItem( args )
-- Gather every 'external-id' statement.
local out = mw.html.create( '' )
for propertyId,claims in pairs( item.claims) do
local propItem = getItem( propertyId )
for _,claim in pairs( claims ) do
if claim.mainsnak.datatype == 'external-id' then
local propLabel = propItem:getLabel()
if not propLabel then
if propItem.aliases.en and propItem.aliases.en[1].value then
propLabel = propItem.aliases.en[1].value
else
propLabel = propertyId
end
end
out:wikitext( '* [[d:Special:EntityPage/'.. propertyId .. '|' .. propLabel .. ']]: ' .. claim.mainsnak.datavalue.value .. '\n' )
end
end
end
return tostring( out )
end
--------------------------------------------------------------------------------
-- Export all public functions.
return {
-- =p.author_list({args={wikidata='Q28913867'}})
author_list = function( frame ) return author_list( frame.args ) end;
-- =p.inline({args={wikidata_id='Q28913867'}})
inline = function( frame ) return inline( frame.args ) end;
-- =p.badge({args={wikidata='Q28020002'}})
badge = function( frame ) return badge( frame.args ) end;
-- =p.authority_control({args={wikidata='Q19035838'}})
authority_control = function( frame ) return authority_control( frame.args ) end;
}
k1vza9jbs6j4dfxyxlxqbxi6ftyq0kt
ماڈیول:Header
828
12961
32060
2026-03-27T22:31:26Z
en>Alien333
0
+ 'Pages with translator' hidden cat for when translator= or override_translator=
32060
Scribunto
text/plain
--[=[
This is a module to implement logic for [[Template:Header]] and [[Template:Translation header]]
TODO:
- centuries are defined as starting on XX01, but WS categorizes them as starting on XX00
-- check whether that's a considered policy choice
]=]
require('strict')
local p = {} --p stands for package
local yesno = require('Module:Yesno')
local getArgs = require('Module:Arguments').getArgs
local TableTools = require('Module:TableTools')
local parent_links = require('Module:Auto parents')._parent_links
local construct_header = require('Module:Header structure').construct_header
local headerAttribution = require('Module:Header/attribution')
local headerLang = require('Module:Header/lang')
local construct_defaultsort = require('Module:Header/sort')._construct_defaultsort
local construct_year = require('Module:Header/year').construct_year
local current_title = mw.title.getCurrentTitle()
--[=[
Wrap stylesheet in noexport div
]=]
local function get_noexport_stylesheet(template)
return tostring(mw.html.create('div'):addClass('ws-noexport'):wikitext(mw.getCurrentFrame():extensionTag('templatestyles', '', {src = template .. '/styles.css'})))
end
--[=[
Get badge if any
]=]
local function badge()
return require('Module:Edition').badge({args = {category = '1', indicator = '1'}})
end
--[=[
Detect explicit formatting in fields like 'section' and 'title'
]=]
local function explicit_formatting(str)
return str and (string.match(str, "\'\'\'?") or string.match(str, '<%s*/?%s*[iIbB]%s*>'))
-- add more cases here or come up with a less silly way to do things
end
local function check_non_existent_author_pages(args, categories, checkArgs)
-- check for cases that aren't supposed to produce a valid link
local param = checkArgs.param
local tracking_cat = checkArgs.tracking_cat or 'Works with non-existent author pages'
if not param or not args[param] or yesno(args[param .. '-nolink']) then
return
end
local lower_arg = string.lower(args[param])
local attr_data = headerAttribution.attr_data[param] or headerAttribution.attr_data[string.gsub(param, 'section%-', '')]
if attr_data and attr_data['special_cases'] and attr_data['special_cases'][lower_arg] then
return
end
-- check if page exists
local target = mw.title.makeTitle('Author', args[param])
-- expensive function!
if not target or not target.exists then
table.insert(categories, tracking_cat)
end
return
end
local function construct_categories(args, argsWithBlanks)
local categories = {}
-- categorize subpages
local title = current_title
local parent_exists = false
while title.isSubpage and not parent_exists do
title = mw.title.new(title.baseText, title.nsText)
parent_exists = title.exists
end
if parent_exists and title:inNamespaces(0) then
table.insert(categories, 'Subpages')
elseif parent_exists then
table.insert(categories, title.nsText .. ' subpages')
end
-- add categories from the categories parameter
local manual_categories = (args.categories and mw.text.split(args.categories, '%s*/%s*', false)) or {}
local using_cat = false
for i, category in ipairs(manual_categories) do
local cat = mw.text.trim(category)
if cat ~= '' then
table.insert(categories, cat)
using_cat = true
end
end
if using_cat then
table.insert(categories, 'Works using categories parameter')
end
local known_override_types = {
['default'] = 'contributor type',
['author'] = 'author',
['translator'] = 'translator',
['section-author'] = 'contributor'
}
for k, v in pairs(argsWithBlanks) do
-- Check for numerical parameters (which shouldn't be used)
if type(k) == 'number' then
table.insert(categories, 'Headers with numerical arguments')
-- Check for 'override-' parameters
elseif string.match(k, '^override%-') then
local contrib_type = string.gsub(k, '^override%-', '')
contrib_type = string.gsub(contrib_type, '%d*$', '')
table.insert(categories, 'Pages with override ' .. (known_override_types[contrib_type] or known_override_types['default']))
end
end
-- check contributor parameters
if args['section-author'] then
table.insert(categories, 'Pages with contributor')
end
local editor = args['override-editor'] or args['editor']
if editor and not args['nocat'] then
editor = string.lower(editor)
if editor == 'unknown' or editor == '?' then
table.insert(categories, 'Works with unknown editors')
elseif editor == 'not mentioned' then
table.insert(categories, 'Works with unmentioned editors')
end
end
local translator = args['override-translator'] or args['translator']
if translator and not args['nocat'] then
translator = string.lower(translator)
table.insert(categories, 'Pages with translator')
if translator == 'unknown' or translator == 'not mentioned' or translator == '?' then
table.insert(categories, 'Translations without translator information specified')
end
end
local author = args['override-author'] or args['author']
if author and (string.lower(author) == 'unknown') and not args['nocat'] then
if args.template_name == 'Translation header' then
table.insert(categories, 'Translations of anonymous works')
else
table.insert(categories, 'Anonymous texts')
end
end
-- check for non-existent contributor pages
if current_title:inNamespaces(0, 114) or args.testing then
local params_to_check = {
{param = 'author'},
{param = 'editor'},
{param = 'translator'},
{param = 'composer', tracking_cat = 'Works with non-existent composer pages'},
{param = 'illustrator', tracking_cat = 'Works with non-existent illustrator pages'}
}
for k, v in pairs(params_to_check) do
check_non_existent_author_pages(args, categories, v)
check_non_existent_author_pages(args, categories, {param = 'section-' .. v.param, tracking_cat = v.tracking_cat})
end
end
if args['shortcut'] then
if current_title:inNamespaces(0) then
table.insert(categories, 'Mainspace pages with shortcuts')
elseif current_title:inNamespaces(114) then
table.insert(categories, 'Translation namespace pages with shortcuts')
end
end
if args['noyear'] then
table.insert(categories, 'Pages with noyear')
end
if args['noyearcat'] then
table.insert(categories, 'Pages with noyearcat')
end
if args['nolanguagecat'] then
table.insert(categories, 'Pages with nolanguagecat')
end
if args['cover'] then
table.insert(categories, 'Pages with an export cover')
end
-- sanity/maintenance checks on various parameters
-- allow-explicit-formatting parameter suppresses this check
-- used by, for example, [[Template:Versions]]
if not args['allow-explicit-formatting'] and (explicit_formatting(args['title']) or explicit_formatting(args['section'])) then
table.insert(categories, 'Pages with explicit formatting in header fields')
end
-- translation header categories
local isMainPage = ((current_title:inNamespaces(0, 114) and not current_title.isSubpage) or args['testing'])
if not args['nocat'] and isMainPage then
local cat_works_start = 'Works originally in'
local cat_translations_start = 'Translations'
if args.is_translation then
cat_works_start = 'Wikisource translations of works in'
cat_translations_start = 'Wikisource translations'
end
if not args['nolanguagecat'] then
if args['languages'] then
for i, lang in ipairs(args['languages']) do
table.insert(categories, headerLang.language_category_name(cat_works_start, lang, args.is_translation))
end
end
if args['interwiki-prefix'] then
local iw_prefix_parts = mw.text.split(args['interwiki-prefix'], ':', true)
table.insert(categories, headerLang.language_category_name(cat_works_start, iw_prefix_parts[1], args.is_translation))
end
end
if not args['languages'] and args['language-required'] then
table.insert(categories, cat_translations_start .. ' with no original language')
end
if args.template_name == 'Translation header' and not args.original then
table.insert(categories, 'Wikisource translations with no original source')
end
end
-- detect inappropriate template use
--[=[
if (args['template-name'] ~= 'Translation header' and translator and string.lower(translator) == 'wikisource')
or (current_title:inNamespaces(114) and args['template-name'] ~= 'Translation header') then
-- tracking category for pages that should be using translation header?
end
if current_title:inNamespaces(0) and args['template-name'] == 'Translation header' then
-- tracking category for translation header in mainspace?
end
]=]
categories = TableTools.removeDuplicates(categories)
local category_links = {}
for k, v in pairs(categories) do
table.insert(category_links, '[[Category:' .. v .. ']]')
end
local category_link_text = table.concat(category_links)
if args.testing then
category_link_text = mw.text.nowiki(category_link_text) .. category_link_text
end
return category_link_text
end
--[=[
For debugging
]=]
--[=[
function p.construct_categories(args)
return construct_categories(args, args)
end
]=]
--[=[
Assemble the title
]=]
local function header_title(args)
local title = args.title or ''
local titleSpan = tostring(mw.html.create('span'):addClass('wst-header-title-text'):wikitext(title))
local year = construct_year(args)
local attr = headerAttribution.construct_attributions(args)
local section = headerAttribution.construct_section(args)
if attr ~= '' and title ~= '' then
attr = tostring(mw.html.create('br'):addClass('wst-header-title-break')) .. attr
end
return table.concat({titleSpan, year, attr, section})
end
--[=[
[[Template:Header]]
]=]
function p._header(args, argsWithBlanks)
argsWithBlanks = argsWithBlanks or args
-- aliases
local dup_cat
local newArgs = {}
local aliases = {
['section-author'] = 'contributor',
['section-translator'] = 'contributing%-translator'
}
for k, v in pairs(args) do
local newkey = string.lower(string.gsub(string.gsub(tostring(k), '_', '-'), ' ', '-'))
for arg, alias in pairs(aliases) do
newkey = string.gsub(newkey, alias, arg)
end
if newkey ~= tostring(k) then
if argsWithBlanks[newkey] then
dup_cat = 'Pages using duplicate arguments in template calls'
end
if not args[newkey] then
newArgs[newkey] = newArgs[newkey] or v
end
end
if newkey == 'testing' or newkey == 'nocat' or newkey == 'nolanguagecat' or newkey == 'language-required' or string.match(newkey, '%-nolink$') then
newArgs[newkey] = newArgs[newkey] or yesno(v)
end
end
for k, v in pairs(newArgs) do
args[k] = v
argsWithBlanks[k] = v
end
if dup_cat then
table.insert(categories, dup_cat)
end
args.sortkey = args.defaultsort or args.sortkey
-- default values
args.template_name = args.template_name or 'Header'
if args.testing == nil then
args.testing = current_title.fullText == 'Template:Header/testcases' or current_title.fullText == 'Template:Translation header/testcases'
end
-- noyearcat has different behavior for nil and false
args.noyearcat = args.noyearcat or args.nocat == true or nil
local language_res = headerLang.get_languages(args)
args.languages = language_res.languages
args.language_name = language_res.language_name
local section_language_res = headerLang.get_languages(args, 'section')
args.section_languages = section_language_res.languages
args.section_language_name = section_language_res.language_name
if not args['interwiki-prefix'] and args['languages'] then
if #(args['languages']) > 1 then
args['interwiki-prefix'] = 'mul'
else
args['interwiki-prefix'] = args['languages'][1]
end
end
if args['interwiki-prefix'] then
args['interwiki-prefix'] = headerLang['interwiki_prefixes'][args['interwiki-prefix']] or args['interwiki-prefix']
end
-- add values to argsWithBlanks
for k, v in pairs(args) do
if not argsWithBlanks[k] then
argsWithBlanks[k] = v
end
end
-- default values for title and section (allow override by setting to blank)
if not argsWithBlanks['title'] then
args['title'] = parent_links({})
argsWithBlanks['title'] = args['title']
end
if not argsWithBlanks['section'] and current_title.isSubpage then
args['section'] = current_title.subpageText
argsWithBlanks['section'] = args['section']
end
-- header args
args.pre_container = badge()
args.header_class = 'wst-header ws-header ws-noexport noprint dynlayout-exempt ' .. (args.header_class or '')
args.main_class = 'headertemplate'
-- title
args.main_title = header_title(args)
-- FIXME: just use Wikidata instead of interwiki links?
local interwiki = ''
if args.template_name == 'Translation header' and args['interwiki-prefix'] then
interwiki = tostring(mw.html.create('span'):addClass('interwiki-info'):attr('id', args['interwiki-prefix']):attr('title', '(original)'))
if args.original then
-- general interwiki link
interwiki = interwiki .. '[[' .. args['interwiki-prefix'] .. ':' .. args.original .. ']]'
end
end
-- set defaultsort tracking categories
args.equalsortcat = '[[Category:' .. 'Headers with DefaultSort equal to page title' .. ']]'
args.diffsortcat = '[[Category:' .. 'Headers applying DefaultSort key' .. ']]'
args.post_notes = table.concat({
headerAttribution.construct_microformat(args),
construct_categories(args, argsWithBlanks),
construct_defaultsort(args),
interwiki
})
-- Check if page has copyvio div that needs closing
local copyvio_close = ''
local page_content = mw.title.getCurrentTitle():getContent()
if page_content and
page_content:find('<div id="copyvio"', 1, true) and
not page_content:find('{{copyvio/e}}', 1, true) and
not page_content:find('{{cv/e}}', 1, true) then
copyvio_close = '{{copyvio/e}}'
end
return get_noexport_stylesheet('Header') .. construct_header(args) .. copyvio_close
end
function p.header(frame)
return p._header(
getArgs(frame),
getArgs(frame, {removeBlanks = false})
)
end
--[=[
[[Template:Translation header]]
]=]
function p._translation_header(args, argsWithBlanks)
argsWithBlanks = argsWithBlanks or args
args.header_class = 'wst-translation-header'
args.template_name = 'Translation header'
args.is_translation = true
args.notes_class = 'header-notes'
args['language-required'] = true
return get_noexport_stylesheet('Translation header') .. p._header(args, argsWithBlanks)
end
function p.translation_header(frame)
return p._translation_header(
getArgs(frame),
getArgs(frame, {removeBlanks = false})
)
end
return p
kusvwguu1mw0wf0rny69kkfasihl1ja
32061
32060
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Module:Header]] سے 1 نسخہ درآمد کیا گیا
32060
Scribunto
text/plain
--[=[
This is a module to implement logic for [[Template:Header]] and [[Template:Translation header]]
TODO:
- centuries are defined as starting on XX01, but WS categorizes them as starting on XX00
-- check whether that's a considered policy choice
]=]
require('strict')
local p = {} --p stands for package
local yesno = require('Module:Yesno')
local getArgs = require('Module:Arguments').getArgs
local TableTools = require('Module:TableTools')
local parent_links = require('Module:Auto parents')._parent_links
local construct_header = require('Module:Header structure').construct_header
local headerAttribution = require('Module:Header/attribution')
local headerLang = require('Module:Header/lang')
local construct_defaultsort = require('Module:Header/sort')._construct_defaultsort
local construct_year = require('Module:Header/year').construct_year
local current_title = mw.title.getCurrentTitle()
--[=[
Wrap stylesheet in noexport div
]=]
local function get_noexport_stylesheet(template)
return tostring(mw.html.create('div'):addClass('ws-noexport'):wikitext(mw.getCurrentFrame():extensionTag('templatestyles', '', {src = template .. '/styles.css'})))
end
--[=[
Get badge if any
]=]
local function badge()
return require('Module:Edition').badge({args = {category = '1', indicator = '1'}})
end
--[=[
Detect explicit formatting in fields like 'section' and 'title'
]=]
local function explicit_formatting(str)
return str and (string.match(str, "\'\'\'?") or string.match(str, '<%s*/?%s*[iIbB]%s*>'))
-- add more cases here or come up with a less silly way to do things
end
local function check_non_existent_author_pages(args, categories, checkArgs)
-- check for cases that aren't supposed to produce a valid link
local param = checkArgs.param
local tracking_cat = checkArgs.tracking_cat or 'Works with non-existent author pages'
if not param or not args[param] or yesno(args[param .. '-nolink']) then
return
end
local lower_arg = string.lower(args[param])
local attr_data = headerAttribution.attr_data[param] or headerAttribution.attr_data[string.gsub(param, 'section%-', '')]
if attr_data and attr_data['special_cases'] and attr_data['special_cases'][lower_arg] then
return
end
-- check if page exists
local target = mw.title.makeTitle('Author', args[param])
-- expensive function!
if not target or not target.exists then
table.insert(categories, tracking_cat)
end
return
end
local function construct_categories(args, argsWithBlanks)
local categories = {}
-- categorize subpages
local title = current_title
local parent_exists = false
while title.isSubpage and not parent_exists do
title = mw.title.new(title.baseText, title.nsText)
parent_exists = title.exists
end
if parent_exists and title:inNamespaces(0) then
table.insert(categories, 'Subpages')
elseif parent_exists then
table.insert(categories, title.nsText .. ' subpages')
end
-- add categories from the categories parameter
local manual_categories = (args.categories and mw.text.split(args.categories, '%s*/%s*', false)) or {}
local using_cat = false
for i, category in ipairs(manual_categories) do
local cat = mw.text.trim(category)
if cat ~= '' then
table.insert(categories, cat)
using_cat = true
end
end
if using_cat then
table.insert(categories, 'Works using categories parameter')
end
local known_override_types = {
['default'] = 'contributor type',
['author'] = 'author',
['translator'] = 'translator',
['section-author'] = 'contributor'
}
for k, v in pairs(argsWithBlanks) do
-- Check for numerical parameters (which shouldn't be used)
if type(k) == 'number' then
table.insert(categories, 'Headers with numerical arguments')
-- Check for 'override-' parameters
elseif string.match(k, '^override%-') then
local contrib_type = string.gsub(k, '^override%-', '')
contrib_type = string.gsub(contrib_type, '%d*$', '')
table.insert(categories, 'Pages with override ' .. (known_override_types[contrib_type] or known_override_types['default']))
end
end
-- check contributor parameters
if args['section-author'] then
table.insert(categories, 'Pages with contributor')
end
local editor = args['override-editor'] or args['editor']
if editor and not args['nocat'] then
editor = string.lower(editor)
if editor == 'unknown' or editor == '?' then
table.insert(categories, 'Works with unknown editors')
elseif editor == 'not mentioned' then
table.insert(categories, 'Works with unmentioned editors')
end
end
local translator = args['override-translator'] or args['translator']
if translator and not args['nocat'] then
translator = string.lower(translator)
table.insert(categories, 'Pages with translator')
if translator == 'unknown' or translator == 'not mentioned' or translator == '?' then
table.insert(categories, 'Translations without translator information specified')
end
end
local author = args['override-author'] or args['author']
if author and (string.lower(author) == 'unknown') and not args['nocat'] then
if args.template_name == 'Translation header' then
table.insert(categories, 'Translations of anonymous works')
else
table.insert(categories, 'Anonymous texts')
end
end
-- check for non-existent contributor pages
if current_title:inNamespaces(0, 114) or args.testing then
local params_to_check = {
{param = 'author'},
{param = 'editor'},
{param = 'translator'},
{param = 'composer', tracking_cat = 'Works with non-existent composer pages'},
{param = 'illustrator', tracking_cat = 'Works with non-existent illustrator pages'}
}
for k, v in pairs(params_to_check) do
check_non_existent_author_pages(args, categories, v)
check_non_existent_author_pages(args, categories, {param = 'section-' .. v.param, tracking_cat = v.tracking_cat})
end
end
if args['shortcut'] then
if current_title:inNamespaces(0) then
table.insert(categories, 'Mainspace pages with shortcuts')
elseif current_title:inNamespaces(114) then
table.insert(categories, 'Translation namespace pages with shortcuts')
end
end
if args['noyear'] then
table.insert(categories, 'Pages with noyear')
end
if args['noyearcat'] then
table.insert(categories, 'Pages with noyearcat')
end
if args['nolanguagecat'] then
table.insert(categories, 'Pages with nolanguagecat')
end
if args['cover'] then
table.insert(categories, 'Pages with an export cover')
end
-- sanity/maintenance checks on various parameters
-- allow-explicit-formatting parameter suppresses this check
-- used by, for example, [[Template:Versions]]
if not args['allow-explicit-formatting'] and (explicit_formatting(args['title']) or explicit_formatting(args['section'])) then
table.insert(categories, 'Pages with explicit formatting in header fields')
end
-- translation header categories
local isMainPage = ((current_title:inNamespaces(0, 114) and not current_title.isSubpage) or args['testing'])
if not args['nocat'] and isMainPage then
local cat_works_start = 'Works originally in'
local cat_translations_start = 'Translations'
if args.is_translation then
cat_works_start = 'Wikisource translations of works in'
cat_translations_start = 'Wikisource translations'
end
if not args['nolanguagecat'] then
if args['languages'] then
for i, lang in ipairs(args['languages']) do
table.insert(categories, headerLang.language_category_name(cat_works_start, lang, args.is_translation))
end
end
if args['interwiki-prefix'] then
local iw_prefix_parts = mw.text.split(args['interwiki-prefix'], ':', true)
table.insert(categories, headerLang.language_category_name(cat_works_start, iw_prefix_parts[1], args.is_translation))
end
end
if not args['languages'] and args['language-required'] then
table.insert(categories, cat_translations_start .. ' with no original language')
end
if args.template_name == 'Translation header' and not args.original then
table.insert(categories, 'Wikisource translations with no original source')
end
end
-- detect inappropriate template use
--[=[
if (args['template-name'] ~= 'Translation header' and translator and string.lower(translator) == 'wikisource')
or (current_title:inNamespaces(114) and args['template-name'] ~= 'Translation header') then
-- tracking category for pages that should be using translation header?
end
if current_title:inNamespaces(0) and args['template-name'] == 'Translation header' then
-- tracking category for translation header in mainspace?
end
]=]
categories = TableTools.removeDuplicates(categories)
local category_links = {}
for k, v in pairs(categories) do
table.insert(category_links, '[[Category:' .. v .. ']]')
end
local category_link_text = table.concat(category_links)
if args.testing then
category_link_text = mw.text.nowiki(category_link_text) .. category_link_text
end
return category_link_text
end
--[=[
For debugging
]=]
--[=[
function p.construct_categories(args)
return construct_categories(args, args)
end
]=]
--[=[
Assemble the title
]=]
local function header_title(args)
local title = args.title or ''
local titleSpan = tostring(mw.html.create('span'):addClass('wst-header-title-text'):wikitext(title))
local year = construct_year(args)
local attr = headerAttribution.construct_attributions(args)
local section = headerAttribution.construct_section(args)
if attr ~= '' and title ~= '' then
attr = tostring(mw.html.create('br'):addClass('wst-header-title-break')) .. attr
end
return table.concat({titleSpan, year, attr, section})
end
--[=[
[[Template:Header]]
]=]
function p._header(args, argsWithBlanks)
argsWithBlanks = argsWithBlanks or args
-- aliases
local dup_cat
local newArgs = {}
local aliases = {
['section-author'] = 'contributor',
['section-translator'] = 'contributing%-translator'
}
for k, v in pairs(args) do
local newkey = string.lower(string.gsub(string.gsub(tostring(k), '_', '-'), ' ', '-'))
for arg, alias in pairs(aliases) do
newkey = string.gsub(newkey, alias, arg)
end
if newkey ~= tostring(k) then
if argsWithBlanks[newkey] then
dup_cat = 'Pages using duplicate arguments in template calls'
end
if not args[newkey] then
newArgs[newkey] = newArgs[newkey] or v
end
end
if newkey == 'testing' or newkey == 'nocat' or newkey == 'nolanguagecat' or newkey == 'language-required' or string.match(newkey, '%-nolink$') then
newArgs[newkey] = newArgs[newkey] or yesno(v)
end
end
for k, v in pairs(newArgs) do
args[k] = v
argsWithBlanks[k] = v
end
if dup_cat then
table.insert(categories, dup_cat)
end
args.sortkey = args.defaultsort or args.sortkey
-- default values
args.template_name = args.template_name or 'Header'
if args.testing == nil then
args.testing = current_title.fullText == 'Template:Header/testcases' or current_title.fullText == 'Template:Translation header/testcases'
end
-- noyearcat has different behavior for nil and false
args.noyearcat = args.noyearcat or args.nocat == true or nil
local language_res = headerLang.get_languages(args)
args.languages = language_res.languages
args.language_name = language_res.language_name
local section_language_res = headerLang.get_languages(args, 'section')
args.section_languages = section_language_res.languages
args.section_language_name = section_language_res.language_name
if not args['interwiki-prefix'] and args['languages'] then
if #(args['languages']) > 1 then
args['interwiki-prefix'] = 'mul'
else
args['interwiki-prefix'] = args['languages'][1]
end
end
if args['interwiki-prefix'] then
args['interwiki-prefix'] = headerLang['interwiki_prefixes'][args['interwiki-prefix']] or args['interwiki-prefix']
end
-- add values to argsWithBlanks
for k, v in pairs(args) do
if not argsWithBlanks[k] then
argsWithBlanks[k] = v
end
end
-- default values for title and section (allow override by setting to blank)
if not argsWithBlanks['title'] then
args['title'] = parent_links({})
argsWithBlanks['title'] = args['title']
end
if not argsWithBlanks['section'] and current_title.isSubpage then
args['section'] = current_title.subpageText
argsWithBlanks['section'] = args['section']
end
-- header args
args.pre_container = badge()
args.header_class = 'wst-header ws-header ws-noexport noprint dynlayout-exempt ' .. (args.header_class or '')
args.main_class = 'headertemplate'
-- title
args.main_title = header_title(args)
-- FIXME: just use Wikidata instead of interwiki links?
local interwiki = ''
if args.template_name == 'Translation header' and args['interwiki-prefix'] then
interwiki = tostring(mw.html.create('span'):addClass('interwiki-info'):attr('id', args['interwiki-prefix']):attr('title', '(original)'))
if args.original then
-- general interwiki link
interwiki = interwiki .. '[[' .. args['interwiki-prefix'] .. ':' .. args.original .. ']]'
end
end
-- set defaultsort tracking categories
args.equalsortcat = '[[Category:' .. 'Headers with DefaultSort equal to page title' .. ']]'
args.diffsortcat = '[[Category:' .. 'Headers applying DefaultSort key' .. ']]'
args.post_notes = table.concat({
headerAttribution.construct_microformat(args),
construct_categories(args, argsWithBlanks),
construct_defaultsort(args),
interwiki
})
-- Check if page has copyvio div that needs closing
local copyvio_close = ''
local page_content = mw.title.getCurrentTitle():getContent()
if page_content and
page_content:find('<div id="copyvio"', 1, true) and
not page_content:find('{{copyvio/e}}', 1, true) and
not page_content:find('{{cv/e}}', 1, true) then
copyvio_close = '{{copyvio/e}}'
end
return get_noexport_stylesheet('Header') .. construct_header(args) .. copyvio_close
end
function p.header(frame)
return p._header(
getArgs(frame),
getArgs(frame, {removeBlanks = false})
)
end
--[=[
[[Template:Translation header]]
]=]
function p._translation_header(args, argsWithBlanks)
argsWithBlanks = argsWithBlanks or args
args.header_class = 'wst-translation-header'
args.template_name = 'Translation header'
args.is_translation = true
args.notes_class = 'header-notes'
args['language-required'] = true
return get_noexport_stylesheet('Translation header') .. p._header(args, argsWithBlanks)
end
function p.translation_header(frame)
return p._translation_header(
getArgs(frame),
getArgs(frame, {removeBlanks = false})
)
end
return p
kusvwguu1mw0wf0rny69kkfasihl1ja
ماڈیول:Plain sister
828
12962
32062
2026-03-29T21:17:57Z
en>Alien333
0
rv, some disagree, discussing
32062
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local TableTools = require('Module:TableTools')
local error_message = require('Module:Error')['error']
-- table of site data
local sites = {
-- interwiki prefix: parameter, label and site id (for Wikidata)
['w'] = {'wikipedia', 'Wikipedia article', 'enwiki'},
['c'] = {'commons', 'Commons gallery', 'commonswiki'},
['c:Category'] = {'commonscat', 'Commons category', 'commonswiki'},
['q'] = {'wikiquote', 'quotes', 'enwikiquote'},
['n'] = {'wikinews', 'news', 'enwikinews'},
['wikt'] = {'wiktionary', 'definition', 'enwiktionary'},
['b'] = {'wikibooks', 'textbook', 'enwikibooks'},
['v'] = {'wikiversity', 'course', 'enwikiversity'},
['wikispecies'] = {'wikispecies', 'taxonomy', 'specieswiki'},
['voy'] = {'wikivoyage', 'travel guide', 'enwikivoyage'},
['d'] = {'wikidata', 'Wikidata item', 'wikidatawiki'},
['m'] = {'meta', 'Meta', 'metawiki'}
}
-- sites is display order (keyed as above)
local sites_in_order = {'w', 'c', 'c:Category', 'q', 'n', 'wikt', 'b', 'v', 'wikispecies', 'voy', 'd', 'm'}
-- some properties are not wanted from certain transitive links
-- for example, the P921 (main topic) should not add the Commons category
-- this is a map of WD property -> WD site ID keys
local transitiveLinkBlacklist = {
P921 = {'commonswiki', 'wikiquote', 'wikinews', 'wiktionary', 'wikiversity', 'wikivoyage', 'meta'},
}
--------------------------------------------------------------------------------
-- Get the item associated with the current page, or specified by the 'wikidata'
-- parameter (of either the module invocation, or the parent template).
-- @return mw.wikibase.entity
local function getItem(args)
local item = nil
-- Firstly, see if the calling tempate or module has a 'wikidata' argument.
if args.wikidata then
item = mw.wikibase.getEntity(args.wikidata)
end
-- Failing that just use the current page's item.
if item == nil then
item = mw.wikibase.getEntity()
end
return item
end
--------------------------------------------------------------------------------
-- Get the page title of the first sitelink found on the target item for the
-- given property.
-- @return string|nil
local function getFirstSitelink(item, property, sitename)
local statements = item:getBestStatements(property)
if #statements > 0 then
-- Go through each 'edition of' statement.
for _, statement in pairs(statements) do
-- datavalue is missing if set to 'unknown value'
if statement['mainsnak']['datatype'] == 'wikibase-item'
and statement['mainsnak']['datavalue'] then
local otherItemId = statement['mainsnak']['datavalue']['value']['id']
local sitelink = mw.wikibase.getSitelink(otherItemId, sitename)
-- If the parent has the required sitelink, return it.
if sitelink ~= '' and sitelink ~= nil then
-- mw.log(sitename, property, sitelink)
return sitelink
end
end -- if
end
end
return nil
end
local function listContains(list, item)
for _, v in pairs(list) do
if v == item then
return true
end
end
return false
end
local function transitivePropertyBlacklisted(prop, wdSitelinkKey)
-- reject prop/key pairs that we don't want
local blacklisted = transitiveLinkBlacklist[prop] and
listContains(transitiveLinkBlacklist[prop], wdSitelinkKey)
return blacklisted
end
function p.getLinks(args)
local item = getItem(args)
local links = {}
-- Build all the wikitext links.
for prefix, site in pairs(sites) do
local val = nil
local wd_sitelink_key = site[3]
local arg_name = site[1]
-- Allow overriding of individual sitelinks.
if args[arg_name] then
val = args[arg_name]
end
if not val and wd_sitelink_key ~= '' and item then -- fetch it from wikidata
val = item:getSitelink(wd_sitelink_key)
if wd_sitelink_key == 'wikidatawiki' and item.id then
val = item.id
elseif wd_sitelink_key == 'commonswiki' and val then -- we have link to commons
local catFlag = (#val>9 and string.sub(val, 1, 9) == 'Category:')
if (arg_name == 'commonscat' and catFlag==false) or (arg_name=='commons' and catFlag==true) then
val = nil -- link is to a wrong namespace so let's nuke it
elseif (arg_name =='commonscat' and catFlag==true) then
val = string.sub(val,10) -- trim 'Category:' from the front
end
end
end
-- Commons gallery.
if not val and arg_name == 'commons' and item then
local statements = item:getBestStatements('P935') -- get commons gallery page from P935 property
if statements[1] and statements[1].mainsnak.datavalue then
val = statements[1].mainsnak.datavalue.value
end
end
-- Commons category.
if not val and arg_name == 'commonscat' and item then
local statements = item:getBestStatements('P373') -- get commons category page from P373 property
if statements[1] and statements[1].mainsnak.datavalue then
val = statements[1].mainsnak.datavalue.value
end
end
-- edition or translation of (P629)
-- category's main topic (P301)
-- Wikimedia portal's main topic (P1204)
-- main subject (P921)
if item then
for _,prop in pairs({ 'P629', 'P301', 'P1204', 'P921' }) do
if not val and not transitivePropertyBlacklisted(prop, wd_sitelink_key) then
local workSitelink = getFirstSitelink(item, prop, wd_sitelink_key)
if workSitelink ~= nil then
val = workSitelink
break
end
end
end
end
if val then
links[prefix] = val
end
end
-- tidy up redundancies in the WD data
-- strip redundant commons category prefix
if links['c:Category'] then
links['c:Category'] = links['c:Category']:gsub('^Category:', '')
end
-- the gallery is exactly the same as the category, so just keep the category
if links['c'] and links['c:Category']
and ('Category:' .. links['c:Category']) == links['c'] then
links['c'] = nil
end
return links
end
--------
local function construct_sisicon_span(args)
return mw.html.create('span')
:addClass(args.class or 'sisicon')
:wikitext('[[File:' .. args.image .. '|frameless|18px|link=' .. args.link .. '|alt=' .. args.alt .. ']]')
end
-- Get an HTML list of all links to all sister projects.
function p._interprojectPart(args)
local item = getItem(args)
local link_data = p.getLinks(args)
local links = {}
-- iterate the links in the desired order and construct Wikitext links
for k, v in pairs(sites_in_order) do
if link_data[v] then
local display = sites[v][2]
local target = v .. ':' .. link_data[v]
table.insert(links, '[[' .. target .. '|' .. display .. ']]')
end
end
if #links == 0 then -- links table length is zero
return nil
end
return mw.html.create('li')
:addClass('sisitem')
:node(construct_sisicon_span({
image = 'Wikimedia-logo.svg',
link = 'Special:sitematrix',
alt = 'Sister Projects'
}))
:wikitext('[[Special:sitematrix|sister projects]]: ' .. table.concat(links, ', '))
end
function p.interprojectPart(frame)
return p._interprojectPart(getArgs(frame))
end
local function construct_related_links(sourceArgs, linkArgs, sisiconArgs)
local links = {}
for k, v in pairs(sourceArgs) do
local key = string.gsub(string.gsub(string.gsub(string.gsub(k, ' ', ''), '_', ''), '-', ''), 's(%d*)$', '%1')
if string.match(key, '^' .. linkArgs.param .. '%d*$') then
local n = string.gsub(key, '^' .. linkArgs.param .. '(%d*)$', '%1')
n = tonumber(n) or 1
if not links[n] then
local items = mw.text.split(v, '%s*/%s*', false)
local itemLinks = {}
for _, item in pairs(items) do
if item ~= '' then
table.insert(itemLinks, '[[' .. linkArgs.nsPrefix .. item .. '|' .. item .. ']]')
end
end
links[n] = table.concat(itemLinks, ', ')
end
end
end
links = TableTools.compressSparseArray(links)
if #links == 0 then
return nil
end
return mw.html.create('li')
:addClass('sisitem')
:node(construct_sisicon_span(sisiconArgs))
:wikitext(linkArgs.linkPrefix .. table.concat(links, ', '))
end
function p._plain_sister(args)
local current_frame = mw.getCurrentFrame()
local current_title = mw.title.getCurrentTitle()
local pagename = current_title.text
local item = getItem(args)
-- construct list
local ul_list = mw.html.create('ul'):addClass('plainSister')
if yesno(args.disambiguation) then
local dabText = 'Search for titles ' .. tostring(mw.html.create('span'):addClass('selfreference'):wikitext('[[Special:Search/intitle:"' .. pagename .. '"|containing]]')) .. ' or '
if current_title:inNamespaces(14) then
dabText = dabText .. '[[Special:Categories/' .. pagename .. '|beginning]]'
elseif current_title:inNamespaces(0) then
dabText = dabText .. '[[Special:PrefixIndex/' .. current_title.fullText .. '|beginning]]'
else
dabText = dabText .. '[[Special:PrefixIndex/' .. current_title.fullText .. '|beginning (in ' .. current_title.nsText .. 's)]]'
end
dabText = dabText .. ' with: "' .. pagename .. '"'
ul_list:tag('li')
:addClass('dabitem')
:node(construct_sisicon_span({
image = 'Disambiguation.svg',
link = 'WS:STYLE#Disambiguation, versions and translations pages',
alt = 'Style Guide for disambiguation, version and translation pages',
class = 'dabicon'
}))
:wikitext(dabText)
end
local edition_title = (args.textinfotitle and mw.title.new(args.textinfotitle)) or (yesno(args.textinfo or args.edition) and current_title) or nil
local edition_title_talk = edition_title and edition_title.talkPageTitle
local tracking_cats = {}
if args.edition then
table.insert(tracking_cats, '[[Category:' .. 'Plain sisters using edition parameter' .. ']]')
end
local textinfo_display
if edition_title_talk and edition_title_talk.exists then
textinfo_display = '[[' .. edition_title_talk.fullText .. '|information about this edition]]'
elseif edition_title and not edition_title.exists then
textinfo_display = error_message({'Textinfo page \"' .. edition_title.fullText .. '\" does not exist'})
table.insert(tracking_cats, '[[Category:' .. 'Plain sisters with nonexistent textinfo page' .. ']]')
end
if textinfo_display then
ul_list:tag('li')
:addClass('sisitem')
:node(construct_sisicon_span({
image = 'Information icon.svg',
link = 'Template:Textinfo',
alt = 'Documentation for the TextInfo template',
}))
:wikitext(textinfo_display)
end
local portalLI = construct_related_links(
args,
{
param = 'portal',
nsPrefix = 'Portal:',
linkPrefix = '[[Portal:Portals|related portals]]: '
},
{
image = 'Wikisource-logo.svg',
link = 'Portal:Portals',
alt = 'Related Portals'
}
)
if portalLI then
ul_list:node(portalLI)
end
local authorLI = construct_related_links(
args,
{
param = 'relatedauthor',
nsPrefix = 'Author:',
linkPrefix = '[[Wikisource:Authors|related authors]]: '
},
{
image = 'System-users.svg',
link = 'Wikisource:Authors',
alt = 'Related Authors'
}
)
if authorLI then
ul_list:node(authorLI)
end
local workLI = construct_related_links(
args,
{
param = 'relatedwork',
nsPrefix = '',
linkPrefix = '[[Wikisource:Works|related works]]: '
},
{
image = 'Nuvola apps bookcase.svg',
link = 'Wikisource:Works',
alt = 'Related Works'
}
)
if workLI then
ul_list:node(workLI)
end
local sisters = p._interprojectPart(args)
if sisters then
ul_list:node(sisters)
end
if yesno(args.wikidataswitch) and not item then
ul_list:tag('li')
:addClass('sisitem')
:node(construct_sisicon_span({
image = 'Wikidata-logo.svg',
link = 'Wikisource:Wikidata',
alt = 'Wikidata',
}))
:wikitext('[[d:Special:Search/' .. pagename .. '|Search Wikidata]]')
end
if not yesno(args.disambiguation) and not textinfo_display and not portalLI and not authorLI and not workLI and not sisters and not yesno(args.wikidataswitch) then
return nil
end
return current_frame:extensionTag('templatestyles', '', {src = 'Plain sister/styles.css'}) .. tostring(ul_list) .. table.concat(tracking_cats)
end
function p.plain_sister(frame)
return p._plain_sister(getArgs(frame))
end
return p
-- Debug console testing:
-- =p.interprojectPart(mw.getCurrentFrame():newChild{title='nop',args={wikidata='Q23308118'}})
nmzmtvufe79bnzmp0p4tixdhurib1nx
32063
32062
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Module:Plain_sister]] سے 1 نسخہ درآمد کیا گیا
32062
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local TableTools = require('Module:TableTools')
local error_message = require('Module:Error')['error']
-- table of site data
local sites = {
-- interwiki prefix: parameter, label and site id (for Wikidata)
['w'] = {'wikipedia', 'Wikipedia article', 'enwiki'},
['c'] = {'commons', 'Commons gallery', 'commonswiki'},
['c:Category'] = {'commonscat', 'Commons category', 'commonswiki'},
['q'] = {'wikiquote', 'quotes', 'enwikiquote'},
['n'] = {'wikinews', 'news', 'enwikinews'},
['wikt'] = {'wiktionary', 'definition', 'enwiktionary'},
['b'] = {'wikibooks', 'textbook', 'enwikibooks'},
['v'] = {'wikiversity', 'course', 'enwikiversity'},
['wikispecies'] = {'wikispecies', 'taxonomy', 'specieswiki'},
['voy'] = {'wikivoyage', 'travel guide', 'enwikivoyage'},
['d'] = {'wikidata', 'Wikidata item', 'wikidatawiki'},
['m'] = {'meta', 'Meta', 'metawiki'}
}
-- sites is display order (keyed as above)
local sites_in_order = {'w', 'c', 'c:Category', 'q', 'n', 'wikt', 'b', 'v', 'wikispecies', 'voy', 'd', 'm'}
-- some properties are not wanted from certain transitive links
-- for example, the P921 (main topic) should not add the Commons category
-- this is a map of WD property -> WD site ID keys
local transitiveLinkBlacklist = {
P921 = {'commonswiki', 'wikiquote', 'wikinews', 'wiktionary', 'wikiversity', 'wikivoyage', 'meta'},
}
--------------------------------------------------------------------------------
-- Get the item associated with the current page, or specified by the 'wikidata'
-- parameter (of either the module invocation, or the parent template).
-- @return mw.wikibase.entity
local function getItem(args)
local item = nil
-- Firstly, see if the calling tempate or module has a 'wikidata' argument.
if args.wikidata then
item = mw.wikibase.getEntity(args.wikidata)
end
-- Failing that just use the current page's item.
if item == nil then
item = mw.wikibase.getEntity()
end
return item
end
--------------------------------------------------------------------------------
-- Get the page title of the first sitelink found on the target item for the
-- given property.
-- @return string|nil
local function getFirstSitelink(item, property, sitename)
local statements = item:getBestStatements(property)
if #statements > 0 then
-- Go through each 'edition of' statement.
for _, statement in pairs(statements) do
-- datavalue is missing if set to 'unknown value'
if statement['mainsnak']['datatype'] == 'wikibase-item'
and statement['mainsnak']['datavalue'] then
local otherItemId = statement['mainsnak']['datavalue']['value']['id']
local sitelink = mw.wikibase.getSitelink(otherItemId, sitename)
-- If the parent has the required sitelink, return it.
if sitelink ~= '' and sitelink ~= nil then
-- mw.log(sitename, property, sitelink)
return sitelink
end
end -- if
end
end
return nil
end
local function listContains(list, item)
for _, v in pairs(list) do
if v == item then
return true
end
end
return false
end
local function transitivePropertyBlacklisted(prop, wdSitelinkKey)
-- reject prop/key pairs that we don't want
local blacklisted = transitiveLinkBlacklist[prop] and
listContains(transitiveLinkBlacklist[prop], wdSitelinkKey)
return blacklisted
end
function p.getLinks(args)
local item = getItem(args)
local links = {}
-- Build all the wikitext links.
for prefix, site in pairs(sites) do
local val = nil
local wd_sitelink_key = site[3]
local arg_name = site[1]
-- Allow overriding of individual sitelinks.
if args[arg_name] then
val = args[arg_name]
end
if not val and wd_sitelink_key ~= '' and item then -- fetch it from wikidata
val = item:getSitelink(wd_sitelink_key)
if wd_sitelink_key == 'wikidatawiki' and item.id then
val = item.id
elseif wd_sitelink_key == 'commonswiki' and val then -- we have link to commons
local catFlag = (#val>9 and string.sub(val, 1, 9) == 'Category:')
if (arg_name == 'commonscat' and catFlag==false) or (arg_name=='commons' and catFlag==true) then
val = nil -- link is to a wrong namespace so let's nuke it
elseif (arg_name =='commonscat' and catFlag==true) then
val = string.sub(val,10) -- trim 'Category:' from the front
end
end
end
-- Commons gallery.
if not val and arg_name == 'commons' and item then
local statements = item:getBestStatements('P935') -- get commons gallery page from P935 property
if statements[1] and statements[1].mainsnak.datavalue then
val = statements[1].mainsnak.datavalue.value
end
end
-- Commons category.
if not val and arg_name == 'commonscat' and item then
local statements = item:getBestStatements('P373') -- get commons category page from P373 property
if statements[1] and statements[1].mainsnak.datavalue then
val = statements[1].mainsnak.datavalue.value
end
end
-- edition or translation of (P629)
-- category's main topic (P301)
-- Wikimedia portal's main topic (P1204)
-- main subject (P921)
if item then
for _,prop in pairs({ 'P629', 'P301', 'P1204', 'P921' }) do
if not val and not transitivePropertyBlacklisted(prop, wd_sitelink_key) then
local workSitelink = getFirstSitelink(item, prop, wd_sitelink_key)
if workSitelink ~= nil then
val = workSitelink
break
end
end
end
end
if val then
links[prefix] = val
end
end
-- tidy up redundancies in the WD data
-- strip redundant commons category prefix
if links['c:Category'] then
links['c:Category'] = links['c:Category']:gsub('^Category:', '')
end
-- the gallery is exactly the same as the category, so just keep the category
if links['c'] and links['c:Category']
and ('Category:' .. links['c:Category']) == links['c'] then
links['c'] = nil
end
return links
end
--------
local function construct_sisicon_span(args)
return mw.html.create('span')
:addClass(args.class or 'sisicon')
:wikitext('[[File:' .. args.image .. '|frameless|18px|link=' .. args.link .. '|alt=' .. args.alt .. ']]')
end
-- Get an HTML list of all links to all sister projects.
function p._interprojectPart(args)
local item = getItem(args)
local link_data = p.getLinks(args)
local links = {}
-- iterate the links in the desired order and construct Wikitext links
for k, v in pairs(sites_in_order) do
if link_data[v] then
local display = sites[v][2]
local target = v .. ':' .. link_data[v]
table.insert(links, '[[' .. target .. '|' .. display .. ']]')
end
end
if #links == 0 then -- links table length is zero
return nil
end
return mw.html.create('li')
:addClass('sisitem')
:node(construct_sisicon_span({
image = 'Wikimedia-logo.svg',
link = 'Special:sitematrix',
alt = 'Sister Projects'
}))
:wikitext('[[Special:sitematrix|sister projects]]: ' .. table.concat(links, ', '))
end
function p.interprojectPart(frame)
return p._interprojectPart(getArgs(frame))
end
local function construct_related_links(sourceArgs, linkArgs, sisiconArgs)
local links = {}
for k, v in pairs(sourceArgs) do
local key = string.gsub(string.gsub(string.gsub(string.gsub(k, ' ', ''), '_', ''), '-', ''), 's(%d*)$', '%1')
if string.match(key, '^' .. linkArgs.param .. '%d*$') then
local n = string.gsub(key, '^' .. linkArgs.param .. '(%d*)$', '%1')
n = tonumber(n) or 1
if not links[n] then
local items = mw.text.split(v, '%s*/%s*', false)
local itemLinks = {}
for _, item in pairs(items) do
if item ~= '' then
table.insert(itemLinks, '[[' .. linkArgs.nsPrefix .. item .. '|' .. item .. ']]')
end
end
links[n] = table.concat(itemLinks, ', ')
end
end
end
links = TableTools.compressSparseArray(links)
if #links == 0 then
return nil
end
return mw.html.create('li')
:addClass('sisitem')
:node(construct_sisicon_span(sisiconArgs))
:wikitext(linkArgs.linkPrefix .. table.concat(links, ', '))
end
function p._plain_sister(args)
local current_frame = mw.getCurrentFrame()
local current_title = mw.title.getCurrentTitle()
local pagename = current_title.text
local item = getItem(args)
-- construct list
local ul_list = mw.html.create('ul'):addClass('plainSister')
if yesno(args.disambiguation) then
local dabText = 'Search for titles ' .. tostring(mw.html.create('span'):addClass('selfreference'):wikitext('[[Special:Search/intitle:"' .. pagename .. '"|containing]]')) .. ' or '
if current_title:inNamespaces(14) then
dabText = dabText .. '[[Special:Categories/' .. pagename .. '|beginning]]'
elseif current_title:inNamespaces(0) then
dabText = dabText .. '[[Special:PrefixIndex/' .. current_title.fullText .. '|beginning]]'
else
dabText = dabText .. '[[Special:PrefixIndex/' .. current_title.fullText .. '|beginning (in ' .. current_title.nsText .. 's)]]'
end
dabText = dabText .. ' with: "' .. pagename .. '"'
ul_list:tag('li')
:addClass('dabitem')
:node(construct_sisicon_span({
image = 'Disambiguation.svg',
link = 'WS:STYLE#Disambiguation, versions and translations pages',
alt = 'Style Guide for disambiguation, version and translation pages',
class = 'dabicon'
}))
:wikitext(dabText)
end
local edition_title = (args.textinfotitle and mw.title.new(args.textinfotitle)) or (yesno(args.textinfo or args.edition) and current_title) or nil
local edition_title_talk = edition_title and edition_title.talkPageTitle
local tracking_cats = {}
if args.edition then
table.insert(tracking_cats, '[[Category:' .. 'Plain sisters using edition parameter' .. ']]')
end
local textinfo_display
if edition_title_talk and edition_title_talk.exists then
textinfo_display = '[[' .. edition_title_talk.fullText .. '|information about this edition]]'
elseif edition_title and not edition_title.exists then
textinfo_display = error_message({'Textinfo page \"' .. edition_title.fullText .. '\" does not exist'})
table.insert(tracking_cats, '[[Category:' .. 'Plain sisters with nonexistent textinfo page' .. ']]')
end
if textinfo_display then
ul_list:tag('li')
:addClass('sisitem')
:node(construct_sisicon_span({
image = 'Information icon.svg',
link = 'Template:Textinfo',
alt = 'Documentation for the TextInfo template',
}))
:wikitext(textinfo_display)
end
local portalLI = construct_related_links(
args,
{
param = 'portal',
nsPrefix = 'Portal:',
linkPrefix = '[[Portal:Portals|related portals]]: '
},
{
image = 'Wikisource-logo.svg',
link = 'Portal:Portals',
alt = 'Related Portals'
}
)
if portalLI then
ul_list:node(portalLI)
end
local authorLI = construct_related_links(
args,
{
param = 'relatedauthor',
nsPrefix = 'Author:',
linkPrefix = '[[Wikisource:Authors|related authors]]: '
},
{
image = 'System-users.svg',
link = 'Wikisource:Authors',
alt = 'Related Authors'
}
)
if authorLI then
ul_list:node(authorLI)
end
local workLI = construct_related_links(
args,
{
param = 'relatedwork',
nsPrefix = '',
linkPrefix = '[[Wikisource:Works|related works]]: '
},
{
image = 'Nuvola apps bookcase.svg',
link = 'Wikisource:Works',
alt = 'Related Works'
}
)
if workLI then
ul_list:node(workLI)
end
local sisters = p._interprojectPart(args)
if sisters then
ul_list:node(sisters)
end
if yesno(args.wikidataswitch) and not item then
ul_list:tag('li')
:addClass('sisitem')
:node(construct_sisicon_span({
image = 'Wikidata-logo.svg',
link = 'Wikisource:Wikidata',
alt = 'Wikidata',
}))
:wikitext('[[d:Special:Search/' .. pagename .. '|Search Wikidata]]')
end
if not yesno(args.disambiguation) and not textinfo_display and not portalLI and not authorLI and not workLI and not sisters and not yesno(args.wikidataswitch) then
return nil
end
return current_frame:extensionTag('templatestyles', '', {src = 'Plain sister/styles.css'}) .. tostring(ul_list) .. table.concat(tracking_cats)
end
function p.plain_sister(frame)
return p._plain_sister(getArgs(frame))
end
return p
-- Debug console testing:
-- =p.interprojectPart(mw.getCurrentFrame():newChild{title='nop',args={wikidata='Q23308118'}})
nmzmtvufe79bnzmp0p4tixdhurib1nx
سانچہ:Anchor+
10
12963
32064
2025-07-05T06:54:09Z
en>Fish bowl
0
Undo revision [[Special:Diff/15181708|15181708]] by [[Special:Contributions/41.145.193.121|41.145.193.121]] ([[User talk:41.145.193.121|talk]])
32064
wikitext
text/x-wiki
<onlyinclude><templatestyles src="Template:Anchor/styles.css" /><span {{makeid|{{{a|{{{1|}}}}}}|blank=.}} title="Anchor:{{anchorencode:{{{a|{{{1|}}}}}}}}" class="wst-anchor {{{class|}}}">{{{label|{{{2|{{{1|}}}}}}}}}</span>{{#ifeq:{{#invoke:Isdigit|_isdigit|{{{a|{{{1|}}}}}}}}|true|[[Category:Anchor which is numeric]]|}}</onlyinclude>
{{documentation}}
syibplbw9yzsy3tnq541117yc5f6729
32065
32064
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Template:Anchor+]] سے 1 نسخہ درآمد کیا گیا
32064
wikitext
text/x-wiki
<onlyinclude><templatestyles src="Template:Anchor/styles.css" /><span {{makeid|{{{a|{{{1|}}}}}}|blank=.}} title="Anchor:{{anchorencode:{{{a|{{{1|}}}}}}}}" class="wst-anchor {{{class|}}}">{{{label|{{{2|{{{1|}}}}}}}}}</span>{{#ifeq:{{#invoke:Isdigit|_isdigit|{{{a|{{{1|}}}}}}}}|true|[[Category:Anchor which is numeric]]|}}</onlyinclude>
{{documentation}}
syibplbw9yzsy3tnq541117yc5f6729
سانچہ:Yesno
10
12964
32066
2024-06-14T16:49:44Z
en>CalendulaAsteraceae
0
Protected "[[Template:Yesno]]": High traffic page or template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32066
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }}
|no
|n
|f
|false
|off
|0 = {{{no|<!-- null -->}}}
| = {{{blank|{{{no|<!-- null -->}}}}}}
|¬ = {{{¬|}}}
|yes
|y
|t
|true
|on
|1 = {{{yes|yes}}}
|#default = {{{def|{{{yes|yes}}}}}}
}}<noinclude>
{{Documentation}}
</noinclude>
bioaq6x8oitfnx7oqmfhviol4hbp1nd
32067
32066
2026-04-22T02:14:41Z
Satdeep Gill
85
[[:en:Template:Yesno]] سے 1 نسخہ درآمد کیا گیا
32066
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#switch: {{<includeonly>safesubst:</includeonly>lc: {{{1|¬}}} }}
|no
|n
|f
|false
|off
|0 = {{{no|<!-- null -->}}}
| = {{{blank|{{{no|<!-- null -->}}}}}}
|¬ = {{{¬|}}}
|yes
|y
|t
|true
|on
|1 = {{{yes|yes}}}
|#default = {{{def|{{{yes|yes}}}}}}
}}<noinclude>
{{Documentation}}
</noinclude>
bioaq6x8oitfnx7oqmfhviol4hbp1nd
سانچہ:Anchor
10
12965
32068
2024-02-16T15:45:12Z
en>ShakespeareFan00
0
Replaced content with "{{#invoke:Anchor|anchor}}<noinclude>{{documentation}}</noinclude>"
32068
wikitext
text/x-wiki
{{#invoke:Anchor|anchor}}<noinclude>{{documentation}}</noinclude>
91xjolh50h68e2zwwmanttvyozyjrqd
32069
32068
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Anchor]] سے 1 نسخہ درآمد کیا گیا
32068
wikitext
text/x-wiki
{{#invoke:Anchor|anchor}}<noinclude>{{documentation}}</noinclude>
91xjolh50h68e2zwwmanttvyozyjrqd
سانچہ:Str left
10
12966
32070
2017-09-29T13:07:54Z
en>Beleg Tâl
0
19 revisions imported from [[:commons:Template:Str_left]]: Contains material copyrighted in source country
32070
wikitext
text/x-wiki
<includeonly>{{ {{{|safesubst:}}}padleft:|{{{2|1}}}|{{{1}}}}}</includeonly><noinclude>
{{heavily used template}}
{{documentation}}
</noinclude>
tqfq8u3hctmwbhh4pvher9gkphm721b
32071
32070
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Str_left]] سے 1 نسخہ درآمد کیا گیا
32070
wikitext
text/x-wiki
<includeonly>{{ {{{|safesubst:}}}padleft:|{{{2|1}}}|{{{1}}}}}</includeonly><noinclude>
{{heavily used template}}
{{documentation}}
</noinclude>
tqfq8u3hctmwbhh4pvher9gkphm721b
سانچہ:Shortcut
10
12967
32072
2024-09-26T20:37:52Z
en>ShakespeareFan00
0
Delint - Does anything actually use the ID on this?
32072
wikitext
text/x-wiki
<templatestyles src="Shortcut/styles.css" /><includeonly><div <!--id="shortcut"--> class="wst-shortcut noprint"><div><div><div>
<span>[[Wikisource:Shortcut|Shortcut]]: </span><br>{{{1}}}
</div></div></div></div></includeonly><noinclude>{{documentation}}</noinclude>
a94qk2ipe5k7yerjm567nz7e8m1wsh8
32073
32072
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Shortcut]] سے 1 نسخہ درآمد کیا گیا
32072
wikitext
text/x-wiki
<templatestyles src="Shortcut/styles.css" /><includeonly><div <!--id="shortcut"--> class="wst-shortcut noprint"><div><div><div>
<span>[[Wikisource:Shortcut|Shortcut]]: </span><br>{{{1}}}
</div></div></div></div></includeonly><noinclude>{{documentation}}</noinclude>
a94qk2ipe5k7yerjm567nz7e8m1wsh8
ماڈیول:Auto parents
828
12968
32074
2024-03-31T19:49:51Z
en>CalendulaAsteraceae
0
Changed protection settings for "[[Module:Auto parents]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32074
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
--[=[
Return a formatted list of links referring to the parents of the current page
Parameters:
* page: the page title to use, if not the current page name
* display: an override display title to use for the top level.
* no_links: if yes, do not link page titles
* existing_links: if yes, check whether pages exist before making them links
Example:
* page = A/B/C/D => [[A|A]], [[A/B|B]], [[A/B/C|C]]
* page = A/B/C, display=Foo => [[A|Foo]], [[A/B|B]]
]=]
function p._parent_links(args)
args = args or {}
local no_links = yesno(args.no_links or args['no links']) or false
local existing_links = yesno(args.existing_links or args['existing links']) or false
-- select override page name if given
local title
if args['page'] then
title = mw.title.new(args['page'])
else
title = mw.title.getCurrentTitle()
end
local title_text = title.prefixedText
-- the parts of the page title
local parts = mw.text.split(title_text, '/', true)
-- collected links for each parent
-- at the top level, substitute the work display name if needed
-- don't include namespace in link name
local links = {
args['display'] or title.rootText
}
if not no_links and (not existing_links or (existing_links and mw.title.new(parts[1]).exists)) then
links[1] = '[[' .. parts[1] .. '|' .. links[1] .. ']]'
end
-- count forwards from the second-highest level to the second-lowest
-- (the lowest level is the current page, not a parent)
for level = 2, #parts - 1, 1 do
local link_name = parts[level]
local link_target = table.concat(parts, '/', 1, level)
-- construct the link wikitext
local link
if no_links then
link = link_name
elseif existing_links then
if mw.title.new(link_target).exists then
link = '[[' .. link_target .. '|' .. link_name .. ']]'
else
link = link_name
end
else
link = '[[' .. link_target .. '|' .. link_name .. ']]'
end
table.insert(links, link)
end
return table.concat(links, ', ')
end
function p.parent_links(frame)
return p._parent_links(getArgs(frame))
end
return p
j7sn3m9vhy2mcu49o2fno3trbn54cc8
32075
32074
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Module:Auto_parents]] سے 1 نسخہ درآمد کیا گیا
32074
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
--[=[
Return a formatted list of links referring to the parents of the current page
Parameters:
* page: the page title to use, if not the current page name
* display: an override display title to use for the top level.
* no_links: if yes, do not link page titles
* existing_links: if yes, check whether pages exist before making them links
Example:
* page = A/B/C/D => [[A|A]], [[A/B|B]], [[A/B/C|C]]
* page = A/B/C, display=Foo => [[A|Foo]], [[A/B|B]]
]=]
function p._parent_links(args)
args = args or {}
local no_links = yesno(args.no_links or args['no links']) or false
local existing_links = yesno(args.existing_links or args['existing links']) or false
-- select override page name if given
local title
if args['page'] then
title = mw.title.new(args['page'])
else
title = mw.title.getCurrentTitle()
end
local title_text = title.prefixedText
-- the parts of the page title
local parts = mw.text.split(title_text, '/', true)
-- collected links for each parent
-- at the top level, substitute the work display name if needed
-- don't include namespace in link name
local links = {
args['display'] or title.rootText
}
if not no_links and (not existing_links or (existing_links and mw.title.new(parts[1]).exists)) then
links[1] = '[[' .. parts[1] .. '|' .. links[1] .. ']]'
end
-- count forwards from the second-highest level to the second-lowest
-- (the lowest level is the current page, not a parent)
for level = 2, #parts - 1, 1 do
local link_name = parts[level]
local link_target = table.concat(parts, '/', 1, level)
-- construct the link wikitext
local link
if no_links then
link = link_name
elseif existing_links then
if mw.title.new(link_target).exists then
link = '[[' .. link_target .. '|' .. link_name .. ']]'
else
link = link_name
end
else
link = '[[' .. link_target .. '|' .. link_name .. ']]'
end
table.insert(links, link)
end
return table.concat(links, ', ')
end
function p.parent_links(frame)
return p._parent_links(getArgs(frame))
end
return p
j7sn3m9vhy2mcu49o2fno3trbn54cc8
سانچہ:TOC right
10
12969
32076
2022-09-03T06:54:12Z
en>Xover
0
use max-width instead of width to allow it to shrink with shorter headings
32076
wikitext
text/x-wiki
<templatestyles src="Template:TOC_right/styles.css" />{{#if:{{{limit|}}}|<templatestyles src="Template:TOC limit/styles.css" />}}<!--
--><div class="tocright {{#if:{{{clear|}}}|tocright-clear-{{{clear|}}}}} {{#if:{{{limit|}}}|toclimit-{{{limit}}}}}" style="{{#if:{{{width|{{{1|}}}}}}|max-width: {{{width|{{{1}}}}}};}}">__TOC__</div><noinclude>
{{documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
nqoxgl5w46pu5z80k5tlxnw1z730mul
32077
32076
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:TOC_right]] سے 1 نسخہ درآمد کیا گیا
32076
wikitext
text/x-wiki
<templatestyles src="Template:TOC_right/styles.css" />{{#if:{{{limit|}}}|<templatestyles src="Template:TOC limit/styles.css" />}}<!--
--><div class="tocright {{#if:{{{clear|}}}|tocright-clear-{{{clear|}}}}} {{#if:{{{limit|}}}|toclimit-{{{limit}}}}}" style="{{#if:{{{width|{{{1|}}}}}}|max-width: {{{width|{{{1}}}}}};}}">__TOC__</div><noinclude>
{{documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
nqoxgl5w46pu5z80k5tlxnw1z730mul
سانچہ:TOC right/styles.css
10
12970
32078
2024-08-04T20:19:05Z
en>CalendulaAsteraceae
0
32078
sanitized-css
text/css
.tocright {
float: right;
clear: right;
width: auto;
background: none;
padding: .5em 0 .8em 1.4em;
margin-bottom: .5em;
}
.tocright-clear-left {
clear: left;
}
.tocright-clear-both {
clear: both;
}
.tocright-clear-none {
clear: none;
}
/* on very small screens, don't allow a content "sliver" up the left side */
@media screen and ( max-width: 720px ) {
.tocright {
width: 100%;
}
}
8pdldcabbl3mdi2wgpqvne1s73zq9o4
32079
32078
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:TOC_right/styles.css]] سے 1 نسخہ درآمد کیا گیا
32078
sanitized-css
text/css
.tocright {
float: right;
clear: right;
width: auto;
background: none;
padding: .5em 0 .8em 1.4em;
margin-bottom: .5em;
}
.tocright-clear-left {
clear: left;
}
.tocright-clear-both {
clear: both;
}
.tocright-clear-none {
clear: none;
}
/* on very small screens, don't allow a content "sliver" up the left side */
@media screen and ( max-width: 720px ) {
.tocright {
width: 100%;
}
}
8pdldcabbl3mdi2wgpqvne1s73zq9o4
سانچہ:TOCright
10
12971
32080
2020-08-11T11:49:56Z
en>Xover
0
convert to redirect to updated version imported from enwp
32080
wikitext
text/x-wiki
#REDIRECT [[Template:TOC right]]
tfpobd5x8b68zq6g7n1kinn14h0dhry
32081
32080
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:TOCright]] سے 1 نسخہ درآمد کیا گیا
32080
wikitext
text/x-wiki
#REDIRECT [[Template:TOC right]]
tfpobd5x8b68zq6g7n1kinn14h0dhry
سانچہ:Parameter
10
12972
32082
2025-07-05T06:54:06Z
en>Fish bowl
0
Undo revision [[Special:Diff/15181714|15181714]] by [[Special:Contributions/41.145.193.121|41.145.193.121]] ([[User talk:41.145.193.121|talk]])
32082
wikitext
text/x-wiki
<includeonly><templatestyles src="Template:Parameter/styles.css" /><span class="wst-doc-parameter">{{{1}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
ovxxduap402ls1tuoyi5ofg7zulpmbi
32083
32082
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Parameter]] سے 1 نسخہ درآمد کیا گیا
32082
wikitext
text/x-wiki
<includeonly><templatestyles src="Template:Parameter/styles.css" /><span class="wst-doc-parameter">{{{1}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
ovxxduap402ls1tuoyi5ofg7zulpmbi
سانچہ:Header/doc
10
12973
32084
2025-07-19T17:18:22Z
en>Alien333
0
update use counts
32084
wikitext
text/x-wiki
{{Documentation subpage}}
{{#ifeq:{{ROOTPAGENAME}}|Translation header|{{high-use|4214}}<!--https://petscan.wmflabs.org/?psid=27045436-->|{{high-use|453170}}<!--https://petscan.wmflabs.org/?psid=26937518-->}}
{{lua|Module:Header}}
{{#ifeq:{{ROOTPAGENAME}}|Translation header|{{uses TemplateStyles|Template:Header/styles.css|Template:Translation header/styles.css|Template:Header structure/styles.css}}|{{uses TemplateStyles|Template:Header/styles.css|Template:Header structure/styles.css}}}}
<!-- PLEASE ADD TEMPLATE CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->{{TOCright}}
This template can be preloaded via the [[Special:Preferences|Gadgets]], alternatively, one can preload [[Template:{{ROOTPAGENAME}}/preload]].
<section begin="Usage" />{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext" copy>
{{translation header
| title =
| author =
| translator =
| section =
| previous =
| next =
| year =
| language =
| original =
| notes =
}}
</syntaxhighlight><!--
-->|<syntaxhighlight lang="wikitext" copy>
{{header
| title =
| author =
| translator =
| section =
| previous =
| next =
| year =
| notes =
}}
</syntaxhighlight><!--
-->}}<section end="Usage" />
This template is meant to be used at the top of a work<ref group=notes>Certain projects have customised versions of {{tl|header}} that are used to present these works, eg. {{tl|DNB00}} is used for the project involved with [[Dictionary of National Biography]]. For these works it is permissible and recommended that these variations are used. New alternatives to {{tl|header}} should be discussed on the talk page, and consequentially listed on each project's pages.</ref> in the {{#switch:{{ROOTPAGENAME}}|Translation header='''Translation:'''|#default=main}} [[Help:Namespaces|namespace]] and its subsections. Fill in any relevant information, and leave unknown or inapplicable parameters empty. For easy use, see also the ''[[Help:Header preloading script gadget|header preloading script gadget]]'' in your preferences.
==Documentation==
===Parameters===
==== Standard ====
* {{parameter|title}} = title of the work, for subpage use [[#Relative links|relative links]] (mandatory)
* {{parameter|author}} = name of author (automatically wikilinks)
** use [[#author-display|{{parameter|author-display}}]] to change how {{parameter|author}} displays
** where control of linking is required use [[#author-nolink|{{parameter|author-nolink}}]], and leave the field empty
* {{parameter|section}} = name of subdivision of work, usually used on subpages, typically text without additional formatting
* {{parameter|previous}} = name of previous part of work; relative links on subpages, full links otherwise
* {{parameter|next}} = name of next part of work, relative links on subpages, full links otherwise
* {{parameter|notes}} = notes to explain the work, to add context, or to impart concise information that adds value to the reader; for example, use of {{tl|listen}}
====Optional====
* Parameters modifying {{parameter|author}}
** {{anchor|author-display}}{{parameter|author-display}}, used to change how {{parameter|author}} displays.
**: By default, <syntaxhighlight lang="wikitext" inline>| author = Winston Leonard Spencer Churchill</syntaxhighlight> will produce the link [[Author:Winston Leonard Spencer Churchill|Winston Leonard Spencer Churchill]], and <syntaxhighlight lang="wikitext" inline>| author = Winston Churchill (1871-1947)</syntaxhighlight> will produce the link [[Author:Winston Churchill (1871-1947)|Winston Churchill]], but <syntaxhighlight lang="wikitext" inline>| author = Winston Leonard Spencer Churchill | author-display = Winston Churchill</syntaxhighlight> will produce the link [[Author:Winston Leonard Spencer Churchill|Winston Churchill]].
** {{anchor+|author-nolink|{{parameter|author-nolink}}}}, which disables automatic linking of the author parameter if true.
**: <syntaxhighlight lang="wikitext" inline>| author = the [[Portal:United States Congress|United States Congress]] | author-nolink = true</syntaxhighlight> will display the author as "the [[Portal:United States Congress|United States Congress]]".
** {{parameter|section-author}} = name of the author of this section, if not the same as author the overall work; or synonym {{parameter|contributor}}.
** {{parameter|author2}}, {{parameter|author2-display}}, {{parameter|section-author2}}, {{parameter|section-author2-display}}, etc. for additional authors. For example, <syntaxhighlight lang="wikitext" inline>| author1 = Winston Churchill (1871-1947) | author2 = Winston Leonard Spencer Churchill | author2-display = Winston Churchill</syntaxhighlight> will display as "[[Author:Winston Churchill (1871-1947)|Winston Churchill]] and [[Author:Winston Leonard Spencer Churchill|Winston Churchill]]".
** {{anchor|override-author}}{{parameter|override-author}} = legacy parameter for unusual cases. When using this, please leave the author field empty. It is not possible to have more than one {{parameter|override-author}} parameter.
* All attribution parameters have the same behavior as author w.r.t. <code>-display</code>, <code>-nolink</code>, <code>section-</code> and additional values.
{{#invoke:Header/docdata|attrParamList}}
* {{parameter|year}} = year of publication, adds work to the category for the year, see [[:Category:Works by year]].
*:Enter "?" for a work with no known publication year, and leave blank if you simply don't have this information.
*:Do not use AD or CE for any Anno Domini/Current Era works (year 1 to the present). Use BCE (do not use BC) for all years before year 1; leave a space between the number and the letters (''e.g.'' <code>150 BCE</code>).
*:Approximate dates can be entered in one of the following ways:
*:#Decades, centuries or periods can be used instead of a year (''e.g.'' <code>1060s</code>, <code>11th century</code> or <code>Medieval</code>).
*:#To use a year in the circa format, enter it as "c/Y" (''e.g.'' <code>c/1066</code> or <code>c/150 BCE</code>). (The use of "ca" or "circa" instead of "c" will also be recognised.) This will display as, for example, "c. 1066".
*:#To use a approximate choice of two years, enter it as "Y/Y" (''e.g.'' <code>1066/1067</code>). This will display as it is written.
*: The behaviour of this parameter can be further modified by:
*:* {{parameter|noyear}} = will prevent the year being displayed in the header but will still add the work to the category for the year. For use in cases where the year is already included in the title of the work. Any use of this parameter, even without text, will work. Example: <code>| noyear = yes</code>. All pages with this parameter will be added to [[:Category:Pages with noyear]] for tracking its usage.
*:* {{parameter|noyearcat}} = will display the year but in the header but will not add the work to the category for the year. For use in cases where a specific subcategory exists for the type of work to avoid flooding the main category for the year. As above, any use of the parameter will trigger this action. Pages will be added to the tracking category [[:Category:Pages with noyearcat]].
*:* {{parameter|nolanguagecat}} = will prevent the header from categorizing by language. Pages will be added to the tracking category [[:Category:Pages with nolanguagecat]].
* {{parameter|textinfo}} <code>= yes</code> to refer to further information on the work's talk page.
* {{parameter|textinfotitle}} <code>= {{var|title}}</code> to refer to further information on another work's talk page.
<!-- * {{parameter|categories}} = Forward-slash-separated list of categories; deprecated -->
* {{parameter|shortcut}} = The shortcut to this page, if it exists. This is normally reserved for very large reference works (''e.g.'' [[EB11]])
* {{parameter|cover}} = The image used as a cover for the book when exported. Do not include the "File:" prefix, e.g. <code>Foobar.jpg</code>. You can use a page of a multi-page file using <code>Foobar.djvu/7</code>.
* {{anchor+|defaultsort|{{parameter|sortkey}}, {{parameter|defaultsort}}}}: For sorting purposes the template will move the articles "a", "an" and "the" to the end of the title, on the root page and all its subpages; for example, [[The Times/1854/News/The Charge of the Light Brigade]] will be sorted as "Times, The/1854/News/Charge of the Light Brigade, The". To override this, set {{parameter|sortkey}} to the desired sort key, e.g. <code>sortkey = Charge of the Light Brigade, The</code>.
* {{parameter|language}} = ISO code of the language in which the work was originally written ([[Template:ISO 639 name/doc|find the ISO code here]]—be sure to use the first one listed); adds work to the category for the original language; see [[:Category:Translations]]. Use with {{tl|translation header}} and {{tl|translations}}.<!--
-->{{#ifeq:{{ROOTPAGENAME}}|Translation header|
* '''{{tl|Translation header}} only:'''
** {{parameter|original}} = name of the page that hosts the original language work (or chapter) on the [[:mul:|appropriate language Wikisource]]. A standard [[Help:Interlanguage links|interlanguage link]] to the original language work (or chapter) should also be present, though.<!--
-->}}
* {{parameter|nocat}} <code>= true</code> to turn off automatic categorization (except for tracking categories)
* See [[#Sister, related author, and portal wiki links|Sister, related author, and portal wiki links]]
** {{parameter|portal}}
** {{parameter|related-author}}
* Sister wiki links are now typically now provided through Wikidata linking, which manages link rot issues. So while the parameters are shown here for fullness of scope, such usage would be used to override automated linking rather than as a primary use.
====All parameters====
<section begin="Full" />{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext" highlight="9,20,23,25,28">
{{translation header
| title =
| author =
| author-display =
| section =
| previous =
| next =
| notes =
<!-- optional from here -->
| year =
| textinfo =
| textinfotitle =
| translator =
| translator-display =
| related-author =
| portal =
| contributor =
| editor =
| cover =
| shortcut =
<!-- modifying "year" behaviour; use one of -->
| noyear =
| noyearcat =
<!-- modifying sorting behaviour -->
| sortkey =
<!-- translation header -->
| language =
| original =
<!-- provided through wikidata, can be used to override wikidata -->
| wikipedia =
| commons =
| commonscat =
| wikiquote =
| wikinews =
| wiktionary =
| wikibooks =
| wikiversity =
| wikispecies =
| wikivoyage =
| meta =
}}
</syntaxhighlight><!--
-->|<syntaxhighlight lang="wikitext" highlight="9,20,23,25">
{{header
| title =
| author =
| author-display =
| section =
| previous =
| next =
| notes =
<!-- optional from here -->
| year =
| textinfo =
| textinfotitle =
| translator =
| translator-display =
| related-author =
| portal =
| contributor =
| editor =
| cover =
| shortcut =
<!-- modifying "year" behaviour; use one of -->
| noyear =
| noyearcat =
<!-- modifying sorting behaviour -->
| sortkey =
<!-- provided through wikidata, can be used to override wikidata -->
| wikipedia =
| commons =
| commonscat =
| wikiquote =
| wikinews =
| wiktionary =
| wikibooks =
| wikiversity =
| wikispecies =
| wikivoyage =
| meta =
}}
</syntaxhighlight><!--
-->}}<section end="Full" />
===Relative links===
With lengthy, multi-page works, using [[m:Help:Link#Subpage feature|relative links]] is highly recommended. This shortens the code and ensures that a work remains linked together even if it is moved or reorganised. The three formats are <nowiki>[[/subpage]]</nowiki> (subpage), <nowiki>[[../]]</nowiki> (parent), and <nowiki>[[../sibling]]</nowiki> (sibling)<ref>The specific form <nowiki>[[../sibling/]]</nowiki> can be used on a sibling to provide both a relative link, and the link label to a sibling page.</ref>; see the example usage below. Note that <nowiki>[[../]]</nowiki> will expand to the title of the parent page, which is ideal if the work is renamed at a later time.
This depends on a page conforming to the page title standards in the [[WS:STYLE|Style guide]], with works in the form <nowiki>[[Work title]]</nowiki> and <nowiki>[[Work title/Subpage]]</nowiki>.
{{smallrefs}}
===Chapter titles===
In general, include chapter titles in the "section" field, but avoid including them in the "previous" and "next" fields. For example:
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext">
{{translation header
| title = [[../|Aurora de Chile]]
| author = Camilo Henríquez
| translator =
| section = Issue 28. Thursday, August 20, 1812. Volume 1.
| previous = [[../27|Issue 27]]
| next = [[../29|Issue 29]]
| language = es
| original =
| year = 1812
| notes = Click on the section headers to go to each article's individual page.
}}
</syntaxhighlight>
{{translation header
| title = [[Translation:Aurora de Chile|Aurora de Chile]]
| author = Camilo Henríquez
| translator =
| section = Issue 28. Thursday, August 20, 1812. Volume 1.
| previous = [[Translation:Aurora de Chile/27|Issue 27]]
| next = [[Translation:Aurora de Chile/29|Issue 29]]
| language = es
| original =
| year = 1812
| notes = Click on the section headers to go to each article's individual page.
}}<!--
-->|<syntaxhighlight lang="wikitext">
{{header
| title = [[../|The Book of Scottish Song]]
| author =
| editor = Alexander Whitelaw
| translator =
| section = Jock o' Hazeldean
| contributor = Walter Scott
| previous = [[../Sing on, sing on/]]
| next = [[../The Laird o' Cockpen/]]
| year = 1843
| notes =
}}
</syntaxhighlight>
{{header
| title = [[The Book of Scottish Song|The Book of Scottish Song]]
| author =
| editor = Alexander Whitelaw
| translator =
| section = Jock o' Hazeldean
| contributor = Walter Scott
| previous = [[The Book of Scottish Song/Sing on, sing on|Sing on, sing on]]
| next = [[The Book of Scottish Song/The Laird o' Cockpen|The Laird o' Cockpen]]
| year = 1843
| notes =
}}
}}
}}
==Usage examples==
===Normal===
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = [[../]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[../Chapter 2/]]
| next = [[../Chapter 4/]]
| notes =
}}
</syntaxhighlight>
{{translation header
| title = [[Alice's Adventures in Wonderland (1866)|Alice's Adventures in Wonderland]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[Alice's Adventures in Wonderland (1866)/Chapter 2|Chapter 2]]
| next = [[Alice's Adventures in Wonderland (1866)/Chapter 4|Chapter 4]]
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = [[../]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[../Chapter 2/]]
| next = [[../Chapter 4/]]
| notes =
}}
</syntaxhighlight>
{{header
| title = [[Alice's Adventures in Wonderland (1866)|Alice's Adventures in Wonderland]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[Alice's Adventures in Wonderland (1866)/Chapter 2|Chapter 2]]
| next = [[Alice's Adventures in Wonderland (1866)/Chapter 4|Chapter 4]]
| notes =
}}
}}
}}
===No author link===
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
</syntaxhighlight>
{{translation header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
</syntaxhighlight>
{{header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
}}
}}
===Translation===
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext">
{{translation header
| title = Sleeping Beauty
| author =
| section =
| previous =
| next =
| translator = Hammurabi
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
</syntaxhighlight>
{{translation header
| title = Sleeping Beauty
| author =
| section =
| previous =
| next =
| translator = Hammurabi
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
{{translation header
| title = Sleeping Beauty
| author =
| section =
| previous =
| next =
| translator = Hammurabi
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Fables
| author = Jean de La Fontaine
| translator = Elizur Wright
| section =
| previous =
| next =
| notes =
}}
</syntaxhighlight>
{{header
| title = Fables
| author = Jean de La Fontaine
| translator = Elizur Wright
| section =
| previous =
| next =
| notes =
}}
}}
}}
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext">
{{translation header
| title = Sleeping Beauty
| author =
| section = Example
| previous =
| next =
| translator1 = Robert Burns (1759-1796)
| translator1-display = Robert Burns
| translator2 = Federico García Lorca
| section-translator = unknown
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
</syntaxhighlight>
{{translation header
| title = Sleeping Beauty
| author =
| section = Example
| previous =
| next =
| translator1 = Robert Burns (1759-1796)
| translator1-display = Robert Burns
| translator2 = Federico García Lorca
| section-translator = unknown
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Pantagruel
| author = François Rabelais
| translator1 = Thomas Urquhart
| translator2 = Peter Antony Motteux
| section-translator = unknown
| section = Example
| previous =
| next =
| notes =
}}
</syntaxhighlight>
{{header
| title = Pantagruel
| author = François Rabelais
| translator1 = Thomas Urquhart
| translator2 = Peter Antony Motteux
| section-translator = unknown
| section = Example
| previous =
| next =
| notes =
}}
}}
}}
==Categories==
<pre>
| categories = 1st category / 2nd category
</pre>
'''Note:''' that use of this methodology excludes further editing by use of the ''HotCat'' tool, so this form should only be used where the categories are unlikely to need to be altered
==Sister, related author, and portal wiki links==
You can link to Wikisource portals and other WMF projects using the optional wiki links parameters '''where required to override the data''' provided from Wikidata. These are:
*{{parameter|portal}}, {{parameter|related-author}}
* {{parameter|wikipedia}}, {{parameter|wikispecies}}, {{parameter|commons}}, {{parameter|commonscat}}, {{parameter|wikiquote}}, {{parameter|wikinews}}, {{parameter|wiktionary}}, {{parameter|wikibooks}}, {{parameter|wikiversity}}, {{parameter|meta}} are typically applied from Wikidata data through interwiki links, or through linking of {{property|P921}} so should only be used to override the default
For portal this would generally be added to the root page of a work, rather than added repeatedly for each subpage. Usage on a subpage would be useful where the subpage alone has a relationship with the specified portal, whereas the parent work does not have that relationship.
{{smaller|These links are generated using {{tl|plain sister}}}}
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
</syntaxhighlight>
{{translation header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
</syntaxhighlight>
{{header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
}}
}}
;List
* {{parameter|wikipedia}}
* {{parameter|commons}}
* {{parameter|commonscat}}
* {{parameter|wikiquote}}
* {{parameter|wikinews}}
* {{parameter|wiktionary}}
* {{parameter|wikibooks}}
* {{parameter|wikiversity}}
* {{parameter|wikispecies}}
* {{parameter|wikivoyage}}
* {{parameter|wikidata}}
* {{parameter|meta}}
==Shortcuts==
If a work has a shortcut, you can add it using the {{parameter|shortcut}} field. This should be in accordance with the [[WS:SHORT|shortcut guidelines]], and shortcuts should ''not'' be used for every work.
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
</syntaxhighlight>
{{translation header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
</syntaxhighlight>
{{header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
}}
}}
==Advanced manipulation==
===Alternative headers===
<references group=notes />
===JavaScript extraction===
The header values can be extracted using [[w:JavaScript|JavaScript]] by accessing the text values of their span wrappers:
{| class="wikitable"
! value
! wrapper id
|-
| title
| header-title-text
|-
| author
| header-author-text
|-
| translator
| header-translator-text
|-
| previous
| headerprevious
|-
| next
| headernext
|-
| notes
| ''none''
|}
== Microformat ==
{{UF-hcard-person}}
== Technical ==
This template delegates some logic to Lua modules and uses sub templates to divide up the structural code:
* [[Module:Header]] the main logic for parameter handling
== Tracking categories ==
This template uses categories to track maintenance tasks, errors, and feature usage, which are grouped in [[:Category:Header tracking categories]].
==See also==
* [[MediaWiki:Proofreadpage header template]] for the auto-generated header available with <code><nowiki><pages header=1/></nowiki></code>
* {{tl|textinfo}} for recording information on work's talk page
* {{#ifeq:{{ROOTPAGENAME}}|Translation header|{{tl|header}} for template header used in mainspace|{{tl|translation header}} for template header used in '''Translation:''' namespace}}
* {{tl|versions}} and {{tl|translations}} which also use {{ml|Header|header}}
* {{tl|author}} for template header used in Author: namespace
* {{tl|process header}} for template header used in Wikisource: namespace
* {{tl|portal header}} for template header used in Portal: namespace
* {{tl|RunningHeader}} for the headers to be used in source texts
* <span class="plainlinks">[{{fullurl:Special:WhatLinksHere|target=Template:{{ROOTPAGENAME}}&namespace=10}} Derived templates leveraging Template:{{ROOTPAGENAME}}]</span>
Templates called by this template:
* {{tl|plain sister}}
* {{tl|shortcut}}
<!-- categories -->
<includeonly>
[[Category:Header templates]]
[[Category:Templates emitting hCard microformats]]
[[Category:Exclude in print]]
{{#ifeq:{{ROOTPAGENAME}}|Translation header|[[Category:Translation templates]]}}
</includeonly>
qh7x7ia2465yc35a4tb4tmzockyl835
32085
32084
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Header/doc]] سے 1 نسخہ درآمد کیا گیا
32084
wikitext
text/x-wiki
{{Documentation subpage}}
{{#ifeq:{{ROOTPAGENAME}}|Translation header|{{high-use|4214}}<!--https://petscan.wmflabs.org/?psid=27045436-->|{{high-use|453170}}<!--https://petscan.wmflabs.org/?psid=26937518-->}}
{{lua|Module:Header}}
{{#ifeq:{{ROOTPAGENAME}}|Translation header|{{uses TemplateStyles|Template:Header/styles.css|Template:Translation header/styles.css|Template:Header structure/styles.css}}|{{uses TemplateStyles|Template:Header/styles.css|Template:Header structure/styles.css}}}}
<!-- PLEASE ADD TEMPLATE CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->{{TOCright}}
This template can be preloaded via the [[Special:Preferences|Gadgets]], alternatively, one can preload [[Template:{{ROOTPAGENAME}}/preload]].
<section begin="Usage" />{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext" copy>
{{translation header
| title =
| author =
| translator =
| section =
| previous =
| next =
| year =
| language =
| original =
| notes =
}}
</syntaxhighlight><!--
-->|<syntaxhighlight lang="wikitext" copy>
{{header
| title =
| author =
| translator =
| section =
| previous =
| next =
| year =
| notes =
}}
</syntaxhighlight><!--
-->}}<section end="Usage" />
This template is meant to be used at the top of a work<ref group=notes>Certain projects have customised versions of {{tl|header}} that are used to present these works, eg. {{tl|DNB00}} is used for the project involved with [[Dictionary of National Biography]]. For these works it is permissible and recommended that these variations are used. New alternatives to {{tl|header}} should be discussed on the talk page, and consequentially listed on each project's pages.</ref> in the {{#switch:{{ROOTPAGENAME}}|Translation header='''Translation:'''|#default=main}} [[Help:Namespaces|namespace]] and its subsections. Fill in any relevant information, and leave unknown or inapplicable parameters empty. For easy use, see also the ''[[Help:Header preloading script gadget|header preloading script gadget]]'' in your preferences.
==Documentation==
===Parameters===
==== Standard ====
* {{parameter|title}} = title of the work, for subpage use [[#Relative links|relative links]] (mandatory)
* {{parameter|author}} = name of author (automatically wikilinks)
** use [[#author-display|{{parameter|author-display}}]] to change how {{parameter|author}} displays
** where control of linking is required use [[#author-nolink|{{parameter|author-nolink}}]], and leave the field empty
* {{parameter|section}} = name of subdivision of work, usually used on subpages, typically text without additional formatting
* {{parameter|previous}} = name of previous part of work; relative links on subpages, full links otherwise
* {{parameter|next}} = name of next part of work, relative links on subpages, full links otherwise
* {{parameter|notes}} = notes to explain the work, to add context, or to impart concise information that adds value to the reader; for example, use of {{tl|listen}}
====Optional====
* Parameters modifying {{parameter|author}}
** {{anchor|author-display}}{{parameter|author-display}}, used to change how {{parameter|author}} displays.
**: By default, <syntaxhighlight lang="wikitext" inline>| author = Winston Leonard Spencer Churchill</syntaxhighlight> will produce the link [[Author:Winston Leonard Spencer Churchill|Winston Leonard Spencer Churchill]], and <syntaxhighlight lang="wikitext" inline>| author = Winston Churchill (1871-1947)</syntaxhighlight> will produce the link [[Author:Winston Churchill (1871-1947)|Winston Churchill]], but <syntaxhighlight lang="wikitext" inline>| author = Winston Leonard Spencer Churchill | author-display = Winston Churchill</syntaxhighlight> will produce the link [[Author:Winston Leonard Spencer Churchill|Winston Churchill]].
** {{anchor+|author-nolink|{{parameter|author-nolink}}}}, which disables automatic linking of the author parameter if true.
**: <syntaxhighlight lang="wikitext" inline>| author = the [[Portal:United States Congress|United States Congress]] | author-nolink = true</syntaxhighlight> will display the author as "the [[Portal:United States Congress|United States Congress]]".
** {{parameter|section-author}} = name of the author of this section, if not the same as author the overall work; or synonym {{parameter|contributor}}.
** {{parameter|author2}}, {{parameter|author2-display}}, {{parameter|section-author2}}, {{parameter|section-author2-display}}, etc. for additional authors. For example, <syntaxhighlight lang="wikitext" inline>| author1 = Winston Churchill (1871-1947) | author2 = Winston Leonard Spencer Churchill | author2-display = Winston Churchill</syntaxhighlight> will display as "[[Author:Winston Churchill (1871-1947)|Winston Churchill]] and [[Author:Winston Leonard Spencer Churchill|Winston Churchill]]".
** {{anchor|override-author}}{{parameter|override-author}} = legacy parameter for unusual cases. When using this, please leave the author field empty. It is not possible to have more than one {{parameter|override-author}} parameter.
* All attribution parameters have the same behavior as author w.r.t. <code>-display</code>, <code>-nolink</code>, <code>section-</code> and additional values.
{{#invoke:Header/docdata|attrParamList}}
* {{parameter|year}} = year of publication, adds work to the category for the year, see [[:Category:Works by year]].
*:Enter "?" for a work with no known publication year, and leave blank if you simply don't have this information.
*:Do not use AD or CE for any Anno Domini/Current Era works (year 1 to the present). Use BCE (do not use BC) for all years before year 1; leave a space between the number and the letters (''e.g.'' <code>150 BCE</code>).
*:Approximate dates can be entered in one of the following ways:
*:#Decades, centuries or periods can be used instead of a year (''e.g.'' <code>1060s</code>, <code>11th century</code> or <code>Medieval</code>).
*:#To use a year in the circa format, enter it as "c/Y" (''e.g.'' <code>c/1066</code> or <code>c/150 BCE</code>). (The use of "ca" or "circa" instead of "c" will also be recognised.) This will display as, for example, "c. 1066".
*:#To use a approximate choice of two years, enter it as "Y/Y" (''e.g.'' <code>1066/1067</code>). This will display as it is written.
*: The behaviour of this parameter can be further modified by:
*:* {{parameter|noyear}} = will prevent the year being displayed in the header but will still add the work to the category for the year. For use in cases where the year is already included in the title of the work. Any use of this parameter, even without text, will work. Example: <code>| noyear = yes</code>. All pages with this parameter will be added to [[:Category:Pages with noyear]] for tracking its usage.
*:* {{parameter|noyearcat}} = will display the year but in the header but will not add the work to the category for the year. For use in cases where a specific subcategory exists for the type of work to avoid flooding the main category for the year. As above, any use of the parameter will trigger this action. Pages will be added to the tracking category [[:Category:Pages with noyearcat]].
*:* {{parameter|nolanguagecat}} = will prevent the header from categorizing by language. Pages will be added to the tracking category [[:Category:Pages with nolanguagecat]].
* {{parameter|textinfo}} <code>= yes</code> to refer to further information on the work's talk page.
* {{parameter|textinfotitle}} <code>= {{var|title}}</code> to refer to further information on another work's talk page.
<!-- * {{parameter|categories}} = Forward-slash-separated list of categories; deprecated -->
* {{parameter|shortcut}} = The shortcut to this page, if it exists. This is normally reserved for very large reference works (''e.g.'' [[EB11]])
* {{parameter|cover}} = The image used as a cover for the book when exported. Do not include the "File:" prefix, e.g. <code>Foobar.jpg</code>. You can use a page of a multi-page file using <code>Foobar.djvu/7</code>.
* {{anchor+|defaultsort|{{parameter|sortkey}}, {{parameter|defaultsort}}}}: For sorting purposes the template will move the articles "a", "an" and "the" to the end of the title, on the root page and all its subpages; for example, [[The Times/1854/News/The Charge of the Light Brigade]] will be sorted as "Times, The/1854/News/Charge of the Light Brigade, The". To override this, set {{parameter|sortkey}} to the desired sort key, e.g. <code>sortkey = Charge of the Light Brigade, The</code>.
* {{parameter|language}} = ISO code of the language in which the work was originally written ([[Template:ISO 639 name/doc|find the ISO code here]]—be sure to use the first one listed); adds work to the category for the original language; see [[:Category:Translations]]. Use with {{tl|translation header}} and {{tl|translations}}.<!--
-->{{#ifeq:{{ROOTPAGENAME}}|Translation header|
* '''{{tl|Translation header}} only:'''
** {{parameter|original}} = name of the page that hosts the original language work (or chapter) on the [[:mul:|appropriate language Wikisource]]. A standard [[Help:Interlanguage links|interlanguage link]] to the original language work (or chapter) should also be present, though.<!--
-->}}
* {{parameter|nocat}} <code>= true</code> to turn off automatic categorization (except for tracking categories)
* See [[#Sister, related author, and portal wiki links|Sister, related author, and portal wiki links]]
** {{parameter|portal}}
** {{parameter|related-author}}
* Sister wiki links are now typically now provided through Wikidata linking, which manages link rot issues. So while the parameters are shown here for fullness of scope, such usage would be used to override automated linking rather than as a primary use.
====All parameters====
<section begin="Full" />{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext" highlight="9,20,23,25,28">
{{translation header
| title =
| author =
| author-display =
| section =
| previous =
| next =
| notes =
<!-- optional from here -->
| year =
| textinfo =
| textinfotitle =
| translator =
| translator-display =
| related-author =
| portal =
| contributor =
| editor =
| cover =
| shortcut =
<!-- modifying "year" behaviour; use one of -->
| noyear =
| noyearcat =
<!-- modifying sorting behaviour -->
| sortkey =
<!-- translation header -->
| language =
| original =
<!-- provided through wikidata, can be used to override wikidata -->
| wikipedia =
| commons =
| commonscat =
| wikiquote =
| wikinews =
| wiktionary =
| wikibooks =
| wikiversity =
| wikispecies =
| wikivoyage =
| meta =
}}
</syntaxhighlight><!--
-->|<syntaxhighlight lang="wikitext" highlight="9,20,23,25">
{{header
| title =
| author =
| author-display =
| section =
| previous =
| next =
| notes =
<!-- optional from here -->
| year =
| textinfo =
| textinfotitle =
| translator =
| translator-display =
| related-author =
| portal =
| contributor =
| editor =
| cover =
| shortcut =
<!-- modifying "year" behaviour; use one of -->
| noyear =
| noyearcat =
<!-- modifying sorting behaviour -->
| sortkey =
<!-- provided through wikidata, can be used to override wikidata -->
| wikipedia =
| commons =
| commonscat =
| wikiquote =
| wikinews =
| wiktionary =
| wikibooks =
| wikiversity =
| wikispecies =
| wikivoyage =
| meta =
}}
</syntaxhighlight><!--
-->}}<section end="Full" />
===Relative links===
With lengthy, multi-page works, using [[m:Help:Link#Subpage feature|relative links]] is highly recommended. This shortens the code and ensures that a work remains linked together even if it is moved or reorganised. The three formats are <nowiki>[[/subpage]]</nowiki> (subpage), <nowiki>[[../]]</nowiki> (parent), and <nowiki>[[../sibling]]</nowiki> (sibling)<ref>The specific form <nowiki>[[../sibling/]]</nowiki> can be used on a sibling to provide both a relative link, and the link label to a sibling page.</ref>; see the example usage below. Note that <nowiki>[[../]]</nowiki> will expand to the title of the parent page, which is ideal if the work is renamed at a later time.
This depends on a page conforming to the page title standards in the [[WS:STYLE|Style guide]], with works in the form <nowiki>[[Work title]]</nowiki> and <nowiki>[[Work title/Subpage]]</nowiki>.
{{smallrefs}}
===Chapter titles===
In general, include chapter titles in the "section" field, but avoid including them in the "previous" and "next" fields. For example:
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext">
{{translation header
| title = [[../|Aurora de Chile]]
| author = Camilo Henríquez
| translator =
| section = Issue 28. Thursday, August 20, 1812. Volume 1.
| previous = [[../27|Issue 27]]
| next = [[../29|Issue 29]]
| language = es
| original =
| year = 1812
| notes = Click on the section headers to go to each article's individual page.
}}
</syntaxhighlight>
{{translation header
| title = [[Translation:Aurora de Chile|Aurora de Chile]]
| author = Camilo Henríquez
| translator =
| section = Issue 28. Thursday, August 20, 1812. Volume 1.
| previous = [[Translation:Aurora de Chile/27|Issue 27]]
| next = [[Translation:Aurora de Chile/29|Issue 29]]
| language = es
| original =
| year = 1812
| notes = Click on the section headers to go to each article's individual page.
}}<!--
-->|<syntaxhighlight lang="wikitext">
{{header
| title = [[../|The Book of Scottish Song]]
| author =
| editor = Alexander Whitelaw
| translator =
| section = Jock o' Hazeldean
| contributor = Walter Scott
| previous = [[../Sing on, sing on/]]
| next = [[../The Laird o' Cockpen/]]
| year = 1843
| notes =
}}
</syntaxhighlight>
{{header
| title = [[The Book of Scottish Song|The Book of Scottish Song]]
| author =
| editor = Alexander Whitelaw
| translator =
| section = Jock o' Hazeldean
| contributor = Walter Scott
| previous = [[The Book of Scottish Song/Sing on, sing on|Sing on, sing on]]
| next = [[The Book of Scottish Song/The Laird o' Cockpen|The Laird o' Cockpen]]
| year = 1843
| notes =
}}
}}
}}
==Usage examples==
===Normal===
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = [[../]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[../Chapter 2/]]
| next = [[../Chapter 4/]]
| notes =
}}
</syntaxhighlight>
{{translation header
| title = [[Alice's Adventures in Wonderland (1866)|Alice's Adventures in Wonderland]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[Alice's Adventures in Wonderland (1866)/Chapter 2|Chapter 2]]
| next = [[Alice's Adventures in Wonderland (1866)/Chapter 4|Chapter 4]]
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = [[../]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[../Chapter 2/]]
| next = [[../Chapter 4/]]
| notes =
}}
</syntaxhighlight>
{{header
| title = [[Alice's Adventures in Wonderland (1866)|Alice's Adventures in Wonderland]]
| author = Lewis Carroll
| section = Chapter 3: A Caucus-Race and a Long Tale
| previous = [[Alice's Adventures in Wonderland (1866)/Chapter 2|Chapter 2]]
| next = [[Alice's Adventures in Wonderland (1866)/Chapter 4|Chapter 4]]
| notes =
}}
}}
}}
===No author link===
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
</syntaxhighlight>
{{translation header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
</syntaxhighlight>
{{header
| title = Peerage Act 1963
| author = the [[Portal:Parliament of the United Kingdom|Parliament of the United Kingdom]] | author-nolink = true
| section =
| previous =
| next =
| year = 1963 | noyear = true
| notes =
}}
}}
}}
===Translation===
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext">
{{translation header
| title = Sleeping Beauty
| author =
| section =
| previous =
| next =
| translator = Hammurabi
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
</syntaxhighlight>
{{translation header
| title = Sleeping Beauty
| author =
| section =
| previous =
| next =
| translator = Hammurabi
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
{{translation header
| title = Sleeping Beauty
| author =
| section =
| previous =
| next =
| translator = Hammurabi
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Fables
| author = Jean de La Fontaine
| translator = Elizur Wright
| section =
| previous =
| next =
| notes =
}}
</syntaxhighlight>
{{header
| title = Fables
| author = Jean de La Fontaine
| translator = Elizur Wright
| section =
| previous =
| next =
| notes =
}}
}}
}}
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<syntaxhighlight lang="wikitext">
{{translation header
| title = Sleeping Beauty
| author =
| section = Example
| previous =
| next =
| translator1 = Robert Burns (1759-1796)
| translator1-display = Robert Burns
| translator2 = Federico García Lorca
| section-translator = unknown
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
</syntaxhighlight>
{{translation header
| title = Sleeping Beauty
| author =
| section = Example
| previous =
| next =
| translator1 = Robert Burns (1759-1796)
| translator1-display = Robert Burns
| translator2 = Federico García Lorca
| section-translator = unknown
| year = 1900
| language = es
| original = La bella durmiente del bosque
| commonscat = La bella durmiente del bosque
| notes =
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Pantagruel
| author = François Rabelais
| translator1 = Thomas Urquhart
| translator2 = Peter Antony Motteux
| section-translator = unknown
| section = Example
| previous =
| next =
| notes =
}}
</syntaxhighlight>
{{header
| title = Pantagruel
| author = François Rabelais
| translator1 = Thomas Urquhart
| translator2 = Peter Antony Motteux
| section-translator = unknown
| section = Example
| previous =
| next =
| notes =
}}
}}
}}
==Categories==
<pre>
| categories = 1st category / 2nd category
</pre>
'''Note:''' that use of this methodology excludes further editing by use of the ''HotCat'' tool, so this form should only be used where the categories are unlikely to need to be altered
==Sister, related author, and portal wiki links==
You can link to Wikisource portals and other WMF projects using the optional wiki links parameters '''where required to override the data''' provided from Wikidata. These are:
*{{parameter|portal}}, {{parameter|related-author}}
* {{parameter|wikipedia}}, {{parameter|wikispecies}}, {{parameter|commons}}, {{parameter|commonscat}}, {{parameter|wikiquote}}, {{parameter|wikinews}}, {{parameter|wiktionary}}, {{parameter|wikibooks}}, {{parameter|wikiversity}}, {{parameter|meta}} are typically applied from Wikidata data through interwiki links, or through linking of {{property|P921}} so should only be used to override the default
For portal this would generally be added to the root page of a work, rather than added repeatedly for each subpage. Usage on a subpage would be useful where the subpage alone has a relationship with the specified portal, whereas the parent work does not have that relationship.
{{smaller|These links are generated using {{tl|plain sister}}}}
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
</syntaxhighlight>
{{translation header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
</syntaxhighlight>
{{header
| title = Kinematics of Machinery
| author = Franz Reuleaux
| section =
| previous =
| next =
| notes =
| portal1 = Technology
| portal2 = Germany
| wikipedia = Kinematics of Machinery
| related-author = Albert Einstein
}}
}}
}}
;List
* {{parameter|wikipedia}}
* {{parameter|commons}}
* {{parameter|commonscat}}
* {{parameter|wikiquote}}
* {{parameter|wikinews}}
* {{parameter|wiktionary}}
* {{parameter|wikibooks}}
* {{parameter|wikiversity}}
* {{parameter|wikispecies}}
* {{parameter|wikivoyage}}
* {{parameter|wikidata}}
* {{parameter|meta}}
==Shortcuts==
If a work has a shortcut, you can add it using the {{parameter|shortcut}} field. This should be in accordance with the [[WS:SHORT|shortcut guidelines]], and shortcuts should ''not'' be used for every work.
{{doc example|
{{#ifeq:{{ROOTPAGENAME}}|Translation header<!--
-->|<!--TODO: replace with translation header example--><syntaxhighlight lang="wikitext">
{{translation header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
</syntaxhighlight>
{{translation header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
|<syntaxhighlight lang="wikitext">
{{header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
</syntaxhighlight>
{{header
| title = 1911 Encyclopædia Britannica
| author =
| section =
| previous =
| next =
| notes =
| shortcut = [[EB1911]]
}}
}}
}}
==Advanced manipulation==
===Alternative headers===
<references group=notes />
===JavaScript extraction===
The header values can be extracted using [[w:JavaScript|JavaScript]] by accessing the text values of their span wrappers:
{| class="wikitable"
! value
! wrapper id
|-
| title
| header-title-text
|-
| author
| header-author-text
|-
| translator
| header-translator-text
|-
| previous
| headerprevious
|-
| next
| headernext
|-
| notes
| ''none''
|}
== Microformat ==
{{UF-hcard-person}}
== Technical ==
This template delegates some logic to Lua modules and uses sub templates to divide up the structural code:
* [[Module:Header]] the main logic for parameter handling
== Tracking categories ==
This template uses categories to track maintenance tasks, errors, and feature usage, which are grouped in [[:Category:Header tracking categories]].
==See also==
* [[MediaWiki:Proofreadpage header template]] for the auto-generated header available with <code><nowiki><pages header=1/></nowiki></code>
* {{tl|textinfo}} for recording information on work's talk page
* {{#ifeq:{{ROOTPAGENAME}}|Translation header|{{tl|header}} for template header used in mainspace|{{tl|translation header}} for template header used in '''Translation:''' namespace}}
* {{tl|versions}} and {{tl|translations}} which also use {{ml|Header|header}}
* {{tl|author}} for template header used in Author: namespace
* {{tl|process header}} for template header used in Wikisource: namespace
* {{tl|portal header}} for template header used in Portal: namespace
* {{tl|RunningHeader}} for the headers to be used in source texts
* <span class="plainlinks">[{{fullurl:Special:WhatLinksHere|target=Template:{{ROOTPAGENAME}}&namespace=10}} Derived templates leveraging Template:{{ROOTPAGENAME}}]</span>
Templates called by this template:
* {{tl|plain sister}}
* {{tl|shortcut}}
<!-- categories -->
<includeonly>
[[Category:Header templates]]
[[Category:Templates emitting hCard microformats]]
[[Category:Exclude in print]]
{{#ifeq:{{ROOTPAGENAME}}|Translation header|[[Category:Translation templates]]}}
</includeonly>
qh7x7ia2465yc35a4tb4tmzockyl835
سانچہ:Label
10
12974
32086
2020-11-21T01:33:39Z
en>Uzume
0
sync from [[d:Template:Label]]
32086
wikitext
text/x-wiki
{{#if:{{{item|{{{1|}}} }}}|
{{#invoke:Wikidata label|getLabel
|item={{{item|{{{1|}}} }}}
|lang={{{lang|{{{2|}}} }}}
|link={{{link|-}}}
|capitalization={{{capitalization|none}}}
|show_id={{{show_id|}}}
}}
}}<noinclude>
{{documentation}}</noinclude>
3n5b146mlbpr2piyuavzxrctzu75y5c
32087
32086
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Label]] سے 1 نسخہ درآمد کیا گیا
32086
wikitext
text/x-wiki
{{#if:{{{item|{{{1|}}} }}}|
{{#invoke:Wikidata label|getLabel
|item={{{item|{{{1|}}} }}}
|lang={{{lang|{{{2|}}} }}}
|link={{{link|-}}}
|capitalization={{{capitalization|none}}}
|show_id={{{show_id|}}}
}}
}}<noinclude>
{{documentation}}</noinclude>
3n5b146mlbpr2piyuavzxrctzu75y5c
سانچہ:Property
10
12975
32088
2025-07-05T06:54:06Z
en>Fish bowl
0
Undo revision [[Special:Diff/15181713|15181713]] by [[Special:Contributions/41.145.193.121|41.145.193.121]] ([[User talk:41.145.193.121|talk]])
32088
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata property link]]
hnd6qym6gp623hmrowx5b3lbsghmzbj
32089
32088
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Property]] سے 1 نسخہ درآمد کیا گیا
32088
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata property link]]
hnd6qym6gp623hmrowx5b3lbsghmzbj
سانچہ:UF-hcard-person
10
12976
32090
2025-07-05T06:54:07Z
en>Fish bowl
0
Undo revision [[Special:Diff/15181712|15181712]] by [[Special:Contributions/41.145.193.121|41.145.193.121]] ([[User talk:41.145.193.121|talk]])
32090
wikitext
text/x-wiki
The HTML markup produced by this template includes an [[:w:HCard|hCard microformat]], which makes the person's details [[:w:Parsing|parsable]] by computers, either acting automatically to catalogue articles across Wikipedia or via a browser tool operated by a reader, to (for example) add the subject to an address book or database. For more information about the use of [[:w:microformat|microformats]] on Wikimedia projects, please see [[:w:Wikipedia:WikiProject Microformats|Wikipedia's microformat project]].
=== Sub-templates ===
<!--Date-of-birth ("bday") information will only be included in the microformat if {{tl|Birth date}} or {{tl|Birth date and age}}, are used in the infobox. ([[:w:Wikipedia:WikiProject Microformats/dates|but do not use these if the date is before 1583]]).-->
To include a URL, use {{Tl|URL}}.
'''Please do not remove instances of these sub-templates.'''
=== Classes ===
hCard uses HTML classes including:
*adr
*agent
*bday
*birthplace
*category
*country-name
*deathdate
*deathplace
*extended-address
*family-name
*fn (required)
*given-name
*honorific-prefix
*honorific-suffix
*label
*locality
*n
*nickname
*note
*org
*role
*url
*vcard
'''Please do not rename or remove these classes; nor collapse nested elements which use them.'''<includeonly>{{#ifeq: {{SUBPAGENAME}}|doc||{{#ifeq: {{SUBPAGENAME}}|sandbox||[[Category:Templates generating hCards|{{PAGENAME}}]]}}}}</includeonly><noinclude>{{documentation}}
</noinclude>
e52z6047eyioixtro4f127xjmliyksi
32091
32090
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:UF-hcard-person]] سے 1 نسخہ درآمد کیا گیا
32090
wikitext
text/x-wiki
The HTML markup produced by this template includes an [[:w:HCard|hCard microformat]], which makes the person's details [[:w:Parsing|parsable]] by computers, either acting automatically to catalogue articles across Wikipedia or via a browser tool operated by a reader, to (for example) add the subject to an address book or database. For more information about the use of [[:w:microformat|microformats]] on Wikimedia projects, please see [[:w:Wikipedia:WikiProject Microformats|Wikipedia's microformat project]].
=== Sub-templates ===
<!--Date-of-birth ("bday") information will only be included in the microformat if {{tl|Birth date}} or {{tl|Birth date and age}}, are used in the infobox. ([[:w:Wikipedia:WikiProject Microformats/dates|but do not use these if the date is before 1583]]).-->
To include a URL, use {{Tl|URL}}.
'''Please do not remove instances of these sub-templates.'''
=== Classes ===
hCard uses HTML classes including:
*adr
*agent
*bday
*birthplace
*category
*country-name
*deathdate
*deathplace
*extended-address
*family-name
*fn (required)
*given-name
*honorific-prefix
*honorific-suffix
*label
*locality
*n
*nickname
*note
*org
*role
*url
*vcard
'''Please do not rename or remove these classes; nor collapse nested elements which use them.'''<includeonly>{{#ifeq: {{SUBPAGENAME}}|doc||{{#ifeq: {{SUBPAGENAME}}|sandbox||[[Category:Templates generating hCards|{{PAGENAME}}]]}}}}</includeonly><noinclude>{{documentation}}
</noinclude>
e52z6047eyioixtro4f127xjmliyksi
سانچہ:Wikidata property link
10
12977
32092
2019-10-20T07:22:16Z
en>Xover
0
5 revisions imported from [[:w:Template:Wikidata_property_link]]: Importing template from enwp
32092
wikitext
text/x-wiki
<includeonly>{{#switch: {{uc:{{Str left|{{{id|}}}|1}}}}
| N <!--none--> = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{Label|{{#if:1|{{{1|}}}}}}}]]
| [[d:Property:P{{#if:1|{{{1|}}}}}|{{Label|P{{#if:1|{{{1|}}}}}}}]]
}}
| O <!--only--> = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{#if:1|{{{1|}}}}}]]
| [[d:Property:P{{#if:1|{{{1|}}}}}|P{{#if:1|{{{1|}}}}}]]
}}
| F <!--first--> = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{#if:1|{{{1|}}}}}]]{{#if:{{Label|{{#if:1|{{{1|}}}}}}}|: <small>{{Label|{{#if:1|{{{1|}}}}}}}</small>}}
| [[d:Property:P{{#if:1|{{{1|}}}}}|P{{#if:1|{{{1|}}}}}]]{{#if:{{Label|P{{#if:1|{{{1|}}}}}}}|: <small>{{Label|P{{#if:1|{{{1|}}}}}}}</small>}}
}}
| #default = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{Label|{{#if:1|{{{1|}}}}}}} <small>({{#if:1|{{{1|}}}}})</small>]]
| [[d:Property:P{{#if:1|{{{1|}}}}}|{{Label|P{{#if:1|{{{1|}}}}}}} <small>(P{{#if:1|{{{1|}}}}})</small>]]
}}
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
h2vf8h846bjwkg7ijv7x7856ifr5wim
32093
32092
2026-04-22T02:14:42Z
Satdeep Gill
85
[[:en:Template:Wikidata_property_link]] سے 1 نسخہ درآمد کیا گیا
32092
wikitext
text/x-wiki
<includeonly>{{#switch: {{uc:{{Str left|{{{id|}}}|1}}}}
| N <!--none--> = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{Label|{{#if:1|{{{1|}}}}}}}]]
| [[d:Property:P{{#if:1|{{{1|}}}}}|{{Label|P{{#if:1|{{{1|}}}}}}}]]
}}
| O <!--only--> = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{#if:1|{{{1|}}}}}]]
| [[d:Property:P{{#if:1|{{{1|}}}}}|P{{#if:1|{{{1|}}}}}]]
}}
| F <!--first--> = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{#if:1|{{{1|}}}}}]]{{#if:{{Label|{{#if:1|{{{1|}}}}}}}|: <small>{{Label|{{#if:1|{{{1|}}}}}}}</small>}}
| [[d:Property:P{{#if:1|{{{1|}}}}}|P{{#if:1|{{{1|}}}}}]]{{#if:{{Label|P{{#if:1|{{{1|}}}}}}}|: <small>{{Label|P{{#if:1|{{{1|}}}}}}}</small>}}
}}
| #default = {{#switch: {{uc:{{Str left|{{{1|}}}|1}}}}
| P = [[d:Property:{{#if:1|{{{1|}}}}}|{{Label|{{#if:1|{{{1|}}}}}}} <small>({{#if:1|{{{1|}}}}})</small>]]
| [[d:Property:P{{#if:1|{{{1|}}}}}|{{Label|P{{#if:1|{{{1|}}}}}}} <small>(P{{#if:1|{{{1|}}}}})</small>]]
}}
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
h2vf8h846bjwkg7ijv7x7856ifr5wim
ماڈیول:Wikidata label
828
12978
32094
2025-03-13T08:33:26Z
en>CalendulaAsteraceae
0
sync from [[commons:Module:Wikidata label]]
32094
Scribunto
text/plain
--[[
__ __ _ _ __ ___ _ _ _ _ _ _ _
| \/ | ___ __| |_ _| | ___ \ \ / (_) | _(_) __| | __ _| |_ __ _ | | __ _| |__ ___| |
| |\/| |/ _ \ / _` | | | | |/ _ (_) \ /\ / /| | |/ / |/ _` |/ _` | __/ _` | | |/ _` | '_ \ / _ \ |
| | | | (_) | (_| | |_| | | __/_ \ V V / | | <| | (_| | (_| | || (_| | | | (_| | |_) | __/ |
|_| |_|\___/ \__,_|\__,_|_|\___(_) \_/\_/ |_|_|\_\_|\__,_|\__,_|\__\__,_| |_|\__,_|_.__/ \___|_|
This module is intended to be the engine behind "Template:Label".
This module was copied from Commons please ask for changes there.
Please do not modify this code without applying the changes first at "Module:Wikidata label/sandbox" and testing
at "Module:Wikidata label/testcases".
Authors and maintainers:
* User:Jarekt - original version
]]
require('strict') -- used for debugging purposes as it detects cases of unintended global variables
--=============================================
--=== Internal functions ======================
--=============================================
---------------------------------------------------------------------------
-- Normalize input arguments by converting them all to lower case and
-- replacing space with "_" in the argument name. Also empty strings are
-- converted to nils. Arguments are collected from arguments passed to the
-- module and if missing from the template that calls the module
local function getArgs(frame)
local function normalize_input_args(input_args, output_args)
for name, value in pairs( input_args ) do
value = mw.text.trim(value) -- trim whitespaces from the beggining and the end of the string
if value ~= '' then -- nuke empty strings
if type(name)=='string' then
name = string.gsub( string.lower(name), ' ', '_')
end
output_args[name] = value
end
end
return output_args
end
local args = {}
args = normalize_input_args(frame:getParent().args, args)
args = normalize_input_args(frame.args, args)
return args
end
---------------------------------------------------------------------------
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to Module:Yesno but does not assume val is a string
local function yesno(val, default)
if type(val) == 'boolean' then
return val
elseif type(val) == 'number' then
if val == 1 then
return true
elseif val == 0 then
return false
end
elseif type(val) == 'string' then
val = mw.ustring.lower(val) -- put in lower case
if val == 'no' or val == 'n' or val == 'false' or val == '0' then
return false
elseif val == 'yes' or val == 'y' or val == 'true' or val == '1' then
return true
end
end
return default
end
-------------------------------------------------------------------------
-- get message in a given language
-- INPUTS:
-- * msg - name of a message. For it to work [[MediaWiki:msg]] page need to be set up
-- * lang - translate message to language "lang"
-- * default - string to return in case this module is moved to a project where this message is not set
-- OUTPUT:
-- * translated message
local function getMessage(msg, lang, default)
msg = mw.message.new(msg):inLanguage(lang):plain()
return (msg == nil and default) or msg
end
---------------------------------------------------------------------------
-- use different sitelink call depending if you already have an entity or not
-- INPUTS:
-- * item and entity - entity id and entity: if full entity already uploded than use that
-- otherwise use entity id to look up sitelink
-- * lang - language of the project
-- OUTPUT:
-- * sitelink
local function getSitelink(item, entity, lang)
if entity and entity.getSitelink then -- if we have entity then use it
return entity:getSitelink(lang .. 'wiki')
else -- if no entity then use different function
return mw.wikibase.getSitelink(item, lang .. 'wiki')
end
end
---------------------------------------------------------------------------
-- use different sitelink call depending if you already have an entity or not
-- INPUTS:
-- * item and entity - entity id and entity: if full entity already uploded than use that
-- otherwise use entity id to look up sitelink
-- * prop - property for which to return the best statment
-- OUTPUT:
-- * value of the best statment (only from the first one)
local function getBestStatementsValue(item, entity, prop)
local statments
if entity then
statments = entity:getBestStatements(prop)
else
statments = mw.wikibase.getBestStatements(item, prop)
end
for _, statment in ipairs(statments) do
if statment and statment.mainsnak.datavalue.value then
return statment.mainsnak.datavalue.value
end
end
end
---------------------------------------------------------------------------
-- change capitalization of the label
-- INPUTS:
-- * label - label string
-- * capitalization - capitalization to be applied: allowed values are "tc", "lc",
-- "uc", "lcfirst", and "ucfirst". Any other value will return original string
-- * lang - language of the label
-- OUTPUT:
-- * value of the best statment (only from the first one)
local function apply_capitalization(label, capitalization, lang)
capitalization = string.lower(capitalization or 'none')
if capitalization == 'none' then
return label
elseif capitalization == 'uc' then
return mw.language.new(lang):uc(label)
elseif capitalization == 'lc' then
return mw.language.new(lang):lc(label)
elseif capitalization == 'tc' then -- title case
local new_label = {}
for _, word in ipairs(mw.text.split(label, ' ')) do
table.insert(new_label, mw.language.new(lang):ucfirst(word))
end
return table.concat(new_label, ' ')
elseif capitalization == 'ucfirst' then
return mw.language.new(lang):ucfirst(label)
elseif capitalization == 'lcfirst' then
return mw.language.new(lang):lcfirst(label)
end
return label
end
--[[-------------------------------------------------------------------------
get link based on user preference
INPUTS:
* link_type - can be :
* "wikidata" - link to wikidata
* "wikipedia" - link to wikipedia (language dependent)
* "wikidata talk" - link to wikidata talk page
* "commons" - link to commons (try sitelink then commons category then commons gallery)
* "commonscat" - link to commons (try commons category then commons gallery)
* "-" - means no link
* item - entity ID (always provided)
* entity - whole entity. It can be nil if whole entity is not loaded
* langList - language fallback list for preferred language (required)
OUTPUT:
* link - link to the wikimedia page
]]
local function getLink(link_type, item, entity, langList)
local link, eLink
link_type = mw.ustring.lower(link_type or '')
local item_type = mw.ustring.sub(item, 1, 1) -- first letter prefix of item entity ID: 'Q', 'P' or 'M'
if item_type == 'M' then
eLink='c:Special:EntityPage/'..item
elseif item_type == 'Q' then
eLink='d:'..item -- wikibase entity page link
elseif item_type == 'P' then
eLink='d:Property:'..item -- wikibase entity page link
else
eLink='d:Special:EntityPage/'..item
end
if link_type == '-' then -- allow different link formats
link = '' -- no link
elseif link_type == 'wikidata' or item_type == 'M' then
link = eLink -- link to wikibase entity page
elseif link_type == 'wikidata talk' and item_type == 'P' then
link = 'd:Property talk:'.. item -- link to wikidata property talk page
elseif link_type == 'wikidata talk' then
link = 'd:Talk:'..item -- link to wikidata talk page
elseif link_type == 'commons' or link_type == 'commonscat' then
--[[
When link_type == 'commons' we try the following links (in specified order):
1) commons sitelink
2) P373 "Commons Category" claims
3) P935 "Commons Gallery" claims
Since most items have a commons sitelink we never have to look for claims
When link_type == 'commonscat' we try to maximize chances of commons link being a category, so we
try the following links (in specified order):
1) commons sitelink, which is kept if it points to a category
2) P373 "Commons Category" claims
3) commons sitelink (which does not point to a category)
4) P935 "Commons Gallery" claims
Since most pages have a commons sitelink we never have to look for claims
]]
local sLink = getSitelink(item, entity, 'commons') -- look for sitelink to commons
if sLink then
sLink = 'c:'..sLink
if (link_type == 'commons') or (link_type == 'commonscat' and mw.ustring.find(sLink, 'Category:')) then
link = sLink
end
end
if not link then -- try linking to P373 "Commons Category"
local cat = getBestStatementsValue(item, entity, 'P373')
link = (cat ~= nil and 'c:Category:' .. cat) or nil
end
link = link or sLink
if not link then -- try linking to P935 "Commons Gallery"
link = getBestStatementsValue(item, entity, 'P935')
end
end
if not link then -- apply default "Wikipedia" link type
for _, language in ipairs(langList) do
local sitelink = getSitelink(item, entity, language)
if sitelink then
link = 'w:'.. language ..':'.. sitelink
break
end
end
end
return link or eLink -- no wiki sitelink, so link to wikidata
end
--=============================================
--=== External functions ======================
--=============================================
local p = {}
--======================================================================
--=== API functions for use from other Scribunto modules ===============
--======================================================================
--[[
_getLabel
This function returns a label translated to desired language, created based on wikidata
Inputs:
1: item - wikidata's item's q-id or entity class
2: lang - desired language of the label
3: link_type - link style. Possible values (case-insensitive): "wikipedia", "wikidata", "Commons", or "-" (no link)
4: capitalization - can be "uc" (upper case), "lc" (lower case), "ucfirst" (upper case for the first letter),
"lcfirst" (lower case for the first letter), or 'none' (default)
Error Handling:
Bad q-id will result in displayed error
]]
function p._getLabel(item, lang, link_type, capitalization, show_id)
local entity, s, link, label, language, desc
-- clean up the input parameters
if type(item) ~= 'string' then -- "item" is not a q-id
entity = item -- "item" must be the entity
item = entity.id -- look-up q-id
elseif tonumber(item) then -- if it is just the number then add "Q" in front
item = 'Q'..item
end
item = mw.ustring.gsub(mw.ustring.upper(item), 'PROPERTY:P', 'P') -- make all the properties the same and capitalize
if link_type == 'no' then
link_type = '-'
end
if not lang then
label, lang = mw.wikibase.getLabelWithLang(item)
end
if not lang then -- if still no language
lang = mw.getCurrentFrame():callParserFunction("int","lang") -- get user's chosen language
label = nil
end
-- build language fallback list
lang = mw.ustring.lower(lang)
local langList = mw.language.getFallbacksFor(lang)
table.insert(langList, 1, lang)
table.insert(langList, 'mul') -- add "default for all languages"
-- get label (visible part of the link)
if not label then
for _, language in ipairs(langList) do -- loop over language fallback list looking for label in the specific language
if entity then
label = entity:getLabel(language)
else
label = mw.wikibase.getLabelByLang(item, language)
end
if label then break end -- label found and we are done
end
end
if label then -- wikitext-escape the label if we have one
label = mw.text.nowiki(label)
end
if not label then -- no labels found, so just show the q-id
label = item
elseif show_id then -- add id
show_id = yesno(show_id,false)
if show_id then
local wordsep = getMessage('Word-separator', lang, ' ')
local id = mw.message.new('parentheses', item):inLanguage(lang):plain()
id = (id~=nil and id) or ('('..item..')') -- in case this module is moved to a project where {{int:parenthesis}} is not set
label = label .. wordsep .. "<small>" .. id .. "</small>"
end
end
label = apply_capitalization(label, capitalization, lang)
-- look for description
if entity and entity.descriptions and lang then
for _, language in ipairs(langList) do
if entity.descriptions[language] then
desc = entity.descriptions[language].value
break
end
end
else
desc = mw.wikibase.getDescription(item)
end
if desc and link_type ~= '-' then -- wikitext-escape the description if we have one
desc = mw.text.nowiki(desc) -- add description as hover text
label = '<span title="' .. desc .. '">' .. label .. '</span>'
end
-- return the results
if link_type == '-' then
return label -- return just the label
else
link = getLink(link_type, item, entity, langList)
return '[[' .. link .. '|' .. label .. ']]' -- return link
end
end
--[[-------------------------------------------------------------------------------
_sitelinks
This function returns a table of sitelinks for a single project organized by language
Inputs:
1: item - wikidata's item's q-id or entity class
2: project - (case-insensitive) one of: "wikipedia", "wikisource", "wikiquote", "wikibooks", "wikinews",
"wikiversity", "wikivoyage", "wiktionary", "commons", "mediawiki", "wikispecies", "wikidata", etc.
Output:
Table of sitelinks with language fields
Output:
Table of sitelinks with language fields
See also
* [https://foundation.wikimedia.org/wiki/Special:SiteMatrix] for the full list of supported interwikis.
* [https://dumps.wikimedia.org/backup-index.html] for the full list of sitecodes (used in database dumps).
]]
function p._sitelinks(item, project)
local entity, sitelink
-- get entity
if type(item) == 'string' then -- "item" is a q-id
entity = mw.wikibase.getEntity(item)
else
entity = item -- "item" is the entity
end
-- convert from english project name to proproject code
local projLUT = {
wikipedia = 'wiki', commons = 'commonswiki',
foundation = 'foundationwiki', mediawiki = 'mediawikiwiki',
wikispecies = 'specieswiki', wikidata = 'wikidatawiki',
incubator = 'incubatorwiki', oldwikisource = 'sourceswiki',
}
local langLUT = {
-- These are not language codes before the 'wiki' or 'wikiversity' suffix in a sitecode:
foundation = '~', commons = '~', -- they will be skipped
incubator = '~', meta = '~',
mediawiki = '~', sources = '~',
species = '~', beta = '~',
-- Legacy language codes used in sitecodes, remapped to standard Wikimedia language codes:
-- See https://meta.wikimedia.org/wiki/Special_language_codes for details
als = 'gsw', bat_smg = 'sgs',
fiu_vro = 'vro', be_x_old = 'be-tarask',
roa_rup = 'rup', zh_classical = 'lzh',
zh_yue = 'yue', zh_min_nan = 'nan',
zh_wuu = 'wuu', no = 'nb',
}
project = project:lower()
project = projLUT[project] or project -- correct the project name
local n = project:len()
local linkTable = {}
if entity and entity.sitelinks then -- See if entity exists, and that it has sitelinks
for _, sitelink in pairs(entity.sitelinks) do -- loop over all sitelinks
local site = sitelink.site
local m = site:len() - n
local proj = site:sub(m +1) -- project part of the siteID
if proj == project then -- proj matches desired "project"
local lang = site:sub(1, m) -- language part of the siteID
lang = langLUT[lang] or lang:gsub('_','-')
if lang ~= '~' then -- proj matches desired "project"
linkTable[lang] = sitelink.title
end
end
end
end
return linkTable
end
--[[----------------------------------------------------------------
_aliases
This function returns a table of aliases for a single language
Inputs:
1: item - wikidata's item's q-id or entity class
2: lang - language code, like 'en' or 'de'
Output:
Table of aliases with language fields
]]
function p._aliases(item, lang)
local entity
if type(item) == 'string' then -- "item" is a q-id
entity = mw.wikibase.getEntity(item)
else
entity = item -- "item" is the entity
end
local aliasTable = {}
if entity and entity.aliases then -- See if there is an entity and that is has aliases
if entity.aliases[lang] then -- See if it has English Aliases
for _, alias in pairs(entity.aliases[lang]) do -- Make a loop around the English aliases
table.insert(aliasTable, alias.value) -- Create a table of English aliases
end
end
end
return aliasTable
end
--======================================================================
--=== Invoke functions for use from wikitext, e.g., templates ==========
---=====================================================================
--[[
getLabel
This function returns a label translated to desired language, created based on wikidata
Usage:
{{#invoke:Wikidata label|getLabel|item=Q...|lang=..|link_style=..|capitalization=..}}
Parameters
1: wikidata's item's q-id (required)
2: language (optional; default {{int:lang}})
3: link_style: "wikipedia" (default), "Wikidata", "Commons", or "-" (no link)
4: capitalization - can be "uc", "lc", "tc", "ucfirst", "lcfirst"
Error Handling:
Bad q-id will result in displayed error
]]
function p.getLabel(frame)
local args = getArgs(frame)
return p._getLabel(args.item, args.lang, args.link, args.capitalization, args.show_id)
end
--[[-------------------------------------------------------------------------------
sitelinks
This function returns a comma separated list of sitelinks for a single project organized by language
Its main purpose is to help with testing of _sitelinks function.
Usage:
{{#invoke:Wikidata label|sitelinks|item=Q...|project=..}}
Inputs:
1: item - wikidata's item's q-id or entity class
2: project - "wikipedia" (or "wiki"), "wikisource", "wikiquote", "wikibooks",
"wikinews", "wikiversity", "wikivoyage", "wiktionary", etc.
Output:
comma separated list
]]
function p.sitelinks(frame)
local args = getArgs(frame)
local sitelinks = p._sitelinks(args.item, args.project)
local sitelinkList = {}
for lang, sitelink in pairs(sitelinks) do
table.insert(sitelinkList, (lang=='' and sitelink) or (lang .. ':' .. sitelink))
end
return table.concat(sitelinkList, ', ')
end
--[[----------------------------------------------------------------------------
aliases
This function returns a comma separated list of aliases for a single language
Its main purpose is to help with testing of _aliases function.
Usage:
{{#invoke:Wikidata label|aliases|item=Q...|lang=..}}
Inputs:
1: item - wikidata's item's q-id or entity class
2: lang - language code, like 'en' or 'de'
Output:
Comma separated list of aliases
]]
function p.aliases(frame)
local args = getArgs(frame)
return table.concat(p._aliases(args.item, args.lang), ', ')
end
return p
7b3k45meuo4sbudososz6gy9dx3nxzm
32095
32094
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Module:Wikidata_label]] سے 1 نسخہ درآمد کیا گیا
32094
Scribunto
text/plain
--[[
__ __ _ _ __ ___ _ _ _ _ _ _ _
| \/ | ___ __| |_ _| | ___ \ \ / (_) | _(_) __| | __ _| |_ __ _ | | __ _| |__ ___| |
| |\/| |/ _ \ / _` | | | | |/ _ (_) \ /\ / /| | |/ / |/ _` |/ _` | __/ _` | | |/ _` | '_ \ / _ \ |
| | | | (_) | (_| | |_| | | __/_ \ V V / | | <| | (_| | (_| | || (_| | | | (_| | |_) | __/ |
|_| |_|\___/ \__,_|\__,_|_|\___(_) \_/\_/ |_|_|\_\_|\__,_|\__,_|\__\__,_| |_|\__,_|_.__/ \___|_|
This module is intended to be the engine behind "Template:Label".
This module was copied from Commons please ask for changes there.
Please do not modify this code without applying the changes first at "Module:Wikidata label/sandbox" and testing
at "Module:Wikidata label/testcases".
Authors and maintainers:
* User:Jarekt - original version
]]
require('strict') -- used for debugging purposes as it detects cases of unintended global variables
--=============================================
--=== Internal functions ======================
--=============================================
---------------------------------------------------------------------------
-- Normalize input arguments by converting them all to lower case and
-- replacing space with "_" in the argument name. Also empty strings are
-- converted to nils. Arguments are collected from arguments passed to the
-- module and if missing from the template that calls the module
local function getArgs(frame)
local function normalize_input_args(input_args, output_args)
for name, value in pairs( input_args ) do
value = mw.text.trim(value) -- trim whitespaces from the beggining and the end of the string
if value ~= '' then -- nuke empty strings
if type(name)=='string' then
name = string.gsub( string.lower(name), ' ', '_')
end
output_args[name] = value
end
end
return output_args
end
local args = {}
args = normalize_input_args(frame:getParent().args, args)
args = normalize_input_args(frame.args, args)
return args
end
---------------------------------------------------------------------------
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to Module:Yesno but does not assume val is a string
local function yesno(val, default)
if type(val) == 'boolean' then
return val
elseif type(val) == 'number' then
if val == 1 then
return true
elseif val == 0 then
return false
end
elseif type(val) == 'string' then
val = mw.ustring.lower(val) -- put in lower case
if val == 'no' or val == 'n' or val == 'false' or val == '0' then
return false
elseif val == 'yes' or val == 'y' or val == 'true' or val == '1' then
return true
end
end
return default
end
-------------------------------------------------------------------------
-- get message in a given language
-- INPUTS:
-- * msg - name of a message. For it to work [[MediaWiki:msg]] page need to be set up
-- * lang - translate message to language "lang"
-- * default - string to return in case this module is moved to a project where this message is not set
-- OUTPUT:
-- * translated message
local function getMessage(msg, lang, default)
msg = mw.message.new(msg):inLanguage(lang):plain()
return (msg == nil and default) or msg
end
---------------------------------------------------------------------------
-- use different sitelink call depending if you already have an entity or not
-- INPUTS:
-- * item and entity - entity id and entity: if full entity already uploded than use that
-- otherwise use entity id to look up sitelink
-- * lang - language of the project
-- OUTPUT:
-- * sitelink
local function getSitelink(item, entity, lang)
if entity and entity.getSitelink then -- if we have entity then use it
return entity:getSitelink(lang .. 'wiki')
else -- if no entity then use different function
return mw.wikibase.getSitelink(item, lang .. 'wiki')
end
end
---------------------------------------------------------------------------
-- use different sitelink call depending if you already have an entity or not
-- INPUTS:
-- * item and entity - entity id and entity: if full entity already uploded than use that
-- otherwise use entity id to look up sitelink
-- * prop - property for which to return the best statment
-- OUTPUT:
-- * value of the best statment (only from the first one)
local function getBestStatementsValue(item, entity, prop)
local statments
if entity then
statments = entity:getBestStatements(prop)
else
statments = mw.wikibase.getBestStatements(item, prop)
end
for _, statment in ipairs(statments) do
if statment and statment.mainsnak.datavalue.value then
return statment.mainsnak.datavalue.value
end
end
end
---------------------------------------------------------------------------
-- change capitalization of the label
-- INPUTS:
-- * label - label string
-- * capitalization - capitalization to be applied: allowed values are "tc", "lc",
-- "uc", "lcfirst", and "ucfirst". Any other value will return original string
-- * lang - language of the label
-- OUTPUT:
-- * value of the best statment (only from the first one)
local function apply_capitalization(label, capitalization, lang)
capitalization = string.lower(capitalization or 'none')
if capitalization == 'none' then
return label
elseif capitalization == 'uc' then
return mw.language.new(lang):uc(label)
elseif capitalization == 'lc' then
return mw.language.new(lang):lc(label)
elseif capitalization == 'tc' then -- title case
local new_label = {}
for _, word in ipairs(mw.text.split(label, ' ')) do
table.insert(new_label, mw.language.new(lang):ucfirst(word))
end
return table.concat(new_label, ' ')
elseif capitalization == 'ucfirst' then
return mw.language.new(lang):ucfirst(label)
elseif capitalization == 'lcfirst' then
return mw.language.new(lang):lcfirst(label)
end
return label
end
--[[-------------------------------------------------------------------------
get link based on user preference
INPUTS:
* link_type - can be :
* "wikidata" - link to wikidata
* "wikipedia" - link to wikipedia (language dependent)
* "wikidata talk" - link to wikidata talk page
* "commons" - link to commons (try sitelink then commons category then commons gallery)
* "commonscat" - link to commons (try commons category then commons gallery)
* "-" - means no link
* item - entity ID (always provided)
* entity - whole entity. It can be nil if whole entity is not loaded
* langList - language fallback list for preferred language (required)
OUTPUT:
* link - link to the wikimedia page
]]
local function getLink(link_type, item, entity, langList)
local link, eLink
link_type = mw.ustring.lower(link_type or '')
local item_type = mw.ustring.sub(item, 1, 1) -- first letter prefix of item entity ID: 'Q', 'P' or 'M'
if item_type == 'M' then
eLink='c:Special:EntityPage/'..item
elseif item_type == 'Q' then
eLink='d:'..item -- wikibase entity page link
elseif item_type == 'P' then
eLink='d:Property:'..item -- wikibase entity page link
else
eLink='d:Special:EntityPage/'..item
end
if link_type == '-' then -- allow different link formats
link = '' -- no link
elseif link_type == 'wikidata' or item_type == 'M' then
link = eLink -- link to wikibase entity page
elseif link_type == 'wikidata talk' and item_type == 'P' then
link = 'd:Property talk:'.. item -- link to wikidata property talk page
elseif link_type == 'wikidata talk' then
link = 'd:Talk:'..item -- link to wikidata talk page
elseif link_type == 'commons' or link_type == 'commonscat' then
--[[
When link_type == 'commons' we try the following links (in specified order):
1) commons sitelink
2) P373 "Commons Category" claims
3) P935 "Commons Gallery" claims
Since most items have a commons sitelink we never have to look for claims
When link_type == 'commonscat' we try to maximize chances of commons link being a category, so we
try the following links (in specified order):
1) commons sitelink, which is kept if it points to a category
2) P373 "Commons Category" claims
3) commons sitelink (which does not point to a category)
4) P935 "Commons Gallery" claims
Since most pages have a commons sitelink we never have to look for claims
]]
local sLink = getSitelink(item, entity, 'commons') -- look for sitelink to commons
if sLink then
sLink = 'c:'..sLink
if (link_type == 'commons') or (link_type == 'commonscat' and mw.ustring.find(sLink, 'Category:')) then
link = sLink
end
end
if not link then -- try linking to P373 "Commons Category"
local cat = getBestStatementsValue(item, entity, 'P373')
link = (cat ~= nil and 'c:Category:' .. cat) or nil
end
link = link or sLink
if not link then -- try linking to P935 "Commons Gallery"
link = getBestStatementsValue(item, entity, 'P935')
end
end
if not link then -- apply default "Wikipedia" link type
for _, language in ipairs(langList) do
local sitelink = getSitelink(item, entity, language)
if sitelink then
link = 'w:'.. language ..':'.. sitelink
break
end
end
end
return link or eLink -- no wiki sitelink, so link to wikidata
end
--=============================================
--=== External functions ======================
--=============================================
local p = {}
--======================================================================
--=== API functions for use from other Scribunto modules ===============
--======================================================================
--[[
_getLabel
This function returns a label translated to desired language, created based on wikidata
Inputs:
1: item - wikidata's item's q-id or entity class
2: lang - desired language of the label
3: link_type - link style. Possible values (case-insensitive): "wikipedia", "wikidata", "Commons", or "-" (no link)
4: capitalization - can be "uc" (upper case), "lc" (lower case), "ucfirst" (upper case for the first letter),
"lcfirst" (lower case for the first letter), or 'none' (default)
Error Handling:
Bad q-id will result in displayed error
]]
function p._getLabel(item, lang, link_type, capitalization, show_id)
local entity, s, link, label, language, desc
-- clean up the input parameters
if type(item) ~= 'string' then -- "item" is not a q-id
entity = item -- "item" must be the entity
item = entity.id -- look-up q-id
elseif tonumber(item) then -- if it is just the number then add "Q" in front
item = 'Q'..item
end
item = mw.ustring.gsub(mw.ustring.upper(item), 'PROPERTY:P', 'P') -- make all the properties the same and capitalize
if link_type == 'no' then
link_type = '-'
end
if not lang then
label, lang = mw.wikibase.getLabelWithLang(item)
end
if not lang then -- if still no language
lang = mw.getCurrentFrame():callParserFunction("int","lang") -- get user's chosen language
label = nil
end
-- build language fallback list
lang = mw.ustring.lower(lang)
local langList = mw.language.getFallbacksFor(lang)
table.insert(langList, 1, lang)
table.insert(langList, 'mul') -- add "default for all languages"
-- get label (visible part of the link)
if not label then
for _, language in ipairs(langList) do -- loop over language fallback list looking for label in the specific language
if entity then
label = entity:getLabel(language)
else
label = mw.wikibase.getLabelByLang(item, language)
end
if label then break end -- label found and we are done
end
end
if label then -- wikitext-escape the label if we have one
label = mw.text.nowiki(label)
end
if not label then -- no labels found, so just show the q-id
label = item
elseif show_id then -- add id
show_id = yesno(show_id,false)
if show_id then
local wordsep = getMessage('Word-separator', lang, ' ')
local id = mw.message.new('parentheses', item):inLanguage(lang):plain()
id = (id~=nil and id) or ('('..item..')') -- in case this module is moved to a project where {{int:parenthesis}} is not set
label = label .. wordsep .. "<small>" .. id .. "</small>"
end
end
label = apply_capitalization(label, capitalization, lang)
-- look for description
if entity and entity.descriptions and lang then
for _, language in ipairs(langList) do
if entity.descriptions[language] then
desc = entity.descriptions[language].value
break
end
end
else
desc = mw.wikibase.getDescription(item)
end
if desc and link_type ~= '-' then -- wikitext-escape the description if we have one
desc = mw.text.nowiki(desc) -- add description as hover text
label = '<span title="' .. desc .. '">' .. label .. '</span>'
end
-- return the results
if link_type == '-' then
return label -- return just the label
else
link = getLink(link_type, item, entity, langList)
return '[[' .. link .. '|' .. label .. ']]' -- return link
end
end
--[[-------------------------------------------------------------------------------
_sitelinks
This function returns a table of sitelinks for a single project organized by language
Inputs:
1: item - wikidata's item's q-id or entity class
2: project - (case-insensitive) one of: "wikipedia", "wikisource", "wikiquote", "wikibooks", "wikinews",
"wikiversity", "wikivoyage", "wiktionary", "commons", "mediawiki", "wikispecies", "wikidata", etc.
Output:
Table of sitelinks with language fields
Output:
Table of sitelinks with language fields
See also
* [https://foundation.wikimedia.org/wiki/Special:SiteMatrix] for the full list of supported interwikis.
* [https://dumps.wikimedia.org/backup-index.html] for the full list of sitecodes (used in database dumps).
]]
function p._sitelinks(item, project)
local entity, sitelink
-- get entity
if type(item) == 'string' then -- "item" is a q-id
entity = mw.wikibase.getEntity(item)
else
entity = item -- "item" is the entity
end
-- convert from english project name to proproject code
local projLUT = {
wikipedia = 'wiki', commons = 'commonswiki',
foundation = 'foundationwiki', mediawiki = 'mediawikiwiki',
wikispecies = 'specieswiki', wikidata = 'wikidatawiki',
incubator = 'incubatorwiki', oldwikisource = 'sourceswiki',
}
local langLUT = {
-- These are not language codes before the 'wiki' or 'wikiversity' suffix in a sitecode:
foundation = '~', commons = '~', -- they will be skipped
incubator = '~', meta = '~',
mediawiki = '~', sources = '~',
species = '~', beta = '~',
-- Legacy language codes used in sitecodes, remapped to standard Wikimedia language codes:
-- See https://meta.wikimedia.org/wiki/Special_language_codes for details
als = 'gsw', bat_smg = 'sgs',
fiu_vro = 'vro', be_x_old = 'be-tarask',
roa_rup = 'rup', zh_classical = 'lzh',
zh_yue = 'yue', zh_min_nan = 'nan',
zh_wuu = 'wuu', no = 'nb',
}
project = project:lower()
project = projLUT[project] or project -- correct the project name
local n = project:len()
local linkTable = {}
if entity and entity.sitelinks then -- See if entity exists, and that it has sitelinks
for _, sitelink in pairs(entity.sitelinks) do -- loop over all sitelinks
local site = sitelink.site
local m = site:len() - n
local proj = site:sub(m +1) -- project part of the siteID
if proj == project then -- proj matches desired "project"
local lang = site:sub(1, m) -- language part of the siteID
lang = langLUT[lang] or lang:gsub('_','-')
if lang ~= '~' then -- proj matches desired "project"
linkTable[lang] = sitelink.title
end
end
end
end
return linkTable
end
--[[----------------------------------------------------------------
_aliases
This function returns a table of aliases for a single language
Inputs:
1: item - wikidata's item's q-id or entity class
2: lang - language code, like 'en' or 'de'
Output:
Table of aliases with language fields
]]
function p._aliases(item, lang)
local entity
if type(item) == 'string' then -- "item" is a q-id
entity = mw.wikibase.getEntity(item)
else
entity = item -- "item" is the entity
end
local aliasTable = {}
if entity and entity.aliases then -- See if there is an entity and that is has aliases
if entity.aliases[lang] then -- See if it has English Aliases
for _, alias in pairs(entity.aliases[lang]) do -- Make a loop around the English aliases
table.insert(aliasTable, alias.value) -- Create a table of English aliases
end
end
end
return aliasTable
end
--======================================================================
--=== Invoke functions for use from wikitext, e.g., templates ==========
---=====================================================================
--[[
getLabel
This function returns a label translated to desired language, created based on wikidata
Usage:
{{#invoke:Wikidata label|getLabel|item=Q...|lang=..|link_style=..|capitalization=..}}
Parameters
1: wikidata's item's q-id (required)
2: language (optional; default {{int:lang}})
3: link_style: "wikipedia" (default), "Wikidata", "Commons", or "-" (no link)
4: capitalization - can be "uc", "lc", "tc", "ucfirst", "lcfirst"
Error Handling:
Bad q-id will result in displayed error
]]
function p.getLabel(frame)
local args = getArgs(frame)
return p._getLabel(args.item, args.lang, args.link, args.capitalization, args.show_id)
end
--[[-------------------------------------------------------------------------------
sitelinks
This function returns a comma separated list of sitelinks for a single project organized by language
Its main purpose is to help with testing of _sitelinks function.
Usage:
{{#invoke:Wikidata label|sitelinks|item=Q...|project=..}}
Inputs:
1: item - wikidata's item's q-id or entity class
2: project - "wikipedia" (or "wiki"), "wikisource", "wikiquote", "wikibooks",
"wikinews", "wikiversity", "wikivoyage", "wiktionary", etc.
Output:
comma separated list
]]
function p.sitelinks(frame)
local args = getArgs(frame)
local sitelinks = p._sitelinks(args.item, args.project)
local sitelinkList = {}
for lang, sitelink in pairs(sitelinks) do
table.insert(sitelinkList, (lang=='' and sitelink) or (lang .. ':' .. sitelink))
end
return table.concat(sitelinkList, ', ')
end
--[[----------------------------------------------------------------------------
aliases
This function returns a comma separated list of aliases for a single language
Its main purpose is to help with testing of _aliases function.
Usage:
{{#invoke:Wikidata label|aliases|item=Q...|lang=..}}
Inputs:
1: item - wikidata's item's q-id or entity class
2: lang - language code, like 'en' or 'de'
Output:
Comma separated list of aliases
]]
function p.aliases(frame)
local args = getArgs(frame)
return table.concat(p._aliases(args.item, args.lang), ', ')
end
return p
7b3k45meuo4sbudososz6gy9dx3nxzm
سانچہ:Doc example
10
12979
32096
2023-07-28T05:20:54Z
en>CalendulaAsteraceae
0
add /s and /e and use them in the main template
32096
wikitext
text/x-wiki
{{doc example/s
| pre_title = {{{pre_title|Example}}}
| title = {{{title|}}}
| margin-left = {{{margin-left|}}}
| collapsed = {{{collapsed|}}}
}}
{{{content|{{{1}}}}}}
{{doc example/e}}<noinclude>
{{documentation}}
</noinclude>
7ajkrmpz2ayhak0ywb6ifbwyfs8sztg
32097
32096
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Doc_example]] سے 1 نسخہ درآمد کیا گیا
32096
wikitext
text/x-wiki
{{doc example/s
| pre_title = {{{pre_title|Example}}}
| title = {{{title|}}}
| margin-left = {{{margin-left|}}}
| collapsed = {{{collapsed|}}}
}}
{{{content|{{{1}}}}}}
{{doc example/e}}<noinclude>
{{documentation}}
</noinclude>
7ajkrmpz2ayhak0ywb6ifbwyfs8sztg
سانچہ:Var
10
12980
32098
2015-09-13T03:35:35Z
en>George Orwell III
0
created
32098
wikitext
text/x-wiki
<var {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} style="padding-right: 1px;{{#if:{{{style|}}}|{{{style}}}}}" {{#if:{{{lang|}}}|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1}}}</var><noinclude>
<!--Categories and interwikis go near the bottom of the /doc page.-->
{{Documentation}}
</noinclude>
a1ykvn9l68fa5gklm4xrpk0u505r11l
32099
32098
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Var]] سے 1 نسخہ درآمد کیا گیا
32098
wikitext
text/x-wiki
<var {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} style="padding-right: 1px;{{#if:{{{style|}}}|{{{style}}}}}" {{#if:{{{lang|}}}|lang="{{{lang}}}" xml:lang="{{{lang}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1}}}</var><noinclude>
<!--Categories and interwikis go near the bottom of the /doc page.-->
{{Documentation}}
</noinclude>
a1ykvn9l68fa5gklm4xrpk0u505r11l
سانچہ:Ml
10
12981
32100
2025-07-05T06:53:16Z
en>Fish bowl
0
Undo revision [[Special:Diff/15181724|15181724]] by [[Special:Contributions/41.145.193.121|41.145.193.121]] ([[User talk:41.145.193.121|talk]])
32100
wikitext
text/x-wiki
#REDIRECT [[Template:Module link]]
kqg7eck6yjcwbaqm7z01snfeozo9pml
32101
32100
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Ml]] سے 1 نسخہ درآمد کیا گیا
32100
wikitext
text/x-wiki
#REDIRECT [[Template:Module link]]
kqg7eck6yjcwbaqm7z01snfeozo9pml
سانچہ:Anchor/styles.css
10
12982
32102
2026-02-04T03:56:47Z
en>ToxicPea
0
dark mode fix
32102
sanitized-css
text/css
.wst-anchor:target {
background-color:rgba(100, 149, 237, 0.1);
color: var(--color-base,#202122);
outline:1px solid cornflowerblue;
}
1xnw6hzqlc1w9q9a5yj1egue3wb5kvi
32103
32102
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Anchor/styles.css]] سے 1 نسخہ درآمد کیا گیا
32102
sanitized-css
text/css
.wst-anchor:target {
background-color:rgba(100, 149, 237, 0.1);
color: var(--color-base,#202122);
outline:1px solid cornflowerblue;
}
1xnw6hzqlc1w9q9a5yj1egue3wb5kvi
ماڈیول:Anchor
828
12983
32104
2025-04-19T20:57:16Z
en>ShakespeareFan00
0
Most of the page namespace is now cleaned up, far quicker than expected and this is adding a LOT of noise
32104
Scribunto
text/plain
--[=[
Implements anchor templates
]=]
require('strict')
local getArgs = require('Module:Arguments').getArgs
local Error = require('Module:Error')
local function error_message(message)
return Error['error']({['message'] = message})
end
local p = {}
-- [[Template:Anchor]]
local function _anchor(args)
local anchorList = {}
for k, v in pairs(args) do
table.insert(anchorList, tostring(mw.html.create('span'):addClass('anchor'):attr('id', mw.uri.anchorEncode(v))))
end
return table.concat(anchorList)
end
function p.anchor(frame)
return _anchor(getArgs(frame))
end
-- [[Template:Anchor link]]
local function _anchor_link(args)
local anchor = args.anchor or args[1]
if not anchor then
return error_message('No anchor specified')
end
anchor = mw.uri.anchorEncode(anchor)
local pageno = args.pageno or args[2]
local subpage = args.subpage or args[3]
local page = (args.page and mw.title.new(args.page)) or mw.title.getCurrentTitle()
if page.nsText == 'Page' and not pageno then
return error_message('No page number specified')
end
local title = page.text
if page.nsText == 'Page' then
title = page.rootText .. '/' .. pageno
elseif subpage then
local rootSubpageTitle = mw.title.makeTitle(page.nsText, page.rootText .. '/' .. subpage)
local baseSubpageTitle = mw.title.makeTitle(page.nsText, page.baseText .. '/' .. subpage)
if rootSubpageTitle.exists then
title = rootSubpageTitle.text
elseif baseSubpageTitle.exists then
title = baseSubpageTitle.text
end
end
return '[[' .. mw.title.makeTitle(page.nsText, title, anchor).fullText .. '|' .. anchor:gsub("_", " ") .. ']]'
end
function p.anchor_link(frame)
return _anchor_link(getArgs(frame))
end
-- [[Template:Anchor link 2]]
local function _anchor_link_2(args)
local anchor = args.anchor or args[3]
if not anchor then
return error_message('No anchor specified')
end
local subpage = args.subpage or args[1]
local pageno = args.pageno or args[2]
anchor = mw.uri.anchorEncode(anchor)
local text = args.text or args[4] or anchor
local page = (args.page and mw.title.new(args.page)) or mw.title.getCurrentTitle()
if page.nsText == 'Page' and not pageno then
return error_message('No page number specified')
end
local title = page.text
if page.nsText == 'Page' then
title = page.rootText .. '/' .. pageno
elseif subpage then
local rootSubpageTitle = mw.title.makeTitle(page.nsText, page.rootText .. '/' .. subpage)
local baseSubpageTitle = mw.title.makeTitle(page.nsText, page.baseText .. '/' .. subpage)
if not rootSubpageTitle or not baseSubpageTitle then
return error_message('Error creating subpage: ' .. subpage)
end
local baseSubpageBaseTitle = mw.title.makeTitle(page.nsText, baseSubpageTitle.baseText .. '/' .. subpage)
if not baseSubpageBaseTitle then
return error_message('Error creating subpage: ' .. subpage)
end
local subpageTitle = mw.title.makeTitle(page.nsText, subpage)
if not subpageTitle then
return error_message('Error creating page: ' .. subpage)
end
if rootSubpageTitle.exists then
title = rootSubpageTitle.text
elseif baseSubpageTitle.exists then
title = baseSubpageTitle.text
elseif baseSubpageBaseTitle.exists then
title = baseSubpageBaseTitle.text
elseif subpageTitle.exists then
title = subpage
end
end
return '[[' .. mw.title.makeTitle(page.nsText, title, anchor).fullText .. '|' .. text .. ']]'
end
function p.anchor_link_2(frame)
return _anchor_link_2(getArgs(frame))
end
return p
5f4lcoaa24p0gqn68siy62e63n40ywc
32105
32104
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Module:Anchor]] سے 1 نسخہ درآمد کیا گیا
32104
Scribunto
text/plain
--[=[
Implements anchor templates
]=]
require('strict')
local getArgs = require('Module:Arguments').getArgs
local Error = require('Module:Error')
local function error_message(message)
return Error['error']({['message'] = message})
end
local p = {}
-- [[Template:Anchor]]
local function _anchor(args)
local anchorList = {}
for k, v in pairs(args) do
table.insert(anchorList, tostring(mw.html.create('span'):addClass('anchor'):attr('id', mw.uri.anchorEncode(v))))
end
return table.concat(anchorList)
end
function p.anchor(frame)
return _anchor(getArgs(frame))
end
-- [[Template:Anchor link]]
local function _anchor_link(args)
local anchor = args.anchor or args[1]
if not anchor then
return error_message('No anchor specified')
end
anchor = mw.uri.anchorEncode(anchor)
local pageno = args.pageno or args[2]
local subpage = args.subpage or args[3]
local page = (args.page and mw.title.new(args.page)) or mw.title.getCurrentTitle()
if page.nsText == 'Page' and not pageno then
return error_message('No page number specified')
end
local title = page.text
if page.nsText == 'Page' then
title = page.rootText .. '/' .. pageno
elseif subpage then
local rootSubpageTitle = mw.title.makeTitle(page.nsText, page.rootText .. '/' .. subpage)
local baseSubpageTitle = mw.title.makeTitle(page.nsText, page.baseText .. '/' .. subpage)
if rootSubpageTitle.exists then
title = rootSubpageTitle.text
elseif baseSubpageTitle.exists then
title = baseSubpageTitle.text
end
end
return '[[' .. mw.title.makeTitle(page.nsText, title, anchor).fullText .. '|' .. anchor:gsub("_", " ") .. ']]'
end
function p.anchor_link(frame)
return _anchor_link(getArgs(frame))
end
-- [[Template:Anchor link 2]]
local function _anchor_link_2(args)
local anchor = args.anchor or args[3]
if not anchor then
return error_message('No anchor specified')
end
local subpage = args.subpage or args[1]
local pageno = args.pageno or args[2]
anchor = mw.uri.anchorEncode(anchor)
local text = args.text or args[4] or anchor
local page = (args.page and mw.title.new(args.page)) or mw.title.getCurrentTitle()
if page.nsText == 'Page' and not pageno then
return error_message('No page number specified')
end
local title = page.text
if page.nsText == 'Page' then
title = page.rootText .. '/' .. pageno
elseif subpage then
local rootSubpageTitle = mw.title.makeTitle(page.nsText, page.rootText .. '/' .. subpage)
local baseSubpageTitle = mw.title.makeTitle(page.nsText, page.baseText .. '/' .. subpage)
if not rootSubpageTitle or not baseSubpageTitle then
return error_message('Error creating subpage: ' .. subpage)
end
local baseSubpageBaseTitle = mw.title.makeTitle(page.nsText, baseSubpageTitle.baseText .. '/' .. subpage)
if not baseSubpageBaseTitle then
return error_message('Error creating subpage: ' .. subpage)
end
local subpageTitle = mw.title.makeTitle(page.nsText, subpage)
if not subpageTitle then
return error_message('Error creating page: ' .. subpage)
end
if rootSubpageTitle.exists then
title = rootSubpageTitle.text
elseif baseSubpageTitle.exists then
title = baseSubpageTitle.text
elseif baseSubpageBaseTitle.exists then
title = baseSubpageBaseTitle.text
elseif subpageTitle.exists then
title = subpage
end
end
return '[[' .. mw.title.makeTitle(page.nsText, title, anchor).fullText .. '|' .. text .. ']]'
end
function p.anchor_link_2(frame)
return _anchor_link_2(getArgs(frame))
end
return p
5f4lcoaa24p0gqn68siy62e63n40ywc
ماڈیول:Separated entries
828
12984
32106
2025-03-17T02:03:09Z
en>CalendulaAsteraceae
0
add updates from [[w:Module:Separated entries]]
32106
Scribunto
text/plain
-- This module takes positional parameters as input and concatenates them with
-- an optional separator. The final separator (the "conjunction") can be
-- specified independently, enabling natural-language lists like
-- "foo, bar, baz and qux". The starting parameter can also be specified.
local compressSparseArray = require('Module:TableTools').compressSparseArray
local p = {}
function p._main(args)
local dataPlural = args.dataPlural
local separator = args.separator
-- Decode (convert to Unicode) HTML escape sequences, such as " " for space.
and mw.text.decode(args.separator) or ''
local conjunction = args.conjunction and mw.text.decode(args.conjunction) or separator
-- Discard values before the starting parameter.
local start = tonumber(args.start)
if start then
for i = 1, start - 1 do args[i] = nil end
end
-- Discard named parameters.
local values = compressSparseArray(args)
local result = mw.text.listToText(values, separator, conjunction)
if dataPlural and #values > 0 and (#separator > 0 or #conjunction > 0) then
-- flag to [[Module:Detect singular]] whether this is a list with >1 element
result = result..'<span style="display:none" data-plural="'..(#values > 1 and '1' or '0')..'"></span>'
end
return result
end
local function makeInvokeFunction(separator, conjunction, first)
return function (frame)
local args = require('Module:Arguments').getArgs(frame)
args.separator = separator or args.separator
args.conjunction = conjunction or args.conjunction
args.first = first or args.first
return p._main(args)
end
end
p.main = makeInvokeFunction()
p.br = makeInvokeFunction('<br />')
p.comma = makeInvokeFunction(mw.message.new('comma-separator'):plain())
return p
0tp4y1kozxhpcw1ykqbo8e2gq604ky9
32107
32106
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Module:Separated_entries]] سے 1 نسخہ درآمد کیا گیا
32106
Scribunto
text/plain
-- This module takes positional parameters as input and concatenates them with
-- an optional separator. The final separator (the "conjunction") can be
-- specified independently, enabling natural-language lists like
-- "foo, bar, baz and qux". The starting parameter can also be specified.
local compressSparseArray = require('Module:TableTools').compressSparseArray
local p = {}
function p._main(args)
local dataPlural = args.dataPlural
local separator = args.separator
-- Decode (convert to Unicode) HTML escape sequences, such as " " for space.
and mw.text.decode(args.separator) or ''
local conjunction = args.conjunction and mw.text.decode(args.conjunction) or separator
-- Discard values before the starting parameter.
local start = tonumber(args.start)
if start then
for i = 1, start - 1 do args[i] = nil end
end
-- Discard named parameters.
local values = compressSparseArray(args)
local result = mw.text.listToText(values, separator, conjunction)
if dataPlural and #values > 0 and (#separator > 0 or #conjunction > 0) then
-- flag to [[Module:Detect singular]] whether this is a list with >1 element
result = result..'<span style="display:none" data-plural="'..(#values > 1 and '1' or '0')..'"></span>'
end
return result
end
local function makeInvokeFunction(separator, conjunction, first)
return function (frame)
local args = require('Module:Arguments').getArgs(frame)
args.separator = separator or args.separator
args.conjunction = conjunction or args.conjunction
args.first = first or args.first
return p._main(args)
end
end
p.main = makeInvokeFunction()
p.br = makeInvokeFunction('<br />')
p.comma = makeInvokeFunction(mw.message.new('comma-separator'):plain())
return p
0tp4y1kozxhpcw1ykqbo8e2gq604ky9
سانچہ:Collapsible box/s
10
12985
32108
2023-10-22T06:27:11Z
en>CalendulaAsteraceae
0
32108
wikitext
text/x-wiki
<templatestyles src="Template:Collapsible box/styles.css" /><div class="mw-collapsible {{yesno|{{{collapsed|}}}|yes=mw-collapsed|def=}} wst-collapsible-box wst-collapsible-box-{{#if:{{{title|}}}|with|without}}-title {{{class_outer|}}}" {{optional style|style={{{style_outer|}}}}} {{{attribs_outer|}}}>
<div class="wst-collapsible-box-title {{{class_title|}}}" {{Optional style|style={{{style_title|}}}}}>
{{{title|}}}
</div>
<div class="mw-collapsible-content wst-collapsible-box-content {{{class_content|}}}" {{optional style|style={{{style_content|}}}}}><noinclude>
{{Collapsible box/e}}
{{documentation|Template:Collapsible box/doc}}
</noinclude>
1vz77y33t1cd3v1x44g66lt7412j3g0
32109
32108
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Collapsible_box/s]] سے 1 نسخہ درآمد کیا گیا
32108
wikitext
text/x-wiki
<templatestyles src="Template:Collapsible box/styles.css" /><div class="mw-collapsible {{yesno|{{{collapsed|}}}|yes=mw-collapsed|def=}} wst-collapsible-box wst-collapsible-box-{{#if:{{{title|}}}|with|without}}-title {{{class_outer|}}}" {{optional style|style={{{style_outer|}}}}} {{{attribs_outer|}}}>
<div class="wst-collapsible-box-title {{{class_title|}}}" {{Optional style|style={{{style_title|}}}}}>
{{{title|}}}
</div>
<div class="mw-collapsible-content wst-collapsible-box-content {{{class_content|}}}" {{optional style|style={{{style_content|}}}}}><noinclude>
{{Collapsible box/e}}
{{documentation|Template:Collapsible box/doc}}
</noinclude>
1vz77y33t1cd3v1x44g66lt7412j3g0
سانچہ:Collapsible box/styles.css
10
12986
32110
2023-10-22T06:53:01Z
en>CalendulaAsteraceae
0
32110
sanitized-css
text/css
.wst-collapsible-box {
margin:0.5em auto;
padding:0.5em;
}
.wst-collapsible-box.wst-collapsible-box-with-title {
padding-top:0;
}
.wst-collapsible-box-title > p:first-child {
margin-top:0;
}
svqjxz5ewwy5owf9lytpnrhe60uu2ma
32111
32110
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Collapsible_box/styles.css]] سے 1 نسخہ درآمد کیا گیا
32110
sanitized-css
text/css
.wst-collapsible-box {
margin:0.5em auto;
padding:0.5em;
}
.wst-collapsible-box.wst-collapsible-box-with-title {
padding-top:0;
}
.wst-collapsible-box-title > p:first-child {
margin-top:0;
}
svqjxz5ewwy5owf9lytpnrhe60uu2ma
سانچہ:Collapsible box/e
10
12987
32112
2026-01-15T08:30:17Z
en>SnowyCinema
0
Reverted edit by [[Special:Contributions/~2026-31130-5|~2026-31130-5]] ([[User talk:~2026-31130-5|talk]]) to last revision by [[User:ShakespeareFan00|ShakespeareFan00]]
32112
wikitext
text/x-wiki
<includeonly>{{div end}}{{div end}}</includeonly><noinclude>{{documentation|Template:Collapsible box/doc}}</noinclude>
jm1zd6wrjk77jl9x0nxe76qfblj3z74
32113
32112
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Collapsible_box/e]] سے 1 نسخہ درآمد کیا گیا
32112
wikitext
text/x-wiki
<includeonly>{{div end}}{{div end}}</includeonly><noinclude>{{documentation|Template:Collapsible box/doc}}</noinclude>
jm1zd6wrjk77jl9x0nxe76qfblj3z74
سانچہ:Doc example/styles.css
10
12988
32114
2025-02-10T21:03:23Z
en>Matrix
0
32114
sanitized-css
text/css
.wst-doc-example {
border:1px solid var(--border-color-success, green);
margin-left:1.5em;
}
.wst-doc-example .wst-example-title {
color:var(--color-success, green);
font-size:90%;
}
2xmpz9n5kde6dnfhe1semxxc14gkalc
32115
32114
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Doc_example/styles.css]] سے 1 نسخہ درآمد کیا گیا
32114
sanitized-css
text/css
.wst-doc-example {
border:1px solid var(--border-color-success, green);
margin-left:1.5em;
}
.wst-doc-example .wst-example-title {
color:var(--color-success, green);
font-size:90%;
}
2xmpz9n5kde6dnfhe1semxxc14gkalc
سانچہ:Doc example/e
10
12989
32116
2023-07-28T04:09:14Z
en>CalendulaAsteraceae
0
Redirected page to [[Template:Collapsible box/e]]
32116
wikitext
text/x-wiki
#redirect[[Template:Collapsible box/e]]
al58q2p455219rl0zaw4gozi5m85nnl
32117
32116
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Doc_example/e]] سے 1 نسخہ درآمد کیا گیا
32116
wikitext
text/x-wiki
#redirect[[Template:Collapsible box/e]]
al58q2p455219rl0zaw4gozi5m85nnl
سانچہ:Doc example/s
10
12990
32118
2023-10-12T02:26:34Z
en>CalendulaAsteraceae
0
32118
wikitext
text/x-wiki
<templatestyles src="Template:Doc example/styles.css" />{{collapsible box/s
| title = {{{pre_title|Example}}}{{#if:{{{title|}}}|: {{{title}}}}}
| style_outer = {{#if:{{{margin-left|}}}|margin-left:{{{margin-left}}};}}
| class_outer = wst-doc-example
| class_title = wst-example-title
| collapsed = {{{collapsed|}}}
}}<noinclude>{{doc example/e}}{{documentation|Template:Doc example/doc}}</noinclude>
swj1p3j9zdk1o8u6472o52s89jicbqk
32119
32118
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Doc_example/s]] سے 1 نسخہ درآمد کیا گیا
32118
wikitext
text/x-wiki
<templatestyles src="Template:Doc example/styles.css" />{{collapsible box/s
| title = {{{pre_title|Example}}}{{#if:{{{title|}}}|: {{{title}}}}}
| style_outer = {{#if:{{{margin-left|}}}|margin-left:{{{margin-left}}};}}
| class_outer = wst-doc-example
| class_title = wst-example-title
| collapsed = {{{collapsed|}}}
}}<noinclude>{{doc example/e}}{{documentation|Template:Doc example/doc}}</noinclude>
swj1p3j9zdk1o8u6472o52s89jicbqk
سانچہ:Header/styles.css
10
12991
32120
2025-10-05T07:44:27Z
en>CalendulaAsteraceae
0
Changed protection settings for "[[Template:Header/styles.css]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32120
sanitized-css
text/css
.wst-header .wst-header-mainblock {
border: 1px solid var(--border-color-success, #ACA);
background-color: var(--background-color-success-subtle, #E6F2E6);
color: var(--color-base, #202122);
}
.wst-header .wst-header-notes {
border-bottom: 1px solid var(--border-color-notice, #A0A0A0);
background-color: var(--background-color-neutral, #FAFAFF);
color: var(--color-base, #202122);
}
.wst-header .contributor-text {
font-style: italic;
}
.wst-header #header-title-text,
.wst-header .wst-header-title-text {
font-weight: bold;
}
/* microformat */
.wst-header #ws-data {
display: none;
}
.wst-header #ws-data.ws-data-show {
display: block;
}
akpoow46l6gxfjiafsfqbtdis00qw9x
32121
32120
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Header/styles.css]] سے 1 نسخہ درآمد کیا گیا
32120
sanitized-css
text/css
.wst-header .wst-header-mainblock {
border: 1px solid var(--border-color-success, #ACA);
background-color: var(--background-color-success-subtle, #E6F2E6);
color: var(--color-base, #202122);
}
.wst-header .wst-header-notes {
border-bottom: 1px solid var(--border-color-notice, #A0A0A0);
background-color: var(--background-color-neutral, #FAFAFF);
color: var(--color-base, #202122);
}
.wst-header .contributor-text {
font-style: italic;
}
.wst-header #header-title-text,
.wst-header .wst-header-title-text {
font-weight: bold;
}
/* microformat */
.wst-header #ws-data {
display: none;
}
.wst-header #ws-data.ws-data-show {
display: block;
}
akpoow46l6gxfjiafsfqbtdis00qw9x
سانچہ:Module link
10
12992
32122
2025-03-17T02:01:47Z
en>CalendulaAsteraceae
0
32122
wikitext
text/x-wiki
<includeonly>{{{{{{{|safesubst:}}}#invoke:Separated entries|main|[[Module:{{{1}}}{{{section|}}}|#invoke:{{{1}}}]]|{{{2|''function''}}}|separator=|}}}}</includeonly><noinclude>{{documentation}}<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
9i2jehvmqdbxqb6uexjk8k33u9p06v8
32123
32122
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Module_link]] سے 1 نسخہ درآمد کیا گیا
32122
wikitext
text/x-wiki
<includeonly>{{{{{{{|safesubst:}}}#invoke:Separated entries|main|[[Module:{{{1}}}{{{section|}}}|#invoke:{{{1}}}]]|{{{2|''function''}}}|separator=|}}}}</includeonly><noinclude>{{documentation}}<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
9i2jehvmqdbxqb6uexjk8k33u9p06v8
ماڈیول:Header/year
828
12993
32124
2025-07-17T02:10:34Z
en>CalendulaAsteraceae
0
refactor code for easier maintenance
32124
Scribunto
text/plain
--[=[
Construct the year span
--]=]
require('strict')
local p = {} --p stands for package
local yesno = require('Module:Yesno')
local TableTools = require('Module:TableTools')
--[=[
Year properties:
{
year = integer,
precision = integer,
circa = boolean,
bce = boolean,
uncertain = boolean,
unknown = boolean,
unrecognised = boolean,
display = string,
start_year = year,
end_year = year,
year_list = year
}
]=]
--[=[ Precision:
0 - billion years
1 - hundred million years,
2 - ten million years,
3 - million years,
4 - hundred thousand years,
5 - ten thousand years,
6 - millenia,
7 - centuries,
8 - decades,
9 - years,
10 - months,
11 - days
12 - hours
13 - minutes
14 - seconds
]=]
local currentyear = {
year = tonumber(os.date('%Y')),
precision = 9,
circa = false,
bce = false,
display = os.date('%Y')
}
local unknownyear = {
unknown = true,
display = 'unknown'
}
local function year_less_than(year1, year2)
if year1 == year2 then
return false
elseif not year1 or not year2 then
return year1 == nil
elseif year1.bce ~= year2.bce then
return year1.bce
end
if year1.bce then
return year1.year > year2.year
else
return year1.year < year2.year
end
end
local function year_greater_than(year1, year2)
if year1 == year2 then
return false
elseif not year1 or not year2 then
return year2 == nil
elseif year1.bce ~= year2.bce then
return year2.bce
end
if year1.bce then
return year1.year < year2.year
else
return year1.year > year2.year
end
end
local function year_equal(year1, year2)
if year1 == year2 then
return true
elseif not year1 or not year2 then
return false
end
year1.bce = year2.bce == true
year1.bce = year2.bce == true
return year1.bce == year2.bce and year1.year == year2.year
end
local function pad_number(n, pad)
n = tostring(n)
return string.rep('0', pad - string.len(n)) .. n
end
local function get_year_text(year, precision, bce)
if not tonumber(year) then
return year
elseif precision < 6 then
return nil
end
year = tonumber(year)
local suffixes = {
[1] = 'st',
[2] = 'nd',
[3] = 'rd',
['default'] = 'th'
}
local bce_text = (bce and ' BCE') or ''
if precision == 6 then
local millennium = (year - year % 1000)/1000 + 1
return millennium .. (suffixes[millennium] or suffixes['default']) .. ' millennium' .. bce_text
elseif precision == 7 then
local century = (year - year % 100)/100 + 1
return century .. (suffixes[century] or suffixes['default']) .. ' century' .. bce_text
elseif precision == 8 then
local decade = year - year % 10
return decade .. 's' .. bce_text
else
return year .. bce_text
end
end
local function format_year_for_display(year)
if not year then
return nil
end
local start_year = year.start_year and TableTools.shallowClone(year.start_year)
local end_year = year.end_year and TableTools.shallowClone(year.end_year)
if year.year then
return (year.circa and 'c. ' or '') .. get_year_text(year.year, year.precision + (year.circa and 1 or 0), year.bce) .. ((year.bce == nil and ' CE') or '')
elseif start_year or end_year then
if start_year and end_year then
if start_year.bce and end_year.bce then
start_year.bce = false
elseif start_year.bce ~= end_year.bce then
start_year.bce = start_year.bce or nil
end_year.bce = end_year.bce or nil
end
if start_year.circa then
end_year.circa = false
end
end
return table.concat({format_year_for_display(start_year) or '', format_year_for_display(end_year) or ''}, '–')
end
return nil
end
local function format_year_list_for_display(years)
local year_displays = {}
for _, year in ipairs(years) do
table.insert(year_displays, year.display or format_year_for_display(year))
end
return table.concat(year_displays, '/')
end
local function substrings_all_equal(years, i)
local substrings = {}
for _, year in ipairs(years) do
table.insert(substrings, string.sub(year, 1, i))
end
return #(TableTools.removeDuplicates(substrings)) <= 1
end
local function get_containing_year_category(years_to_categorize)
local years = {}
for _, year in ipairs(TableTools.shallowClone(years_to_categorize)) do
if not year.year or not year.precision then
return nil
else
table.insert(years, year)
end
end
if #years == 0 then
return nil
end
local bce = years[1].bce
for _, year in ipairs(years) do
year.bce = year.bce == true
if bce ~= year.bce then
return nil
end
end
local precisions = {}
for _, year in ipairs(years) do
table.insert(precisions, year.precision)
end
table.sort(precisions)
local n_length = 0
for _, year in ipairs(years) do
n_length = math.max(n_length, string.len(year.year))
end
local padded_years = {}
for _, year in ipairs(years) do
table.insert(padded_years, pad_number(year.year, n_length))
end
local shared_digits = 1
while shared_digits <= n_length and substrings_all_equal(padded_years, shared_digits) do
shared_digits = shared_digits + 1
end
shared_digits = shared_digits - 1
local range_precision = math.min(precisions[1], 9 - n_length + shared_digits)
return get_year_text(years[1].year, range_precision, years[1].bce)
end
local function categorise_year(args)
local cats = {}
if not args.input_year and args.year then
table.insert(cats, '[[Category:' .. 'Works with year from Wikidata' .. ']]')
elseif not args.input_year then
table.insert(cats, '[[Category:' .. 'Undated works' .. ']]')
elseif args.input_year and not tonumber(args.input_year) then
table.insert(cats, '[[Category:' .. 'Works with non-numeric dates' .. ']]')
end
if args.unrecognised then
table.insert(cats, '[[Category:' .. 'Works with unrecognised dates' .. ']]')
end
local year = args.year or {}
local start_year = year.start_year or (year.end_year ~= nil and unknownyear) or {}
local end_year = year.end_year or (year.start_year ~= nil and currentyear) or {}
start_year.bce = start_year.bce == true
end_year.bce = end_year.bce == true
local year_list = year.year_list or {}
local precisions = {}
table.insert(precisions, year.precision)
table.insert(precisions, start_year.precision)
table.insert(precisions, end_year.precision)
table.sort(precisions)
if year.uncertain or start_year.uncertain or end_year.uncertain or year.circa or start_year.circa or end_year.circa or #(year_list) > 1 or (precisions[1] and precisions[1] < 9) then
table.insert(cats, '[[Category:' .. 'Works of uncertain date' .. ']]')
end
if year.unknown or start_year.unknown or end_year.unknown then
table.insert(cats, '[[Category:' .. 'Works of unknown date' .. ']]')
end
if start_year.year and end_year.year and year_greater_than(start_year, end_year) then
table.insert(cats, '[[Category:' .. 'Works with start and end dates in the wrong order' .. ']]')
end
-- single year
local year_for_cat
if year.year then
year_for_cat = get_year_text(year.year, year.precision, year.bce)
-- date range
elseif start_year.year and end_year.year and start_year.bce == end_year.bce then
year_for_cat = get_containing_year_category({start_year, end_year})
elseif #year_list > 0 then
year_for_cat = get_containing_year_category(year_list)
end
table.insert(cats, year_for_cat and ('[[Category:' .. year_for_cat .. ' works]]'))
return table.concat(cats)
end
local function get_year_from_single_statement(statement)
local snak = statement.mainsnak
if not snak or not snak.datavalue or not snak.datavalue.value or not snak['datavalue']['value']['time'] or not snak.datavalue.value.precision then
return nil
end
local precision = snak.datavalue.value.precision
if precision < 6 then
-- precision is less than a millennium
return {
precision = precision,
display = string.gsub(mw.wikibase.formatValue(statement.mainsnak), '^<span>(.*)</span>$', '%1')
}
end
local start_years = {}
local end_years = {}
local start_year, end_year
local circa = false
if statement.qualifiers then
-- Check if date is approximate
-- P1480 = sourcing circumstances, Q5727902 = circa
if statement.qualifiers.P1480 then
for _, qualifier in ipairs(statement.qualifiers.P1480) do
if qualifier.datavalue and qualifier.datavalue.value.id == 'Q5727902' then
circa = true
break
end
end
end
if circa then
precision = precision - 1
end
-- P580 = start time
if statement.qualifiers.P580 then
for k, v in pairs(statement.qualifiers.P580) do
table.insert(start_years, get_year_from_single_statement({mainsnak = v}))
end
start_years = TableTools.compressSparseArray(TableTools.removeDuplicates(start_years))
table.sort(start_years, year_less_than)
start_year = start_years[1]
if #start_years > 1 then
start_year.uncertain = true
end
end
-- P582 = end time
if statement.qualifiers.P582 then
for k, v in pairs(statement.qualifiers.P582) do
table.insert(end_years, get_year_from_single_statement({mainsnak = v}))
end
end_years = TableTools.compressSparseArray(TableTools.removeDuplicates(end_years))
table.sort(end_years, year_less_than)
end_year = end_years[1]
if #end_years > 1 then
end_year.uncertain = true
end
end
end
-- extract the year from the timestamp
-- example timestamps: +2016-10-05T00:00:00Z, -1752-00-00T00:00:00Z
local year
local bce = false
local split = mw.text.split(snak['datavalue']['value']['time'], '-', true)
if split[1] == '' then
year = tonumber(split[2])
bce = true
else
year = tonumber(split[1])
end
-- malformed timestamp
if not year then
return nil
end
local year_data = {
year = (not start_year and not end_year and year) or nil,
circa = circa,
bce = bce,
uncertain = (start_year and start_year.year ~= year) or circa,
precision = precision,
start_year = start_year,
end_year = end_year
}
year_data.display = format_year_for_display(year_data)
return year_data
end
local function get_wikidata_year(args)
-- Fetch entity object for Wikidata item connected to the current page
-- Let manually-specified Wikidata ID override if given and valid
if not (args.wikidata and mw.wikibase.isValidEntityId(args.wikidata)) then
args.wikidata = mw.wikibase.getEntityIdForCurrentPage()
end
if not args.wikidata then
return nil
end
local item = mw.wikibase.getEntity(args.wikidata)
if not item then
return nil
end
local statements = item:getBestStatements('P577') -- publication date
if #statements == 0 then
return nil
end
local years = {}
for _, statement in ipairs(statements) do
local year_data = get_year_from_single_statement(statement)
table.insert(years, year_data)
end
years = TableTools.compressSparseArray(TableTools.removeDuplicates(years))
if #years == 0 then
return nil
elseif #years == 1 then
return years[1]
end
return {
uncertain = true,
year_list = years,
display = format_year_list_for_display(years)
}
end
local function parse_year(year)
if not year then
return nil
elseif year == '?' or string.lower(year) == 'unknown' then
return unknownyear
end
local input_year = year
local circa = false
-- Lua patterns can't do ^c(irca)?(%s|%.|/)* because they don't do alternation or apply quantifiers to groups
if string.match(year, '^circa') or string.match(year, '^c%.') or string.match(year, '^c%s*/') then
circa = true
year = string.gsub(string.gsub(string.gsub(year, '^circa%s*', ''), '^c%.%s*', ''), '^c%s*/%s*', '')
end
local bce = false
if string.match(year, 'BC[E]?$') then
bce = true
year = string.gsub(year, '%s*BC[E]?$', '')
end
if string.match(year, '/') then
local year_split = mw.text.split(year, '/')
local years = {}
for _, opt in ipairs(year_split) do
if opt ~= '' then
local y = parse_year(opt)
y.bce = y.bce or bce
y.circa = y.circa or circa
table.insert(years, y)
end
end
if #years > 1 then
return {
uncertain = true,
year_list = years,
display = format_year_list_for_display(years)
}
elseif #years == 1 then
return years[1]
end
end
local start_year, end_year
year = string.gsub(string.gsub(year, '%-', '–'), '—', '–')
if string.match(year, '^[^–]*–[^–]*$') then
local year_range = mw.text.split(year, '–')
start_year = mw.text.trim(year_range[1])
end_year = mw.text.trim(year_range[2])
if start_year == '' then
start_year = nil
else
start_year = parse_year(start_year)
start_year.circa = start_year.circa or circa
start_year.bce = start_year.bce or bce
end
if end_year == '' then
end_year = nil
else
end_year = parse_year(end_year)
end_year.circa = end_year.circa or circa
end_year.bce = end_year.bce or bce
end
end
local precision
if tonumber(year) then
precision = 9
-- Check if it looks like a decade
elseif string.match(year, '^%d*0s$') then
precision = 8
year = string.gsub(year, '^(%d*0)s$', '%1')
-- Or a century
elseif string.match(year, '^%d+[a-z]* century$') then
precision = 7
year = string.gsub(year, '^(%d+)[a-z]* century$', '%1')
year = 100 * (tonumber(year) - 1)
-- Or a millennium
elseif string.match(year, '^%d+[a-z]* millennium$') then
precision = 6
year = string.gsub(year, '^(%d+)[a-z]* millennium', '%1')
year = 1000 * (tonumber(year) - 1)
end
if circa and precision then
precision = precision - 1
end
if tonumber(year) then
local data = {
year = tonumber(year),
bce = bce,
circa = circa,
precision = precision
}
data['display'] = format_year_for_display(data)
return data
elseif start_year or end_year then
return {
start_year = start_year,
end_year = end_year,
display = format_year_for_display({start_year = start_year, end_year = end_year})
}
end
return {
unrecognised = true,
display = input_year
}
end
function p.construct_year(args)
local current_title = mw.title.getCurrentTitle()
local year_args = {
year = args.year,
noprint = yesno(args.noyear) or false,
wikidata = args.wikidata
}
year_args.nocat = yesno(args.noyearcat)
if year_args.nocat == nil then
if args.testing then
year_args.nocat = false
else
year_args.nocat = (
yesno(args.disambiguation) -- disambiguations never categorise
or not current_title:inNamespaces(0, 114) -- only categorise in mainspace and Translation
or current_title.isSubpage -- only categorise if this is a base page
)
end
end
local year_data = parse_year(year_args.year) or get_wikidata_year(year_args)
local cats = (year_args.nocat and '') or categorise_year({input_year = year_args.year, year = year_data})
if args.testing then
cats = mw.text.nowiki(cats) .. cats
end
if year_args.noprint or not year_data or not year_data.display then
return cats
end
local year_span = mw.html.create('span')
:addClass('wst-header-year-text')
:wikitext(year_data.display)
:allDone()
return ' (' .. tostring(year_span) .. ')' .. cats
end
return p
exd55p7il0vy78txatwrcldb9ku82g0
32125
32124
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Module:Header/year]] سے 1 نسخہ درآمد کیا گیا
32124
Scribunto
text/plain
--[=[
Construct the year span
--]=]
require('strict')
local p = {} --p stands for package
local yesno = require('Module:Yesno')
local TableTools = require('Module:TableTools')
--[=[
Year properties:
{
year = integer,
precision = integer,
circa = boolean,
bce = boolean,
uncertain = boolean,
unknown = boolean,
unrecognised = boolean,
display = string,
start_year = year,
end_year = year,
year_list = year
}
]=]
--[=[ Precision:
0 - billion years
1 - hundred million years,
2 - ten million years,
3 - million years,
4 - hundred thousand years,
5 - ten thousand years,
6 - millenia,
7 - centuries,
8 - decades,
9 - years,
10 - months,
11 - days
12 - hours
13 - minutes
14 - seconds
]=]
local currentyear = {
year = tonumber(os.date('%Y')),
precision = 9,
circa = false,
bce = false,
display = os.date('%Y')
}
local unknownyear = {
unknown = true,
display = 'unknown'
}
local function year_less_than(year1, year2)
if year1 == year2 then
return false
elseif not year1 or not year2 then
return year1 == nil
elseif year1.bce ~= year2.bce then
return year1.bce
end
if year1.bce then
return year1.year > year2.year
else
return year1.year < year2.year
end
end
local function year_greater_than(year1, year2)
if year1 == year2 then
return false
elseif not year1 or not year2 then
return year2 == nil
elseif year1.bce ~= year2.bce then
return year2.bce
end
if year1.bce then
return year1.year < year2.year
else
return year1.year > year2.year
end
end
local function year_equal(year1, year2)
if year1 == year2 then
return true
elseif not year1 or not year2 then
return false
end
year1.bce = year2.bce == true
year1.bce = year2.bce == true
return year1.bce == year2.bce and year1.year == year2.year
end
local function pad_number(n, pad)
n = tostring(n)
return string.rep('0', pad - string.len(n)) .. n
end
local function get_year_text(year, precision, bce)
if not tonumber(year) then
return year
elseif precision < 6 then
return nil
end
year = tonumber(year)
local suffixes = {
[1] = 'st',
[2] = 'nd',
[3] = 'rd',
['default'] = 'th'
}
local bce_text = (bce and ' BCE') or ''
if precision == 6 then
local millennium = (year - year % 1000)/1000 + 1
return millennium .. (suffixes[millennium] or suffixes['default']) .. ' millennium' .. bce_text
elseif precision == 7 then
local century = (year - year % 100)/100 + 1
return century .. (suffixes[century] or suffixes['default']) .. ' century' .. bce_text
elseif precision == 8 then
local decade = year - year % 10
return decade .. 's' .. bce_text
else
return year .. bce_text
end
end
local function format_year_for_display(year)
if not year then
return nil
end
local start_year = year.start_year and TableTools.shallowClone(year.start_year)
local end_year = year.end_year and TableTools.shallowClone(year.end_year)
if year.year then
return (year.circa and 'c. ' or '') .. get_year_text(year.year, year.precision + (year.circa and 1 or 0), year.bce) .. ((year.bce == nil and ' CE') or '')
elseif start_year or end_year then
if start_year and end_year then
if start_year.bce and end_year.bce then
start_year.bce = false
elseif start_year.bce ~= end_year.bce then
start_year.bce = start_year.bce or nil
end_year.bce = end_year.bce or nil
end
if start_year.circa then
end_year.circa = false
end
end
return table.concat({format_year_for_display(start_year) or '', format_year_for_display(end_year) or ''}, '–')
end
return nil
end
local function format_year_list_for_display(years)
local year_displays = {}
for _, year in ipairs(years) do
table.insert(year_displays, year.display or format_year_for_display(year))
end
return table.concat(year_displays, '/')
end
local function substrings_all_equal(years, i)
local substrings = {}
for _, year in ipairs(years) do
table.insert(substrings, string.sub(year, 1, i))
end
return #(TableTools.removeDuplicates(substrings)) <= 1
end
local function get_containing_year_category(years_to_categorize)
local years = {}
for _, year in ipairs(TableTools.shallowClone(years_to_categorize)) do
if not year.year or not year.precision then
return nil
else
table.insert(years, year)
end
end
if #years == 0 then
return nil
end
local bce = years[1].bce
for _, year in ipairs(years) do
year.bce = year.bce == true
if bce ~= year.bce then
return nil
end
end
local precisions = {}
for _, year in ipairs(years) do
table.insert(precisions, year.precision)
end
table.sort(precisions)
local n_length = 0
for _, year in ipairs(years) do
n_length = math.max(n_length, string.len(year.year))
end
local padded_years = {}
for _, year in ipairs(years) do
table.insert(padded_years, pad_number(year.year, n_length))
end
local shared_digits = 1
while shared_digits <= n_length and substrings_all_equal(padded_years, shared_digits) do
shared_digits = shared_digits + 1
end
shared_digits = shared_digits - 1
local range_precision = math.min(precisions[1], 9 - n_length + shared_digits)
return get_year_text(years[1].year, range_precision, years[1].bce)
end
local function categorise_year(args)
local cats = {}
if not args.input_year and args.year then
table.insert(cats, '[[Category:' .. 'Works with year from Wikidata' .. ']]')
elseif not args.input_year then
table.insert(cats, '[[Category:' .. 'Undated works' .. ']]')
elseif args.input_year and not tonumber(args.input_year) then
table.insert(cats, '[[Category:' .. 'Works with non-numeric dates' .. ']]')
end
if args.unrecognised then
table.insert(cats, '[[Category:' .. 'Works with unrecognised dates' .. ']]')
end
local year = args.year or {}
local start_year = year.start_year or (year.end_year ~= nil and unknownyear) or {}
local end_year = year.end_year or (year.start_year ~= nil and currentyear) or {}
start_year.bce = start_year.bce == true
end_year.bce = end_year.bce == true
local year_list = year.year_list or {}
local precisions = {}
table.insert(precisions, year.precision)
table.insert(precisions, start_year.precision)
table.insert(precisions, end_year.precision)
table.sort(precisions)
if year.uncertain or start_year.uncertain or end_year.uncertain or year.circa or start_year.circa or end_year.circa or #(year_list) > 1 or (precisions[1] and precisions[1] < 9) then
table.insert(cats, '[[Category:' .. 'Works of uncertain date' .. ']]')
end
if year.unknown or start_year.unknown or end_year.unknown then
table.insert(cats, '[[Category:' .. 'Works of unknown date' .. ']]')
end
if start_year.year and end_year.year and year_greater_than(start_year, end_year) then
table.insert(cats, '[[Category:' .. 'Works with start and end dates in the wrong order' .. ']]')
end
-- single year
local year_for_cat
if year.year then
year_for_cat = get_year_text(year.year, year.precision, year.bce)
-- date range
elseif start_year.year and end_year.year and start_year.bce == end_year.bce then
year_for_cat = get_containing_year_category({start_year, end_year})
elseif #year_list > 0 then
year_for_cat = get_containing_year_category(year_list)
end
table.insert(cats, year_for_cat and ('[[Category:' .. year_for_cat .. ' works]]'))
return table.concat(cats)
end
local function get_year_from_single_statement(statement)
local snak = statement.mainsnak
if not snak or not snak.datavalue or not snak.datavalue.value or not snak['datavalue']['value']['time'] or not snak.datavalue.value.precision then
return nil
end
local precision = snak.datavalue.value.precision
if precision < 6 then
-- precision is less than a millennium
return {
precision = precision,
display = string.gsub(mw.wikibase.formatValue(statement.mainsnak), '^<span>(.*)</span>$', '%1')
}
end
local start_years = {}
local end_years = {}
local start_year, end_year
local circa = false
if statement.qualifiers then
-- Check if date is approximate
-- P1480 = sourcing circumstances, Q5727902 = circa
if statement.qualifiers.P1480 then
for _, qualifier in ipairs(statement.qualifiers.P1480) do
if qualifier.datavalue and qualifier.datavalue.value.id == 'Q5727902' then
circa = true
break
end
end
end
if circa then
precision = precision - 1
end
-- P580 = start time
if statement.qualifiers.P580 then
for k, v in pairs(statement.qualifiers.P580) do
table.insert(start_years, get_year_from_single_statement({mainsnak = v}))
end
start_years = TableTools.compressSparseArray(TableTools.removeDuplicates(start_years))
table.sort(start_years, year_less_than)
start_year = start_years[1]
if #start_years > 1 then
start_year.uncertain = true
end
end
-- P582 = end time
if statement.qualifiers.P582 then
for k, v in pairs(statement.qualifiers.P582) do
table.insert(end_years, get_year_from_single_statement({mainsnak = v}))
end
end_years = TableTools.compressSparseArray(TableTools.removeDuplicates(end_years))
table.sort(end_years, year_less_than)
end_year = end_years[1]
if #end_years > 1 then
end_year.uncertain = true
end
end
end
-- extract the year from the timestamp
-- example timestamps: +2016-10-05T00:00:00Z, -1752-00-00T00:00:00Z
local year
local bce = false
local split = mw.text.split(snak['datavalue']['value']['time'], '-', true)
if split[1] == '' then
year = tonumber(split[2])
bce = true
else
year = tonumber(split[1])
end
-- malformed timestamp
if not year then
return nil
end
local year_data = {
year = (not start_year and not end_year and year) or nil,
circa = circa,
bce = bce,
uncertain = (start_year and start_year.year ~= year) or circa,
precision = precision,
start_year = start_year,
end_year = end_year
}
year_data.display = format_year_for_display(year_data)
return year_data
end
local function get_wikidata_year(args)
-- Fetch entity object for Wikidata item connected to the current page
-- Let manually-specified Wikidata ID override if given and valid
if not (args.wikidata and mw.wikibase.isValidEntityId(args.wikidata)) then
args.wikidata = mw.wikibase.getEntityIdForCurrentPage()
end
if not args.wikidata then
return nil
end
local item = mw.wikibase.getEntity(args.wikidata)
if not item then
return nil
end
local statements = item:getBestStatements('P577') -- publication date
if #statements == 0 then
return nil
end
local years = {}
for _, statement in ipairs(statements) do
local year_data = get_year_from_single_statement(statement)
table.insert(years, year_data)
end
years = TableTools.compressSparseArray(TableTools.removeDuplicates(years))
if #years == 0 then
return nil
elseif #years == 1 then
return years[1]
end
return {
uncertain = true,
year_list = years,
display = format_year_list_for_display(years)
}
end
local function parse_year(year)
if not year then
return nil
elseif year == '?' or string.lower(year) == 'unknown' then
return unknownyear
end
local input_year = year
local circa = false
-- Lua patterns can't do ^c(irca)?(%s|%.|/)* because they don't do alternation or apply quantifiers to groups
if string.match(year, '^circa') or string.match(year, '^c%.') or string.match(year, '^c%s*/') then
circa = true
year = string.gsub(string.gsub(string.gsub(year, '^circa%s*', ''), '^c%.%s*', ''), '^c%s*/%s*', '')
end
local bce = false
if string.match(year, 'BC[E]?$') then
bce = true
year = string.gsub(year, '%s*BC[E]?$', '')
end
if string.match(year, '/') then
local year_split = mw.text.split(year, '/')
local years = {}
for _, opt in ipairs(year_split) do
if opt ~= '' then
local y = parse_year(opt)
y.bce = y.bce or bce
y.circa = y.circa or circa
table.insert(years, y)
end
end
if #years > 1 then
return {
uncertain = true,
year_list = years,
display = format_year_list_for_display(years)
}
elseif #years == 1 then
return years[1]
end
end
local start_year, end_year
year = string.gsub(string.gsub(year, '%-', '–'), '—', '–')
if string.match(year, '^[^–]*–[^–]*$') then
local year_range = mw.text.split(year, '–')
start_year = mw.text.trim(year_range[1])
end_year = mw.text.trim(year_range[2])
if start_year == '' then
start_year = nil
else
start_year = parse_year(start_year)
start_year.circa = start_year.circa or circa
start_year.bce = start_year.bce or bce
end
if end_year == '' then
end_year = nil
else
end_year = parse_year(end_year)
end_year.circa = end_year.circa or circa
end_year.bce = end_year.bce or bce
end
end
local precision
if tonumber(year) then
precision = 9
-- Check if it looks like a decade
elseif string.match(year, '^%d*0s$') then
precision = 8
year = string.gsub(year, '^(%d*0)s$', '%1')
-- Or a century
elseif string.match(year, '^%d+[a-z]* century$') then
precision = 7
year = string.gsub(year, '^(%d+)[a-z]* century$', '%1')
year = 100 * (tonumber(year) - 1)
-- Or a millennium
elseif string.match(year, '^%d+[a-z]* millennium$') then
precision = 6
year = string.gsub(year, '^(%d+)[a-z]* millennium', '%1')
year = 1000 * (tonumber(year) - 1)
end
if circa and precision then
precision = precision - 1
end
if tonumber(year) then
local data = {
year = tonumber(year),
bce = bce,
circa = circa,
precision = precision
}
data['display'] = format_year_for_display(data)
return data
elseif start_year or end_year then
return {
start_year = start_year,
end_year = end_year,
display = format_year_for_display({start_year = start_year, end_year = end_year})
}
end
return {
unrecognised = true,
display = input_year
}
end
function p.construct_year(args)
local current_title = mw.title.getCurrentTitle()
local year_args = {
year = args.year,
noprint = yesno(args.noyear) or false,
wikidata = args.wikidata
}
year_args.nocat = yesno(args.noyearcat)
if year_args.nocat == nil then
if args.testing then
year_args.nocat = false
else
year_args.nocat = (
yesno(args.disambiguation) -- disambiguations never categorise
or not current_title:inNamespaces(0, 114) -- only categorise in mainspace and Translation
or current_title.isSubpage -- only categorise if this is a base page
)
end
end
local year_data = parse_year(year_args.year) or get_wikidata_year(year_args)
local cats = (year_args.nocat and '') or categorise_year({input_year = year_args.year, year = year_data})
if args.testing then
cats = mw.text.nowiki(cats) .. cats
end
if year_args.noprint or not year_data or not year_data.display then
return cats
end
local year_span = mw.html.create('span')
:addClass('wst-header-year-text')
:wikitext(year_data.display)
:allDone()
return ' (' .. tostring(year_span) .. ')' .. cats
end
return p
exd55p7il0vy78txatwrcldb9ku82g0
سانچہ:Shortcut/styles.css
10
12994
32126
2025-10-05T08:02:43Z
en>CalendulaAsteraceae
0
Protected "[[Template:Shortcut/styles.css]]": High traffic page or template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32126
sanitized-css
text/css
.wst-shortcut {
display:table;
border-collapse:collapse;
border:1px solid var(--border-color-base, #999);
margin:2px 0px 2px 8px;
float:right;
clear:right;
}
.wst-shortcut > div {
display:table-row-group;
background-color:var(--background-color-base, #fff);
}
.wst-shortcut > div > div {
display:table-row;
}
.wst-shortcut > div > div > div {
display:table-cell;
font-size:86%;
font-weight:bold;
padding:4px;
text-align:center;
}
.wst-shortcut > div > div > div > span {
letter-spacing:1px;
}
tezv4175s07uy2gtd6lyu19c4vt9ah1
32127
32126
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Shortcut/styles.css]] سے 1 نسخہ درآمد کیا گیا
32126
sanitized-css
text/css
.wst-shortcut {
display:table;
border-collapse:collapse;
border:1px solid var(--border-color-base, #999);
margin:2px 0px 2px 8px;
float:right;
clear:right;
}
.wst-shortcut > div {
display:table-row-group;
background-color:var(--background-color-base, #fff);
}
.wst-shortcut > div > div {
display:table-row;
}
.wst-shortcut > div > div > div {
display:table-cell;
font-size:86%;
font-weight:bold;
padding:4px;
text-align:center;
}
.wst-shortcut > div > div > div > span {
letter-spacing:1px;
}
tezv4175s07uy2gtd6lyu19c4vt9ah1
ماڈیول:Header structure
828
12995
32128
2024-07-11T06:56:16Z
en>Xover
0
remove unused variable and call to mw.wikibase.getEntityIdForCurrentPage()
32128
Scribunto
text/plain
--[=[
This is a module to implement logic for header templates
]=]
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local plain_sister = require('Module:Plain sister')._plain_sister
-- return true if any value in list is not nil or empty in args
-- (nil means not present; empty string is not nil)
local function has_any_arg(args, list)
for k, v in pairs(list) do
if args[v] ~= nil then
return true
end
end
return false
end
--[=[
Construct the main block
]=]
local function construct_main_block(args, prefix)
-- header and tracking categories
local main_div = mw.html.create('div')
:addClass('wst-header-mainblock')
:addClass(prefix .. '-mainblock')
-- If an extra main class was provided, add it
-- TODO: Is this used? Is it needed?
if args.main_class ~= nil and args.main_class ~= "" then
main_div:addClass(args.main_class)
end
-- "Previous" field
local prev_div = main_div:tag('div')
:addClass('wst-header-back')
:addClass('searchaux')
:addClass(prefix .. '-back')
:tag('div'):addClass('wst-header-back-arrow'):wikitext('←')
:done()
:tag('div'):addClass('wst-header-back-link'):wikitext(args['previous'])
:done()
if args['previous'] == nil or args['previous'] == "" then
prev_div:addClass('wst-header-nav-empty')
end
-- The central cell
local center_div = main_div:tag('div')
:addClass('wst-header-central-cell')
:addClass(prefix .. '-central-cell')
-- Special case to manage exceptional formatting in disambiguation-like
-- pages; not otherwise documented
local pretitle = ''
if args.pretitle then
local br = '<br/>'
if not args.main_title or args.main_title == '' then
br = ''
end
center_div:tag('span')
:addClass('wst-header-pretitle')
:wikitext(args.pretitle .. br)
end
center_div:tag('span')
:addClass('wst-header-title')
:addClass(prefix .. '-title')
:wikitext(args.main_title or '')
-- "Next" field
local next_div = main_div:tag('div')
:addClass('wst-header-forward')
:addClass('searchaux')
:addClass(prefix .. '-forward')
:tag('div'):addClass('wst-header-forward-link'):wikitext(args['next'])
:done()
:tag('div'):addClass('wst-header-forward-arrow'):wikitext('→')
:done()
if args['next'] == nil or args['next'] == "" then
next_div:addClass('wst-header-nav-empty')
end
return tostring(main_div)
end
--[=[
Construct the notes block
]=]
local function construct_notes_block(args, prefix)
local main_div = mw.html.create('div')
:addClass('wst-header-notes')
:addClass('header_notes')
:addClass('searchaux')
:addClass(prefix .. '-notes')
-- If an extra main class was provided, add it
-- TODO: Is this used? Is it needed?
if args.notes_class ~= nil and args.notes_class ~= "" then
main_div:addClass(args.notes_class)
end
-- Left-floated content has to come first, or it may float below the sisters.
local notes_left_content = ''
if args.notes_left_content then
local notes_left_content_div = mw.html.create('div')
:addClass('wst-header-left')
:addClass('header_notes_left_content')
:addClass(prefix .. '-left')
:wikitext(args.notes_left_content)
notes_left_content = tostring(notes_left_content_div)
end
local shortcut = ''
if args.shortcut then
shortcut = mw.getCurrentFrame():expandTemplate {
title = 'shortcut',
args = {args.shortcut}
}
end
local notes_content = ''
if args.notes then
args.notes = mw.getCurrentFrame():preprocess(args.notes)
-- linebreaks are so notes get paragraph formatting
local notes_content_div = mw.html.create('div')
:addClass('wst-header-content')
:addClass('header_notes_content')
:addClass('wst-header-notes-content')
:addClass(prefix .. '-notes-content')
:wikitext('\n' .. args.notes .. '\n')
notes_content = tostring(notes_content_div)
end
local sister = plain_sister(args)
if not sister and not args.notes and not args.notes_left_content then
return ''
end
return tostring(main_div:wikitext(notes_left_content .. (sister or '') .. shortcut .. notes_content))
end
--[=[
Construct header
]=]
function p.construct_header(args)
-- Make sure the main identifying class for the client template is set
local prefix = "wst-unknown"
if args.template ~= nil and args.template ~= "" then
prefix = "wst-" .. args.template
end
local headerContainer = mw.html.create('div')
:addClass("ws-header")
:addClass("wst-header-structure")
:addClass(prefix)
-- header_class from client modules, class from individual uses
if args.header_class then
headerContainer:addClass(args.header_class)
end
if args.class then
headerContainer:addClass(args.class)
end
headerContainer:wikitext(table.concat({
(args.pre_main or ''),
construct_main_block(args, prefix),
construct_notes_block(args, prefix),
(args.post_notes or '')
}))
local stylesheet = mw.getCurrentFrame():extensionTag('templatestyles', '', {src = 'Header structure/styles.css'})
return stylesheet .. (args.pre_container or '') .. tostring(headerContainer)
end
function p.header_structure(frame)
return p.construct_header(getArgs(frame))
end
return p
971hsxfdvcp7ud5w4balnss3cmkboio
32129
32128
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Module:Header_structure]] سے 1 نسخہ درآمد کیا گیا
32128
Scribunto
text/plain
--[=[
This is a module to implement logic for header templates
]=]
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local plain_sister = require('Module:Plain sister')._plain_sister
-- return true if any value in list is not nil or empty in args
-- (nil means not present; empty string is not nil)
local function has_any_arg(args, list)
for k, v in pairs(list) do
if args[v] ~= nil then
return true
end
end
return false
end
--[=[
Construct the main block
]=]
local function construct_main_block(args, prefix)
-- header and tracking categories
local main_div = mw.html.create('div')
:addClass('wst-header-mainblock')
:addClass(prefix .. '-mainblock')
-- If an extra main class was provided, add it
-- TODO: Is this used? Is it needed?
if args.main_class ~= nil and args.main_class ~= "" then
main_div:addClass(args.main_class)
end
-- "Previous" field
local prev_div = main_div:tag('div')
:addClass('wst-header-back')
:addClass('searchaux')
:addClass(prefix .. '-back')
:tag('div'):addClass('wst-header-back-arrow'):wikitext('←')
:done()
:tag('div'):addClass('wst-header-back-link'):wikitext(args['previous'])
:done()
if args['previous'] == nil or args['previous'] == "" then
prev_div:addClass('wst-header-nav-empty')
end
-- The central cell
local center_div = main_div:tag('div')
:addClass('wst-header-central-cell')
:addClass(prefix .. '-central-cell')
-- Special case to manage exceptional formatting in disambiguation-like
-- pages; not otherwise documented
local pretitle = ''
if args.pretitle then
local br = '<br/>'
if not args.main_title or args.main_title == '' then
br = ''
end
center_div:tag('span')
:addClass('wst-header-pretitle')
:wikitext(args.pretitle .. br)
end
center_div:tag('span')
:addClass('wst-header-title')
:addClass(prefix .. '-title')
:wikitext(args.main_title or '')
-- "Next" field
local next_div = main_div:tag('div')
:addClass('wst-header-forward')
:addClass('searchaux')
:addClass(prefix .. '-forward')
:tag('div'):addClass('wst-header-forward-link'):wikitext(args['next'])
:done()
:tag('div'):addClass('wst-header-forward-arrow'):wikitext('→')
:done()
if args['next'] == nil or args['next'] == "" then
next_div:addClass('wst-header-nav-empty')
end
return tostring(main_div)
end
--[=[
Construct the notes block
]=]
local function construct_notes_block(args, prefix)
local main_div = mw.html.create('div')
:addClass('wst-header-notes')
:addClass('header_notes')
:addClass('searchaux')
:addClass(prefix .. '-notes')
-- If an extra main class was provided, add it
-- TODO: Is this used? Is it needed?
if args.notes_class ~= nil and args.notes_class ~= "" then
main_div:addClass(args.notes_class)
end
-- Left-floated content has to come first, or it may float below the sisters.
local notes_left_content = ''
if args.notes_left_content then
local notes_left_content_div = mw.html.create('div')
:addClass('wst-header-left')
:addClass('header_notes_left_content')
:addClass(prefix .. '-left')
:wikitext(args.notes_left_content)
notes_left_content = tostring(notes_left_content_div)
end
local shortcut = ''
if args.shortcut then
shortcut = mw.getCurrentFrame():expandTemplate {
title = 'shortcut',
args = {args.shortcut}
}
end
local notes_content = ''
if args.notes then
args.notes = mw.getCurrentFrame():preprocess(args.notes)
-- linebreaks are so notes get paragraph formatting
local notes_content_div = mw.html.create('div')
:addClass('wst-header-content')
:addClass('header_notes_content')
:addClass('wst-header-notes-content')
:addClass(prefix .. '-notes-content')
:wikitext('\n' .. args.notes .. '\n')
notes_content = tostring(notes_content_div)
end
local sister = plain_sister(args)
if not sister and not args.notes and not args.notes_left_content then
return ''
end
return tostring(main_div:wikitext(notes_left_content .. (sister or '') .. shortcut .. notes_content))
end
--[=[
Construct header
]=]
function p.construct_header(args)
-- Make sure the main identifying class for the client template is set
local prefix = "wst-unknown"
if args.template ~= nil and args.template ~= "" then
prefix = "wst-" .. args.template
end
local headerContainer = mw.html.create('div')
:addClass("ws-header")
:addClass("wst-header-structure")
:addClass(prefix)
-- header_class from client modules, class from individual uses
if args.header_class then
headerContainer:addClass(args.header_class)
end
if args.class then
headerContainer:addClass(args.class)
end
headerContainer:wikitext(table.concat({
(args.pre_main or ''),
construct_main_block(args, prefix),
construct_notes_block(args, prefix),
(args.post_notes or '')
}))
local stylesheet = mw.getCurrentFrame():extensionTag('templatestyles', '', {src = 'Header structure/styles.css'})
return stylesheet .. (args.pre_container or '') .. tostring(headerContainer)
end
function p.header_structure(frame)
return p.construct_header(getArgs(frame))
end
return p
971hsxfdvcp7ud5w4balnss3cmkboio
سانچہ:Header structure/styles.css
10
12996
32130
2026-01-29T07:06:05Z
en>CalendulaAsteraceae
0
fix behavior of prev-link in dark mode
32130
sanitized-css
text/css
/* Styles used by header templates (not just header) */
/*
* main block
*/
/* The top level wrapper for the header main block. */
.wst-header-mainblock {
margin: 4px auto 4px auto;
padding: 0 3px;
display: flex;
align-items: center;
}
/* Common styles for back and forward links */
.wst-header-back, .wst-header-forward {
display: flex;
flex: 1 4 100%;
min-width: min-content;
align-items: center;
font-size: .9em;
}
.wst-header-nav-empty {
visibility: hidden;
}
/* The container for the back (previous) link. */
.wst-header-back {
justify-content: flex-start;
text-align: left;
}
/* The container for the central cell. */
.wst-header-central-cell {
flex: 4 1 100%;
max-width: max-content;
text-align: center;
}
/* The container for the forward (next) link. */
.wst-header-forward {
justify-content: flex-end;
text-align: right;
}
@media(max-width:768px) {
/* Put title on its own flexbox row */
.wst-header-mainblock {
flex-wrap:wrap;
}
.wst-header-central-cell {
flex:0 0 100%;
order:-2;
width:auto;
}
.wst-header-back, .wst-header-forward {
width:auto;
}
}
/*
* notes block
*/
/* The overall notes container. */
.wst-header-notes {
display:inline-block;
border-collapse:collapse;
border-spacing:0;
empty-cells:hide;
font-size:.9em;
line-height:1.4;
margin:0 auto 4px auto;
width:100%;
}
/* Left-floated content. */
.wst-header-left {
float:left;
}
endbvjhthg540or09glpy5cpeygobni
32131
32130
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Template:Header_structure/styles.css]] سے 1 نسخہ درآمد کیا گیا
32130
sanitized-css
text/css
/* Styles used by header templates (not just header) */
/*
* main block
*/
/* The top level wrapper for the header main block. */
.wst-header-mainblock {
margin: 4px auto 4px auto;
padding: 0 3px;
display: flex;
align-items: center;
}
/* Common styles for back and forward links */
.wst-header-back, .wst-header-forward {
display: flex;
flex: 1 4 100%;
min-width: min-content;
align-items: center;
font-size: .9em;
}
.wst-header-nav-empty {
visibility: hidden;
}
/* The container for the back (previous) link. */
.wst-header-back {
justify-content: flex-start;
text-align: left;
}
/* The container for the central cell. */
.wst-header-central-cell {
flex: 4 1 100%;
max-width: max-content;
text-align: center;
}
/* The container for the forward (next) link. */
.wst-header-forward {
justify-content: flex-end;
text-align: right;
}
@media(max-width:768px) {
/* Put title on its own flexbox row */
.wst-header-mainblock {
flex-wrap:wrap;
}
.wst-header-central-cell {
flex:0 0 100%;
order:-2;
width:auto;
}
.wst-header-back, .wst-header-forward {
width:auto;
}
}
/*
* notes block
*/
/* The overall notes container. */
.wst-header-notes {
display:inline-block;
border-collapse:collapse;
border-spacing:0;
empty-cells:hide;
font-size:.9em;
line-height:1.4;
margin:0 auto 4px auto;
width:100%;
}
/* Left-floated content. */
.wst-header-left {
float:left;
}
endbvjhthg540or09glpy5cpeygobni
ماڈیول:Header/attribution
828
12997
32132
2025-09-30T06:17:07Z
en>CalendulaAsteraceae
0
32132
Scribunto
text/plain
require('strict')
local p = {}
local yesno = require('Module:Yesno')
local TableTools = require('Module:TableTools')
local contrib_types = require('Module:Header/attribution data')
local headerLang = require('Module:Header/lang')
p.attr_data = {}
for k, v in pairs(contrib_types) do
p.attr_data[v['param_name']] = v
end
local function get_attribution_params(args)
local all_contributors = {
title = {},
section = {}
}
for k, v in pairs(args) do
local base_param_name = string.gsub(string.gsub(k, '%-display$', ''), '%-nolink$', '')
local arg_param_name = string.gsub(base_param_name, '^override%-', '')
local param_name = string.gsub(arg_param_name, '%d*$', '')
local section_key
if string.match(arg_param_name, '^section%-') then
section_key = 'section'
param_name = string.gsub(param_name, '^section%-', '')
else
section_key = 'title'
end
if p['attr_data'][param_name] then
local param_name_pattern = '^' .. string.gsub(string.gsub(base_param_name, '%d*$', ''), '%-', '%%%-')
local nText = string.match(k, param_name_pattern .. '%d*$')
local nDisplay = string.match(k, param_name_pattern .. '%d*%-display$')
local nNoLink = string.match(k, param_name_pattern .. '%d*%-nolink$')
local n
local info
if nText then
n = string.gsub(nText, param_name_pattern .. '(%d*)$', '%1')
n = tonumber(n) or 1
info = 'text'
elseif nDisplay then
n = string.gsub(nDisplay, param_name_pattern .. '(%d*)%-display$', '%1')
n = tonumber(n) or 1
info = 'display'
elseif nNoLink then
n = string.gsub(nNoLink, param_name_pattern .. '(%d*)%-nolink$', '%1')
n = tonumber(n) or 1
info = 'nolink'
end
local index = p['attr_data'][param_name]['index']
all_contributors[section_key][index] = all_contributors[section_key][index] or {}
all_contributors[section_key][index]['param_name'] = all_contributors[section_key][index]['param_name'] or param_name
all_contributors[section_key][index]['arg_param_name'] = all_contributors[section_key][index]['arg_param_name'] or arg_param_name
all_contributors[section_key][index]['override'] = all_contributors[section_key][index]['override'] or args['override-' .. arg_param_name]
if n and not (args.is_translation and arg_param_name == 'translator' and info == 'text' and string.lower(v) == 'wikisource') then
all_contributors[section_key][index]['values'] = all_contributors[section_key][index]['values'] or {}
all_contributors[section_key][index]['values'][n] = all_contributors[section_key][index]['values'][n] or {}
all_contributors[section_key][index]['values'][n][info] = all_contributors[section_key][index]['values'][n][info] or v
end
end
end
if args.is_translation then
local index = p['attr_data']['translator']['index']
all_contributors['title'][index] = all_contributors['title'][index] or {}
all_contributors['title'][index]['param_name'] = all_contributors['title'][index]['param_name'] or 'translator'
all_contributors['title'][index]['arg_param_name'] = all_contributors['title'][index]['arg_param_name'] or 'translator'
all_contributors['title'][index]['override'] = all_contributors['title'][index]['override'] or nil
all_contributors['title'][index]['values'] = all_contributors['title'][index]['values'] or {}
table.insert(all_contributors['title'][index]['values'], {text = 'wikisource'})
end
local contributors = {
title = {},
section = {}
}
for section_key, section_values in pairs(all_contributors) do
for i, contrib in ipairs(TableTools.compressSparseArray(section_values)) do
local new_contrib = {}
for k, v in pairs(TableTools.shallowClone(contrib)) do
if k == 'values' then
new_contrib[k] = TableTools.compressSparseArray(v)
else
new_contrib[k] = v
end
end
table.insert(contributors[section_key], new_contrib)
end
end
return contributors
end
function p.get_attribution_params(args)
return get_attribution_params(args)
end
local function construct_attribution_span(args)
local aspan = mw.html.create('span')
:addClass('vcard')
:attr('id', 'header-' .. args.span_param_name .. '-text')
:tag('span'):addClass('fn'):wikitext(args.atext)
return tostring(mw.html.create('span')
:addClass('contributor-text')
:wikitext(args.prefix .. tostring(aspan))
)
end
local function construct_attribution(args)
local data = args.data
local param_name = data['param_name']
local span_param_name = param_name
local prefix = p['attr_data'][param_name]['prefix'] .. ' '
local is_section = args.is_section
if data['arg_param_name'] == 'section-author' then
span_param_name = 'contributor'
end
if data['arg_param_name'] == 'author' and data['override'] then
prefix = '' -- legacy parameter
elseif param_name == 'translator' and args.languages then
prefix = p['attr_data'][param_name]['language_prefix'](args.language_name or 'an undefined language') .. ' '
end
-- override (legacy parameter)
local atext = data['override']
if atext then
if args.is_translation and param_name == 'translator' then
atext = atext .. ' and ' .. p['attr_data'][param_name]['special_cases']['wikisource']
end
return construct_attribution_span({span_param_name = span_param_name, prefix = prefix, atext = atext, is_section = is_section})
end
local contributors = {}
for i, contributor in ipairs(data['values']) do
local text = contributor['text']
local display = contributor['display']
local nolink = yesno(contributor['nolink']) or false
if nolink then
table.insert(contributors, display or text)
elseif text then
local special = false
for k, v in pairs(p['attr_data'][param_name]['special_cases']) do
if string.lower(text) == k then
special = true
if type(v) == 'function' then
display = v(display)
else
display = v
end
break
end
end
if not special then
if not display then
display = string.gsub(text, ' %(.*%)$', '')
end
display = '[[Author:' .. text .. '|' .. display .. ']]'
end
if display then
table.insert(contributors, display)
end
else
mw.logObject(contributor)
end
end
if #contributors == 0 then
return nil
elseif #contributors == 1 then
atext = contributors[1]
else
atext = table.concat(contributors, ', ', 1, #contributors - 1) .. ' and ' .. contributors[#contributors]
end
-- Temporary check for illustrator in subpages.
-- TODO: remove once
-- [[Special:PermanentLink/14324127#Replace illustrator header parameter with section illustrator in subpages of works]]
-- has been addressed.
local cat = ''
if param_name == 'illustrator' and mw.title.getCurrentTitle().isSubpage and not is_section then
cat = '[[' .. 'Category:' .. 'Subpages using illustrator parameter' .. ']]'
end
local s = construct_attribution_span({span_param_name = span_param_name, prefix = prefix, atext = atext, is_section = is_section})
return s .. cat
end
function p.construct_attributions(args)
local attributions = {}
local a_args = TableTools.shallowClone(args)
local attr_params = get_attribution_params(args)['title']
for i, data in ipairs(attr_params) do
a_args['data'] = data
a_args['is_section'] = false
local atext = construct_attribution(a_args)
if atext then
table.insert(attributions, atext)
end
end
if #attributions == 0 then
return ''
end
return table.concat(attributions, ', ')
end
-- section
function p.construct_section(args)
local section_text = args['section']
if not section_text or section_text == '' then
return ''
end
local attributions = {}
local a_args = TableTools.shallowClone(args)
a_args.languages = a_args.section_languages or a_args.languages
a_args.language_name = a_args.section_language_name or a_args.language_name
local attr_params = get_attribution_params(args)['section']
for i, data in ipairs(attr_params) do
a_args['data'] = data
a_args['is_section'] = true
local atext = construct_attribution(a_args)
if atext then
table.insert(attributions, atext)
end
end
if #attributions > 0 then
local sep = ' '
if #attributions > 1 then
sep = '<br/>'
end
section_text = section_text .. sep .. table.concat(attributions, ', ')
end
return tostring(mw.html.create('div')
:addClass('header-section-text')
:wikitext(section_text)
)
end
--[=[
Construct the [[Help:Microformat]] for the page.
This is in the form:
<div id="ws-data" ...>
<span id="ws-title">Title here...</span>
...
<div>
]=]
function p.construct_microformat(args)
local mf_div = mw.html.create('div')
:addClass('ws-noexport')
:attr('id', 'ws-data')
:css({speak = 'none'})
-- override to show the microformat
if yesno(args['show-microformat']) then
mf_div:addClass('ws-data-show')
end
-- collect the MF values here
local mf = {};
-- page ID
mf['ws-article-id'] = mw.title.getCurrentTitle().id
-- title
if args['title'] then
mf['ws-title'] = args['title']
-- append section if there is one
if args['section'] then
mf['ws-title'] = mf['ws-title'] .. " — " .. args['section']
end
end
-- year
mf['ws-year'] = args['year']
-- cover
mf['ws-cover'] = args['cover']
-- use section values if available, otherwise use work values
local attr_params = get_attribution_params(args)
local joined_attr_params = {}
for i, section_key in ipairs({'section', 'title'}) do
for i, data in ipairs(attr_params[section_key]) do
local index = p['attr_data'][data['param_name']]['index']
joined_attr_params[index] = joined_attr_params[index] or data
end
end
joined_attr_params = TableTools.compressSparseArray(joined_attr_params)
for i, data in ipairs(joined_attr_params) do
local atext = data['override']
local ws_translator = args.template_name == 'Translation header' and data['param_name'] == 'translator'
if atext and ws_translator then
atext = atext .. ' and Wikisource'
elseif not atext then
local attr_text = {}
for i, values in ipairs(data['values']) do
local display = values['text']
local special = false
if values['text'] then
for k, v in pairs(p['attr_data'][data['param_name']]['special_cases']) do
if string.lower(values['text']) == k then
special = true
if k == 'anon' or k == 'anonymous' then
display = 'Anonymous'
elseif k == 'wikisource' then
display = 'Wikisource'
elseif type(v) == 'function' then
display = v(display)
else
display = v
end
break
end
end
else
mw.logObject(values)
end
table.insert(attr_text, display)
end
if #attr_text == 1 then
atext = attr_text[1]
elseif #attr_text > 1 then
atext = table.concat(attr_text, ', ', 1, #attr_text - 1) .. ' and ' .. attr_text[#attr_text]
end
end
if atext then
mf['ws-' .. data['param_name']] = atext
end
end
for k, v in pairs(mf) do
mf_div:tag('span'):attr('id', k):wikitext(v)
end
return tostring(mf_div)
end
return p
88ntodpl1jelxio2hv60fb0mxadl2cp
32133
32132
2026-04-22T02:14:43Z
Satdeep Gill
85
[[:en:Module:Header/attribution]] سے 1 نسخہ درآمد کیا گیا
32132
Scribunto
text/plain
require('strict')
local p = {}
local yesno = require('Module:Yesno')
local TableTools = require('Module:TableTools')
local contrib_types = require('Module:Header/attribution data')
local headerLang = require('Module:Header/lang')
p.attr_data = {}
for k, v in pairs(contrib_types) do
p.attr_data[v['param_name']] = v
end
local function get_attribution_params(args)
local all_contributors = {
title = {},
section = {}
}
for k, v in pairs(args) do
local base_param_name = string.gsub(string.gsub(k, '%-display$', ''), '%-nolink$', '')
local arg_param_name = string.gsub(base_param_name, '^override%-', '')
local param_name = string.gsub(arg_param_name, '%d*$', '')
local section_key
if string.match(arg_param_name, '^section%-') then
section_key = 'section'
param_name = string.gsub(param_name, '^section%-', '')
else
section_key = 'title'
end
if p['attr_data'][param_name] then
local param_name_pattern = '^' .. string.gsub(string.gsub(base_param_name, '%d*$', ''), '%-', '%%%-')
local nText = string.match(k, param_name_pattern .. '%d*$')
local nDisplay = string.match(k, param_name_pattern .. '%d*%-display$')
local nNoLink = string.match(k, param_name_pattern .. '%d*%-nolink$')
local n
local info
if nText then
n = string.gsub(nText, param_name_pattern .. '(%d*)$', '%1')
n = tonumber(n) or 1
info = 'text'
elseif nDisplay then
n = string.gsub(nDisplay, param_name_pattern .. '(%d*)%-display$', '%1')
n = tonumber(n) or 1
info = 'display'
elseif nNoLink then
n = string.gsub(nNoLink, param_name_pattern .. '(%d*)%-nolink$', '%1')
n = tonumber(n) or 1
info = 'nolink'
end
local index = p['attr_data'][param_name]['index']
all_contributors[section_key][index] = all_contributors[section_key][index] or {}
all_contributors[section_key][index]['param_name'] = all_contributors[section_key][index]['param_name'] or param_name
all_contributors[section_key][index]['arg_param_name'] = all_contributors[section_key][index]['arg_param_name'] or arg_param_name
all_contributors[section_key][index]['override'] = all_contributors[section_key][index]['override'] or args['override-' .. arg_param_name]
if n and not (args.is_translation and arg_param_name == 'translator' and info == 'text' and string.lower(v) == 'wikisource') then
all_contributors[section_key][index]['values'] = all_contributors[section_key][index]['values'] or {}
all_contributors[section_key][index]['values'][n] = all_contributors[section_key][index]['values'][n] or {}
all_contributors[section_key][index]['values'][n][info] = all_contributors[section_key][index]['values'][n][info] or v
end
end
end
if args.is_translation then
local index = p['attr_data']['translator']['index']
all_contributors['title'][index] = all_contributors['title'][index] or {}
all_contributors['title'][index]['param_name'] = all_contributors['title'][index]['param_name'] or 'translator'
all_contributors['title'][index]['arg_param_name'] = all_contributors['title'][index]['arg_param_name'] or 'translator'
all_contributors['title'][index]['override'] = all_contributors['title'][index]['override'] or nil
all_contributors['title'][index]['values'] = all_contributors['title'][index]['values'] or {}
table.insert(all_contributors['title'][index]['values'], {text = 'wikisource'})
end
local contributors = {
title = {},
section = {}
}
for section_key, section_values in pairs(all_contributors) do
for i, contrib in ipairs(TableTools.compressSparseArray(section_values)) do
local new_contrib = {}
for k, v in pairs(TableTools.shallowClone(contrib)) do
if k == 'values' then
new_contrib[k] = TableTools.compressSparseArray(v)
else
new_contrib[k] = v
end
end
table.insert(contributors[section_key], new_contrib)
end
end
return contributors
end
function p.get_attribution_params(args)
return get_attribution_params(args)
end
local function construct_attribution_span(args)
local aspan = mw.html.create('span')
:addClass('vcard')
:attr('id', 'header-' .. args.span_param_name .. '-text')
:tag('span'):addClass('fn'):wikitext(args.atext)
return tostring(mw.html.create('span')
:addClass('contributor-text')
:wikitext(args.prefix .. tostring(aspan))
)
end
local function construct_attribution(args)
local data = args.data
local param_name = data['param_name']
local span_param_name = param_name
local prefix = p['attr_data'][param_name]['prefix'] .. ' '
local is_section = args.is_section
if data['arg_param_name'] == 'section-author' then
span_param_name = 'contributor'
end
if data['arg_param_name'] == 'author' and data['override'] then
prefix = '' -- legacy parameter
elseif param_name == 'translator' and args.languages then
prefix = p['attr_data'][param_name]['language_prefix'](args.language_name or 'an undefined language') .. ' '
end
-- override (legacy parameter)
local atext = data['override']
if atext then
if args.is_translation and param_name == 'translator' then
atext = atext .. ' and ' .. p['attr_data'][param_name]['special_cases']['wikisource']
end
return construct_attribution_span({span_param_name = span_param_name, prefix = prefix, atext = atext, is_section = is_section})
end
local contributors = {}
for i, contributor in ipairs(data['values']) do
local text = contributor['text']
local display = contributor['display']
local nolink = yesno(contributor['nolink']) or false
if nolink then
table.insert(contributors, display or text)
elseif text then
local special = false
for k, v in pairs(p['attr_data'][param_name]['special_cases']) do
if string.lower(text) == k then
special = true
if type(v) == 'function' then
display = v(display)
else
display = v
end
break
end
end
if not special then
if not display then
display = string.gsub(text, ' %(.*%)$', '')
end
display = '[[Author:' .. text .. '|' .. display .. ']]'
end
if display then
table.insert(contributors, display)
end
else
mw.logObject(contributor)
end
end
if #contributors == 0 then
return nil
elseif #contributors == 1 then
atext = contributors[1]
else
atext = table.concat(contributors, ', ', 1, #contributors - 1) .. ' and ' .. contributors[#contributors]
end
-- Temporary check for illustrator in subpages.
-- TODO: remove once
-- [[Special:PermanentLink/14324127#Replace illustrator header parameter with section illustrator in subpages of works]]
-- has been addressed.
local cat = ''
if param_name == 'illustrator' and mw.title.getCurrentTitle().isSubpage and not is_section then
cat = '[[' .. 'Category:' .. 'Subpages using illustrator parameter' .. ']]'
end
local s = construct_attribution_span({span_param_name = span_param_name, prefix = prefix, atext = atext, is_section = is_section})
return s .. cat
end
function p.construct_attributions(args)
local attributions = {}
local a_args = TableTools.shallowClone(args)
local attr_params = get_attribution_params(args)['title']
for i, data in ipairs(attr_params) do
a_args['data'] = data
a_args['is_section'] = false
local atext = construct_attribution(a_args)
if atext then
table.insert(attributions, atext)
end
end
if #attributions == 0 then
return ''
end
return table.concat(attributions, ', ')
end
-- section
function p.construct_section(args)
local section_text = args['section']
if not section_text or section_text == '' then
return ''
end
local attributions = {}
local a_args = TableTools.shallowClone(args)
a_args.languages = a_args.section_languages or a_args.languages
a_args.language_name = a_args.section_language_name or a_args.language_name
local attr_params = get_attribution_params(args)['section']
for i, data in ipairs(attr_params) do
a_args['data'] = data
a_args['is_section'] = true
local atext = construct_attribution(a_args)
if atext then
table.insert(attributions, atext)
end
end
if #attributions > 0 then
local sep = ' '
if #attributions > 1 then
sep = '<br/>'
end
section_text = section_text .. sep .. table.concat(attributions, ', ')
end
return tostring(mw.html.create('div')
:addClass('header-section-text')
:wikitext(section_text)
)
end
--[=[
Construct the [[Help:Microformat]] for the page.
This is in the form:
<div id="ws-data" ...>
<span id="ws-title">Title here...</span>
...
<div>
]=]
function p.construct_microformat(args)
local mf_div = mw.html.create('div')
:addClass('ws-noexport')
:attr('id', 'ws-data')
:css({speak = 'none'})
-- override to show the microformat
if yesno(args['show-microformat']) then
mf_div:addClass('ws-data-show')
end
-- collect the MF values here
local mf = {};
-- page ID
mf['ws-article-id'] = mw.title.getCurrentTitle().id
-- title
if args['title'] then
mf['ws-title'] = args['title']
-- append section if there is one
if args['section'] then
mf['ws-title'] = mf['ws-title'] .. " — " .. args['section']
end
end
-- year
mf['ws-year'] = args['year']
-- cover
mf['ws-cover'] = args['cover']
-- use section values if available, otherwise use work values
local attr_params = get_attribution_params(args)
local joined_attr_params = {}
for i, section_key in ipairs({'section', 'title'}) do
for i, data in ipairs(attr_params[section_key]) do
local index = p['attr_data'][data['param_name']]['index']
joined_attr_params[index] = joined_attr_params[index] or data
end
end
joined_attr_params = TableTools.compressSparseArray(joined_attr_params)
for i, data in ipairs(joined_attr_params) do
local atext = data['override']
local ws_translator = args.template_name == 'Translation header' and data['param_name'] == 'translator'
if atext and ws_translator then
atext = atext .. ' and Wikisource'
elseif not atext then
local attr_text = {}
for i, values in ipairs(data['values']) do
local display = values['text']
local special = false
if values['text'] then
for k, v in pairs(p['attr_data'][data['param_name']]['special_cases']) do
if string.lower(values['text']) == k then
special = true
if k == 'anon' or k == 'anonymous' then
display = 'Anonymous'
elseif k == 'wikisource' then
display = 'Wikisource'
elseif type(v) == 'function' then
display = v(display)
else
display = v
end
break
end
end
else
mw.logObject(values)
end
table.insert(attr_text, display)
end
if #attr_text == 1 then
atext = attr_text[1]
elseif #attr_text > 1 then
atext = table.concat(attr_text, ', ', 1, #attr_text - 1) .. ' and ' .. attr_text[#attr_text]
end
end
if atext then
mf['ws-' .. data['param_name']] = atext
end
end
for k, v in pairs(mf) do
mf_div:tag('span'):attr('id', k):wikitext(v)
end
return tostring(mf_div)
end
return p
88ntodpl1jelxio2hv60fb0mxadl2cp
سانچہ:Plain sister/styles.css
10
12998
32134
2025-01-15T06:31:33Z
en>Alien333
0
32134
sanitized-css
text/css
.plainSister {
display:block;
font-size:93%;
line-height:normal;
list-style-type:none;
list-style-image:none;
list-style-position:outside;
border:1px solid var(--border-color-interactive--hover, #AAA);
float:right;
clear:right;
margin:0.5ex 0 0.5ex 0.5ex;
padding:0;
background:var(--background-color-base, #FFFFFF);
color:var(--color-base, #202122);
}
.sisicon,
.dabicon {
padding-right:1ex
}
9u4b2frpymhp7399l44mvdwuwjijgut
32135
32134
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Template:Plain_sister/styles.css]] سے 1 نسخہ درآمد کیا گیا
32134
sanitized-css
text/css
.plainSister {
display:block;
font-size:93%;
line-height:normal;
list-style-type:none;
list-style-image:none;
list-style-position:outside;
border:1px solid var(--border-color-interactive--hover, #AAA);
float:right;
clear:right;
margin:0.5ex 0 0.5ex 0.5ex;
padding:0;
background:var(--background-color-base, #FFFFFF);
color:var(--color-base, #202122);
}
.sisicon,
.dabicon {
padding-right:1ex
}
9u4b2frpymhp7399l44mvdwuwjijgut
ماڈیول:Header/docdata
828
12999
32136
2025-07-08T03:57:14Z
en>CalendulaAsteraceae
0
32136
Scribunto
text/plain
require('strict')
local p = {}
local attr_data = require('Module:Header/attribution').attr_data
function p.attrParamList()
local params = {}
-- formatting from [[Template:Parameter]]
for k, v in pairs(attr_data) do
local i = v['index']
params[i] = tostring(mw.html.create('span')
:addClass('wst-doc-parameter')
:wikitext(v['param_name'])
)
if i == 1 then
params[i] = '** ' .. mw.getCurrentFrame():extensionTag('templatestyles', '', {src = 'Template:Parameter/styles.css'}) .. params[i]
else
params[i] = '** ' .. params[i]
end
end
return table.concat(params, '\n')
end
return p
8atkm38o3y5qalp543zldx0b95tzn3k
32137
32136
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Module:Header/docdata]] سے 1 نسخہ درآمد کیا گیا
32136
Scribunto
text/plain
require('strict')
local p = {}
local attr_data = require('Module:Header/attribution').attr_data
function p.attrParamList()
local params = {}
-- formatting from [[Template:Parameter]]
for k, v in pairs(attr_data) do
local i = v['index']
params[i] = tostring(mw.html.create('span')
:addClass('wst-doc-parameter')
:wikitext(v['param_name'])
)
if i == 1 then
params[i] = '** ' .. mw.getCurrentFrame():extensionTag('templatestyles', '', {src = 'Template:Parameter/styles.css'}) .. params[i]
else
params[i] = '** ' .. params[i]
end
end
return table.concat(params, '\n')
end
return p
8atkm38o3y5qalp543zldx0b95tzn3k
ماڈیول:Header/sort
828
13000
32138
2024-09-03T22:46:59Z
en>CalendulaAsteraceae
0
fix title reconstitution
32138
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
--[=[
Generate a {{DEFAULTSORT}} magic word according to the defaultsort parameter
]=]
function p._construct_defaultsort(args)
local defsortKey
local title = mw.title.getCurrentTitle().text
if args.sortkey then
defsortKey = args.sortkey
else
-- construct defaultsort automatically by stripping A/An/The as needed
local title_table = mw.text.split(title, '/')
local sorted_title
local sorted_title_table = {}
local articles = {'A', 'An', 'The'}
for k, part in pairs(title_table) do
local sorted_part = part
local disambig = string.match(sorted_part, ' %(.*%)$')
if disambig then
sorted_part = string.gsub(sorted_part, ' %(.*%)$', '')
else
disambig = ''
end
for j, article in pairs(articles) do
if string.len(sorted_part) > string.len(article) and string.sub(sorted_part, 1, string.len(article) + 1) == (article .. ' ') then
sorted_part = string.sub(sorted_part, string.len(article) + 2) .. ', ' .. article .. disambig
break
end
end
table.insert(sorted_title_table, sorted_part)
end
defsortKey = table.concat(sorted_title_table, '/')
if defsortKey == title then
defsortKey = nil
end
end
-- if a suitable key is found or constructed, apply it
if defsortKey == title then
return args.equalsortcat or ''
elseif defsortKey then
return mw.getCurrentFrame():callParserFunction('DEFAULTSORT', {defsortKey}) .. (args.diffsortcat or '')
end
-- otherwise, don't do anything and use the default
return ''
end
function p.construct_defaultsort(frame)
return p._construct_defaultsort(getArgs(frame))
end
return p
1n19hnqrhvczpbubuuf59ozzv3lkchj
32139
32138
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Module:Header/sort]] سے 1 نسخہ درآمد کیا گیا
32138
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
--[=[
Generate a {{DEFAULTSORT}} magic word according to the defaultsort parameter
]=]
function p._construct_defaultsort(args)
local defsortKey
local title = mw.title.getCurrentTitle().text
if args.sortkey then
defsortKey = args.sortkey
else
-- construct defaultsort automatically by stripping A/An/The as needed
local title_table = mw.text.split(title, '/')
local sorted_title
local sorted_title_table = {}
local articles = {'A', 'An', 'The'}
for k, part in pairs(title_table) do
local sorted_part = part
local disambig = string.match(sorted_part, ' %(.*%)$')
if disambig then
sorted_part = string.gsub(sorted_part, ' %(.*%)$', '')
else
disambig = ''
end
for j, article in pairs(articles) do
if string.len(sorted_part) > string.len(article) and string.sub(sorted_part, 1, string.len(article) + 1) == (article .. ' ') then
sorted_part = string.sub(sorted_part, string.len(article) + 2) .. ', ' .. article .. disambig
break
end
end
table.insert(sorted_title_table, sorted_part)
end
defsortKey = table.concat(sorted_title_table, '/')
if defsortKey == title then
defsortKey = nil
end
end
-- if a suitable key is found or constructed, apply it
if defsortKey == title then
return args.equalsortcat or ''
elseif defsortKey then
return mw.getCurrentFrame():callParserFunction('DEFAULTSORT', {defsortKey}) .. (args.diffsortcat or '')
end
-- otherwise, don't do anything and use the default
return ''
end
function p.construct_defaultsort(frame)
return p._construct_defaultsort(getArgs(frame))
end
return p
1n19hnqrhvczpbubuuf59ozzv3lkchj
سانچہ:Makeid
10
13001
32140
2024-09-27T07:44:08Z
en>CalendulaAsteraceae
0
implement in Lua
32140
wikitext
text/x-wiki
{{#invoke:Makeid|makeid}}<noinclude>{{documentation}}</noinclude>
te2n2rtbiieliawzvx0k9pkdrj8cvs9
32141
32140
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Template:Makeid]] سے 1 نسخہ درآمد کیا گیا
32140
wikitext
text/x-wiki
{{#invoke:Makeid|makeid}}<noinclude>{{documentation}}</noinclude>
te2n2rtbiieliawzvx0k9pkdrj8cvs9
ماڈیول:Makeid
828
13002
32142
2025-04-19T15:16:53Z
en>EncycloPetey
0
massive template spillover breakage
32142
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p._makeid(args)
local id_text = args[1]
if not id_text or id_text == '' then
return ''
end
local blank_values = {}
for k, v in pairs(args) do
if string.match(k, '^blank%d*$') then
blank_values[v] = true
end
end
if blank_values[id_text] then
return ''
else
return 'id=\"' .. mw.uri.anchorEncode(id_text) .. '\"'
end
end
function p.makeid(frame)
return p._makeid(getArgs(frame))
end
return p
hrgorewi10670e3soofoqxl17a7owpi
32143
32142
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Module:Makeid]] سے 1 نسخہ درآمد کیا گیا
32142
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p._makeid(args)
local id_text = args[1]
if not id_text or id_text == '' then
return ''
end
local blank_values = {}
for k, v in pairs(args) do
if string.match(k, '^blank%d*$') then
blank_values[v] = true
end
end
if blank_values[id_text] then
return ''
else
return 'id=\"' .. mw.uri.anchorEncode(id_text) .. '\"'
end
end
function p.makeid(frame)
return p._makeid(getArgs(frame))
end
return p
hrgorewi10670e3soofoqxl17a7owpi
سانچہ:Parameter/styles.css
10
13003
32144
2025-09-15T19:33:36Z
en>CalendulaAsteraceae
0
also use variable for background
32144
sanitized-css
text/css
.wst-doc-parameter {
color:var(--color-icon-success, #099979);
background-color:var(--background-color-neutral-subtle, #f8f9fa);
font-weight:bold;
}
@media screen {
html.skin-theme-clientpref-night .wst-doc-parameter {
color:var(--color-icon-success, #24ebbf);
background-color:var(--background-color-neutral-subtle, #202122);
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .wst-doc-parameter {
color:var(--color-icon-success, #24ebbf);
background-color:var(--background-color-neutral-subtle, #202122);
}
}
k173nnrcuigyy8gm5nvolhek3hc1buu
32145
32144
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Template:Parameter/styles.css]] سے 1 نسخہ درآمد کیا گیا
32144
sanitized-css
text/css
.wst-doc-parameter {
color:var(--color-icon-success, #099979);
background-color:var(--background-color-neutral-subtle, #f8f9fa);
font-weight:bold;
}
@media screen {
html.skin-theme-clientpref-night .wst-doc-parameter {
color:var(--color-icon-success, #24ebbf);
background-color:var(--background-color-neutral-subtle, #202122);
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .wst-doc-parameter {
color:var(--color-icon-success, #24ebbf);
background-color:var(--background-color-neutral-subtle, #202122);
}
}
k173nnrcuigyy8gm5nvolhek3hc1buu
ماڈیول:Isdigit
828
13004
32146
2025-04-19T16:00:10Z
en>ShakespeareFan00
0
32146
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.__isdigit(args)
local id_text = args[1]
if not id_text or id_text == '' then
return 'false'
end
local ___isdigit
___isdigit = false
if string.match(id_text, '^%d+$') then
___isdigit = true
end
if ___isdigit==true then
return 'true'
else
return 'false'
end
end
function p._isdigit(frame)
return p.__isdigit(getArgs(frame))
end
return p
4yrv8kqdchevhqjdzydrwrhg6jwh2im
32147
32146
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Module:Isdigit]] سے 1 نسخہ درآمد کیا گیا
32146
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.__isdigit(args)
local id_text = args[1]
if not id_text or id_text == '' then
return 'false'
end
local ___isdigit
___isdigit = false
if string.match(id_text, '^%d+$') then
___isdigit = true
end
if ___isdigit==true then
return 'true'
else
return 'false'
end
end
function p._isdigit(frame)
return p.__isdigit(getArgs(frame))
end
return p
4yrv8kqdchevhqjdzydrwrhg6jwh2im
سانچہ:Font-size-base
10
13005
32148
2025-08-12T03:54:27Z
en>CalendulaAsteraceae
0
Protected "[[Template:Font-size-base]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32148
wikitext
text/x-wiki
<includeonly><span {{optional style|font-size={{{font-size|}}}|style={{{style|}}}}}>{{{1}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
biahc5r13z11i108dpqu3vztiin7nrr
32149
32148
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Template:Font-size-base]] سے 1 نسخہ درآمد کیا گیا
32148
wikitext
text/x-wiki
<includeonly><span {{optional style|font-size={{{font-size|}}}|style={{{style|}}}}}>{{{1}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
biahc5r13z11i108dpqu3vztiin7nrr
ماڈیول:Header/lang
828
13006
32150
2025-10-01T21:23:53Z
en>CalendulaAsteraceae
0
support indexes with multiple languages that are passed to header as a comma-separated list
32150
Scribunto
text/plain
require('strict')
local p = {}
local ISO_639_language_name = require('Module:ISO 639').language_name
local TableTools = require('Module:TableTools')
p.project_language = mw.language.getContentLanguage().code
p.project_language_name = ISO_639_language_name(p.project_language)
p.interwiki_prefixes = {
['grc'] = 'el',
['ang'] = 'ang:' .. p.project_language,
['enm'] = 'enm:' .. p.project_language,
['sco'] = 'sco:' .. p.project_language
}
--[=[
Construct the automatic categories for the header
]=]
function p.language_category_name(cat_works_start, lang, is_translation)
local cat_language_name = ISO_639_language_name(lang) or 'an undefined language'
if lang == 'el' then
cat_language_name = 'Modern Greek'
elseif lang == p.project_language and not is_translation then
cat_language_name = 'explicitly cited ' .. p.project_language_name
end
return cat_works_start .. ' ' .. cat_language_name
end
function p.get_languages(args, prefix)
prefix = (prefix and prefix .. '%-') or ''
-- language handling
local languages = {}
for k, v in pairs(args) do
local n
local nText = string.match(k, '^' .. prefix .. 'language%d*$') or string.match(k, '^' .. prefix .. 'lang%d*$')
if nText and type(v) == 'string' then
n = string.gsub(string.gsub(nText, 'language', ''), 'lang', '')
n = tonumber(n) or 1
languages[n] = mw.text.split(v, '%s*,%s*')
end
end
languages = TableTools.compressSparseArray(languages)
if #languages == 0 then
return {}
end
local flat_languages = {}
local language_name
local language_names = {}
for i, langs in ipairs(languages) do
for j, lang in ipairs(langs) do
table.insert(flat_languages, lang)
local name = ISO_639_language_name(lang)
if name then
table.insert(language_names, name)
end
end
end
if #language_names == 1 then
language_name = language_names[1]
elseif #language_names > 1 then
language_name = table.concat(language_names, ', ', 1, #language_names - 1) .. ' and ' .. language_names[#language_names]
end
return {
languages = flat_languages,
language_name = language_name
}
end
return p
qsmse5pmpoijw807kl1pbdmrr05kxaz
32151
32150
2026-04-22T02:14:44Z
Satdeep Gill
85
[[:en:Module:Header/lang]] سے 1 نسخہ درآمد کیا گیا
32150
Scribunto
text/plain
require('strict')
local p = {}
local ISO_639_language_name = require('Module:ISO 639').language_name
local TableTools = require('Module:TableTools')
p.project_language = mw.language.getContentLanguage().code
p.project_language_name = ISO_639_language_name(p.project_language)
p.interwiki_prefixes = {
['grc'] = 'el',
['ang'] = 'ang:' .. p.project_language,
['enm'] = 'enm:' .. p.project_language,
['sco'] = 'sco:' .. p.project_language
}
--[=[
Construct the automatic categories for the header
]=]
function p.language_category_name(cat_works_start, lang, is_translation)
local cat_language_name = ISO_639_language_name(lang) or 'an undefined language'
if lang == 'el' then
cat_language_name = 'Modern Greek'
elseif lang == p.project_language and not is_translation then
cat_language_name = 'explicitly cited ' .. p.project_language_name
end
return cat_works_start .. ' ' .. cat_language_name
end
function p.get_languages(args, prefix)
prefix = (prefix and prefix .. '%-') or ''
-- language handling
local languages = {}
for k, v in pairs(args) do
local n
local nText = string.match(k, '^' .. prefix .. 'language%d*$') or string.match(k, '^' .. prefix .. 'lang%d*$')
if nText and type(v) == 'string' then
n = string.gsub(string.gsub(nText, 'language', ''), 'lang', '')
n = tonumber(n) or 1
languages[n] = mw.text.split(v, '%s*,%s*')
end
end
languages = TableTools.compressSparseArray(languages)
if #languages == 0 then
return {}
end
local flat_languages = {}
local language_name
local language_names = {}
for i, langs in ipairs(languages) do
for j, lang in ipairs(langs) do
table.insert(flat_languages, lang)
local name = ISO_639_language_name(lang)
if name then
table.insert(language_names, name)
end
end
end
if #language_names == 1 then
language_name = language_names[1]
elseif #language_names > 1 then
language_name = table.concat(language_names, ', ', 1, #language_names - 1) .. ' and ' .. language_names[#language_names]
end
return {
languages = flat_languages,
language_name = language_name
}
end
return p
qsmse5pmpoijw807kl1pbdmrr05kxaz
سانچہ:RunningHeader
10
13007
32152
2024-11-09T06:24:05Z
en>CalendulaAsteraceae
0
32152
wikitext
text/x-wiki
<includeonly><templatestyles src="RunningHeader/styles.css" />{{#invoke:Running header|running_header}}</includeonly><noinclude>{{documentation}}</noinclude>
pzoka6coyscy6849exq6zyccy0w499z
32153
32152
2026-04-22T02:14:54Z
Satdeep Gill
85
[[:en:Template:RunningHeader]] سے 1 نسخہ درآمد کیا گیا
32152
wikitext
text/x-wiki
<includeonly><templatestyles src="RunningHeader/styles.css" />{{#invoke:Running header|running_header}}</includeonly><noinclude>{{documentation}}</noinclude>
pzoka6coyscy6849exq6zyccy0w499z
ماڈیول:String
828
13008
32154
2023-05-12T06:43:36Z
en>Billinghurst
0
Changed protection settings for "[[Module:String]]": called in Mediawiki: ns, should remain fully protected ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32154
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:Errors reported by Module String].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'Errors reported by Module String'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
cufmbepw7ml3gut4lchtqrhtj5r63cp
32155
32154
2026-04-22T02:14:54Z
Satdeep Gill
85
[[:en:Module:String]] سے 1 نسخہ درآمد کیا گیا
32154
Scribunto
text/plain
--[[
This module is intended to provide access to basic string functions.
Most of the functions provided here can be invoked with named parameters,
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will
automatically remove any leading or trailing whitespace from the parameter.
Depending on the intended use, it may be advantageous to either preserve or
remove such whitespace.
Global options
ignore_errors: If set to 'true' or 1, any error condition will result in
an empty string being returned rather than an error message.
error_category: If an error occurs, specifies the name of a category to
include with the error message. The default category is
[Category:Errors reported by Module String].
no_category: If set to 'true' or 1, no category will be added if an error
is generated.
Unit tests for this module are available at Module:String/tests.
]]
local str = {}
--[[
len
This function returns the length of the target string.
Usage:
{{#invoke:String|len|target_string|}}
OR
{{#invoke:String|len|s=target_string}}
Parameters
s: The string whose length to report
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string.
]]
function str.len( frame )
local new_args = str._getParameters( frame.args, {'s'} )
local s = new_args['s'] or ''
return mw.ustring.len( s )
end
--[[
sub
This function returns a substring of the target string at specified indices.
Usage:
{{#invoke:String|sub|target_string|start_index|end_index}}
OR
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}
Parameters
s: The string to return a subset of
i: The fist index of the substring to return, defaults to 1.
j: The last index of the string to return, defaults to the last character.
The first character of the string is assigned an index of 1. If either i or j
is a negative value, it is interpreted the same as selecting a character by
counting from the end of the string. Hence, a value of -1 is the same as
selecting the last character of the string.
If the requested indices are out of range for the given string, an error is
reported.
]]
function str.sub( frame )
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )
local s = new_args['s'] or ''
local i = tonumber( new_args['i'] ) or 1
local j = tonumber( new_args['j'] ) or -1
local len = mw.ustring.len( s )
-- Convert negatives for range checking
if i < 0 then
i = len + i + 1
end
if j < 0 then
j = len + j + 1
end
if i > len or j > len or i < 1 or j < 1 then
return str._error( 'String subset index out of range' )
end
if j < i then
return str._error( 'String subset indices out of order' )
end
return mw.ustring.sub( s, i, j )
end
--[[
This function implements that features of {{str sub old}} and is kept in order
to maintain these older templates.
]]
function str.sublength( frame )
local i = tonumber( frame.args.i ) or 0
local len = tonumber( frame.args.len )
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )
end
--[[
_match
This function returns a substring from the source string that matches a
specified pattern. It is exported for use in other modules
Usage:
strmatch = require("Module:String")._match
sresult = strmatch( s, pattern, start, match, plain, nomatch )
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This sub-routine is exported for use in other modules
function str._match( s, pattern, start, match_index, plain_flag, nomatch )
if s == '' then
return str._error( 'Target string is empty' )
end
if pattern == '' then
return str._error( 'Pattern string is empty' )
end
start = tonumber(start) or 1
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then
return str._error( 'Requested start is out of range' )
end
if match_index == 0 then
return str._error( 'Match index is out of range' )
end
if plain_flag then
pattern = str._escapePattern( pattern )
end
local result
if match_index == 1 then
-- Find first match is simple case
result = mw.ustring.match( s, pattern, start )
else
if start > 1 then
s = mw.ustring.sub( s, start )
end
local iterator = mw.ustring.gmatch(s, pattern)
if match_index > 0 then
-- Forward search
for w in iterator do
match_index = match_index - 1
if match_index == 0 then
result = w
break
end
end
else
-- Reverse search
local result_table = {}
local count = 1
for w in iterator do
result_table[count] = w
count = count + 1
end
result = result_table[ count + match_index ]
end
end
if result == nil then
if nomatch == nil then
return str._error( 'Match not found' )
else
return nomatch
end
else
return result
end
end
--[[
match
This function returns a substring from the source string that matches a
specified pattern.
Usage:
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
Parameters
s: The string to search
pattern: The pattern or string to find within the string
start: The index within the source string to start the search. The first
character of the string has index 1. Defaults to 1.
match: In some cases it may be possible to make multiple matches on a single
string. This specifies which match to return, where the first match is
match= 1. If a negative number is specified then a match is returned
counting from the last match. Hence match = -1 is the same as requesting
the last match. Defaults to 1.
plain: A flag indicating that the pattern should be understood as plain
text. Defaults to false.
nomatch: If no match is found, output the "nomatch" value rather than an error.
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from each string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
If the match_number or start_index are out of range for the string being queried, then
this function generates an error. An error is also generated if no match is found.
If one adds the parameter ignore_errors=true, then the error will be suppressed and
an empty string will be returned on any failure.
For information on constructing Lua patterns, a form of [regular expression], see:
* http://www.lua.org/manual/5.1/manual.html#5.4.1
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns
]]
-- This is the entry point for #invoke:String|match
function str.match( frame )
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )
local s = new_args['s'] or ''
local start = tonumber( new_args['start'] ) or 1
local plain_flag = str._getBoolean( new_args['plain'] or false )
local pattern = new_args['pattern'] or ''
local match_index = math.floor( tonumber(new_args['match']) or 1 )
local nomatch = new_args['nomatch']
return str._match( s, pattern, start, match_index, plain_flag, nomatch )
end
--[[
pos
This function returns a single character from the target string at position pos.
Usage:
{{#invoke:String|pos|target_string|index_value}}
OR
{{#invoke:String|pos|target=target_string|pos=index_value}}
Parameters
target: The string to search
pos: The index for the character to return
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the target string. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
The first character has an index value of 1.
If one requests a negative value, this function will select a character by counting backwards
from the end of the string. In other words pos = -1 is the same as asking for the last character.
A requested value of zero, or a value greater than the length of the string returns an error.
]]
function str.pos( frame )
local new_args = str._getParameters( frame.args, {'target', 'pos'} )
local target_str = new_args['target'] or ''
local pos = tonumber( new_args['pos'] ) or 0
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then
return str._error( 'String index out of range' )
end
return mw.ustring.sub( target_str, pos, pos )
end
--[[
str_find
This function duplicates the behavior of {{str_find}}, including all of its quirks.
This is provided in order to support existing templates, but is NOT RECOMMENDED for
new code and templates. New code is recommended to use the "find" function instead.
Returns the first index in "source" that is a match to "target". Indexing is 1-based,
and the function returns -1 if the "target" string is not present in "source".
Important Note: If the "target" string is empty / missing, this function returns a
value of "1", which is generally unexpected behavior, and must be accounted for
separatetly.
]]
function str.str_find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target'} )
local source_str = new_args['source'] or ''
local target_str = new_args['target'] or ''
if target_str == '' then
return 1
end
local start = mw.ustring.find( source_str, target_str, 1, true )
if start == nil then
start = -1
end
return start
end
--[[
find
This function allows one to search for a target string or pattern within another
string.
Usage:
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}
OR
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}
Parameters
source: The string to search
target: The string or pattern to find within source
start: The index within the source string to start the search, defaults to 1
plain: Boolean flag indicating that target should be understood as plain
text and not as a Lua style regular expression, defaults to true
If invoked using named parameters, Mediawiki will automatically remove any leading or
trailing whitespace from the parameter. In some circumstances this is desirable, in
other cases one may want to preserve the whitespace.
This function returns the first index >= "start" where "target" can be found
within "source". Indices are 1-based. If "target" is not found, then this
function returns 0. If either "source" or "target" are missing / empty, this
function also returns 0.
This function should be safe for UTF-8 strings.
]]
function str.find( frame )
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['target'] or ''
local start_pos = tonumber(new_args['start']) or 1
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return 0
end
plain = str._getBoolean( plain )
local start = mw.ustring.find( source_str, pattern, start_pos, plain )
if start == nil then
start = 0
end
return start
end
--[[
replace
This function allows one to replace a target string or pattern within another
string.
Usage:
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}
OR
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|
count=replacement_count|plain=plain_flag}}
Parameters
source: The string to search
pattern: The string or pattern to find within source
replace: The replacement text
count: The number of occurences to replace, defaults to all.
plain: Boolean flag indicating that pattern should be understood as plain
text and not as a Lua style regular expression, defaults to true
]]
function str.replace( frame )
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )
local source_str = new_args['source'] or ''
local pattern = new_args['pattern'] or ''
local replace = new_args['replace'] or ''
local count = tonumber( new_args['count'] )
local plain = new_args['plain'] or true
if source_str == '' or pattern == '' then
return source_str
end
plain = str._getBoolean( plain )
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.
end
local result
if count ~= nil then
result = mw.ustring.gsub( source_str, pattern, replace, count )
else
result = mw.ustring.gsub( source_str, pattern, replace )
end
return result
end
--[[
simple function to pipe string.rep to templates.
]]
function str.rep( frame )
local repetitions = tonumber( frame.args[2] )
if not repetitions then
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )
end
return string.rep( frame.args[1] or '', repetitions )
end
--[[
escapePattern
This function escapes special characters from a Lua string pattern. See [1]
for details on how patterns work.
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns
Usage:
{{#invoke:String|escapePattern|pattern_string}}
Parameters
pattern_string: The pattern string to escape.
]]
function str.escapePattern( frame )
local pattern_str = frame.args[1]
if not pattern_str then
return str._error( 'No pattern string specified' )
end
local result = str._escapePattern( pattern_str )
return result
end
--[[
count
This function counts the number of occurrences of one string in another.
]]
function str.count(frame)
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})
local source = args.source or ''
local pattern = args.pattern or ''
local plain = str._getBoolean(args.plain or true)
if plain then
pattern = str._escapePattern(pattern)
end
local _, count = mw.ustring.gsub(source, pattern, '')
return count
end
--[[
endswith
This function determines whether a string ends with another string.
]]
function str.endswith(frame)
local args = str._getParameters(frame.args, {'source', 'pattern'})
local source = args.source or ''
local pattern = args.pattern or ''
if pattern == '' then
-- All strings end with the empty string.
return "yes"
end
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then
return "yes"
else
return ""
end
end
--[[
join
Join all non empty arguments together; the first argument is the separator.
Usage:
{{#invoke:String|join|sep|one|two|three}}
]]
function str.join(frame)
local args = {}
local sep
for _, v in ipairs( frame.args ) do
if sep then
if v ~= '' then
table.insert(args, v)
end
else
sep = v
end
end
return table.concat( args, sep or '' )
end
--[[
Helper function that populates the argument list given that user may need to use a mix of
named and unnamed parameters. This is relevant because named parameters are not
identical to unnamed parameters due to string trimming, and when dealing with strings
we sometimes want to either preserve or remove that whitespace depending on the application.
]]
function str._getParameters( frame_args, arg_list )
local new_args = {}
local index = 1
local value
for _, arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index]
index = index + 1
end
new_args[arg] = value
end
return new_args
end
--[[
Helper function to handle error messages.
]]
function str._error( error_str )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'Errors reported by Module String'
local ignore_errors = frame.args.ignore_errors or false
local no_category = frame.args.no_category or false
if str._getBoolean(ignore_errors) then
return ''
end
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
end
return error_str
end
--[[
Helper Function to interpret boolean strings
]]
function str._getBoolean( boolean_str )
local boolean_value
if type( boolean_str ) == 'string' then
boolean_str = boolean_str:lower()
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'
or boolean_str == '' then
boolean_value = false
else
boolean_value = true
end
elseif type( boolean_str ) == 'boolean' then
boolean_value = boolean_str
else
error( 'No boolean value found' )
end
return boolean_value
end
--[[
Helper function that escapes all pattern characters so that they will be treated
as plain text.
]]
function str._escapePattern( pattern_str )
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )
end
return str
cufmbepw7ml3gut4lchtqrhtj5r63cp
سانچہ:Rh
10
13009
32156
2010-06-24T02:50:29Z
en>Hesperian
0
Protected "[[Template:Rh]]": High traffic page: 13000 uses ([edit=sysop] (indefinite) [move=sysop] (indefinite))
32156
wikitext
text/x-wiki
#REDIRECT[[Template:RunningHeader]]
tidtjufuek1wg5wr3v4efp4mxrnonmp
32157
32156
2026-04-22T02:14:54Z
Satdeep Gill
85
[[:en:Template:Rh]] سے 1 نسخہ درآمد کیا گیا
32156
wikitext
text/x-wiki
#REDIRECT[[Template:RunningHeader]]
tidtjufuek1wg5wr3v4efp4mxrnonmp
سانچہ:RunningHeader/styles.css
10
13010
32158
2024-05-02T15:47:42Z
en>CalendulaAsteraceae
0
Changed protection settings for "[[Template:RunningHeader/styles.css]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32158
sanitized-css
text/css
/* Base style */
.wst-rh {
display:flex;
width:100%;
text-align:center;
justify-content:space-between;
}
.wst-rh > div {
flex:auto;
}
.wst-rh > div:first-child {
text-align:left;
}
.wst-rh > div:last-child {
text-align:right;
}
.wst-rh > div > p {
margin:0;
}
/* 1 cell */
.wst-rh.wst-rh-1 {
justify-content:center;
}
.wst-rh.wst-rh-1 > div:first-child {
text-align:center;
}
4knhto1q3g8al967fdtpi2nuql0j532
32159
32158
2026-04-22T02:14:54Z
Satdeep Gill
85
[[:en:Template:RunningHeader/styles.css]] سے 1 نسخہ درآمد کیا گیا
32158
sanitized-css
text/css
/* Base style */
.wst-rh {
display:flex;
width:100%;
text-align:center;
justify-content:space-between;
}
.wst-rh > div {
flex:auto;
}
.wst-rh > div:first-child {
text-align:left;
}
.wst-rh > div:last-child {
text-align:right;
}
.wst-rh > div > p {
margin:0;
}
/* 1 cell */
.wst-rh.wst-rh-1 {
justify-content:center;
}
.wst-rh.wst-rh-1 > div:first-child {
text-align:center;
}
4knhto1q3g8al967fdtpi2nuql0j532
سانچہ:Ombox
10
13011
32160
2020-08-20T11:28:14Z
en>Billinghurst
0
4 revisions imported from [[:w:Template:Ombox]]
32160
wikitext
text/x-wiki
{{#invoke:Message box|ombox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
1o93yrjvq6v2ylug2k0uaaltljurje2
32161
32160
2026-04-22T02:14:54Z
Satdeep Gill
85
[[:en:Template:Ombox]] سے 1 نسخہ درآمد کیا گیا
32160
wikitext
text/x-wiki
{{#invoke:Message box|ombox}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
1o93yrjvq6v2ylug2k0uaaltljurje2
سانچہ:Template shortcut
10
13012
32162
2025-02-10T19:12:48Z
en>Matrix
0
dark mode fix
32162
wikitext
text/x-wiki
<table class="shortcutbox shortcutbox-template plainlinks noprint" style="
{{#ifeq:{{{float|}}}|left
| float:left; margin: .3em 1em .3em .3em;
| float:right; margin: .3em .3em .3em 1em;
}}
border:1px solid #aaa; background:var(--background-color-base, white); color: inherit; padding:3px; text-align:center;"><tr><th style="border:none; background:transparent;color: inherit"><span style="font-size:smaller;">Shortcut{{#if:{{{2|}}}|s}}:<!--
--><br> {{{{{pre|}}}[{{fullurl:Template:{{{1|{{PAGENAME}}}}}|redirect=no}} {{{1|{{PAGENAME}}}}}]}}<!--
-->{{#if:{{{2|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{2}}}|redirect=no}} {{{2}}}]}}}}<!--
-->{{#if:{{{3|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{3}}}|redirect=no}} {{{3}}}]}}}}<!--
-->{{#if:{{{4|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{4}}}|redirect=no}} {{{4}}}]}}}}<!--
-->{{#if:{{{5|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{5}}}|redirect=no}} {{{5}}}]}}}}<!--
-->{{#if:{{{6|}}}|<br> {{{{{pre3|}}}[{{fullurl:Template:{{{6}}}|redirect=no}} {{{6}}}]}}}}</span></table><noinclude>
{{Documentation}}
</noinclude>
se66tvdzocgjbcra4lzfq7aeqkck0c0
32163
32162
2026-04-22T02:14:54Z
Satdeep Gill
85
[[:en:Template:Template_shortcut]] سے 1 نسخہ درآمد کیا گیا
32162
wikitext
text/x-wiki
<table class="shortcutbox shortcutbox-template plainlinks noprint" style="
{{#ifeq:{{{float|}}}|left
| float:left; margin: .3em 1em .3em .3em;
| float:right; margin: .3em .3em .3em 1em;
}}
border:1px solid #aaa; background:var(--background-color-base, white); color: inherit; padding:3px; text-align:center;"><tr><th style="border:none; background:transparent;color: inherit"><span style="font-size:smaller;">Shortcut{{#if:{{{2|}}}|s}}:<!--
--><br> {{{{{pre|}}}[{{fullurl:Template:{{{1|{{PAGENAME}}}}}|redirect=no}} {{{1|{{PAGENAME}}}}}]}}<!--
-->{{#if:{{{2|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{2}}}|redirect=no}} {{{2}}}]}}}}<!--
-->{{#if:{{{3|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{3}}}|redirect=no}} {{{3}}}]}}}}<!--
-->{{#if:{{{4|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{4}}}|redirect=no}} {{{4}}}]}}}}<!--
-->{{#if:{{{5|}}}|<br> {{{{{pre2|}}}[{{fullurl:Template:{{{5}}}|redirect=no}} {{{5}}}]}}}}<!--
-->{{#if:{{{6|}}}|<br> {{{{{pre3|}}}[{{fullurl:Template:{{{6}}}|redirect=no}} {{{6}}}]}}}}</span></table><noinclude>
{{Documentation}}
</noinclude>
se66tvdzocgjbcra4lzfq7aeqkck0c0
سانچہ:Color
10
13013
32164
2024-01-11T01:22:48Z
en>Stefán Örvar Sigmundsson
0
We all know this at this point.
32164
wikitext
text/x-wiki
<span style="color:{{{color|{{{1|}}}}}}">{{{text|{{{2|}}}}}}</span><noinclude>{{Documentation}}</noinclude>
7bai5gimv377zt72jer1wl748tivgmm
32165
32164
2026-04-22T02:14:54Z
Satdeep Gill
85
[[:en:Template:Color]] سے 1 نسخہ درآمد کیا گیا
32164
wikitext
text/x-wiki
<span style="color:{{{color|{{{1|}}}}}}">{{{text|{{{2|}}}}}}</span><noinclude>{{Documentation}}</noinclude>
7bai5gimv377zt72jer1wl748tivgmm
سانچہ:Lorem ipsum
10
13014
32166
2025-02-25T05:09:29Z
en>CalendulaAsteraceae
0
move functionality to module
32166
wikitext
text/x-wiki
{{{{{|safesubst:}}}#invoke:Lorem ipsum|lorem_ipsum}}<noinclude>{{documentation}}</noinclude>
3bqwsnvhjnuw3ktn5ard27ckadde9w0
32167
32166
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:Lorem_ipsum]] سے 1 نسخہ درآمد کیا گیا
32166
wikitext
text/x-wiki
{{{{{|safesubst:}}}#invoke:Lorem ipsum|lorem_ipsum}}<noinclude>{{documentation}}</noinclude>
3bqwsnvhjnuw3ktn5ard27ckadde9w0
سانچہ:TemplateDataHeader
10
13015
32168
2026-04-06T04:06:41Z
en>Uzume
0
Undid revision [[Special:Diff/15729890|15729890]] by [[Special:Contributions/Daask|Daask]] ([[User talk:Daask|talk]]) this is broken without things like [[Template:IsDocSubpage]]
32168
wikitext
text/x-wiki
<div class="templatedata-header">{{#if:{{{noheader|}}}| |This is the [[w:Wikipedia:TemplateData|TemplateData]] documentation for this template used by [[w:Wikipedia:VisualEditor|VisualEditor]] and other tools.}}
'''{{{1|{{BASEPAGENAME}}}}}'''
</div><includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
[[Category:TemplateData documentation]]
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
171oqow31c94wonkmfrr5etck5ppvsr
32169
32168
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:TemplateDataHeader]] سے 1 نسخہ درآمد کیا گیا
32168
wikitext
text/x-wiki
<div class="templatedata-header">{{#if:{{{noheader|}}}| |This is the [[w:Wikipedia:TemplateData|TemplateData]] documentation for this template used by [[w:Wikipedia:VisualEditor|VisualEditor]] and other tools.}}
'''{{{1|{{BASEPAGENAME}}}}}'''
</div><includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
[[Category:TemplateData documentation]]
}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
171oqow31c94wonkmfrr5etck5ppvsr
سانچہ:Sandbox other
10
13016
32170
2020-08-20T11:28:16Z
en>Billinghurst
0
16 revisions imported from [[:w:Template:Sandbox_other]]
32170
wikitext
text/x-wiki
{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--
--><noinclude>{{documentation}}</noinclude>
h1idujwaw20aducxsd1gc4ovgnjikqa
32171
32170
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:Sandbox_other]] سے 1 نسخہ درآمد کیا گیا
32170
wikitext
text/x-wiki
{{#if:{{#ifeq:{{#invoke:String|sublength|s={{SUBPAGENAME}}|i=0|len=7}}|sandbox|1}}{{#ifeq:{{SUBPAGENAME}}|doc|1}}{{#invoke:String|match|{{PAGENAME}}|/sandbox/styles.css$|plain=false|nomatch=}}|{{{1|}}}|{{{2|}}}}}<!--
--><noinclude>{{documentation}}</noinclude>
h1idujwaw20aducxsd1gc4ovgnjikqa
سانچہ:Class notice
10
13017
32172
2025-01-28T07:58:51Z
en>CalendulaAsteraceae
0
32172
wikitext
text/x-wiki
<onlyinclude><p>This template applies the {{#if:{{{classcount|}}}|{{#ifexpr:{{{classcount}}}>1|classes|class}}|class(es)}} {{color|var(--border-color-success, #008000)|<kbd>{{{class|{{{1}}}}}}</kbd>}}, which can be targeted with a work's index <kbd>styles.css</kbd> using [[Help:page styles|page styles]].</p></onlyinclude>
{{documentation}}
8atj9gkxow63ir5m4biw1ead7qwcvrq
32173
32172
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:Class_notice]] سے 1 نسخہ درآمد کیا گیا
32172
wikitext
text/x-wiki
<onlyinclude><p>This template applies the {{#if:{{{classcount|}}}|{{#ifexpr:{{{classcount}}}>1|classes|class}}|class(es)}} {{color|var(--border-color-success, #008000)|<kbd>{{{class|{{{1}}}}}}</kbd>}}, which can be targeted with a work's index <kbd>styles.css</kbd> using [[Help:page styles|page styles]].</p></onlyinclude>
{{documentation}}
8atj9gkxow63ir5m4biw1ead7qwcvrq
سانچہ:Div-based-template
10
13018
32174
2025-05-15T13:43:58Z
en>Uzume
0
don't cat /doc and sandboxes
32174
wikitext
text/x-wiki
{{ombox|type = notice
| small = yes
| image = [[File:Paragraph font awesome white.svg|35px]]
| style = width: 25em;
| text = <p>This template uses block elements, ''e.g.'' <code><div></code> or <code><p></code>.<br />It should not be nested inside an inline element, ''e.g.'' <code><span></code>, or a template that produces such an element.</p>
{{#if:{{{class|}}}|{{class notice|class={{{class}}}|classcount={{{classcount|}}}}}}}
<p>See [[H:DIVSPAN]] for details.</p>}}<includeonly>{{sandbox other||[[Category:block based templates]]}}</includeonly><noinclude>{{documentation}}</noinclude>
7r00ci8q9lk0ulhjq3ef0rs81693p3e
32175
32174
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:Div-based-template]] سے 1 نسخہ درآمد کیا گیا
32174
wikitext
text/x-wiki
{{ombox|type = notice
| small = yes
| image = [[File:Paragraph font awesome white.svg|35px]]
| style = width: 25em;
| text = <p>This template uses block elements, ''e.g.'' <code><div></code> or <code><p></code>.<br />It should not be nested inside an inline element, ''e.g.'' <code><span></code>, or a template that produces such an element.</p>
{{#if:{{{class|}}}|{{class notice|class={{{class}}}|classcount={{{classcount|}}}}}}}
<p>See [[H:DIVSPAN]] for details.</p>}}<includeonly>{{sandbox other||[[Category:block based templates]]}}</includeonly><noinclude>{{documentation}}</noinclude>
7r00ci8q9lk0ulhjq3ef0rs81693p3e
سانچہ:RunningHeader/doc
10
13019
32176
2024-11-09T06:27:31Z
en>CalendulaAsteraceae
0
/* Tracking categories */
32176
wikitext
text/x-wiki
{{Documentation subpage}}{{template shortcut|rh|RunningFooter|rf}}
{{high-use|1583888}}<!--https://petscan.wmflabs.org/?psid=26908675-->
{{lua|Module:Running header}}
{{uses TemplateStyles|Template:RunningHeader/styles.css}}
{{div-based-template|class=.wst-rh}}
==Usage==
Intended to simplify the display of [[w:Page header|running headers]] (can also be used for footers) when transcribing scanned text pages. Many texts include running headers (chapter names, etc.) centered at the top of a page, with accompanying page numbers on the left or right side (depending on whether the page number is even or odd). Some works, especially dictionaries and directories, have two headings in the center of the page, one to the left and one to the right.
You can provide any number of parameters to the template. By default, all heading "cells" are center-aligned, except for the first cell, which is left-aligned, and the last cell, which is right-aligned. Note that a usage with only one or two cells is really a three-cell header with the second and third, or third, cell blank.
{{doc example|
<pre>{{rh|left|right}}</pre>
{{rh|left|right}}
}}
{{doc example|
<pre>{{rh|left|center|right}}</pre>
{{rh|left|center|right}}
}}
{{doc example|
<pre>{{rh|left|left-center|right-center|right}}</pre>
{{rh|left|left-center|right-center|right}}
}}
{{doc example|
<pre>{{rh|left|mid-left|center|mid-right|right}}</pre>
{{rh|left|mid-left|center|mid-right|right}}
}}
{{doc example|
<pre>{{rh|一|二|三|四|[page]|五|六|七|八|九}}</pre>
{{rh|一|二|三|四|[page]|五|六|七|八|九}}
}}
Parameters can be blank:
{{doc example|
<pre>{{rh|left|{{lorem ipsum}}|}}</pre>
{{rh|left|{{lorem ipsum}}|}}
}}
=== Page styles ===
This template adds the class <code>wst-rh</code> ({{search/css|.wst-rh}}) to the outer container.
You can target specific cells of the header with [[H:Page styles|CSS]] like <syntaxhighlight lang=css inline=yes>.wst-rh > div:nth-child(n)</syntaxhighlight>, where ''n'' is the cell number, or target all cells with <syntaxhighlight lang=css inline=yes>.wst-rh > div</syntaxhighlight>.
==Redirects==
{{tl|Running header}}, {{tl|runningheader}}, {{tl|rh}}, {{tl|RunningFooter}} and {{tl|rf}} redirect here. Use these forms of the template if you prefer.
==Tracking categories==
* [[:Category:Running header tracking categories]]
==TemplateData==
{{TemplateDataHeader}}
<templatedata>
{
"params": {
"1": {},
"2": {},
"3": {},
"4": {},
"5": {},
"6": {},
"7": {},
"8": {},
"9": {},
"1, …, n": {
"label": "Numbered parameters",
"description": "Numbered parameters will be arranged in equal widths across the width of the page.",
"type": "string",
"suggested": true
},
"class": {
"label": "class",
"description": "Additional CSS classes to apply to running header."
},
"center": {
"aliases": [
"centre"
]
},
"left": {},
"right": {}
},
"description": "Simplify the display of running headers (and footers) when transcribing scanned text pages.",
"paramOrder": [
"1, …, n",
"class",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"center",
"left",
"right"
],
"format": "inline"
}
</templatedata>
==See also==
* {{tl|recto-verso header}} for simple headers that vary by page number
* {{tl|recto-verso header2}} for more complicated headers that vary by page number
* {{tl|recto-verso header3}} for left/right aligned non-page number headers
* {{tl|recto-verso header4}} for left/right aligned page number headers
* {{tl|recto-verso}} for other headers that vary by page number
* {{tl|left}} for left text-alignment
* {{tl|center}} for center text-alignment
* {{tl|right}} for right text-alignment
* {{tl|issue banner}} for headers in periodicals
<!-- template categories -->
<includeonly>{{sandbox other||
[[Category:Page numbering templates|RunningHeader]]
[[Category:Templates applying classes for page styles|RunningHeader]]
}}</includeonly>
smvb631tsmclsloc3n70vbfsl75tbzy
32177
32176
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:RunningHeader/doc]] سے 1 نسخہ درآمد کیا گیا
32176
wikitext
text/x-wiki
{{Documentation subpage}}{{template shortcut|rh|RunningFooter|rf}}
{{high-use|1583888}}<!--https://petscan.wmflabs.org/?psid=26908675-->
{{lua|Module:Running header}}
{{uses TemplateStyles|Template:RunningHeader/styles.css}}
{{div-based-template|class=.wst-rh}}
==Usage==
Intended to simplify the display of [[w:Page header|running headers]] (can also be used for footers) when transcribing scanned text pages. Many texts include running headers (chapter names, etc.) centered at the top of a page, with accompanying page numbers on the left or right side (depending on whether the page number is even or odd). Some works, especially dictionaries and directories, have two headings in the center of the page, one to the left and one to the right.
You can provide any number of parameters to the template. By default, all heading "cells" are center-aligned, except for the first cell, which is left-aligned, and the last cell, which is right-aligned. Note that a usage with only one or two cells is really a three-cell header with the second and third, or third, cell blank.
{{doc example|
<pre>{{rh|left|right}}</pre>
{{rh|left|right}}
}}
{{doc example|
<pre>{{rh|left|center|right}}</pre>
{{rh|left|center|right}}
}}
{{doc example|
<pre>{{rh|left|left-center|right-center|right}}</pre>
{{rh|left|left-center|right-center|right}}
}}
{{doc example|
<pre>{{rh|left|mid-left|center|mid-right|right}}</pre>
{{rh|left|mid-left|center|mid-right|right}}
}}
{{doc example|
<pre>{{rh|一|二|三|四|[page]|五|六|七|八|九}}</pre>
{{rh|一|二|三|四|[page]|五|六|七|八|九}}
}}
Parameters can be blank:
{{doc example|
<pre>{{rh|left|{{lorem ipsum}}|}}</pre>
{{rh|left|{{lorem ipsum}}|}}
}}
=== Page styles ===
This template adds the class <code>wst-rh</code> ({{search/css|.wst-rh}}) to the outer container.
You can target specific cells of the header with [[H:Page styles|CSS]] like <syntaxhighlight lang=css inline=yes>.wst-rh > div:nth-child(n)</syntaxhighlight>, where ''n'' is the cell number, or target all cells with <syntaxhighlight lang=css inline=yes>.wst-rh > div</syntaxhighlight>.
==Redirects==
{{tl|Running header}}, {{tl|runningheader}}, {{tl|rh}}, {{tl|RunningFooter}} and {{tl|rf}} redirect here. Use these forms of the template if you prefer.
==Tracking categories==
* [[:Category:Running header tracking categories]]
==TemplateData==
{{TemplateDataHeader}}
<templatedata>
{
"params": {
"1": {},
"2": {},
"3": {},
"4": {},
"5": {},
"6": {},
"7": {},
"8": {},
"9": {},
"1, …, n": {
"label": "Numbered parameters",
"description": "Numbered parameters will be arranged in equal widths across the width of the page.",
"type": "string",
"suggested": true
},
"class": {
"label": "class",
"description": "Additional CSS classes to apply to running header."
},
"center": {
"aliases": [
"centre"
]
},
"left": {},
"right": {}
},
"description": "Simplify the display of running headers (and footers) when transcribing scanned text pages.",
"paramOrder": [
"1, …, n",
"class",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"center",
"left",
"right"
],
"format": "inline"
}
</templatedata>
==See also==
* {{tl|recto-verso header}} for simple headers that vary by page number
* {{tl|recto-verso header2}} for more complicated headers that vary by page number
* {{tl|recto-verso header3}} for left/right aligned non-page number headers
* {{tl|recto-verso header4}} for left/right aligned page number headers
* {{tl|recto-verso}} for other headers that vary by page number
* {{tl|left}} for left text-alignment
* {{tl|center}} for center text-alignment
* {{tl|right}} for right text-alignment
* {{tl|issue banner}} for headers in periodicals
<!-- template categories -->
<includeonly>{{sandbox other||
[[Category:Page numbering templates|RunningHeader]]
[[Category:Templates applying classes for page styles|RunningHeader]]
}}</includeonly>
smvb631tsmclsloc3n70vbfsl75tbzy
سانچہ:Search
10
13020
32178
2011-01-07T03:11:26Z
en>Billinghurst
0
tag close
32178
wikitext
text/x-wiki
<span class="plainlinks">[{{fullurl:Special:Search/{{{1}}}|fulltext=Search{{#if:{{{ns|}}}|{{!}}&{{{ns|}}}=1}}}} {{{2|search}}}]</span><noinclude>
{{documentation}}</noinclude>
6aauruthyblk99a2v0fq304ta599lmd
32179
32178
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:Search]] سے 1 نسخہ درآمد کیا گیا
32178
wikitext
text/x-wiki
<span class="plainlinks">[{{fullurl:Special:Search/{{{1}}}|fulltext=Search{{#if:{{{ns|}}}|{{!}}&{{{ns|}}}=1}}}} {{{2|search}}}]</span><noinclude>
{{documentation}}</noinclude>
6aauruthyblk99a2v0fq304ta599lmd
سانچہ:Search/css
10
13021
32180
2025-03-14T03:06:01Z
en>Uzume
0
cosmetic "files"->"pages"; clarify since this does not really search anything any files such as the content of media in "File:" namespace, etc.
32180
wikitext
text/x-wiki
<includeonly>{{search|1=all: contentmodel:sanitized-css insource:/{{#invoke:string|replace|{{{1}}}|([%.*^$%[%]%{%}])|\%1|plain=false}}/|2={{{2|search for {{{1}}} in CSS pages}}}}}</includeonly><noinclude>
{{documentation}}
</noinclude>
7ru19sq8sxkgg17y43ur9toqf3h1dcj
32181
32180
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Template:Search/css]] سے 1 نسخہ درآمد کیا گیا
32180
wikitext
text/x-wiki
<includeonly>{{search|1=all: contentmodel:sanitized-css insource:/{{#invoke:string|replace|{{{1}}}|([%.*^$%[%]%{%}])|\%1|plain=false}}/|2={{{2|search for {{{1}}} in CSS pages}}}}}</includeonly><noinclude>
{{documentation}}
</noinclude>
7ru19sq8sxkgg17y43ur9toqf3h1dcj
ماڈیول:Lang
828
13022
32182
2025-07-23T03:40:18Z
en>CalendulaAsteraceae
0
32182
Scribunto
text/plain
--[=[
Module description
]=]
local p = {} -- p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
--[=[
Get the appropriate text direction for a language
]=]
p.rtl_langs = {
['ae'] = true, -- Avestan
['ar'] = true, -- Arabic
['arc'] = true, -- Aramaic/Imperial Aramaic
['dv'] = true, -- Dhivehi
['fa'] = true, -- Persian
['ha'] = true, -- Hausa
['he'] = true, -- Hebrew
['hbo'] = true, -- Hebrew
['ira'] = true, -- Iranian
['khw'] = true, -- Khowar
['ks'] = true, -- Kashmiri
['ku'] = true, -- Kurdish
['mid'] = true, -- Mandaic
['myz'] = true, -- Classical Mandaic
['obm-hebr'] = true, -- Moabite
['phn'] = true, -- Phoenician
['ps'] = true, -- Pashto
['syc'] = true, -- Syriac
['syr'] = true, -- Syriac
['ur'] = true, -- Urdu
['yi'] = true, -- Yiddish
-- scripts
['Adlm'] = true, -- Adlam
['Arab'] = true, -- Arabic
['Armi'] = true, -- Imperial Aramaic
['Avst'] = true, -- Avestan
['Cprt'] = true, -- Cypriot syllabary
['Elym'] = true, -- Elymaic
['Gara'] = true, -- Garay
['Hatr'] = true, -- Hatran
['Hebr'] = true, -- Hebrew
['Hung'] = true, -- Old Hungarian (Hungarian Runic)
['Khar'] = true, -- Kharoshthi
['Lydi'] = true, -- Lydian
['Mand'] = true, -- Mandaic, Mandaean
['Mani'] = true, -- Manichaean
['Mend'] = true, -- Mende Kikakui
['Merc'] = true, -- Meroitic Cursive
['Mero'] = true, -- Meroitic Hieroglyphs
['Narb'] = true, -- Old North Arabian (Ancient North Arabian)
['Nbat'] = true, -- Nabataean
['Nkoo'] = true, -- N’Ko
['Orkh'] = true, -- Old Turkic, Orkhon Runic
['Palm'] = true, -- Palmyrene
['Phli'] = true, -- Inscriptional Pahlavi
['Phlp'] = true, -- Psalter Pahlavi
['Phnx'] = true, -- Phoenician
['Prti'] = true, -- Inscriptional Parthian
['Rohg'] = true, -- Hanifi Rohingya
['Sarb'] = true, -- Old South Arabian
['Sidt'] = true, -- Sidetic
['Sogo'] = true, -- Old Sogdian
['Syrc'] = true, -- Syriac
['Thaa'] = true, -- Thaana
['Todr'] = true, -- Todhri
['Yezi'] = true -- Yezidi
}
function p._text_direction(args)
local lang = args.lang
if lang and p.rtl_langs[lang] then
return 'rtl'
elseif type(lang) == 'string' then
local stripped_lang = mw.text.split(lang, '-')[1]
if p.rtl_langs[stripped_lang] then
return 'rtl'
end
end
return 'ltr'
end
--[=[
Implements [[Template:Lang]] and [[Template:Lang block]]
]=]
function p._lang(args)
local lang = args.language or args.lang or args[1] or 'en'
local dir = args.direction or args.dir or p._text_direction({['lang'] = lang})
local text = args.text or args[2]
local inline = yesno(args.inline) ~= false -- default is true
local noclose = yesno(args.noclose) or false -- default is false
-- Span or div?
local tag = (inline and 'span') or 'div'
local content = mw.html.create(tag)
-- Set the attributes
content
:addClass(table.concat({'wst-lang', args.class}, ' '))
:attr('lang', lang)
:attr('xml:lang', lang)
:attr('dir', dir)
:css({['font-family'] = args.fonts or args.font, ['style'] = args.style})
:allDone()
if text and inline then
content:wikitext(text)
elseif text then
content:newline():wikitext(text)
end
if not inline and not noclose then
content:newline()
end
content = tostring(content)
if noclose then
content = string.gsub(content, '</' .. tag .. '>$', '')
end
return content
end
function p.lang(frame)
local args = getArgs(frame)
return p._lang(args)
end
return p
l8y0fas40r70ngz80nzfpcupn0kfhu9
32183
32182
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Module:Lang]] سے 1 نسخہ درآمد کیا گیا
32182
Scribunto
text/plain
--[=[
Module description
]=]
local p = {} -- p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
--[=[
Get the appropriate text direction for a language
]=]
p.rtl_langs = {
['ae'] = true, -- Avestan
['ar'] = true, -- Arabic
['arc'] = true, -- Aramaic/Imperial Aramaic
['dv'] = true, -- Dhivehi
['fa'] = true, -- Persian
['ha'] = true, -- Hausa
['he'] = true, -- Hebrew
['hbo'] = true, -- Hebrew
['ira'] = true, -- Iranian
['khw'] = true, -- Khowar
['ks'] = true, -- Kashmiri
['ku'] = true, -- Kurdish
['mid'] = true, -- Mandaic
['myz'] = true, -- Classical Mandaic
['obm-hebr'] = true, -- Moabite
['phn'] = true, -- Phoenician
['ps'] = true, -- Pashto
['syc'] = true, -- Syriac
['syr'] = true, -- Syriac
['ur'] = true, -- Urdu
['yi'] = true, -- Yiddish
-- scripts
['Adlm'] = true, -- Adlam
['Arab'] = true, -- Arabic
['Armi'] = true, -- Imperial Aramaic
['Avst'] = true, -- Avestan
['Cprt'] = true, -- Cypriot syllabary
['Elym'] = true, -- Elymaic
['Gara'] = true, -- Garay
['Hatr'] = true, -- Hatran
['Hebr'] = true, -- Hebrew
['Hung'] = true, -- Old Hungarian (Hungarian Runic)
['Khar'] = true, -- Kharoshthi
['Lydi'] = true, -- Lydian
['Mand'] = true, -- Mandaic, Mandaean
['Mani'] = true, -- Manichaean
['Mend'] = true, -- Mende Kikakui
['Merc'] = true, -- Meroitic Cursive
['Mero'] = true, -- Meroitic Hieroglyphs
['Narb'] = true, -- Old North Arabian (Ancient North Arabian)
['Nbat'] = true, -- Nabataean
['Nkoo'] = true, -- N’Ko
['Orkh'] = true, -- Old Turkic, Orkhon Runic
['Palm'] = true, -- Palmyrene
['Phli'] = true, -- Inscriptional Pahlavi
['Phlp'] = true, -- Psalter Pahlavi
['Phnx'] = true, -- Phoenician
['Prti'] = true, -- Inscriptional Parthian
['Rohg'] = true, -- Hanifi Rohingya
['Sarb'] = true, -- Old South Arabian
['Sidt'] = true, -- Sidetic
['Sogo'] = true, -- Old Sogdian
['Syrc'] = true, -- Syriac
['Thaa'] = true, -- Thaana
['Todr'] = true, -- Todhri
['Yezi'] = true -- Yezidi
}
function p._text_direction(args)
local lang = args.lang
if lang and p.rtl_langs[lang] then
return 'rtl'
elseif type(lang) == 'string' then
local stripped_lang = mw.text.split(lang, '-')[1]
if p.rtl_langs[stripped_lang] then
return 'rtl'
end
end
return 'ltr'
end
--[=[
Implements [[Template:Lang]] and [[Template:Lang block]]
]=]
function p._lang(args)
local lang = args.language or args.lang or args[1] or 'en'
local dir = args.direction or args.dir or p._text_direction({['lang'] = lang})
local text = args.text or args[2]
local inline = yesno(args.inline) ~= false -- default is true
local noclose = yesno(args.noclose) or false -- default is false
-- Span or div?
local tag = (inline and 'span') or 'div'
local content = mw.html.create(tag)
-- Set the attributes
content
:addClass(table.concat({'wst-lang', args.class}, ' '))
:attr('lang', lang)
:attr('xml:lang', lang)
:attr('dir', dir)
:css({['font-family'] = args.fonts or args.font, ['style'] = args.style})
:allDone()
if text and inline then
content:wikitext(text)
elseif text then
content:newline():wikitext(text)
end
if not inline and not noclose then
content:newline()
end
content = tostring(content)
if noclose then
content = string.gsub(content, '</' .. tag .. '>$', '')
end
return content
end
function p.lang(frame)
local args = getArgs(frame)
return p._lang(args)
end
return p
l8y0fas40r70ngz80nzfpcupn0kfhu9
ماڈیول:Greek
828
13023
32184
2025-04-14T05:18:19Z
en>CalendulaAsteraceae
0
32184
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local lang = require('Module:Lang')._lang
local wikt_link = require('Module:Wikt')._wikt
function p._greek(args)
local text = args[1]
local wikt = args.wikt or args[2]
local inline = yesno(args.inline) ~= false
local content = text
if wikt and inline then
content = wikt_link({
['link'] = wikt,
['text'] = text,
['anchor'] = 'Ancient Greek'
})
end
return mw.getCurrentFrame():extensionTag('templatestyles', '', {src = 'Template:Greek/styles.css'}) .. lang({
['lang'] = 'grc',
['class'] = 'wst-lang-grc',
['text'] = content,
['inline'] = inline,
['noclose'] = yesno(args.noclose) or false
})
end
function p.greek(frame)
return p._greek(getArgs(frame))
end
return p
s9o5qunia1jmnzifoo7trnz5g8snsif
32185
32184
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Module:Greek]] سے 1 نسخہ درآمد کیا گیا
32184
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local lang = require('Module:Lang')._lang
local wikt_link = require('Module:Wikt')._wikt
function p._greek(args)
local text = args[1]
local wikt = args.wikt or args[2]
local inline = yesno(args.inline) ~= false
local content = text
if wikt and inline then
content = wikt_link({
['link'] = wikt,
['text'] = text,
['anchor'] = 'Ancient Greek'
})
end
return mw.getCurrentFrame():extensionTag('templatestyles', '', {src = 'Template:Greek/styles.css'}) .. lang({
['lang'] = 'grc',
['class'] = 'wst-lang-grc',
['text'] = content,
['inline'] = inline,
['noclose'] = yesno(args.noclose) or false
})
end
function p.greek(frame)
return p._greek(getArgs(frame))
end
return p
s9o5qunia1jmnzifoo7trnz5g8snsif
ماڈیول:Wikt
828
13024
32186
2025-04-14T04:55:23Z
en>CalendulaAsteraceae
0
32186
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local error_message = require('Module:Error')['error']
function p._wikt(args)
local link = args.link or args[1]
if not link then
return error_message({message = '[[Module:Wikt]] error: no link provided'})
end
local text = args.text or args[2] or link
local anchor = args.anchor or args[3]
local gray = yesno(args.gray or false)
if gray then
text = tostring(mw.html.create('span'):css({['color'] = 'dimgray'}):wikitext(text))
end
if anchor then
anchor = mw.uri.anchorEncode(anchor)
end
return '[[' .. mw.title.makeTitle('', link, anchor, 'wikt').fullText .. '|' .. text .. ']]'
end
function p.wikt(frame)
return p._wikt(getArgs(frame))
end
return p
pixobafie524h73jac0bbhi3xiq41l2
32187
32186
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Module:Wikt]] سے 1 نسخہ درآمد کیا گیا
32186
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local error_message = require('Module:Error')['error']
function p._wikt(args)
local link = args.link or args[1]
if not link then
return error_message({message = '[[Module:Wikt]] error: no link provided'})
end
local text = args.text or args[2] or link
local anchor = args.anchor or args[3]
local gray = yesno(args.gray or false)
if gray then
text = tostring(mw.html.create('span'):css({['color'] = 'dimgray'}):wikitext(text))
end
if anchor then
anchor = mw.uri.anchorEncode(anchor)
end
return '[[' .. mw.title.makeTitle('', link, anchor, 'wikt').fullText .. '|' .. text .. ']]'
end
function p.wikt(frame)
return p._wikt(getArgs(frame))
end
return p
pixobafie524h73jac0bbhi3xiq41l2
ماڈیول:Running header
828
13025
32188
2025-09-15T19:04:14Z
en>CalendulaAsteraceae
0
clean up cell-adding code
32188
Scribunto
text/plain
--[=[
Implements [[Template:RunningHeader]]
]=]
require('strict')
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p._running_header(args)
-- holds tracking categories
local tracking_cats = {}
-- aliases for first 3 parameters
if args.left or args.center or args.centre or args.right then
-- this is fine but it's worth keeping track of
table.insert(tracking_cats, '[[Category:' .. 'Running headers using explicit parameter names' .. ']]')
-- check for duplicates (which are a problem)
if (args[1] and args.left) or (args[2] and args.center) or (args[2] and args.centre) or (args.center and args.centre) or (args[3] and args.right) then
table.insert(tracking_cats, '[[Category:' .. 'Pages using duplicate arguments in template calls' .. ']]')
end
-- use aliases
args[1] = args[1] or args.left
args[2] = args[2] or args.center or args.centre
args[3] = args[3] or args.right
end
-- get number of cells (largest-numbered parameter)
-- can't use #args because that doesn't work consistently on tables that aren't sequences
-- table.maxn also seems not to work
local cell_count = 0
for k, v in pairs(args) do
local i = tonumber(k)
if i and i > cell_count then
cell_count = i
end
end
-- track headers which don't set the contents of every cell
local undefined_entries = false
-- track how many cells have content
local content_entries = 0
for i = 1, cell_count do
if not args[i] then
undefined_entries = true
elseif args[i] and args[i] ~= '' then
content_entries = content_entries + 1
end
end
if undefined_entries then
-- track headers with undefined entries (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with undefined entries' .. ']]')
end
if content_entries == 1 then
-- track headers with only one non-blank entry
table.insert(tracking_cats, '[[Category:' .. 'Running headers with only one content entry' .. ']]')
end
if cell_count == 0 or content_entries == 0 then
-- track headers with no entries (pointless)
table.insert(tracking_cats, '[[Category:' .. 'Empty running headers' .. ']]')
elseif cell_count == 1 then
-- track 1-cell headers (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with one entry' .. ']]')
elseif cell_count == 2 then
-- track 2-cell headers (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with two entries' .. ']]')
elseif cell_count > 4 then
-- track headers with more than 4 cells (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with more than four entries' .. ']]')
end
-- TEMPORARY FOR MIGRATION: enforce 3-cell minimum
cell_count = math.max(cell_count, 3)
-- assemble header
local base_class = 'wst-rh'
local header_class = table.concat({
base_class,
base_class .. '-' .. cell_count,
args.class or (base_class .. '-default')
}, ' ')
local header_div = mw.html.create('div')
:addClass(header_class)
-- cell classes
local cell_class = base_class .. '-cell'
local extra_cell_classes = {
[3] = {'wst-rh-left', 'wst-rh-center', 'wst-rh-right'}
}
extra_cell_classes = extra_cell_classes[cell_count] or {}
for i = 1, cell_count do
local cell = header_div:tag('div')
:addClass(cell_class)
:wikitext(args[i] or '')
if extra_cell_classes[i] then
cell:addClass(extra_cell_classes[i])
end
end
return tostring(header_div) .. table.concat(tracking_cats)
end
function p.running_header(frame)
local args = getArgs(frame, {trim = true, removeBlanks = false})
return p._running_header(args)
end
return p
82rul6vqvjo1f9yc4d5nav8h515q16h
32189
32188
2026-04-22T02:14:55Z
Satdeep Gill
85
[[:en:Module:Running_header]] سے 1 نسخہ درآمد کیا گیا
32188
Scribunto
text/plain
--[=[
Implements [[Template:RunningHeader]]
]=]
require('strict')
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p._running_header(args)
-- holds tracking categories
local tracking_cats = {}
-- aliases for first 3 parameters
if args.left or args.center or args.centre or args.right then
-- this is fine but it's worth keeping track of
table.insert(tracking_cats, '[[Category:' .. 'Running headers using explicit parameter names' .. ']]')
-- check for duplicates (which are a problem)
if (args[1] and args.left) or (args[2] and args.center) or (args[2] and args.centre) or (args.center and args.centre) or (args[3] and args.right) then
table.insert(tracking_cats, '[[Category:' .. 'Pages using duplicate arguments in template calls' .. ']]')
end
-- use aliases
args[1] = args[1] or args.left
args[2] = args[2] or args.center or args.centre
args[3] = args[3] or args.right
end
-- get number of cells (largest-numbered parameter)
-- can't use #args because that doesn't work consistently on tables that aren't sequences
-- table.maxn also seems not to work
local cell_count = 0
for k, v in pairs(args) do
local i = tonumber(k)
if i and i > cell_count then
cell_count = i
end
end
-- track headers which don't set the contents of every cell
local undefined_entries = false
-- track how many cells have content
local content_entries = 0
for i = 1, cell_count do
if not args[i] then
undefined_entries = true
elseif args[i] and args[i] ~= '' then
content_entries = content_entries + 1
end
end
if undefined_entries then
-- track headers with undefined entries (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with undefined entries' .. ']]')
end
if content_entries == 1 then
-- track headers with only one non-blank entry
table.insert(tracking_cats, '[[Category:' .. 'Running headers with only one content entry' .. ']]')
end
if cell_count == 0 or content_entries == 0 then
-- track headers with no entries (pointless)
table.insert(tracking_cats, '[[Category:' .. 'Empty running headers' .. ']]')
elseif cell_count == 1 then
-- track 1-cell headers (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with one entry' .. ']]')
elseif cell_count == 2 then
-- track 2-cell headers (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with two entries' .. ']]')
elseif cell_count > 4 then
-- track headers with more than 4 cells (fine but worth keeping track of)
table.insert(tracking_cats, '[[Category:' .. 'Running headers with more than four entries' .. ']]')
end
-- TEMPORARY FOR MIGRATION: enforce 3-cell minimum
cell_count = math.max(cell_count, 3)
-- assemble header
local base_class = 'wst-rh'
local header_class = table.concat({
base_class,
base_class .. '-' .. cell_count,
args.class or (base_class .. '-default')
}, ' ')
local header_div = mw.html.create('div')
:addClass(header_class)
-- cell classes
local cell_class = base_class .. '-cell'
local extra_cell_classes = {
[3] = {'wst-rh-left', 'wst-rh-center', 'wst-rh-right'}
}
extra_cell_classes = extra_cell_classes[cell_count] or {}
for i = 1, cell_count do
local cell = header_div:tag('div')
:addClass(cell_class)
:wikitext(args[i] or '')
if extra_cell_classes[i] then
cell:addClass(extra_cell_classes[i])
end
end
return tostring(header_div) .. table.concat(tracking_cats)
end
function p.running_header(frame)
local args = getArgs(frame, {trim = true, removeBlanks = false})
return p._running_header(args)
end
return p
82rul6vqvjo1f9yc4d5nav8h515q16h
ماڈیول:Namespace other
828
13026
32190
2025-11-10T17:50:10Z
en>CalendulaAsteraceae
0
Protected "[[Module:Namespace other]]": High traffic page or template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32190
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
function p._namespace_other(args)
local namespace = string.lower(args.demospace or mw.title.getCurrentTitle().nsText)
namespace = string.gsub(namespace, ' ', '_')
local target = string.lower(args.target or 'main')
if yesno(args['include-talk']) then
namespace = string.gsub(namespace, '[%s_]*talk', '')
end
local special_targets = {
['talk'] = function (ns)
return mw.title.new(mw.title.getCurrentTitle().rootText, ns).isTalkPage
end,
['main'] = function (ns)
return ns == '' or ns == 'main'
end
}
if namespace == target or (special_targets[target] and special_targets[target](namespace)) then
return args[1]
else
return args[2]
end
end
function p.namespace_other(frame)
return p._namespace_other(getArgs(frame))
end
local function _page_index_other(args)
local page_entry = args['page index'] or args['page'] or args[1]
local index_entry = args['page index'] or args['index'] or args[2]
local other_entry = args['other'] or args[3]
local namespace = string.lower(args.demospace or mw.title.getCurrentTitle().nsText)
namespace = string.gsub(namespace, ' ', '_')
namespace = string.gsub(namespace, '[%s_]*talk', '')
return (namespace == 'page' and page_entry) or (namespace == 'index' and index_entry) or other_entry
end
function p.page_index_other(frame)
return _page_index_other(getArgs(frame))
end
return p
8mk1vq1pikiuuut9c6e0xtb4jtim4x4
32191
32190
2026-04-22T02:14:56Z
Satdeep Gill
85
[[:en:Module:Namespace_other]] سے 1 نسخہ درآمد کیا گیا
32190
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
function p._namespace_other(args)
local namespace = string.lower(args.demospace or mw.title.getCurrentTitle().nsText)
namespace = string.gsub(namespace, ' ', '_')
local target = string.lower(args.target or 'main')
if yesno(args['include-talk']) then
namespace = string.gsub(namespace, '[%s_]*talk', '')
end
local special_targets = {
['talk'] = function (ns)
return mw.title.new(mw.title.getCurrentTitle().rootText, ns).isTalkPage
end,
['main'] = function (ns)
return ns == '' or ns == 'main'
end
}
if namespace == target or (special_targets[target] and special_targets[target](namespace)) then
return args[1]
else
return args[2]
end
end
function p.namespace_other(frame)
return p._namespace_other(getArgs(frame))
end
local function _page_index_other(args)
local page_entry = args['page index'] or args['page'] or args[1]
local index_entry = args['page index'] or args['index'] or args[2]
local other_entry = args['other'] or args[3]
local namespace = string.lower(args.demospace or mw.title.getCurrentTitle().nsText)
namespace = string.gsub(namespace, ' ', '_')
namespace = string.gsub(namespace, '[%s_]*talk', '')
return (namespace == 'page' and page_entry) or (namespace == 'index' and index_entry) or other_entry
end
function p.page_index_other(frame)
return _page_index_other(getArgs(frame))
end
return p
8mk1vq1pikiuuut9c6e0xtb4jtim4x4
ماڈیول:Lorem ipsum
828
13027
32192
2025-02-25T05:28:32Z
en>CalendulaAsteraceae
0
32192
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local namespace_other = require('Module:Namespace other')._namespace_other
local greek = require('Module:Greek')._greek
local lipsum_data = {
['latin'] = {
['start'] = 'Lorem ipsum',
['text'] = {
' dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
'Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.',
'Fusce convallis, mauris imperdiet gravida bibendum, nisl turpis suscipit mauris, sed placerat ipsum urna sed risus. In convallis tellus a mauris. Curabitur non elit ut libero tristique sodales. Mauris a lacus. Donec mattis semper leo. In hac habitasse platea dictumst. Vivamus facilisis diam at odio. Mauris dictum, nisi eget consequat elementum, lacus ligula molestie metus, non feugiat orci magna ac sem. Donec turpis. Donec vitae metus. Morbi tristique neque eu mauris. Quisque gravida ipsum non sapien. Proin turpis lacus, scelerisque vitae, elementum at, lobortis ac, quam. Aliquam dictum eleifend risus. In hac habitasse platea dictumst. Etiam sit amet diam. Suspendisse odio. Suspendisse nunc. In semper bibendum libero.',
'Proin nonummy, lacus eget pulvinar lacinia, pede felis dignissim leo, vitae tristique magna lacus sit amet eros. Nullam ornare. Praesent odio ligula, dapibus sed, tincidunt eget, dictum ac, nibh. Nam quis lacus. Nunc eleifend molestie velit. Morbi lobortis quam eu velit. Donec euismod vestibulum massa. Donec non lectus. Aliquam commodo lacus sit amet nulla. Cras dignissim elit et augue. Nullam non diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In hac habitasse platea dictumst. Aenean vestibulum. Sed lobortis elit quis lectus. Nunc sed lacus at augue bibendum dapibus.',
'Aliquam vehicula sem ut pede. Cras purus lectus, egestas eu, vehicula at, imperdiet sed, nibh. Morbi consectetuer luctus felis. Donec vitae nisi. Aliquam tincidunt feugiat elit. Duis sed elit ut turpis ullamcorper feugiat. Praesent pretium, mauris sed fermentum hendrerit, nulla lorem iaculis magna, pulvinar scelerisque urna tellus a justo. Suspendisse pulvinar massa in metus. Duis quis quam. Proin justo. Curabitur ac sapien. Nam erat. Praesent ut quam.',
'Vivamus commodo, augue et laoreet euismod, sem sapien tempor dolor, ac egestas sem ligula quis lacus. Donec vestibulum tortor ac lacus. Sed posuere vestibulum nisl. Curabitur eleifend fermentum justo. Nullam imperdiet. Integer sit amet mauris imperdiet risus sollicitudin rutrum. Ut vitae turpis. Nulla facilisi. Quisque tortor velit, scelerisque et, facilisis vel, tempor sed, urna. Vivamus nulla elit, vestibulum eget, semper et, scelerisque eget, lacus. Pellentesque viverra purus. Quisque elit. Donec ut dolor.',
'Duis volutpat elit et erat. In at nulla at nisl condimentum aliquet. Quisque elementum pharetra lacus. Nunc gravida arcu eget nunc. Nulla iaculis egestas magna. Aliquam erat volutpat. Sed pellentesque orci. Etiam lacus lorem, iaculis sit amet, pharetra quis, imperdiet sit amet, lectus. Integer quis elit ac mi aliquam pretium. Nullam mauris orci, porttitor eget, sollicitudin non, vulputate id, risus. Donec varius enim nec sem. Nam aliquam lacinia enim. Quisque eget lorem eu purus dignissim ultricies. Fusce porttitor hendrerit ante. Mauris urna diam, cursus id, mattis eget, tempus sit amet, risus. Curabitur eu felis. Sed eu mi. Nullam lectus mauris, luctus a, mattis ac, tempus non, leo. Cras mi nulla, rhoncus id, laoreet ut, ultricies id, odio.',
'Donec imperdiet. Vestibulum auctor tortor at orci. Integer semper, nisi eget suscipit eleifend, erat nisl hendrerit justo, eget vestibulum lorem justo ac leo. Integer sem velit, pharetra in, fringilla eu, fermentum id, felis. Vestibulum sed felis. In elit. Praesent et pede vel ante dapibus condimentum. Donec magna. Quisque id risus. Mauris vulputate pellentesque leo. Duis vulputate, ligula at venenatis tincidunt, orci nunc interdum leo, ac egestas elit sem ut lacus. Etiam non diam quis arcu egestas commodo. Curabitur nec massa ac massa gravida condimentum. Aenean id libero. Pellentesque vitae tellus. Fusce lectus est, accumsan ac, bibendum sed, porta eget, augue. Etiam faucibus. Quisque tempus purus eu ante.',
'Vestibulum sapien nisl, ornare auctor, consectetuer quis, posuere tristique, odio. Fusce ultrices ullamcorper odio. Ut augue nulla, interdum at, adipiscing non, tristique eget, neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut pede est, condimentum id, scelerisque ac, malesuada non, quam. Proin eu ligula ac sapien suscipit blandit. Suspendisse euismod. Ut accumsan, neque id gravida luctus, arcu pede sodales felis, vel blandit massa arcu eget ligula. Aenean sed turpis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec sem eros, ornare ut, commodo eu, tempor nec, risus. Donec laoreet dapibus ligula. Praesent orci leo, bibendum nec, ornare et, nonummy in, elit. Donec interdum feugiat leo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque feugiat ullamcorper ipsum. Donec convallis tincidunt urna.',
'Suspendisse et orci et arcu porttitor pellentesque. Sed lacus nunc, fermentum vel, vehicula in, imperdiet eget, urna. Nam consectetuer euismod nunc. Nulla dignissim posuere nulla. Integer iaculis lacinia massa. Nullam sapien augue, condimentum vel, venenatis id, rhoncus pellentesque, sapien. Donec sed ipsum ultrices turpis consectetuer imperdiet. Duis et ipsum ac nisl laoreet commodo. Mauris eu est. Suspendisse id turpis quis orci euismod consequat. Donec tellus mi, luctus sit amet, ultrices a, convallis eu, lorem. Proin faucibus convallis elit. Maecenas rhoncus arcu at arcu. Proin libero. Proin adipiscing. In quis lorem vitae elit consectetuer pretium. Nullam ligula urna, adipiscing nec, iaculis ut, elementum non, turpis. Fusce pulvinar.'
}
},
['greek'] = {
['start'] = 'Λορεμ ιψων',
['text'] = {
' δωλορ σιτ αμετ, κονσεκτετυρ αδιπισικιγγ ελιτ, αλλα δο ειυσμοδ τεμπορ ινκιδιδυντ η λαβορε και δωλορε μαγνα αλιχα. Υτ ενιμ αδ μινιμ ουενιαμ, χις νοστρυδ εξερκιτατιον υλλαμκο λαβορις νισι η αλιχιπ εξ εα κομμωδο κονσεχατ. Δυις αυτε ιρυρε δωλορ ιν ρεπρεχενδεριτ ιν ουωλυπτατε ουελιτ εσσε κιλλων δωλορε ευ φυγιατ νυλλα παριατυρ. Εξκεπτευρ σιντ οκκαικατ κυπιδατατ νον προιδεντ, συντ ιν κυλπα χι οφφικια δεσερυντ μολλιτ ανιμ ιδ εστ λαβορων.',
'Κυραβιτυρ πρετιων τινκιδυντ λακος. Νυλλα γραυιδα ορκι α ωδιο. Νυλλαμ ουαριος, τυρπις και κομμωδο φαρετρα, εστ ερως βιβενδων ελιτ, νεκ λυκτος μαγνα φελις σολλικιτυδιν μαυρις. Ιντεγερ ιν μαυρις ευ νιβη ευισμοδ γραυιδα. Δυις ακ τελλος και ρισος ουλπυτατε ουεχικυλα. Δονεκ λοβορτις ρισος α ελιτ. Ετιαμ τεμπορ. Υτ υλλαμκορπερ, λιγυλα ευ τεμπορ κογγυε, ερως εστ ευισμοδ τυρπις, ιδ τινκιδυντ σαπιεν ρισος α χαμ. Μαικενας φερμεντων κονσεχατ μι. Δονεκ φερμεντων. Τε πελληντης μαλεσυαδα νυλλα α μι. Δυις σαπιεν σεμ, αλιχετ νεκ, κομμωδο εγετ, κονσεχατ χις, τε νε. Αλιχαμ φαυκιβος, ελιτ η δικτων αλιχετ, φελις νισλ αδιπισκιγγ σαπιεν, αλλα μαλεσυαδα διαμ λακος εγετ ερατ. Κρας μολλις τε σκελερις νυνκ. Νυλλαμ αρκυ. Αλιχαμ κονσεχατ. Κυραβιτυρ αυγυε λορεμ, δαπιβος χις, λαορεετ και, πρετιων ακ, νισι. Αινεαν μαγνα νισλ, μολλις χις, μολεστιε ευ, φευγιατ ιν, ορκι. Ιν ακ αβιτασσε πλατεα δικτυμστ.',
'Φυσκε κονυαλλις, μαυρις ιμπερδιετ γραυιδα βιβενδων, νισλ τυρπις συσκιπιτ μαυρις, αλλα πλακερατ ιψων υρνα αλλα ρισος. Ιν κονυαλλις τελλος α μαυρις. Κυραβιτυρ νον ελιτ η λιβερο τε τριστι σοδαλης. Μαυρις α λακος. Δονεκ μαθις σεμπερ λεο. Ιν ακ αβιτασσε πλατεα δικτυμστ. Ουιυαμος φακιλισις διαμ ατ ωδιο. Μαυρις δικτων, νισι εγετ κονσεχατ ελεμεντων, λακος λιγυλα μολεστιε μετος, νον φευγιατ ορκι μαγνα ακ σεμ. Δονεκ τυρπις. Δονεκ ουιται μετος. Μορβι τε τριστι τε νε ευ μαυρις. Τε χης γραυιδα ιψων νον σαπιεν. Προιν τυρπις λακος, τε σκελερις ουιται, ελεμεντων ατ, λοβορτις ακ, χαμ. Αλιχαμ δικτων ελειφενδ ρισος. Ιν ακ αβιτασσε πλατεα δικτυμστ. Ετιαμ σιτ αμετ διαμ. Συσπενδισσε ωδιο. Συσπενδισσε νυνκ. Ιν σεμπερ βιβενδων λιβερο.',
'Προιν νονυμμυ, λακος εγετ πυλυιναρ λακινια, πεδε φελις διγνισσιμ λεο, ουιται τε τριστι μαγνα λακος σιτ αμετ ερως. Νυλλαμ ορναρε. Πραισεντ ωδιο λιγυλα, δαπιβος αλλα, τινκιδυντ εγετ, δικτων ακ, νιβη. Ναμ χις λακος. Νυνκ ελειφενδ μολεστιε ουελιτ. Μορβι λοβορτις χαμ ευ ουελιτ. Δονεκ ευισμοδ ουεστιβυλων μασσα. Δονεκ νον λεκτος. Αλιχαμ κομμωδο λακος σιτ αμετ νυλλα. Κρας διγνισσιμ ελιτ και αυγυε. Νυλλαμ νον διαμ. Τε πελληντης αβιταντ μορβι τε τριστι σενεκτος και νετος και μαλεσυαδα φαμης ακ τυρπις εγεστας. Ιν ακ αβιτασσε πλατεα δικτυμστ. Αινεαν ουεστιβυλων. Σεδ λοβορτις ελιτ χις λεκτος. Νυνκ αλλα λακος ατ αυγυε βιβενδων δαπιβος.',
'Αλιχαμ ουεχικυλα σεμ η πεδε. Κρας πυρος λεκτος, εγεστας ευ, ουεχικυλα ατ, ιμπερδιετ αλλα, νιβη. Μορβι κονσεκτετυερ λυκτος φελις. Δονεκ ουιται νισι. Αλιχαμ τινκιδυντ φευγιατ ελιτ. Δυις αλλα ελιτ η τυρπις υλλαμκορπερ φευγιατ. Πραισεντ πρετιων, μαυρις αλλα φερμεντων ενδρεριτ, νυλλα λορεμ ιακυλις μαγνα, πυλυιναρ τε σκελερις υρνα τελλος α ιυστο. Συσπενδισσε πυλυιναρ μασσα ιν μετος. Δυις χις χαμ. Προιν ιυστο. Κυραβιτυρ ακ σαπιεν. Ναμ ερατ. Πραισεντ η χαμ.',
'Ουιυαμος κομμωδο, αυγυε και λαορεετ ευισμοδ, σεμ σαπιεν τεμπορ δωλορ, ακ εγεστας σεμ λιγυλα χις λακος. Δονεκ ουεστιβυλων τορτωρ ακ λακος. Σεδ ποσυερε ουεστιβυλων νισλ. Κυραβιτυρ ελειφενδ φερμεντων ιυστο. Νυλλαμ ιμπερδιετ. Ιντεγερ σιτ αμετ μαυρις ιμπερδιετ ρισος σολλικιτυδιν ρυτρων. Υτ ουιται τυρπις. Νυλλα φακιλισι. Τε χης τορτωρ ουελιτ, τε σκελερις και, φακιλισις ουελ, τεμπορ αλλα, υρνα. Ουιυαμος νυλλα ελιτ, ουεστιβυλων εγετ, σεμπερ και, τε σκελερις εγετ, λακος. Τε πελληντης ουιυερρα πυρος. Τε χης ελιτ. Δονεκ η δωλορ.',
'Δυις ουωλυτπατ ελιτ και ερατ. Ιν ατ νυλλα ατ νισλ κονδιμεντων αλιχετ. Τε χης ελεμεντων φαρετρα λακος. Νυνκ γραυιδα αρκυ εγετ νυνκ. Νυλλα ιακυλις εγεστας μαγνα. Αλιχαμ ερατ ουλυτπατ. Σεδ τε πελληντης ορκι. Ετιαμ λακος λορεμ, ιακυλις σιτ αμετ, φαρετρα χις, ιμπερδιετ σιτ αμετ, λεκτος. Ιντεγερ χις ελιτ ακ μι αλιχαμ πρετιων. Νυλλαμ μαυρις ορκι, πορθιτορ εγετ, σολλικιτυδιν νον, ουωλπυτατε ιδ, ρισος. Δονεκ ουαριος ενιμ νεκ σεμ. Ναμ αλιχαμ λακινια ενιμ. Τε χης εγετ λορεμ ευ πυρος διγνισσιμ υλτρικιης. Φυσκε πορθιτορ ενδρεριτ αντε. Μαυρις υρνα διαμ, κυρσος ιδ, μαθις εγετ, τεμπος σιτ αμετ, ρισος. Κυραβιτυρ ευ φελις. Σεδ ευ μι. Νυλλαμ λεκτος μαυρις, λυκτος α, μαθις ακ, τεμπος νον, λεο. Κρας μι νυλλα, ρονκος ιδ, λαορεετ υτ, υλτρικιης ιδ, ωδιο.',
'Δονεκ ιμπερδιετ. Ουεστιβυλων αυκτορ τορτωρ ατ ορκι. Ιντεγερ σεμπερ, νισι εγετ συσκιπιτ ελειφενδ, ερατ νισλ ενδρεριτ ιυστο, εγετ ουεστιβυλων λορεμ ιυστο ακ λεο. Ιντεγερ σεμ ουελιτ, φαρετρα ιν, φριγγιλλα ευ, φερμεντων ιδ, φελις. Ουεστιβυλων αλλα φελις. Ιν ελιτ. Πραισεντ και πεδε ουελ αντε δαπιβος κονδιμεντων. Δονεκ μαγνα. Τε χης ιδ ρισος. Μαυρις ουλπυτατε τε πελληντης λεο. Δυις ουλπυτατε, λιγυλα ατ ουενενατις τινκιδυντ, ορκι νυνκ ιντερδων λεο, ακ εγεστας ελιτ σεμ η λακος. Ετιαμ νον διαμ χις αρκυ εγεστας κομμωδο. Κυραβιτυρ νεκ μασσα ακ μασσα γραυιδα κονδιμεντων. Αινεαν ιδ λιβερο. Τε πελληντης ουιται τελλος. Φυσκε λεκτος εστ, ακκυμσαν ακ, βιβενδων αλλα, πορτα εγετ, αυγυε. Ετιαμ φαυκιβος. Τε χης τεμπος πυρος ευ αντε.',
'Ουεστιβυλων σαπιεν νισλ, ορναρε αυκτορ, κονσεκτετυερ χις, ποσυερε τε τριστι, ωδιο. Φυσκε υλτρικης υλλαμκορπερ ωδιο. Υτ αυγυε νυλλα, ιντερδων ατ, αδιπισκιγγ νον, τε τριστι εγετ, τε νε. Τε πελληντης αβιταντ μορβι τε τριστι σενεκτος και νετος και μαλεσυαδα φαμης ακ τυρπις εγεστας. Υτ πεδε εστ, κονδιμεντων ιδ, τε σκελερις ακ, μαλεσυαδα νον, χαμ. Προιν ευ λιγυλα ακ σαπιεν συσκιπιτ βλανδιτ. Συσπενδισσε ευισμοδ. Υτ ακκυμσαν, τε νε ιδ γραυιδα λυκτος, αρκυ πεδε σοδαλης φελις, ουελ βλανδιτ μασσα αρκυ εγετ λιγυλα. Αινεαν αλλα τυρπις. Τε πελληντης αβιταντ μορβι τε τριστι σενεκτος και νετος και μαλεσυαδα φαμης ακ τυρπις εγεστας. Δονεκ σεμ ερως, ορναρε υτ, κομμωδο ευ, τεμπορ νεκ, ρισος. Δονεκ λαορεετ δαπιβος λιγυλα. Πραισεντ ορκι λεο, βιβενδων νεκ, ορναρε και, νονυμμυ ιν, ελιτ. Δονεκ ιντερδων φευγιατ λεο. Ουεστιβυλων αντε ιψων πριμις ιν φαυκιβος ορκι λυκτος και υλτρικης ποσυερε κυβιλια Κυραι; Τε πελληντης φευγιατ υλλαμκορπερ ιψων. Δονεκ κονυαλλις τινκιδυντ υρνα.',
'Συσπενδισσε και ορκι και αρκυ πορθιτορ τε πελληντης. Σεδ λακος νυνκ, φερμεντων ουελ, ουεχικυλα ιν, ιμπερδιετ εγετ, υρνα. Ναμ κονσεκτετυερ ευισμοδ νυνκ. Νυλλα διγνισσιμ ποσυερε νυλλα. Ιντεγερ ιακυλις λακινια μασσα. Νυλλαμ σαπιεν αυγυε, κονδιμεντων ουελ, ουενενατις ιδ, ρονκος τε πελληντης, σαπιεν. Δονεκ αλλα ιψων υλτρικης τυρπις κονσεκτετυερ ιμπερδιετ. Δυις και ιψων ακ νισλ λαορεετ κομμωδο. Μαυρις ευ εστ. Συσπενδισσε ιδ τυρπις χις ορκι ευισμοδ κονσεχατ. Δονεκ τελλος μι, λυκτος σιτ αμετ, υλτρικης α, κονυαλλις ευ, λορεμ. Προιν φαυκιβος κονυαλλις ελιτ. Μαικενας ρονκος αρκυ ατ αρκυ. Προιν λιβερο. Προιν αδιπισκιγγ. Ιν χις λορεμ ουιται ελιτ κονσεκτετυερ πρετιων. Νυλλαμ λιγυλα υρνα, αδιπισκιγγ νεκ, ιακυλις υτ, ελεμεντων νον, τυρπις. Φυσκε πυλυιναρ.'
}
}
}
local function _lorem_ipsum(args)
local par_count = tonumber(args[1]) or 1
local par_lead = args[2] or ''
local par_end = args[3] or ''
local link = yesno(args.link or args[4]) or false
local paragraphs = yesno(args.paragraphs) ~= false
local demospace = args.demospace or nil
local script = args.script or 'latin'
local par_break = '\n\n'
if not paragraphs then
par_break = ''
elseif mw.text.trim(par_lead) == '' and par_end ~= ' ' then
par_break = mw.getCurrentFrame():extensionTag('nowiki', '') .. '\n\n'
end
local lipsum = lipsum_data[script] or lipsum_data['latin']
local start = lipsum.start
local pars = {}
for i = 1, par_count do
local j = (i - 1) % #(lipsum.text) + 1
local par_start = ''
if i == 1 and link then
par_start = '[[Lorem ipsum|' .. start .. ']]'
elseif j == 1 then
par_start = start
end
local par_text = par_start .. lipsum['text'][j]
if script == 'greek' then
par_text = greek({par_text})
end
table.insert(pars, par_lead .. par_text .. par_end)
end
local cats = {}
if par_lead ~= '' or par_end ~= '' or link or not paragraphs or script ~= 'latin' then
table.insert(cats, '[[Category:' .. 'Lorem ipsum with additional parameters' .. ']]')
end
if yesno(args.cat) ~= false then
table.insert(cats, namespace_other({
[1] = '[[Category:' .. 'Content templates' .. '|' .. 'Lorem ipsum' .. ']]',
[2] = '',
['target'] = 'main',
['demospace'] = demospace
}))
end
return table.concat(pars, par_break) .. table.concat(cats)
end
function p.lorem_ipsum(frame)
local args = getArgs(frame)
local unblanked_args = getArgs(frame, {removeBlanks = false, trim = false})
args[2] = unblanked_args[2]
args[3] = unblanked_args[3]
return _lorem_ipsum(args)
end
return p
1c11omihlfre0qqxkljwfmkqxkqd5bl
32193
32192
2026-04-22T02:14:56Z
Satdeep Gill
85
[[:en:Module:Lorem_ipsum]] سے 1 نسخہ درآمد کیا گیا
32192
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local namespace_other = require('Module:Namespace other')._namespace_other
local greek = require('Module:Greek')._greek
local lipsum_data = {
['latin'] = {
['start'] = 'Lorem ipsum',
['text'] = {
' dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
'Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.',
'Fusce convallis, mauris imperdiet gravida bibendum, nisl turpis suscipit mauris, sed placerat ipsum urna sed risus. In convallis tellus a mauris. Curabitur non elit ut libero tristique sodales. Mauris a lacus. Donec mattis semper leo. In hac habitasse platea dictumst. Vivamus facilisis diam at odio. Mauris dictum, nisi eget consequat elementum, lacus ligula molestie metus, non feugiat orci magna ac sem. Donec turpis. Donec vitae metus. Morbi tristique neque eu mauris. Quisque gravida ipsum non sapien. Proin turpis lacus, scelerisque vitae, elementum at, lobortis ac, quam. Aliquam dictum eleifend risus. In hac habitasse platea dictumst. Etiam sit amet diam. Suspendisse odio. Suspendisse nunc. In semper bibendum libero.',
'Proin nonummy, lacus eget pulvinar lacinia, pede felis dignissim leo, vitae tristique magna lacus sit amet eros. Nullam ornare. Praesent odio ligula, dapibus sed, tincidunt eget, dictum ac, nibh. Nam quis lacus. Nunc eleifend molestie velit. Morbi lobortis quam eu velit. Donec euismod vestibulum massa. Donec non lectus. Aliquam commodo lacus sit amet nulla. Cras dignissim elit et augue. Nullam non diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In hac habitasse platea dictumst. Aenean vestibulum. Sed lobortis elit quis lectus. Nunc sed lacus at augue bibendum dapibus.',
'Aliquam vehicula sem ut pede. Cras purus lectus, egestas eu, vehicula at, imperdiet sed, nibh. Morbi consectetuer luctus felis. Donec vitae nisi. Aliquam tincidunt feugiat elit. Duis sed elit ut turpis ullamcorper feugiat. Praesent pretium, mauris sed fermentum hendrerit, nulla lorem iaculis magna, pulvinar scelerisque urna tellus a justo. Suspendisse pulvinar massa in metus. Duis quis quam. Proin justo. Curabitur ac sapien. Nam erat. Praesent ut quam.',
'Vivamus commodo, augue et laoreet euismod, sem sapien tempor dolor, ac egestas sem ligula quis lacus. Donec vestibulum tortor ac lacus. Sed posuere vestibulum nisl. Curabitur eleifend fermentum justo. Nullam imperdiet. Integer sit amet mauris imperdiet risus sollicitudin rutrum. Ut vitae turpis. Nulla facilisi. Quisque tortor velit, scelerisque et, facilisis vel, tempor sed, urna. Vivamus nulla elit, vestibulum eget, semper et, scelerisque eget, lacus. Pellentesque viverra purus. Quisque elit. Donec ut dolor.',
'Duis volutpat elit et erat. In at nulla at nisl condimentum aliquet. Quisque elementum pharetra lacus. Nunc gravida arcu eget nunc. Nulla iaculis egestas magna. Aliquam erat volutpat. Sed pellentesque orci. Etiam lacus lorem, iaculis sit amet, pharetra quis, imperdiet sit amet, lectus. Integer quis elit ac mi aliquam pretium. Nullam mauris orci, porttitor eget, sollicitudin non, vulputate id, risus. Donec varius enim nec sem. Nam aliquam lacinia enim. Quisque eget lorem eu purus dignissim ultricies. Fusce porttitor hendrerit ante. Mauris urna diam, cursus id, mattis eget, tempus sit amet, risus. Curabitur eu felis. Sed eu mi. Nullam lectus mauris, luctus a, mattis ac, tempus non, leo. Cras mi nulla, rhoncus id, laoreet ut, ultricies id, odio.',
'Donec imperdiet. Vestibulum auctor tortor at orci. Integer semper, nisi eget suscipit eleifend, erat nisl hendrerit justo, eget vestibulum lorem justo ac leo. Integer sem velit, pharetra in, fringilla eu, fermentum id, felis. Vestibulum sed felis. In elit. Praesent et pede vel ante dapibus condimentum. Donec magna. Quisque id risus. Mauris vulputate pellentesque leo. Duis vulputate, ligula at venenatis tincidunt, orci nunc interdum leo, ac egestas elit sem ut lacus. Etiam non diam quis arcu egestas commodo. Curabitur nec massa ac massa gravida condimentum. Aenean id libero. Pellentesque vitae tellus. Fusce lectus est, accumsan ac, bibendum sed, porta eget, augue. Etiam faucibus. Quisque tempus purus eu ante.',
'Vestibulum sapien nisl, ornare auctor, consectetuer quis, posuere tristique, odio. Fusce ultrices ullamcorper odio. Ut augue nulla, interdum at, adipiscing non, tristique eget, neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut pede est, condimentum id, scelerisque ac, malesuada non, quam. Proin eu ligula ac sapien suscipit blandit. Suspendisse euismod. Ut accumsan, neque id gravida luctus, arcu pede sodales felis, vel blandit massa arcu eget ligula. Aenean sed turpis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec sem eros, ornare ut, commodo eu, tempor nec, risus. Donec laoreet dapibus ligula. Praesent orci leo, bibendum nec, ornare et, nonummy in, elit. Donec interdum feugiat leo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque feugiat ullamcorper ipsum. Donec convallis tincidunt urna.',
'Suspendisse et orci et arcu porttitor pellentesque. Sed lacus nunc, fermentum vel, vehicula in, imperdiet eget, urna. Nam consectetuer euismod nunc. Nulla dignissim posuere nulla. Integer iaculis lacinia massa. Nullam sapien augue, condimentum vel, venenatis id, rhoncus pellentesque, sapien. Donec sed ipsum ultrices turpis consectetuer imperdiet. Duis et ipsum ac nisl laoreet commodo. Mauris eu est. Suspendisse id turpis quis orci euismod consequat. Donec tellus mi, luctus sit amet, ultrices a, convallis eu, lorem. Proin faucibus convallis elit. Maecenas rhoncus arcu at arcu. Proin libero. Proin adipiscing. In quis lorem vitae elit consectetuer pretium. Nullam ligula urna, adipiscing nec, iaculis ut, elementum non, turpis. Fusce pulvinar.'
}
},
['greek'] = {
['start'] = 'Λορεμ ιψων',
['text'] = {
' δωλορ σιτ αμετ, κονσεκτετυρ αδιπισικιγγ ελιτ, αλλα δο ειυσμοδ τεμπορ ινκιδιδυντ η λαβορε και δωλορε μαγνα αλιχα. Υτ ενιμ αδ μινιμ ουενιαμ, χις νοστρυδ εξερκιτατιον υλλαμκο λαβορις νισι η αλιχιπ εξ εα κομμωδο κονσεχατ. Δυις αυτε ιρυρε δωλορ ιν ρεπρεχενδεριτ ιν ουωλυπτατε ουελιτ εσσε κιλλων δωλορε ευ φυγιατ νυλλα παριατυρ. Εξκεπτευρ σιντ οκκαικατ κυπιδατατ νον προιδεντ, συντ ιν κυλπα χι οφφικια δεσερυντ μολλιτ ανιμ ιδ εστ λαβορων.',
'Κυραβιτυρ πρετιων τινκιδυντ λακος. Νυλλα γραυιδα ορκι α ωδιο. Νυλλαμ ουαριος, τυρπις και κομμωδο φαρετρα, εστ ερως βιβενδων ελιτ, νεκ λυκτος μαγνα φελις σολλικιτυδιν μαυρις. Ιντεγερ ιν μαυρις ευ νιβη ευισμοδ γραυιδα. Δυις ακ τελλος και ρισος ουλπυτατε ουεχικυλα. Δονεκ λοβορτις ρισος α ελιτ. Ετιαμ τεμπορ. Υτ υλλαμκορπερ, λιγυλα ευ τεμπορ κογγυε, ερως εστ ευισμοδ τυρπις, ιδ τινκιδυντ σαπιεν ρισος α χαμ. Μαικενας φερμεντων κονσεχατ μι. Δονεκ φερμεντων. Τε πελληντης μαλεσυαδα νυλλα α μι. Δυις σαπιεν σεμ, αλιχετ νεκ, κομμωδο εγετ, κονσεχατ χις, τε νε. Αλιχαμ φαυκιβος, ελιτ η δικτων αλιχετ, φελις νισλ αδιπισκιγγ σαπιεν, αλλα μαλεσυαδα διαμ λακος εγετ ερατ. Κρας μολλις τε σκελερις νυνκ. Νυλλαμ αρκυ. Αλιχαμ κονσεχατ. Κυραβιτυρ αυγυε λορεμ, δαπιβος χις, λαορεετ και, πρετιων ακ, νισι. Αινεαν μαγνα νισλ, μολλις χις, μολεστιε ευ, φευγιατ ιν, ορκι. Ιν ακ αβιτασσε πλατεα δικτυμστ.',
'Φυσκε κονυαλλις, μαυρις ιμπερδιετ γραυιδα βιβενδων, νισλ τυρπις συσκιπιτ μαυρις, αλλα πλακερατ ιψων υρνα αλλα ρισος. Ιν κονυαλλις τελλος α μαυρις. Κυραβιτυρ νον ελιτ η λιβερο τε τριστι σοδαλης. Μαυρις α λακος. Δονεκ μαθις σεμπερ λεο. Ιν ακ αβιτασσε πλατεα δικτυμστ. Ουιυαμος φακιλισις διαμ ατ ωδιο. Μαυρις δικτων, νισι εγετ κονσεχατ ελεμεντων, λακος λιγυλα μολεστιε μετος, νον φευγιατ ορκι μαγνα ακ σεμ. Δονεκ τυρπις. Δονεκ ουιται μετος. Μορβι τε τριστι τε νε ευ μαυρις. Τε χης γραυιδα ιψων νον σαπιεν. Προιν τυρπις λακος, τε σκελερις ουιται, ελεμεντων ατ, λοβορτις ακ, χαμ. Αλιχαμ δικτων ελειφενδ ρισος. Ιν ακ αβιτασσε πλατεα δικτυμστ. Ετιαμ σιτ αμετ διαμ. Συσπενδισσε ωδιο. Συσπενδισσε νυνκ. Ιν σεμπερ βιβενδων λιβερο.',
'Προιν νονυμμυ, λακος εγετ πυλυιναρ λακινια, πεδε φελις διγνισσιμ λεο, ουιται τε τριστι μαγνα λακος σιτ αμετ ερως. Νυλλαμ ορναρε. Πραισεντ ωδιο λιγυλα, δαπιβος αλλα, τινκιδυντ εγετ, δικτων ακ, νιβη. Ναμ χις λακος. Νυνκ ελειφενδ μολεστιε ουελιτ. Μορβι λοβορτις χαμ ευ ουελιτ. Δονεκ ευισμοδ ουεστιβυλων μασσα. Δονεκ νον λεκτος. Αλιχαμ κομμωδο λακος σιτ αμετ νυλλα. Κρας διγνισσιμ ελιτ και αυγυε. Νυλλαμ νον διαμ. Τε πελληντης αβιταντ μορβι τε τριστι σενεκτος και νετος και μαλεσυαδα φαμης ακ τυρπις εγεστας. Ιν ακ αβιτασσε πλατεα δικτυμστ. Αινεαν ουεστιβυλων. Σεδ λοβορτις ελιτ χις λεκτος. Νυνκ αλλα λακος ατ αυγυε βιβενδων δαπιβος.',
'Αλιχαμ ουεχικυλα σεμ η πεδε. Κρας πυρος λεκτος, εγεστας ευ, ουεχικυλα ατ, ιμπερδιετ αλλα, νιβη. Μορβι κονσεκτετυερ λυκτος φελις. Δονεκ ουιται νισι. Αλιχαμ τινκιδυντ φευγιατ ελιτ. Δυις αλλα ελιτ η τυρπις υλλαμκορπερ φευγιατ. Πραισεντ πρετιων, μαυρις αλλα φερμεντων ενδρεριτ, νυλλα λορεμ ιακυλις μαγνα, πυλυιναρ τε σκελερις υρνα τελλος α ιυστο. Συσπενδισσε πυλυιναρ μασσα ιν μετος. Δυις χις χαμ. Προιν ιυστο. Κυραβιτυρ ακ σαπιεν. Ναμ ερατ. Πραισεντ η χαμ.',
'Ουιυαμος κομμωδο, αυγυε και λαορεετ ευισμοδ, σεμ σαπιεν τεμπορ δωλορ, ακ εγεστας σεμ λιγυλα χις λακος. Δονεκ ουεστιβυλων τορτωρ ακ λακος. Σεδ ποσυερε ουεστιβυλων νισλ. Κυραβιτυρ ελειφενδ φερμεντων ιυστο. Νυλλαμ ιμπερδιετ. Ιντεγερ σιτ αμετ μαυρις ιμπερδιετ ρισος σολλικιτυδιν ρυτρων. Υτ ουιται τυρπις. Νυλλα φακιλισι. Τε χης τορτωρ ουελιτ, τε σκελερις και, φακιλισις ουελ, τεμπορ αλλα, υρνα. Ουιυαμος νυλλα ελιτ, ουεστιβυλων εγετ, σεμπερ και, τε σκελερις εγετ, λακος. Τε πελληντης ουιυερρα πυρος. Τε χης ελιτ. Δονεκ η δωλορ.',
'Δυις ουωλυτπατ ελιτ και ερατ. Ιν ατ νυλλα ατ νισλ κονδιμεντων αλιχετ. Τε χης ελεμεντων φαρετρα λακος. Νυνκ γραυιδα αρκυ εγετ νυνκ. Νυλλα ιακυλις εγεστας μαγνα. Αλιχαμ ερατ ουλυτπατ. Σεδ τε πελληντης ορκι. Ετιαμ λακος λορεμ, ιακυλις σιτ αμετ, φαρετρα χις, ιμπερδιετ σιτ αμετ, λεκτος. Ιντεγερ χις ελιτ ακ μι αλιχαμ πρετιων. Νυλλαμ μαυρις ορκι, πορθιτορ εγετ, σολλικιτυδιν νον, ουωλπυτατε ιδ, ρισος. Δονεκ ουαριος ενιμ νεκ σεμ. Ναμ αλιχαμ λακινια ενιμ. Τε χης εγετ λορεμ ευ πυρος διγνισσιμ υλτρικιης. Φυσκε πορθιτορ ενδρεριτ αντε. Μαυρις υρνα διαμ, κυρσος ιδ, μαθις εγετ, τεμπος σιτ αμετ, ρισος. Κυραβιτυρ ευ φελις. Σεδ ευ μι. Νυλλαμ λεκτος μαυρις, λυκτος α, μαθις ακ, τεμπος νον, λεο. Κρας μι νυλλα, ρονκος ιδ, λαορεετ υτ, υλτρικιης ιδ, ωδιο.',
'Δονεκ ιμπερδιετ. Ουεστιβυλων αυκτορ τορτωρ ατ ορκι. Ιντεγερ σεμπερ, νισι εγετ συσκιπιτ ελειφενδ, ερατ νισλ ενδρεριτ ιυστο, εγετ ουεστιβυλων λορεμ ιυστο ακ λεο. Ιντεγερ σεμ ουελιτ, φαρετρα ιν, φριγγιλλα ευ, φερμεντων ιδ, φελις. Ουεστιβυλων αλλα φελις. Ιν ελιτ. Πραισεντ και πεδε ουελ αντε δαπιβος κονδιμεντων. Δονεκ μαγνα. Τε χης ιδ ρισος. Μαυρις ουλπυτατε τε πελληντης λεο. Δυις ουλπυτατε, λιγυλα ατ ουενενατις τινκιδυντ, ορκι νυνκ ιντερδων λεο, ακ εγεστας ελιτ σεμ η λακος. Ετιαμ νον διαμ χις αρκυ εγεστας κομμωδο. Κυραβιτυρ νεκ μασσα ακ μασσα γραυιδα κονδιμεντων. Αινεαν ιδ λιβερο. Τε πελληντης ουιται τελλος. Φυσκε λεκτος εστ, ακκυμσαν ακ, βιβενδων αλλα, πορτα εγετ, αυγυε. Ετιαμ φαυκιβος. Τε χης τεμπος πυρος ευ αντε.',
'Ουεστιβυλων σαπιεν νισλ, ορναρε αυκτορ, κονσεκτετυερ χις, ποσυερε τε τριστι, ωδιο. Φυσκε υλτρικης υλλαμκορπερ ωδιο. Υτ αυγυε νυλλα, ιντερδων ατ, αδιπισκιγγ νον, τε τριστι εγετ, τε νε. Τε πελληντης αβιταντ μορβι τε τριστι σενεκτος και νετος και μαλεσυαδα φαμης ακ τυρπις εγεστας. Υτ πεδε εστ, κονδιμεντων ιδ, τε σκελερις ακ, μαλεσυαδα νον, χαμ. Προιν ευ λιγυλα ακ σαπιεν συσκιπιτ βλανδιτ. Συσπενδισσε ευισμοδ. Υτ ακκυμσαν, τε νε ιδ γραυιδα λυκτος, αρκυ πεδε σοδαλης φελις, ουελ βλανδιτ μασσα αρκυ εγετ λιγυλα. Αινεαν αλλα τυρπις. Τε πελληντης αβιταντ μορβι τε τριστι σενεκτος και νετος και μαλεσυαδα φαμης ακ τυρπις εγεστας. Δονεκ σεμ ερως, ορναρε υτ, κομμωδο ευ, τεμπορ νεκ, ρισος. Δονεκ λαορεετ δαπιβος λιγυλα. Πραισεντ ορκι λεο, βιβενδων νεκ, ορναρε και, νονυμμυ ιν, ελιτ. Δονεκ ιντερδων φευγιατ λεο. Ουεστιβυλων αντε ιψων πριμις ιν φαυκιβος ορκι λυκτος και υλτρικης ποσυερε κυβιλια Κυραι; Τε πελληντης φευγιατ υλλαμκορπερ ιψων. Δονεκ κονυαλλις τινκιδυντ υρνα.',
'Συσπενδισσε και ορκι και αρκυ πορθιτορ τε πελληντης. Σεδ λακος νυνκ, φερμεντων ουελ, ουεχικυλα ιν, ιμπερδιετ εγετ, υρνα. Ναμ κονσεκτετυερ ευισμοδ νυνκ. Νυλλα διγνισσιμ ποσυερε νυλλα. Ιντεγερ ιακυλις λακινια μασσα. Νυλλαμ σαπιεν αυγυε, κονδιμεντων ουελ, ουενενατις ιδ, ρονκος τε πελληντης, σαπιεν. Δονεκ αλλα ιψων υλτρικης τυρπις κονσεκτετυερ ιμπερδιετ. Δυις και ιψων ακ νισλ λαορεετ κομμωδο. Μαυρις ευ εστ. Συσπενδισσε ιδ τυρπις χις ορκι ευισμοδ κονσεχατ. Δονεκ τελλος μι, λυκτος σιτ αμετ, υλτρικης α, κονυαλλις ευ, λορεμ. Προιν φαυκιβος κονυαλλις ελιτ. Μαικενας ρονκος αρκυ ατ αρκυ. Προιν λιβερο. Προιν αδιπισκιγγ. Ιν χις λορεμ ουιται ελιτ κονσεκτετυερ πρετιων. Νυλλαμ λιγυλα υρνα, αδιπισκιγγ νεκ, ιακυλις υτ, ελεμεντων νον, τυρπις. Φυσκε πυλυιναρ.'
}
}
}
local function _lorem_ipsum(args)
local par_count = tonumber(args[1]) or 1
local par_lead = args[2] or ''
local par_end = args[3] or ''
local link = yesno(args.link or args[4]) or false
local paragraphs = yesno(args.paragraphs) ~= false
local demospace = args.demospace or nil
local script = args.script or 'latin'
local par_break = '\n\n'
if not paragraphs then
par_break = ''
elseif mw.text.trim(par_lead) == '' and par_end ~= ' ' then
par_break = mw.getCurrentFrame():extensionTag('nowiki', '') .. '\n\n'
end
local lipsum = lipsum_data[script] or lipsum_data['latin']
local start = lipsum.start
local pars = {}
for i = 1, par_count do
local j = (i - 1) % #(lipsum.text) + 1
local par_start = ''
if i == 1 and link then
par_start = '[[Lorem ipsum|' .. start .. ']]'
elseif j == 1 then
par_start = start
end
local par_text = par_start .. lipsum['text'][j]
if script == 'greek' then
par_text = greek({par_text})
end
table.insert(pars, par_lead .. par_text .. par_end)
end
local cats = {}
if par_lead ~= '' or par_end ~= '' or link or not paragraphs or script ~= 'latin' then
table.insert(cats, '[[Category:' .. 'Lorem ipsum with additional parameters' .. ']]')
end
if yesno(args.cat) ~= false then
table.insert(cats, namespace_other({
[1] = '[[Category:' .. 'Content templates' .. '|' .. 'Lorem ipsum' .. ']]',
[2] = '',
['target'] = 'main',
['demospace'] = demospace
}))
end
return table.concat(pars, par_break) .. table.concat(cats)
end
function p.lorem_ipsum(frame)
local args = getArgs(frame)
local unblanked_args = getArgs(frame, {removeBlanks = false, trim = false})
args[2] = unblanked_args[2]
args[3] = unblanked_args[3]
return _lorem_ipsum(args)
end
return p
1c11omihlfre0qqxkljwfmkqxkqd5bl
سانچہ:Sc
10
13028
32196
2010-06-24T02:49:27Z
en>Hesperian
0
Protected "[[Template:Sc]]": High traffic page: 27000 uses ([edit=sysop] (indefinite) [move=sysop] (indefinite))
32196
wikitext
text/x-wiki
#REDIRECT[[Template:Small-caps]]
3rsunug3zff0yo4blqi92q350gbvdf4
32197
32196
2026-04-22T02:15:03Z
Satdeep Gill
85
[[:en:Template:Sc]] سے 1 نسخہ درآمد کیا گیا
32196
wikitext
text/x-wiki
#REDIRECT[[Template:Small-caps]]
3rsunug3zff0yo4blqi92q350gbvdf4
سانچہ:Small-caps
10
13029
32198
2023-01-26T04:26:20Z
en>Billinghurst
0
32198
wikitext
text/x-wiki
<onlyinclude><span class="smallcaps" style="font-variant:small-caps;">{{{1}}}</span></onlyinclude>
{{documentation}}
t9dimrkv1rz6c6nq1lbz1pkl1ditgpp
32199
32198
2026-04-22T02:15:03Z
Satdeep Gill
85
[[:en:Template:Small-caps]] سے 1 نسخہ درآمد کیا گیا
32198
wikitext
text/x-wiki
<onlyinclude><span class="smallcaps" style="font-variant:small-caps;">{{{1}}}</span></onlyinclude>
{{documentation}}
t9dimrkv1rz6c6nq1lbz1pkl1ditgpp
سانچہ:Category handler
10
13030
32200
2024-01-11T01:20:36Z
en>Stefán Örvar Sigmundsson
0
We all know this at this point.
32200
wikitext
text/x-wiki
{{#invoke:Category handler|main}}<noinclude>
{{documentation}}
</noinclude>
9acxoepywp0cdp5suzz98rj6iwwb0n2
32201
32200
2026-04-22T02:15:03Z
Satdeep Gill
85
[[:en:Template:Category_handler]] سے 1 نسخہ درآمد کیا گیا
32200
wikitext
text/x-wiki
{{#invoke:Category handler|main}}<noinclude>
{{documentation}}
</noinclude>
9acxoepywp0cdp5suzz98rj6iwwb0n2
ماڈیول:Category handler/data
828
13031
32202
2024-03-31T20:00:10Z
en>CalendulaAsteraceae
0
Protected "[[Module:Category handler/data]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32202
Scribunto
text/plain
-- This module assembles data to be passed to [[Module:Category handler]] using
-- mw.loadData. This includes the configuration data and whether the current
-- page matches the title blacklist.
local data = require('Module:Category handler/config')
local mShared = require('Module:Category handler/shared')
local blacklist = require('Module:Category handler/blacklist')
local title = mw.title.getCurrentTitle()
data.currentTitleMatchesBlacklist = mShared.matchesBlacklist(
title.prefixedText,
blacklist
)
data.currentTitleNamespaceParameters = mShared.getNamespaceParameters(
title,
mShared.getParamMappings()
)
return data
k26mwixuaeijisfddb0sxkg82iux8v4
32203
32202
2026-04-22T02:15:03Z
Satdeep Gill
85
[[:en:Module:Category_handler/data]] سے 1 نسخہ درآمد کیا گیا
32202
Scribunto
text/plain
-- This module assembles data to be passed to [[Module:Category handler]] using
-- mw.loadData. This includes the configuration data and whether the current
-- page matches the title blacklist.
local data = require('Module:Category handler/config')
local mShared = require('Module:Category handler/shared')
local blacklist = require('Module:Category handler/blacklist')
local title = mw.title.getCurrentTitle()
data.currentTitleMatchesBlacklist = mShared.matchesBlacklist(
title.prefixedText,
blacklist
)
data.currentTitleNamespaceParameters = mShared.getNamespaceParameters(
title,
mShared.getParamMappings()
)
return data
k26mwixuaeijisfddb0sxkg82iux8v4
ماڈیول:Category handler/config
828
13032
32204
2015-01-23T14:14:02Z
en>AdamBMorgan
0
12 revisions imported from [[:w:Module:Category_handler/config]]: import code for updated template
32204
Scribunto
text/plain
--------------------------------------------------------------------------------
-- [[Module:Category handler]] configuration data --
-- Language-specific parameter names and values can be set here. --
-- For blacklist config, see [[Module:Category handler/blacklist]]. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- foo = 'parameter name', --
-- --
-- To add multiple names, you can use this format: --
-- --
-- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --
--------------------------------------------------------------------------------
cfg.parameters = {
-- The nocat and categories parameter suppress
-- categorisation. They are used with Module:Yesno, and work as follows:
--
-- cfg.nocat:
-- Result of yesno() Effect
-- true Categorisation is suppressed
-- false Categorisation is allowed, and
-- the blacklist check is skipped
-- nil Categorisation is allowed
--
-- cfg.categories:
-- Result of yesno() Effect
-- true Categorisation is allowed, and
-- the blacklist check is skipped
-- false Categorisation is suppressed
-- nil Categorisation is allowed
nocat = 'nocat',
categories = 'categories',
-- The parameter name for the legacy "category2" parameter. This skips the
-- blacklist if set to the cfg.category2Yes value, and suppresses
-- categorisation if present but equal to anything other than
-- cfg.category2Yes or cfg.category2Negative.
category2 = 'category2',
-- cfg.subpage is the parameter name to specify how to behave on subpages.
subpage = 'subpage',
-- The parameter for data to return in all namespaces.
all = 'all',
-- The parameter name for data to return if no data is specified for the
-- namespace that is detected.
other = 'other',
-- The parameter name used to specify a page other than the current page;
-- used for testing and demonstration.
demopage = 'demopage',
}
--------------------------------------------------------------------------------
-- Parameter values --
-- These are set values that can be used with certain parameters. Only one --
-- value can be specified, like this: --
-- --
-- cfg.foo = 'value name' -- --
--------------------------------------------------------------------------------
-- The following settings are used with the cfg.category2 parameter. Setting
-- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2
-- is present but equal to anything other than cfg.category2Yes or
-- cfg.category2Negative then it supresses cateogrisation.
cfg.category2Yes = 'yes'
cfg.category2Negative = '¬'
-- The following settings are used with the cfg.subpage parameter.
-- cfg.subpageNo is the value to specify to not categorise on subpages;
-- cfg.subpageOnly is the value to specify to only categorise on subpages.
cfg.subpageNo = 'no'
cfg.subpageOnly = 'only'
--------------------------------------------------------------------------------
-- Default namespaces --
-- This is a table of namespaces to categorise by default. The keys are the --
-- namespace numbers. --
--------------------------------------------------------------------------------
cfg.defaultNamespaces = {
[ 0] = true, -- main
[ 6] = true, -- file
[ 12] = true, -- help
[ 14] = true, -- category
[100] = true, -- portal
[102] = true, -- author
}
--------------------------------------------------------------------------------
-- Wrappers --
-- This is a wrapper template or a list of wrapper templates to be passed to --
-- [[Module:Arguments]]. --
--------------------------------------------------------------------------------
cfg.wrappers = 'Template:Category handler'
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
m8k5q9d9n5x70j6xyg17x3o9s9ofn14
32205
32204
2026-04-22T02:15:04Z
Satdeep Gill
85
[[:en:Module:Category_handler/config]] سے 1 نسخہ درآمد کیا گیا
32204
Scribunto
text/plain
--------------------------------------------------------------------------------
-- [[Module:Category handler]] configuration data --
-- Language-specific parameter names and values can be set here. --
-- For blacklist config, see [[Module:Category handler/blacklist]]. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- foo = 'parameter name', --
-- --
-- To add multiple names, you can use this format: --
-- --
-- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --
--------------------------------------------------------------------------------
cfg.parameters = {
-- The nocat and categories parameter suppress
-- categorisation. They are used with Module:Yesno, and work as follows:
--
-- cfg.nocat:
-- Result of yesno() Effect
-- true Categorisation is suppressed
-- false Categorisation is allowed, and
-- the blacklist check is skipped
-- nil Categorisation is allowed
--
-- cfg.categories:
-- Result of yesno() Effect
-- true Categorisation is allowed, and
-- the blacklist check is skipped
-- false Categorisation is suppressed
-- nil Categorisation is allowed
nocat = 'nocat',
categories = 'categories',
-- The parameter name for the legacy "category2" parameter. This skips the
-- blacklist if set to the cfg.category2Yes value, and suppresses
-- categorisation if present but equal to anything other than
-- cfg.category2Yes or cfg.category2Negative.
category2 = 'category2',
-- cfg.subpage is the parameter name to specify how to behave on subpages.
subpage = 'subpage',
-- The parameter for data to return in all namespaces.
all = 'all',
-- The parameter name for data to return if no data is specified for the
-- namespace that is detected.
other = 'other',
-- The parameter name used to specify a page other than the current page;
-- used for testing and demonstration.
demopage = 'demopage',
}
--------------------------------------------------------------------------------
-- Parameter values --
-- These are set values that can be used with certain parameters. Only one --
-- value can be specified, like this: --
-- --
-- cfg.foo = 'value name' -- --
--------------------------------------------------------------------------------
-- The following settings are used with the cfg.category2 parameter. Setting
-- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2
-- is present but equal to anything other than cfg.category2Yes or
-- cfg.category2Negative then it supresses cateogrisation.
cfg.category2Yes = 'yes'
cfg.category2Negative = '¬'
-- The following settings are used with the cfg.subpage parameter.
-- cfg.subpageNo is the value to specify to not categorise on subpages;
-- cfg.subpageOnly is the value to specify to only categorise on subpages.
cfg.subpageNo = 'no'
cfg.subpageOnly = 'only'
--------------------------------------------------------------------------------
-- Default namespaces --
-- This is a table of namespaces to categorise by default. The keys are the --
-- namespace numbers. --
--------------------------------------------------------------------------------
cfg.defaultNamespaces = {
[ 0] = true, -- main
[ 6] = true, -- file
[ 12] = true, -- help
[ 14] = true, -- category
[100] = true, -- portal
[102] = true, -- author
}
--------------------------------------------------------------------------------
-- Wrappers --
-- This is a wrapper template or a list of wrapper templates to be passed to --
-- [[Module:Arguments]]. --
--------------------------------------------------------------------------------
cfg.wrappers = 'Template:Category handler'
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
m8k5q9d9n5x70j6xyg17x3o9s9ofn14
ماڈیول:Category handler/shared
828
13033
32206
2024-03-31T20:00:20Z
en>CalendulaAsteraceae
0
Protected "[[Module:Category handler/shared]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32206
Scribunto
text/plain
-- This module contains shared functions used by [[Module:Category handler]]
-- and its submodules.
local p = {}
function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end
function p.getParamMappings(useLoadData)
local dataPage = 'Module:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end
function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end
return p
omlsnhudxz6juptvtxz7ns97jutbzc5
32207
32206
2026-04-22T02:15:04Z
Satdeep Gill
85
[[:en:Module:Category_handler/shared]] سے 1 نسخہ درآمد کیا گیا
32206
Scribunto
text/plain
-- This module contains shared functions used by [[Module:Category handler]]
-- and its submodules.
local p = {}
function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end
function p.getParamMappings(useLoadData)
local dataPage = 'Module:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end
function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end
return p
omlsnhudxz6juptvtxz7ns97jutbzc5
ماڈیول:Category handler/blacklist
828
13034
32208
2024-03-31T19:59:52Z
en>CalendulaAsteraceae
0
Protected "[[Module:Category handler/blacklist]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32208
Scribunto
text/plain
-- This module contains the blacklist used by [[Module:Category handler]].
-- Pages that match Lua patterns in this list will not be categorised unless
-- categorisation is explicitly requested.
return {
'^Main Page$', -- don't categorise the main page.
-- Don't categorise the following pages or their subpages.
-- "%f[/\0]" matches if the next character is "/" or the end of the string.
'^Wikisource:Cascade%-protected items%f[/\0]',
'^User:UBX%f[/\0]', -- The userbox "template" space.
'^User talk:UBX%f[/\0]',
-- Don't categorise subpages of these pages, but allow
-- categorisation of the base page.
'^Wikisource:Template messages/.*$',
-- Don't categorise archives.
'/[aA]rchive%f[/\0]',
'/[aA]rchives%f[/\0]'
}
3eok90scs2c2o9aru604xtx1gfpjopu
32209
32208
2026-04-22T02:15:04Z
Satdeep Gill
85
[[:en:Module:Category_handler/blacklist]] سے 1 نسخہ درآمد کیا گیا
32208
Scribunto
text/plain
-- This module contains the blacklist used by [[Module:Category handler]].
-- Pages that match Lua patterns in this list will not be categorised unless
-- categorisation is explicitly requested.
return {
'^Main Page$', -- don't categorise the main page.
-- Don't categorise the following pages or their subpages.
-- "%f[/\0]" matches if the next character is "/" or the end of the string.
'^Wikisource:Cascade%-protected items%f[/\0]',
'^User:UBX%f[/\0]', -- The userbox "template" space.
'^User talk:UBX%f[/\0]',
-- Don't categorise subpages of these pages, but allow
-- categorisation of the base page.
'^Wikisource:Template messages/.*$',
-- Don't categorise archives.
'/[aA]rchive%f[/\0]',
'/[aA]rchives%f[/\0]'
}
3eok90scs2c2o9aru604xtx1gfpjopu
ماڈیول:Namespace detect/data
828
13035
32210
2018-07-26T18:20:51Z
en>EncycloPetey
0
Protected "[[Module:Namespace detect/data]]" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32210
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect data --
-- This module holds data for [[Module:Namespace detect]] to be loaded per --
-- page, rather than per #invoke, for performance reasons. --
--------------------------------------------------------------------------------
local cfg = require('Module:Namespace detect/config')
local function addKey(t, key, defaultKey)
if key ~= defaultKey then
t[#t + 1] = key
end
end
-- Get a table of parameters to query for each default parameter name.
-- This allows wikis to customise parameter names in the cfg table while
-- ensuring that default parameter names will always work. The cfg table
-- values can be added as a string, or as an array of strings.
local defaultKeys = {
'main',
'talk',
'other',
'subjectns',
'demospace',
'demopage'
}
local argKeys = {}
for i, defaultKey in ipairs(defaultKeys) do
argKeys[defaultKey] = {defaultKey}
end
for defaultKey, t in pairs(argKeys) do
local cfgValue = cfg[defaultKey]
local cfgValueType = type(cfgValue)
if cfgValueType == 'string' then
addKey(t, cfgValue, defaultKey)
elseif cfgValueType == 'table' then
for i, key in ipairs(cfgValue) do
addKey(t, key, defaultKey)
end
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.
end
local function getParamMappings()
--[[
-- Returns a table of how parameter names map to namespace names. The keys
-- are the actual namespace names, in lower case, and the values are the
-- possible parameter names for that namespace, also in lower case. The
-- table entries are structured like this:
-- {
-- [''] = {'main'},
-- ['wikisource'] = {'wikisource', 'project', 'ws'},
-- ...
-- }
--]]
local mappings = {}
local mainNsName = mw.site.subjectNamespaces[0].name
mainNsName = mw.ustring.lower(mainNsName)
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = mw.ustring.lower(ns.name)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
table.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
return mappings
end
return {
argKeys = argKeys,
cfg = cfg,
mappings = getParamMappings()
}
a6ap9xtq25pujaijv7a89da6k0dc51e
32211
32210
2026-04-22T02:15:04Z
Satdeep Gill
85
[[:en:Module:Namespace_detect/data]] سے 1 نسخہ درآمد کیا گیا
32210
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect data --
-- This module holds data for [[Module:Namespace detect]] to be loaded per --
-- page, rather than per #invoke, for performance reasons. --
--------------------------------------------------------------------------------
local cfg = require('Module:Namespace detect/config')
local function addKey(t, key, defaultKey)
if key ~= defaultKey then
t[#t + 1] = key
end
end
-- Get a table of parameters to query for each default parameter name.
-- This allows wikis to customise parameter names in the cfg table while
-- ensuring that default parameter names will always work. The cfg table
-- values can be added as a string, or as an array of strings.
local defaultKeys = {
'main',
'talk',
'other',
'subjectns',
'demospace',
'demopage'
}
local argKeys = {}
for i, defaultKey in ipairs(defaultKeys) do
argKeys[defaultKey] = {defaultKey}
end
for defaultKey, t in pairs(argKeys) do
local cfgValue = cfg[defaultKey]
local cfgValueType = type(cfgValue)
if cfgValueType == 'string' then
addKey(t, cfgValue, defaultKey)
elseif cfgValueType == 'table' then
for i, key in ipairs(cfgValue) do
addKey(t, key, defaultKey)
end
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.
end
local function getParamMappings()
--[[
-- Returns a table of how parameter names map to namespace names. The keys
-- are the actual namespace names, in lower case, and the values are the
-- possible parameter names for that namespace, also in lower case. The
-- table entries are structured like this:
-- {
-- [''] = {'main'},
-- ['wikisource'] = {'wikisource', 'project', 'ws'},
-- ...
-- }
--]]
local mappings = {}
local mainNsName = mw.site.subjectNamespaces[0].name
mainNsName = mw.ustring.lower(mainNsName)
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = mw.ustring.lower(ns.name)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
table.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
return mappings
end
return {
argKeys = argKeys,
cfg = cfg,
mappings = getParamMappings()
}
a6ap9xtq25pujaijv7a89da6k0dc51e
ماڈیول:Namespace detect/config
828
13036
32212
2015-01-23T14:14:12Z
en>AdamBMorgan
0
7 revisions imported from [[:w:Module:Namespace_detect/config]]: import code for updated template
32212
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect configuration data --
-- --
-- This module stores configuration data for Module:Namespace detect. Here --
-- you can localise the module to your wiki's language. --
-- --
-- To activate a configuration item, you need to uncomment it. This means --
-- that you need to remove the text "-- " at the start of the line. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. Values added --
-- here will work in addition to the default English parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- cfg.foo = 'parameter name' --
-- --
-- To add multiple names, you can use this format: --
-- --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --
--------------------------------------------------------------------------------
---- This parameter displays content for the main namespace:
-- cfg.main = 'main'
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
---- This parameter sets a specific page to compare:
cfg.demopage = 'demopage'
--------------------------------------------------------------------------------
-- Table configuration --
-- These configuration items allow customisation of the "table" function, --
-- used to generate a table of possible parameters in the module --
-- documentation. --
--------------------------------------------------------------------------------
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
--------------------------------------------------------------------------------
-- End of configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
mlt92g3c1kq66jv01p0l0u25rey5c7m
32213
32212
2026-04-22T02:15:04Z
Satdeep Gill
85
[[:en:Module:Namespace_detect/config]] سے 1 نسخہ درآمد کیا گیا
32212
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect configuration data --
-- --
-- This module stores configuration data for Module:Namespace detect. Here --
-- you can localise the module to your wiki's language. --
-- --
-- To activate a configuration item, you need to uncomment it. This means --
-- that you need to remove the text "-- " at the start of the line. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. Values added --
-- here will work in addition to the default English parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- cfg.foo = 'parameter name' --
-- --
-- To add multiple names, you can use this format: --
-- --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --
--------------------------------------------------------------------------------
---- This parameter displays content for the main namespace:
-- cfg.main = 'main'
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
---- This parameter sets a specific page to compare:
cfg.demopage = 'demopage'
--------------------------------------------------------------------------------
-- Table configuration --
-- These configuration items allow customisation of the "table" function, --
-- used to generate a table of possible parameters in the module --
-- documentation. --
--------------------------------------------------------------------------------
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
--------------------------------------------------------------------------------
-- End of configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
mlt92g3c1kq66jv01p0l0u25rey5c7m
سانچہ:Uc
10
13037
32214
2017-04-07T00:35:02Z
en>Hesperian
0
Redirected page to [[Template:Uppercase]]
32214
wikitext
text/x-wiki
#REDIRECT [[Template:Uppercase]]
hajzmy98nxoluw7e8jstzo8emruorxd
32215
32214
2026-04-22T02:15:05Z
Satdeep Gill
85
[[:en:Template:Uc]] سے 1 نسخہ درآمد کیا گیا
32214
wikitext
text/x-wiki
#REDIRECT [[Template:Uppercase]]
hajzmy98nxoluw7e8jstzo8emruorxd
سانچہ:Uppercase
10
13038
32216
2025-02-02T11:06:54Z
en>CalendulaAsteraceae
0
32216
wikitext
text/x-wiki
<includeonly><templatestyles src="Template:Uppercase/styles.css" /><span class="wst-uppercase">{{{1}}}</span></includeonly><noinclude>
{{documentation}}</noinclude>
tr4awfssv0kgdz1axw3rkbytlocizcp
32217
32216
2026-04-22T02:15:05Z
Satdeep Gill
85
[[:en:Template:Uppercase]] سے 1 نسخہ درآمد کیا گیا
32216
wikitext
text/x-wiki
<includeonly><templatestyles src="Template:Uppercase/styles.css" /><span class="wst-uppercase">{{{1}}}</span></includeonly><noinclude>
{{documentation}}</noinclude>
tr4awfssv0kgdz1axw3rkbytlocizcp
سانچہ:Serif
10
13039
32218
2021-08-27T13:08:48Z
en>Inductiveload
0
add classes
32218
wikitext
text/x-wiki
<includeonly><span class="wst-serif {{{class|}}}" style="font-family:serif;">{{{1}}}</span></includeonly><noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
h8fxfazq4fihx3usr2cnrs00jxpo2st
32219
32218
2026-04-22T02:15:05Z
Satdeep Gill
85
[[:en:Template:Serif]] سے 1 نسخہ درآمد کیا گیا
32218
wikitext
text/x-wiki
<includeonly><span class="wst-serif {{{class|}}}" style="font-family:serif;">{{{1}}}</span></includeonly><noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
h8fxfazq4fihx3usr2cnrs00jxpo2st
سانچہ:C/e
10
13040
32224
2020-05-13T08:26:39Z
en>Xover
0
Meh, double redirect apparently doesn't work (or I'm having a senior moment)
32224
wikitext
text/x-wiki
#REDIRECT [[Template:div end]]
tnwnc33r87f5zpije5ayy7noubbjhb0
32225
32224
2026-04-22T02:15:05Z
Satdeep Gill
85
[[:en:Template:C/e]] سے 1 نسخہ درآمد کیا گیا
32224
wikitext
text/x-wiki
#REDIRECT [[Template:div end]]
tnwnc33r87f5zpije5ayy7noubbjhb0
سانچہ:C/s
10
13041
32226
2020-05-13T08:17:58Z
en>Xover
0
create convenience redirect
32226
wikitext
text/x-wiki
#REDIRECT [[Template:center/s]]
841jqcmbe4dbn0y65xf3mlneqlm6kf4
32227
32226
2026-04-22T02:15:05Z
Satdeep Gill
85
[[:en:Template:C/s]] سے 1 نسخہ درآمد کیا گیا
32226
wikitext
text/x-wiki
#REDIRECT [[Template:center/s]]
841jqcmbe4dbn0y65xf3mlneqlm6kf4
سانچہ:Flex wrap centre
10
13042
32228
2025-12-19T19:55:08Z
en>Tosca-the-engineer
0
Fix missing parameter
32228
wikitext
text/x-wiki
<includeonly>{{flex wrap centre/s
| align = {{{align|}}}
| max-width = {{{max-width|}}}
| align-items = {{{align-items|}}}
| align-content = {{{align-items|}}}
| class = {{{class|}}}
| style = {{{style|}}}
}}<!--
-->{{#if:{{{1|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class1|}}}"<!--
-->{{#if:{{{child_style1|child_style}}}|style="{{{child_style|}}} {{{child_style1|}}}"}}>
{{{1}}}
</div>}}<!--
-->{{#if:{{{2|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class2|}}}"<!--
-->{{#if:{{{child_style2|child_style}}}|style="{{{child_style|}}} {{{child_style2|}}}"}}>
{{{2}}}
</div>}}<!--
-->{{#if:{{{3|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class3|}}}"<!--
-->{{#if:{{{child_style3|child_style}}}|style="{{{child_style|}}} {{{child_style3|}}}"}}>
{{{3}}}
</div>}}<!--
-->{{#if:{{{4|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class4|}}}"<!--
-->{{#if:{{{child_style4|child_style}}}|style="{{{child_style|}}} {{{child_style4|}}}"}}>
{{{4}}}
</div>}}<!--
--></div></includeonly><noinclude>
{{documentation}}
</noinclude>
ft985l8eysdxmtek361qjybizm5v8rt
32229
32228
2026-04-22T02:15:06Z
Satdeep Gill
85
[[:en:Template:Flex_wrap_centre]] سے 1 نسخہ درآمد کیا گیا
32228
wikitext
text/x-wiki
<includeonly>{{flex wrap centre/s
| align = {{{align|}}}
| max-width = {{{max-width|}}}
| align-items = {{{align-items|}}}
| align-content = {{{align-items|}}}
| class = {{{class|}}}
| style = {{{style|}}}
}}<!--
-->{{#if:{{{1|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class1|}}}"<!--
-->{{#if:{{{child_style1|child_style}}}|style="{{{child_style|}}} {{{child_style1|}}}"}}>
{{{1}}}
</div>}}<!--
-->{{#if:{{{2|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class2|}}}"<!--
-->{{#if:{{{child_style2|child_style}}}|style="{{{child_style|}}} {{{child_style2|}}}"}}>
{{{2}}}
</div>}}<!--
-->{{#if:{{{3|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class3|}}}"<!--
-->{{#if:{{{child_style3|child_style}}}|style="{{{child_style|}}} {{{child_style3|}}}"}}>
{{{3}}}
</div>}}<!--
-->{{#if:{{{4|}}}|<div class="_flex_child {{{child_class|}}} {{{child_class4|}}}"<!--
-->{{#if:{{{child_style4|child_style}}}|style="{{{child_style|}}} {{{child_style4|}}}"}}>
{{{4}}}
</div>}}<!--
--></div></includeonly><noinclude>
{{documentation}}
</noinclude>
ft985l8eysdxmtek361qjybizm5v8rt
سانچہ:Flex wrap centre/s
10
13043
32230
2021-07-10T14:26:57Z
en>Inductiveload
0
add standardised wst- prefix classname
32230
wikitext
text/x-wiki
<includeonly><templatestyles src="Flex wrap centre/styles.css" /><!--
--><div class="_flex_wrap_center wst-flex-wrap-center {{{class|}}}" style="<!--
-->text-align:{{#if:{{{align|}}}|{{{align}}}|center}};<!--
--> {{#if:{{{max-width|}}}|max-width:{{{max-width}}};}}<!--
--> {{#if:{{{align-items|}}}|align-items:{{{align-items}}};}}<!--
--> {{#if:{{{align-content|}}}|align-content:{{{align-content}}};}}<!--
--> {{{style|}}}"><!--
--></includeonly><noinclude>
{{documentation|Template:Flex wrap centre/doc}}
</noinclude>
acrai8gwnt7d6a1z6n6w7gmhgg06x4t
32231
32230
2026-04-22T02:15:06Z
Satdeep Gill
85
[[:en:Template:Flex_wrap_centre/s]] سے 1 نسخہ درآمد کیا گیا
32230
wikitext
text/x-wiki
<includeonly><templatestyles src="Flex wrap centre/styles.css" /><!--
--><div class="_flex_wrap_center wst-flex-wrap-center {{{class|}}}" style="<!--
-->text-align:{{#if:{{{align|}}}|{{{align}}}|center}};<!--
--> {{#if:{{{max-width|}}}|max-width:{{{max-width}}};}}<!--
--> {{#if:{{{align-items|}}}|align-items:{{{align-items}}};}}<!--
--> {{#if:{{{align-content|}}}|align-content:{{{align-content}}};}}<!--
--> {{{style|}}}"><!--
--></includeonly><noinclude>
{{documentation|Template:Flex wrap centre/doc}}
</noinclude>
acrai8gwnt7d6a1z6n6w7gmhgg06x4t
سانچہ:Flex wrap centre/styles.css
10
13044
32232
2021-07-10T14:27:40Z
en>Inductiveload
0
use standardised CSS class name wst-flex-wrap-center
32232
sanitized-css
text/css
/* main container: flex-box with wrapping, align to centre */
.wst-flex-wrap-center {
margin: auto; /* centre in page if width < 100% */
display: flex;
flex-wrap: wrap;
justify-content: center;
}
/* the direct childen have this class */
.wst-flex-wrap-center > ._flex_child {
/* default: a little padding on each side to separate cells */
/* can be overridden on a per-cell basis */
margin: 0.5em;
}
/* utility class if you want to remove child padding (can override without this) */
.wst-flex-wrap-center > ._flex_child._no_margin {
margin: 0;
}
.wst-flex-wrap-center img {
max-width: 100%; /* don't allow the imge to overspill containers */
height: auto; /* maintain aspect ratio */
}
3p5uoz1q5bstmavukew95qwcoaugxif
32233
32232
2026-04-22T02:15:06Z
Satdeep Gill
85
[[:en:Template:Flex_wrap_centre/styles.css]] سے 1 نسخہ درآمد کیا گیا
32232
sanitized-css
text/css
/* main container: flex-box with wrapping, align to centre */
.wst-flex-wrap-center {
margin: auto; /* centre in page if width < 100% */
display: flex;
flex-wrap: wrap;
justify-content: center;
}
/* the direct childen have this class */
.wst-flex-wrap-center > ._flex_child {
/* default: a little padding on each side to separate cells */
/* can be overridden on a per-cell basis */
margin: 0.5em;
}
/* utility class if you want to remove child padding (can override without this) */
.wst-flex-wrap-center > ._flex_child._no_margin {
margin: 0;
}
.wst-flex-wrap-center img {
max-width: 100%; /* don't allow the imge to overspill containers */
height: auto; /* maintain aspect ratio */
}
3p5uoz1q5bstmavukew95qwcoaugxif
سانچہ:Center/doc
10
13045
32234
2025-08-22T16:40:36Z
en>Omegatron
0
c/s template uses this documentation, but is not documented in it
32234
wikitext
text/x-wiki
{{Documentation subpage}}{{template shortcut|c}}
{{high-risk|668000}}{{uses TemplateStyles|Template:center/styles.css}}
{{div-based-template}}
== Usage ==
This template center-aligns text. For example,
{{doc example|content=
<pre>
{{center|'''Example text'''}}
</pre>
{{center|'''Example text'''}}
}}
=== Other parameters ===
==== style ====
Where there is a need to specify the style of text for the whole <nowiki><div>...</div></nowiki> item, an optional {{parameter|style}} parameter can be used.
This can be useful when the body of the template is not a single [[H:DIVSPAN|inline item]] but a multi-paragraph structure. If the formatting in question has a "block" template, you can also nest that inside or outside the <code><nowiki>{{center}}</nowiki></code> template:
The following solutions are then applicable.
{{flex wrap centre|align=left
|'''Option 1'''
<pre>
{{center|style=font-family:serif;|
Title of the work
by
Author of the work
}}
</pre>
yields
{{center|style=font-family:serif;|
Title of the work
by
Author of the work
}}
|'''Option 2''' (block template)
<pre>{{center|{{serif block|
<!--or {{serif block|{{center| -->
Title of the work
by
Author of the work
}}}}</pre>
yields
{{center|{{serif block|
Title of the work
by
Author of the work
}}}}
|'''Option 3''' (if block template not available)
<pre>{{center|
{{serif|Title of the work}}
{{serif|by}}
{{serif|Author of the work}}
}}</pre>
yields
{{center|
{{serif|Title of the work}}
{{serif|by}}
{{serif|Author of the work}}
}}
}} <!-- flex wrap centre -->
=== Start and end templates ===
Another block method is to use the paired start and end templates <code>{{tl|c/s}}</code> (center start) and <code>{{tl|c/e}}</code> (center end):
{{doc example|content=
<pre>
{{c/s}}
{{uc|Title of the work}}
{{sc|Subtitle by Author}}
{{c/e}}
</pre>
{{c/s}}
{{uc|Title of the work}}
{{sc|Subtitle by Author}}
{{c/e}}
}}
The <code>{{tl|c/s}}</code> template accepts the same parameters as <code>{{tl|center}}</code> (e.g., <code>style=font-family: serif;</code>, <code>width=50%</code>, <code>nomargin=yes</code>).
==Redirects==
*{{tl|c}}
== Tracking categories==
* [[:Category:Pages using center with no text argument]]—Pages where the template is called with no text or first argument, typically because the content contains an = or otherwise confuses the parser
== See also ==
* [[Template:Block center]]
* [[Template:Center block]]
* [[Template:Center inline]] (span-based version)
===Template data===
{{TemplateDataHeader}}
<templatedata>
{
"description": "Align text to the center",
"params": {
"style": {
"label": "style",
"description": "Additional CSS styles to apply to the block",
"type": "content",
"required": false
},
"text": {
"aliases": [
"1"
],
"label": "text",
"description": "The text to center, this can be more than one paragraph.",
"type": "content",
"required": true
},
"nomargin": {
"label": "nomargin",
"type": "string",
"suggestedvalues": [
"yes, no"
]
},
"nocat": {},
"class": {
"description": "Additional CSS classes to apply."
},
"width": {}
},
"paramOrder": [
"style",
"text",
"nomargin",
"nocat",
"class",
"width"
],
"format": "inline"
}
</templatedata>
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Special effects templates|{{PAGENAME}}]]
</includeonly>
8s8aw8k0ugb4va0jjuz30yl36k3rwpp
32235
32234
2026-04-22T02:15:06Z
Satdeep Gill
85
[[:en:Template:Center/doc]] سے 1 نسخہ درآمد کیا گیا
32234
wikitext
text/x-wiki
{{Documentation subpage}}{{template shortcut|c}}
{{high-risk|668000}}{{uses TemplateStyles|Template:center/styles.css}}
{{div-based-template}}
== Usage ==
This template center-aligns text. For example,
{{doc example|content=
<pre>
{{center|'''Example text'''}}
</pre>
{{center|'''Example text'''}}
}}
=== Other parameters ===
==== style ====
Where there is a need to specify the style of text for the whole <nowiki><div>...</div></nowiki> item, an optional {{parameter|style}} parameter can be used.
This can be useful when the body of the template is not a single [[H:DIVSPAN|inline item]] but a multi-paragraph structure. If the formatting in question has a "block" template, you can also nest that inside or outside the <code><nowiki>{{center}}</nowiki></code> template:
The following solutions are then applicable.
{{flex wrap centre|align=left
|'''Option 1'''
<pre>
{{center|style=font-family:serif;|
Title of the work
by
Author of the work
}}
</pre>
yields
{{center|style=font-family:serif;|
Title of the work
by
Author of the work
}}
|'''Option 2''' (block template)
<pre>{{center|{{serif block|
<!--or {{serif block|{{center| -->
Title of the work
by
Author of the work
}}}}</pre>
yields
{{center|{{serif block|
Title of the work
by
Author of the work
}}}}
|'''Option 3''' (if block template not available)
<pre>{{center|
{{serif|Title of the work}}
{{serif|by}}
{{serif|Author of the work}}
}}</pre>
yields
{{center|
{{serif|Title of the work}}
{{serif|by}}
{{serif|Author of the work}}
}}
}} <!-- flex wrap centre -->
=== Start and end templates ===
Another block method is to use the paired start and end templates <code>{{tl|c/s}}</code> (center start) and <code>{{tl|c/e}}</code> (center end):
{{doc example|content=
<pre>
{{c/s}}
{{uc|Title of the work}}
{{sc|Subtitle by Author}}
{{c/e}}
</pre>
{{c/s}}
{{uc|Title of the work}}
{{sc|Subtitle by Author}}
{{c/e}}
}}
The <code>{{tl|c/s}}</code> template accepts the same parameters as <code>{{tl|center}}</code> (e.g., <code>style=font-family: serif;</code>, <code>width=50%</code>, <code>nomargin=yes</code>).
==Redirects==
*{{tl|c}}
== Tracking categories==
* [[:Category:Pages using center with no text argument]]—Pages where the template is called with no text or first argument, typically because the content contains an = or otherwise confuses the parser
== See also ==
* [[Template:Block center]]
* [[Template:Center block]]
* [[Template:Center inline]] (span-based version)
===Template data===
{{TemplateDataHeader}}
<templatedata>
{
"description": "Align text to the center",
"params": {
"style": {
"label": "style",
"description": "Additional CSS styles to apply to the block",
"type": "content",
"required": false
},
"text": {
"aliases": [
"1"
],
"label": "text",
"description": "The text to center, this can be more than one paragraph.",
"type": "content",
"required": true
},
"nomargin": {
"label": "nomargin",
"type": "string",
"suggestedvalues": [
"yes, no"
]
},
"nocat": {},
"class": {
"description": "Additional CSS classes to apply."
},
"width": {}
},
"paramOrder": [
"style",
"text",
"nomargin",
"nocat",
"class",
"width"
],
"format": "inline"
}
</templatedata>
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Special effects templates|{{PAGENAME}}]]
</includeonly>
8s8aw8k0ugb4va0jjuz30yl36k3rwpp
سانچہ:Serif block
10
13046
32236
2021-03-12T09:54:24Z
en>Inductiveload
0
32236
wikitext
text/x-wiki
<includeonly><div style="font-family:serif;">
{{{1}}}
</div></includeonly><noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
nadtrp2azbcp9n4mwjaun0bui73g9r2
32237
32236
2026-04-22T02:15:06Z
Satdeep Gill
85
[[:en:Template:Serif_block]] سے 1 نسخہ درآمد کیا گیا
32236
wikitext
text/x-wiki
<includeonly><div style="font-family:serif;">
{{{1}}}
</div></includeonly><noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
nadtrp2azbcp9n4mwjaun0bui73g9r2
سانچہ:High-risk
10
13047
32238
2022-01-01T05:14:03Z
en>Serprinss
0
merging with Template:High-use
32238
wikitext
text/x-wiki
#REDIRECT [[Template:High-use]]
e17i7zdjae1f1pi88fnci4b96lfz175
32239
32238
2026-04-22T02:15:06Z
Satdeep Gill
85
[[:en:Template:High-risk]] سے 1 نسخہ درآمد کیا گیا
32238
wikitext
text/x-wiki
#REDIRECT [[Template:High-use]]
e17i7zdjae1f1pi88fnci4b96lfz175
سانچہ:Uppercase/styles.css
10
13048
32242
2025-02-02T11:06:23Z
en>CalendulaAsteraceae
0
CalendulaAsteraceae moved page [[Template:Allcaps/styles.css]] to [[Template:Uppercase/styles.css]] without leaving a redirect
32242
sanitized-css
text/css
.wst-uppercase {
text-transform: uppercase;
}
klt7b4k6y2nvpm9ybzatesqggh1u2qo
32243
32242
2026-04-22T02:15:07Z
Satdeep Gill
85
[[:en:Template:Uppercase/styles.css]] سے 1 نسخہ درآمد کیا گیا
32242
sanitized-css
text/css
.wst-uppercase {
text-transform: uppercase;
}
klt7b4k6y2nvpm9ybzatesqggh1u2qo
سانچہ:Left
10
13049
32244
2020-02-04T10:22:42Z
en>Xover
0
there's no need to force leading/trailing whitespace here, even if it generally shouldn't matter; the whitespace serves no particular purpose and there are edge cases where it matters
32244
wikitext
text/x-wiki
<includeonly><div style="text-align:left; margin-left:{{{offset|{{{2|0}}}}}}">{{{1}}}</div></includeonly><noinclude>
{{documentation}}
</noinclude>
t6ed4vepjmhjhru43pp4okht5daaqc5
32245
32244
2026-04-22T02:15:13Z
Satdeep Gill
85
[[:en:Template:Left]] سے 1 نسخہ درآمد کیا گیا
32244
wikitext
text/x-wiki
<includeonly><div style="text-align:left; margin-left:{{{offset|{{{2|0}}}}}}">{{{1}}}</div></includeonly><noinclude>
{{documentation}}
</noinclude>
t6ed4vepjmhjhru43pp4okht5daaqc5
سانچہ:Left/doc
10
13050
32246
2025-02-01T19:02:06Z
en>GrammarPoliceOffical
0
removed template shortcut
32246
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->
{{Div-based-template}}
=== Usage ===
Left aligns text with a <code><div></code>
<syntaxhighlight lang="wikitext">{{left|here is left-aligned text with a 5em offset|offset=5em}}</syntaxhighlight>
{{left|here is left-aligned text with a 5em offset|offset=5em}}
If any text is placed before or after the template, it will simply wrap to another line without any offset:
<syntaxhighlight lang="wikitext">{{left|here is left-aligned text<br>with a 5em offset for both these lines,|offset=5em}} but not this one right here, {{left|and here is more left-aligned text|offset=5em}}</syntaxhighlight>
{{left|here is left-aligned text<br>with a 5em offset for both these lines,|offset=5em}} but not this one right here, {{left|and here is more left-aligned text|offset=5em}}
Where the block of text to be formatted extends over a page-break {{tl|left/s}} and {{tl|left/e}} should be used. {{tl|left/s}} accepts the {{parameter|offset}} parameter.
Body of first page:
<syntaxhighlight lang="wikitext">
{{left/s|offset=5em}}
here is left-aligned text
</syntaxhighlight>
Footer:
<syntaxhighlight lang="wikitext">
{{left/e}}
</syntaxhighlight>
Header (of second page):
<syntaxhighlight lang="wikitext">
{{left/s|offset=5em}}
</syntaxhighlight>
Body of second page:
<syntaxhighlight lang="wikitext">
with a 5em offset
{{left/e}}
</syntaxhighlight>
=== See also ===
* [[Template:Right]]
* [[Template:Block left]]
* [[Template:Float left]]
<includeonly>
<!-- PLEASE ADD CATEGORIES BELOW THIS LINE AND INTERWIKIS IN WIKIDATA, THANKS -->
[[Category:Special effects templates]]
[[Category:Formatting templates]]
</includeonly>
rsup9jhgmx7y3bjw3vxm3todegge5sx
32247
32246
2026-04-22T02:15:13Z
Satdeep Gill
85
[[:en:Template:Left/doc]] سے 1 نسخہ درآمد کیا گیا
32246
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->
{{Div-based-template}}
=== Usage ===
Left aligns text with a <code><div></code>
<syntaxhighlight lang="wikitext">{{left|here is left-aligned text with a 5em offset|offset=5em}}</syntaxhighlight>
{{left|here is left-aligned text with a 5em offset|offset=5em}}
If any text is placed before or after the template, it will simply wrap to another line without any offset:
<syntaxhighlight lang="wikitext">{{left|here is left-aligned text<br>with a 5em offset for both these lines,|offset=5em}} but not this one right here, {{left|and here is more left-aligned text|offset=5em}}</syntaxhighlight>
{{left|here is left-aligned text<br>with a 5em offset for both these lines,|offset=5em}} but not this one right here, {{left|and here is more left-aligned text|offset=5em}}
Where the block of text to be formatted extends over a page-break {{tl|left/s}} and {{tl|left/e}} should be used. {{tl|left/s}} accepts the {{parameter|offset}} parameter.
Body of first page:
<syntaxhighlight lang="wikitext">
{{left/s|offset=5em}}
here is left-aligned text
</syntaxhighlight>
Footer:
<syntaxhighlight lang="wikitext">
{{left/e}}
</syntaxhighlight>
Header (of second page):
<syntaxhighlight lang="wikitext">
{{left/s|offset=5em}}
</syntaxhighlight>
Body of second page:
<syntaxhighlight lang="wikitext">
with a 5em offset
{{left/e}}
</syntaxhighlight>
=== See also ===
* [[Template:Right]]
* [[Template:Block left]]
* [[Template:Float left]]
<includeonly>
<!-- PLEASE ADD CATEGORIES BELOW THIS LINE AND INTERWIKIS IN WIKIDATA, THANKS -->
[[Category:Special effects templates]]
[[Category:Formatting templates]]
</includeonly>
rsup9jhgmx7y3bjw3vxm3todegge5sx
سانچہ:Right
10
13051
32248
2024-10-13T06:38:34Z
en>CalendulaAsteraceae
0
use /s and /e
32248
wikitext
text/x-wiki
<onlyinclude>{{right/s|leading-top={{{leading-top|}}}|offset={{{offset|{{{2|}}}}}}|style={{{style|}}}}}
{{{1}}}
{{right/e}}</onlyinclude>
{{documentation}}
jal5vfpyskqtgw14gjjil1rgm1yxk5j
32249
32248
2026-04-22T02:15:19Z
Satdeep Gill
85
[[:en:Template:Right]] سے 1 نسخہ درآمد کیا گیا
32248
wikitext
text/x-wiki
<onlyinclude>{{right/s|leading-top={{{leading-top|}}}|offset={{{offset|{{{2|}}}}}}|style={{{style|}}}}}
{{{1}}}
{{right/e}}</onlyinclude>
{{documentation}}
jal5vfpyskqtgw14gjjil1rgm1yxk5j
سانچہ:Float right
10
13052
32250
2021-08-06T08:04:46Z
en>Inductiveload
0
use templatestyles
32250
wikitext
text/x-wiki
<onlyinclude><!--
--><templatestyles src="Float right/styles.css" /><!--
--><span class="wst-floatright {{{class|}}}" {{#if:{{{id|}}}|id="{{{id}}}"}} style="margin:{{{3|0}}} {{{offset|{{{2|0}}}}}} {{{3|0}}} {{{gutter|{{{4|0}}}}}}; {{{style|}}}">{{{content|{{{1}}}}}}</span></onlyinclude>
{{documentation}}
dsqtamflc7xebjjz0o4n2x15c41rrxm
32251
32250
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Float_right]] سے 1 نسخہ درآمد کیا گیا
32250
wikitext
text/x-wiki
<onlyinclude><!--
--><templatestyles src="Float right/styles.css" /><!--
--><span class="wst-floatright {{{class|}}}" {{#if:{{{id|}}}|id="{{{id}}}"}} style="margin:{{{3|0}}} {{{offset|{{{2|0}}}}}} {{{3|0}}} {{{gutter|{{{4|0}}}}}}; {{{style|}}}">{{{content|{{{1}}}}}}</span></onlyinclude>
{{documentation}}
dsqtamflc7xebjjz0o4n2x15c41rrxm
سانچہ:Float right/styles.css
10
13053
32252
2025-01-06T21:25:44Z
en>Jan.Kamenicek
0
Protected "[[Template:Float right/styles.css]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32252
sanitized-css
text/css
.wst-floatright {
float:right;
text-indent: 0;
}
ijetemjtp82ypxvar0xvafun5q4vm5b
32253
32252
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Float_right/styles.css]] سے 1 نسخہ درآمد کیا گیا
32252
sanitized-css
text/css
.wst-floatright {
float:right;
text-indent: 0;
}
ijetemjtp82ypxvar0xvafun5q4vm5b
سانچہ:Clear
10
13054
32254
2022-09-07T22:35:12Z
en>Prosfilaes
0
21 revisions imported from [[:commons:Template:Clear]]
32254
wikitext
text/x-wiki
<div style="clear:{{{1|both}}};"></div><noinclude>
{{documentation}}
</noinclude>
6mk3e4afot6hzu6tzbljxxk83e14xv6
32255
32254
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Clear]] سے 1 نسخہ درآمد کیا گیا
32254
wikitext
text/x-wiki
<div style="clear:{{{1|both}}};"></div><noinclude>
{{documentation}}
</noinclude>
6mk3e4afot6hzu6tzbljxxk83e14xv6
سانچہ:Template
10
13055
32256
2007-02-12T17:25:21Z
en>Fabartus
0
imp fm en.wp
32256
wikitext
text/x-wiki
#redirect [[Template:Tl]]
kguhrbkq8mksgjr7oifzhh10u6ng5lr
32257
32256
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Template]] سے 1 نسخہ درآمد کیا گیا
32256
wikitext
text/x-wiki
#redirect [[Template:Tl]]
kguhrbkq8mksgjr7oifzhh10u6ng5lr
سانچہ:Monospace
10
13056
32258
2022-11-27T00:26:45Z
en>ShakespeareFan00
0
32258
wikitext
text/x-wiki
<onlyinclude><templatestyles src="Monospace/styles.css" /><span class="wst-mono">{{{1}}}</span></onlyinclude><noinclude>{{documentation}}</noinclude>
heore78wbq63ex9y1j1cmzsfunq9jrh
32259
32258
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Monospace]] سے 1 نسخہ درآمد کیا گیا
32258
wikitext
text/x-wiki
<onlyinclude><templatestyles src="Monospace/styles.css" /><span class="wst-mono">{{{1}}}</span></onlyinclude><noinclude>{{documentation}}</noinclude>
heore78wbq63ex9y1j1cmzsfunq9jrh
سانچہ:Tt
10
13057
32260
2020-09-26T18:35:01Z
en>Waldyrious
0
update target
32260
wikitext
text/x-wiki
#REDIRECT [[Template:Monospace]]
dp746vof79idspevhxdkwi2t8ws28tf
32261
32260
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Tt]] سے 1 نسخہ درآمد کیا گیا
32260
wikitext
text/x-wiki
#REDIRECT [[Template:Monospace]]
dp746vof79idspevhxdkwi2t8ws28tf
سانچہ:Right/doc
10
13058
32262
2025-02-22T02:07:01Z
en>1F616EMO
0
properly demostrate
32262
wikitext
text/x-wiki
{{documentation subpage}}
{{high-use|171437}}
{{div-based-template|class=.wst-right}}
{{templatestyles|Template:Right/styles.css}}
{{clear}}
==Usage==
This template aligns text to the right. For example,
{{doc example|
<pre>{{right|'''Example text'''}}</pre>
yields
{{right|'''Example text'''}}
}}
Text can be offset from the right margin by use of a second {{tt|offset}} parameter, implicitly or by name:
{{doc example|
<pre>{{right|'''Example text'''|3em}}</pre>
and
<pre>{{right|'''Example text'''|offset=3em}}</pre>
both yield
{{right|'''Example text'''|3em}}
}}
==<nowiki>{{right}}</nowiki> ''versus'' {{tl|float right}}==
This template, <nowiki>{{right}}</nowiki>, retains the text in the normal flow, but causes it to be aligned along the right margin. {{tl|float right}} takes a block of text out of the normal text flow, and floats it as far right as possible, without changing how it is aligned; other text can flow around it, as if it were a picture or diagram.
{| class="wikitable" width="100%" cellpadding="20"
!{{template|right}} !! {{template|float right}}
|-
| width="50%" | {{Lorem ipsum}}
{{right|'''This text is'''<br/>
'''right aligned'''<br/>
'''using <nowiki>{{right}}</nowiki>.'''}}
''{{Lorem ipsum}}''
| width="50%" | {{Lorem ipsum}}
{{float right|'''This text is'''<br/>
'''floated right'''<br/>
'''using <nowiki>{{float right}}</nowiki>.'''}}
''{{Lorem ipsum}}''
|}
== TemplateData ==
{{TemplateDataHeader}}
<templatedata>
{
"params": {
"1": {
"label": "Text",
"description": "The text to right-align.",
"type": "content",
"required": true
},
"leading-top": {
"label": "Top leading/padding",
"description": "The space to leave at the top of the aligned block. Value in ems (do not specify units).",
"example": "2",
"type": "string",
"default": "0",
"suggested": true
},
"offset": {
"aliases": [
"2"
],
"label": "Offset",
"description": "The right margin.",
"example": "3em",
"type": "string",
"default": "0",
"suggested": true
},
"style": {
"label": "Style",
"description": "Any other CSS rules to apply to the block.",
"type": "string"
}
},
"description": "Align text to the right.",
"paramOrder": [
"1",
"offset",
"leading-top",
"style"
],
"format": "inline"
}
</templatedata>
===See also===
* {{tl|Left}}: left aligns a block of text
* {{tl|Right inline}}: Inline version of this template.
* {{tl|Block right}}: places a block of text in the right of the page, without affecting the text alignment within that block
* {{tl|Continues}}: adds the first word of the next page, right aligned, to the page footer
<!-- template categories and interwiki links -->
<includeonly>
[[Category:Special effects templates|{{PAGENAME}}]]
[[es:Plantilla:Derecha]]
[[id:Templat:Right]]
[[pt:Predefinição:Alinhado à direita]]
</includeonly>
ih955mclrnutkugplwhkafd06w2aft5
32263
32262
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Right/doc]] سے 1 نسخہ درآمد کیا گیا
32262
wikitext
text/x-wiki
{{documentation subpage}}
{{high-use|171437}}
{{div-based-template|class=.wst-right}}
{{templatestyles|Template:Right/styles.css}}
{{clear}}
==Usage==
This template aligns text to the right. For example,
{{doc example|
<pre>{{right|'''Example text'''}}</pre>
yields
{{right|'''Example text'''}}
}}
Text can be offset from the right margin by use of a second {{tt|offset}} parameter, implicitly or by name:
{{doc example|
<pre>{{right|'''Example text'''|3em}}</pre>
and
<pre>{{right|'''Example text'''|offset=3em}}</pre>
both yield
{{right|'''Example text'''|3em}}
}}
==<nowiki>{{right}}</nowiki> ''versus'' {{tl|float right}}==
This template, <nowiki>{{right}}</nowiki>, retains the text in the normal flow, but causes it to be aligned along the right margin. {{tl|float right}} takes a block of text out of the normal text flow, and floats it as far right as possible, without changing how it is aligned; other text can flow around it, as if it were a picture or diagram.
{| class="wikitable" width="100%" cellpadding="20"
!{{template|right}} !! {{template|float right}}
|-
| width="50%" | {{Lorem ipsum}}
{{right|'''This text is'''<br/>
'''right aligned'''<br/>
'''using <nowiki>{{right}}</nowiki>.'''}}
''{{Lorem ipsum}}''
| width="50%" | {{Lorem ipsum}}
{{float right|'''This text is'''<br/>
'''floated right'''<br/>
'''using <nowiki>{{float right}}</nowiki>.'''}}
''{{Lorem ipsum}}''
|}
== TemplateData ==
{{TemplateDataHeader}}
<templatedata>
{
"params": {
"1": {
"label": "Text",
"description": "The text to right-align.",
"type": "content",
"required": true
},
"leading-top": {
"label": "Top leading/padding",
"description": "The space to leave at the top of the aligned block. Value in ems (do not specify units).",
"example": "2",
"type": "string",
"default": "0",
"suggested": true
},
"offset": {
"aliases": [
"2"
],
"label": "Offset",
"description": "The right margin.",
"example": "3em",
"type": "string",
"default": "0",
"suggested": true
},
"style": {
"label": "Style",
"description": "Any other CSS rules to apply to the block.",
"type": "string"
}
},
"description": "Align text to the right.",
"paramOrder": [
"1",
"offset",
"leading-top",
"style"
],
"format": "inline"
}
</templatedata>
===See also===
* {{tl|Left}}: left aligns a block of text
* {{tl|Right inline}}: Inline version of this template.
* {{tl|Block right}}: places a block of text in the right of the page, without affecting the text alignment within that block
* {{tl|Continues}}: adds the first word of the next page, right aligned, to the page footer
<!-- template categories and interwiki links -->
<includeonly>
[[Category:Special effects templates|{{PAGENAME}}]]
[[es:Plantilla:Derecha]]
[[id:Templat:Right]]
[[pt:Predefinição:Alinhado à direita]]
</includeonly>
ih955mclrnutkugplwhkafd06w2aft5
سانچہ:Monospace/styles.css
10
13059
32264
2022-11-27T22:38:50Z
en>Mpaa
0
added comment per WP, just in case
32264
sanitized-css
text/css
.wst-mono {
/* "monospace, monospace" per [[WP:MONO]] */
font-family: monospace, monospace;
}
21jj4nkje0jiuihnph16mraz1xqojcp
32265
32264
2026-04-22T02:15:20Z
Satdeep Gill
85
[[:en:Template:Monospace/styles.css]] سے 1 نسخہ درآمد کیا گیا
32264
sanitized-css
text/css
.wst-mono {
/* "monospace, monospace" per [[WP:MONO]] */
font-family: monospace, monospace;
}
21jj4nkje0jiuihnph16mraz1xqojcp
سانچہ:Right/styles.css
10
13060
32266
2025-10-05T08:06:05Z
en>CalendulaAsteraceae
0
Protected "[[Template:Right/styles.css]]": High traffic page or template/module ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
32266
sanitized-css
text/css
.wst-right {
text-align:right;
}
msov04re53kgg2xoz6p8c45l9zjm7xd
32267
32266
2026-04-22T02:15:21Z
Satdeep Gill
85
[[:en:Template:Right/styles.css]] سے 1 نسخہ درآمد کیا گیا
32266
sanitized-css
text/css
.wst-right {
text-align:right;
}
msov04re53kgg2xoz6p8c45l9zjm7xd
سانچہ:Right/s
10
13061
32268
2025-12-06T08:09:32Z
en>CalendulaAsteraceae
0
32268
wikitext
text/x-wiki
<onlyinclude><templatestyles src="Template:Right/styles.css" /><div class="wst-right" {{optional style|padding-top={{#if:{{{leading-top|}}}|{{{leading-top}}}em}}|margin-right={{#if:{{{offset|{{{2|}}}}}}|{{{offset|{{{2|}}}}}}}}|style={{{style|}}}}}></onlyinclude><noinclude>
</div>
{{documentation|Template:Right/doc}}</noinclude>
qvzsrcmemxo2i2k6p3ypg7vsldgg0yi
32269
32268
2026-04-22T02:15:21Z
Satdeep Gill
85
[[:en:Template:Right/s]] سے 1 نسخہ درآمد کیا گیا
32268
wikitext
text/x-wiki
<onlyinclude><templatestyles src="Template:Right/styles.css" /><div class="wst-right" {{optional style|padding-top={{#if:{{{leading-top|}}}|{{{leading-top}}}em}}|margin-right={{#if:{{{offset|{{{2|}}}}}}|{{{offset|{{{2|}}}}}}}}|style={{{style|}}}}}></onlyinclude><noinclude>
</div>
{{documentation|Template:Right/doc}}</noinclude>
qvzsrcmemxo2i2k6p3ypg7vsldgg0yi
سانچہ:Right/e
10
13062
32270
2024-10-13T06:25:14Z
en>CalendulaAsteraceae
0
Redirected page to [[Template:Div end]]
32270
wikitext
text/x-wiki
#redirect[[Template:Div end]]
exllz7k5cunac41zi64n3793tmll7bx
32271
32270
2026-04-22T02:15:21Z
Satdeep Gill
85
[[:en:Template:Right/e]] سے 1 نسخہ درآمد کیا گیا
32270
wikitext
text/x-wiki
#redirect[[Template:Div end]]
exllz7k5cunac41zi64n3793tmll7bx
سانچہ:Larger
10
13063
32272
2025-08-12T03:55:50Z
en>CalendulaAsteraceae
0
32272
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=120%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
thxusr6xnm4iot8j595q45ngzgr5j08
32273
32272
2026-04-22T02:15:26Z
Satdeep Gill
85
[[:en:Template:Larger]] سے 1 نسخہ درآمد کیا گیا
32272
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=120%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
thxusr6xnm4iot8j595q45ngzgr5j08
سانچہ:Fine
10
13064
32274
2025-08-12T03:56:20Z
en>CalendulaAsteraceae
0
32274
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=92%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
48oekfvpwoawdgaiywuzimu21ogrdvl
32275
32274
2026-04-22T02:15:27Z
Satdeep Gill
85
[[:en:Template:Fine]] سے 1 نسخہ درآمد کیا گیا
32274
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=92%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
48oekfvpwoawdgaiywuzimu21ogrdvl
سانچہ:X-smaller
10
13065
32276
2025-08-12T03:57:15Z
en>CalendulaAsteraceae
0
32276
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=69%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
sk4k32obx8x04thci1d0gk236dhuptk
32277
32276
2026-04-22T02:15:27Z
Satdeep Gill
85
[[:en:Template:X-smaller]] سے 1 نسخہ درآمد کیا گیا
32276
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=69%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
sk4k32obx8x04thci1d0gk236dhuptk
سانچہ:Xxx-larger
10
13066
32278
2025-08-12T03:55:06Z
en>CalendulaAsteraceae
0
32278
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=207%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
87n1wo5a9ltv88secr1ugojda2wrcfa
32279
32278
2026-04-22T02:15:27Z
Satdeep Gill
85
[[:en:Template:Xxx-larger]] سے 1 نسخہ درآمد کیا گیا
32278
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=207%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
87n1wo5a9ltv88secr1ugojda2wrcfa
سانچہ:Xx-larger
10
13067
32280
2025-08-12T03:55:20Z
en>CalendulaAsteraceae
0
32280
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=182%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
c5kpvdak4baev8soufiehqiqpbsz1np
32281
32280
2026-04-22T02:15:27Z
Satdeep Gill
85
[[:en:Template:Xx-larger]] سے 1 نسخہ درآمد کیا گیا
32280
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=182%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
c5kpvdak4baev8soufiehqiqpbsz1np
سانچہ:X-larger
10
13068
32282
2025-08-12T03:55:35Z
en>CalendulaAsteraceae
0
32282
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=144%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
8ftgy1auc1zlyvddd986ya2c9x1rqwg
32283
32282
2026-04-22T02:15:28Z
Satdeep Gill
85
[[:en:Template:X-larger]] سے 1 نسخہ درآمد کیا گیا
32282
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=144%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
8ftgy1auc1zlyvddd986ya2c9x1rqwg
سانچہ:Xx-smaller
10
13069
32284
2025-08-12T03:57:27Z
en>CalendulaAsteraceae
0
32284
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=58%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
89kkx5eaefqy5yvyw6dcyzyvj4iiuj2
32285
32284
2026-04-22T02:15:28Z
Satdeep Gill
85
[[:en:Template:Xx-smaller]] سے 1 نسخہ درآمد کیا گیا
32284
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=58%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
89kkx5eaefqy5yvyw6dcyzyvj4iiuj2
سانچہ:Xxxx-larger
10
13070
32286
2025-08-12T03:54:51Z
en>CalendulaAsteraceae
0
32286
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=249%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
mvp16aa4f6k4sie5ak1tz1s0uwnw95r
32287
32286
2026-04-22T02:15:28Z
Satdeep Gill
85
[[:en:Template:Xxxx-larger]] سے 1 نسخہ درآمد کیا گیا
32286
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=249%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
mvp16aa4f6k4sie5ak1tz1s0uwnw95r
سانچہ:Span-based-template
10
13071
32288
2025-05-15T13:42:34Z
en>Uzume
0
don't cat /doc and sandboxes
32288
wikitext
text/x-wiki
<onlyinclude>{{ombox|type = notice
|small = yes
|image =[[File:Italic font awesome.svg|35px]]
|text=<p>This template uses a <code><span></code> element for formatting.<br />
Block-based templates and paragraph breaks cannot be nested inside it.</p>
<p>See [[H:DIVSPAN]] for details.</p>
{{#if:{{{class|}}}|{{class notice|class={{{class}}}|classcount={{{classcount|}}}}}}}
}}<includeonly>{{sandbox other||[[Category:Span based templates]]}}</includeonly></onlyinclude>
{{documentation}}
joj6dvjj3cl52m6eagcd4wjrp5af2lq
32289
32288
2026-04-22T02:15:28Z
Satdeep Gill
85
[[:en:Template:Span-based-template]] سے 1 نسخہ درآمد کیا گیا
32288
wikitext
text/x-wiki
<onlyinclude>{{ombox|type = notice
|small = yes
|image =[[File:Italic font awesome.svg|35px]]
|text=<p>This template uses a <code><span></code> element for formatting.<br />
Block-based templates and paragraph breaks cannot be nested inside it.</p>
<p>See [[H:DIVSPAN]] for details.</p>
{{#if:{{{class|}}}|{{class notice|class={{{class}}}|classcount={{{classcount|}}}}}}}
}}<includeonly>{{sandbox other||[[Category:Span based templates]]}}</includeonly></onlyinclude>
{{documentation}}
joj6dvjj3cl52m6eagcd4wjrp5af2lq
سانچہ:References
10
13072
32290
2009-03-12T22:14:44Z
en>Billinghurst
0
add sort to category
32290
wikitext
text/x-wiki
<references />
<noinclude>[[Category:Article templates|References]]</noinclude>
co7p5ux3d62vs8t61evme6uhgszds0q
32291
32290
2026-04-22T02:15:28Z
Satdeep Gill
85
[[:en:Template:References]] سے 1 نسخہ درآمد کیا گیا
32290
wikitext
text/x-wiki
<references />
<noinclude>[[Category:Article templates|References]]</noinclude>
co7p5ux3d62vs8t61evme6uhgszds0q
سانچہ:X-smaller/doc
10
13073
32292
2025-08-12T04:21:19Z
en>CalendulaAsteraceae
0
32292
wikitext
text/x-wiki
{{documentation subpage}}
{{high-use|{{#switch:{{ROOTPAGENAME}}
|Xxxx-smaller=66
|Xxx-smaller=80
|Xx-smaller=4660
|X-smaller=43860
|Smaller=398857
|Fine=49849
|M-larger=1954
|Larger=338142
|X-larger=146418
|Xx-larger=43843
|Xxx-larger=20807
|Xxxx-larger=10762
}}}}
== Usage ==
{{span-based-template}}
This is a font size template to simplify the formatting of text that is {{{{BASEPAGENAME}}|{{BASEPAGENAME}}}}. Refer to the table below for specifics. This template is based on {{tl|font-size-base}}.
== Example ==
{{doc example/s}}
{{{{BASEPAGENAME}}|{{BASEPAGENAME}}}}
{{{{BASEPAGENAME}}|{{BASEPAGENAME}}}}
{{doc example/e}}
Note that if you use the equals character "=", it can cause problems. Specifically, the template will think that whatever comes before the equals character is a parameter and the content won't display properly. Use <syntaxhighlight lang="wikitext" inline="yes">{{=}}</syntaxhighlight> or <syntaxhighlight lang="wikitext" inline="yes">=</syntaxhighlight> instead, or set the first parameter explicitly with <syntaxhighlight lang="wikitext" inline="yes">1=</syntaxhighlight>.
{{doc example/s}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "=", it can cause problems.}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "=", it can cause problems.}}
{{doc example/e}}
{{doc example/s}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "&equals;", it can cause problems.}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "=", it can cause problems.}}
{{doc example/e}}
{{doc example/s}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "{{=}}", it can cause problems.}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "{{=}}", it can cause problems.}}
{{doc example/e}}
{{doc example/s}}
{{{{BASEPAGENAME}}|1=Note that if you use the equals character "=", it can cause problems.}}
{{{{BASEPAGENAME}}|1=Note that if you use the equals character "=", it can cause problems.}}
{{doc example/e}}
== See also ==
{{Help:Font size templates}}
<!-- template categories -->
<includeonly>
[[Category:Formatting templates|{{PAGENAME}}]]
</includeonly>
<templatedata>
{
"params": {
"1": {
"required": true,
"label": "text",
"description": "Text to render",
"type": "content"
},
"style": {
"description": "CSS style line to apply in addition to font-size",
"type": "string"
}
},
"format": "inline"
}
</templatedata>
g7dhl8szr63ofa85hkjcz12z6ske205
32293
32292
2026-04-22T02:15:28Z
Satdeep Gill
85
[[:en:Template:X-smaller/doc]] سے 1 نسخہ درآمد کیا گیا
32292
wikitext
text/x-wiki
{{documentation subpage}}
{{high-use|{{#switch:{{ROOTPAGENAME}}
|Xxxx-smaller=66
|Xxx-smaller=80
|Xx-smaller=4660
|X-smaller=43860
|Smaller=398857
|Fine=49849
|M-larger=1954
|Larger=338142
|X-larger=146418
|Xx-larger=43843
|Xxx-larger=20807
|Xxxx-larger=10762
}}}}
== Usage ==
{{span-based-template}}
This is a font size template to simplify the formatting of text that is {{{{BASEPAGENAME}}|{{BASEPAGENAME}}}}. Refer to the table below for specifics. This template is based on {{tl|font-size-base}}.
== Example ==
{{doc example/s}}
{{{{BASEPAGENAME}}|{{BASEPAGENAME}}}}
{{{{BASEPAGENAME}}|{{BASEPAGENAME}}}}
{{doc example/e}}
Note that if you use the equals character "=", it can cause problems. Specifically, the template will think that whatever comes before the equals character is a parameter and the content won't display properly. Use <syntaxhighlight lang="wikitext" inline="yes">{{=}}</syntaxhighlight> or <syntaxhighlight lang="wikitext" inline="yes">=</syntaxhighlight> instead, or set the first parameter explicitly with <syntaxhighlight lang="wikitext" inline="yes">1=</syntaxhighlight>.
{{doc example/s}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "=", it can cause problems.}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "=", it can cause problems.}}
{{doc example/e}}
{{doc example/s}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "&equals;", it can cause problems.}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "=", it can cause problems.}}
{{doc example/e}}
{{doc example/s}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "{{=}}", it can cause problems.}}
{{{{BASEPAGENAME}}|Note that if you use the equals character "{{=}}", it can cause problems.}}
{{doc example/e}}
{{doc example/s}}
{{{{BASEPAGENAME}}|1=Note that if you use the equals character "=", it can cause problems.}}
{{{{BASEPAGENAME}}|1=Note that if you use the equals character "=", it can cause problems.}}
{{doc example/e}}
== See also ==
{{Help:Font size templates}}
<!-- template categories -->
<includeonly>
[[Category:Formatting templates|{{PAGENAME}}]]
</includeonly>
<templatedata>
{
"params": {
"1": {
"required": true,
"label": "text",
"description": "Text to render",
"type": "content"
},
"style": {
"description": "CSS style line to apply in addition to font-size",
"type": "string"
}
},
"format": "inline"
}
</templatedata>
g7dhl8szr63ofa85hkjcz12z6ske205
معاونت:Font size templates
12
13074
32294
2024-08-30T00:10:13Z
en>Ineuw
0
/* Fonts smaller than 100% with proportional line heights */ removed under construction tag
32294
wikitext
text/x-wiki
{{process header
| title = Font size templates
| section =
| previous = [[Help:Templates]]
| next =
| shortcut =
| notes =
}}
{{templatestyles|Help:Font size templates/styles.css}}
__TOC__
<onlyinclude>
<section begin="size templates"/>
<templatestyles src="Help:Font size templates/styles.css" />
<div class="relative-size-help">
All Wikisource size templates are ''relative'' to the default size. There are two kinds of sizing template: '''inline''' and '''block''' templates. Inline templates are suitable for use within a paragraph, but can't handle paragraph breaks, and do not adjust line spacing. Block templates can handle paragraph breaks, and adjust line spacing, but are not suitable for use within a paragraph, as they will cause a paragraph break. See [[H:DIVSPAN]] for more details.
</div>
{{#ifeq:{{FULLPAGENAME}}|Help:Font size templates|==|===}} Font size definition by relative differences using words {{#ifeq:{{FULLPAGENAME}}|Help:Font size templates|==|===}}
{{Notice|The line heights of fonts greater than 100% increase proportionally with the font size. The line heights of fonts less than 100% are not proportional but inherit the line height of the font at the 100% size. The smaller the font, the greater the distance between rows of text. For these, see: [[Help:Font size templates#Fonts smaller than_100% with proportional line heights|Fonts smaller than 100% with proportional line heights]].}}
{| class="font-size-table font-size-template-table"
|-
!Inline template
!Block template
!Size
!12pt/16px<br/>default base<ref>Contemporary web browsers have largely standardized on a default base font size of 12pt or 16px.</ref>
!Sample
|-
|{{tl|xxxx-smaller}} || — || 41% || 5pt/6.7px || {{xxxx-smaller|Lorem ipsum dolor sit amet,}}
|-
|{{tl|xxx-smaller}} || — || 50% || 6pt/8px || {{xxx-smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xx-smaller}} || {{tl|xx-smaller block}} || 58% || 7pt/9px || {{xx-smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|x-smaller}} || {{tl|x-smaller block}} || 69% || 8pt/11px || {{x-smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|smaller}} || {{tl|smaller block}} || 83% || 10pt/13px || {{smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|fine}} || {{tl|fine block}} || 92% || 11pt/15px || {{fine|Lorem ipsum dolor sit amet,}}
|-
|style="text-align:center;"| — ||style="text-align:center;"| — || 100% || 12pt/16px || Lorem ipsum dolor sit amet,
|-
| {{tl|m-larger}} || {{tl|m-larger block}} || 110% || 13pt/18px || {{m-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|larger}} || {{tl|larger block}} || 120% || 14pt/19px || {{larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|x-larger}} || {{tl|x-larger block}} || 144% || 17pt/23px || {{x-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xx-larger}} || {{tl|xx-larger block}} || 182% || 22pt/29px || {{xx-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xxx-larger}} || {{tl|xxx-larger block}} || 207% || 25pt/33px || {{xxx-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xxxx-larger}} || {{tl|xxxx-larger block}} || 249% || 30pt/40px || {{xxxx-larger|Lorem ipsum dolor sit amet,}}
|}
{{references}}
<section end="size templates"/>
</onlyinclude>
== 100% and smaller font size and style comparisons table==
{| class="wikitable font-size-table green-brown-table font-size-weight-table"
|-
!Template
!Normal
!Bold
!Italics
!Bold and italics
|-
|
|{{fs|100%|This is 100% font size.}}
|{{fs|100%|This is 100% font size.}}
|{{fs|100%|This is 100% font size.}}
|{{fs|100%|This is 100% font size.}}
|-
|
|{{fs|96%|This is 96% font size.}}
|{{fs|96%|This is 96% font size.}}
|{{fs|96%|This is 96% font size.}}
|{{fs|96%|This is 96% font size.}}
|-
|{{tl|fine block}} and {{tl|fine}}
|{{fs|92%|This is 92% font size.}}
|{{fs|92%|This is 92% font size.}}
|{{fs|92%|This is 92% font size.}}
|{{fs|92%|This is 92% font size.}}
|-
|
|{{fs|88%|This is 88% font size.}}
|{{fs|88%|This is 88% font size.}}
|{{fs|88%|This is 88% font size.}}
|{{fs|88%|This is 88% font size.}}
|-
|
|{{fs|84%|This is 84% font size.}}
|{{fs|84%|This is 84% font size.}}
|{{fs|84%|This is 84% font size.}}
|{{fs|84%|This is 84% font size.}}
|-
|{{tl|smaller}}
|{{fs|80%|This is 80% font size.}}
|{{fs|80%|This is 80% font size.}}
|{{fs|80%|This is 80% font size.}}
|{{fs|80%|This is 80% font size.}}
|-
|
|{{fs|76%|This is 76% font size.}}
|{{fs|76%|This is 76% font size.}}
|{{fs|76%|This is 76% font size.}}
|{{fs|76%|This is 76% font size.}}
|-
|
|{{fs|72%|This is 72% font size.}}
|{{fs|72%|This is 72% font size.}}
|{{fs|72%|This is 72% font size.}}
|{{fs|72%|This is 72% font size.}}
|-
|{{tl|x-smaller}} {{tl|x-smaller block}}
|{{fs|68%|This is 68% font size.}}
|{{fs|68%|This is 68% font size.}}
|{{fs|68%|This is 68% font size.}}
|{{fs|68%|This is 68% font size.}}
|-
|{{tl|xx-smaller}} {{tl|xx-smaller block}}
|{{fs|58%|This is 58% font size.}}
|{{fs|58%|This is 58% font size.}}
|{{fs|58%|This is 58% font size.}}
|{{fs|58%|This is 58% font size.}}
|}
== Fonts smaller than 100% with proportional line heights ==
{| class="wikitable font-size-table green-brown-table"
|-
|+ Line height of 100% font size is 140%
|-
! Template
! Font size
! Line height
! Block
! Inline
! Comments
|-
| {{tl|fs70}}
| 70%
| inherited
|
| {{tick|10}}
| used for fractions {{tl|sfrac}} inline, no paragraph padding
|-
| {{tl|fs75}}
| 75%
| inherited
|
| {{tick|10}}
| no paragraph padding
|-
| {{tl|fs80}}
| 80%
| 112%
| {{tick|10}}
|
| .50em padding before and after single paragraph
|-
| {{tl|fs80/s}} & {{tl|fs80/e}}
| 80%
| 112%
| {{tick|10}}
|
| .50em padding before and after single paragraph
|-
| {{tl|fs85}}
| 85%
| 119%
|{{tick|10}}
|
| .50em padding before and after a single paragraph
|-
| {{tl|fs85/s}} & {{tl|fs85/e}}
| 85%
| 119%
| {{tick|10}}
|
| .50em padding before and after spanning multiple paragraph(s) or page(s)
|-
| {{tl|fs90}}
| 90%
| 126%
| {{tick|10}}
|
| .50em padding included before and after wrapped text.
|-
| {{tl|fs90/s}} & {{tl|fs90/e}}
| 90%
| 126%
| {{tick|10}}
|
| .50em padding before and after spanning multiple paragraph(s) or page(s)
|-
|}
==See also==
* [[Help:Templates]]
[[Category:Template templates]]
[[Category:Help]]
tmagzvh1egrsdaktposxqgyk2xtiwfw
32295
32294
2026-04-22T02:15:29Z
Satdeep Gill
85
[[:en:Help:Font_size_templates]] سے 1 نسخہ درآمد کیا گیا
32294
wikitext
text/x-wiki
{{process header
| title = Font size templates
| section =
| previous = [[Help:Templates]]
| next =
| shortcut =
| notes =
}}
{{templatestyles|Help:Font size templates/styles.css}}
__TOC__
<onlyinclude>
<section begin="size templates"/>
<templatestyles src="Help:Font size templates/styles.css" />
<div class="relative-size-help">
All Wikisource size templates are ''relative'' to the default size. There are two kinds of sizing template: '''inline''' and '''block''' templates. Inline templates are suitable for use within a paragraph, but can't handle paragraph breaks, and do not adjust line spacing. Block templates can handle paragraph breaks, and adjust line spacing, but are not suitable for use within a paragraph, as they will cause a paragraph break. See [[H:DIVSPAN]] for more details.
</div>
{{#ifeq:{{FULLPAGENAME}}|Help:Font size templates|==|===}} Font size definition by relative differences using words {{#ifeq:{{FULLPAGENAME}}|Help:Font size templates|==|===}}
{{Notice|The line heights of fonts greater than 100% increase proportionally with the font size. The line heights of fonts less than 100% are not proportional but inherit the line height of the font at the 100% size. The smaller the font, the greater the distance between rows of text. For these, see: [[Help:Font size templates#Fonts smaller than_100% with proportional line heights|Fonts smaller than 100% with proportional line heights]].}}
{| class="font-size-table font-size-template-table"
|-
!Inline template
!Block template
!Size
!12pt/16px<br/>default base<ref>Contemporary web browsers have largely standardized on a default base font size of 12pt or 16px.</ref>
!Sample
|-
|{{tl|xxxx-smaller}} || — || 41% || 5pt/6.7px || {{xxxx-smaller|Lorem ipsum dolor sit amet,}}
|-
|{{tl|xxx-smaller}} || — || 50% || 6pt/8px || {{xxx-smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xx-smaller}} || {{tl|xx-smaller block}} || 58% || 7pt/9px || {{xx-smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|x-smaller}} || {{tl|x-smaller block}} || 69% || 8pt/11px || {{x-smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|smaller}} || {{tl|smaller block}} || 83% || 10pt/13px || {{smaller|Lorem ipsum dolor sit amet,}}
|-
| {{tl|fine}} || {{tl|fine block}} || 92% || 11pt/15px || {{fine|Lorem ipsum dolor sit amet,}}
|-
|style="text-align:center;"| — ||style="text-align:center;"| — || 100% || 12pt/16px || Lorem ipsum dolor sit amet,
|-
| {{tl|m-larger}} || {{tl|m-larger block}} || 110% || 13pt/18px || {{m-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|larger}} || {{tl|larger block}} || 120% || 14pt/19px || {{larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|x-larger}} || {{tl|x-larger block}} || 144% || 17pt/23px || {{x-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xx-larger}} || {{tl|xx-larger block}} || 182% || 22pt/29px || {{xx-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xxx-larger}} || {{tl|xxx-larger block}} || 207% || 25pt/33px || {{xxx-larger|Lorem ipsum dolor sit amet,}}
|-
| {{tl|xxxx-larger}} || {{tl|xxxx-larger block}} || 249% || 30pt/40px || {{xxxx-larger|Lorem ipsum dolor sit amet,}}
|}
{{references}}
<section end="size templates"/>
</onlyinclude>
== 100% and smaller font size and style comparisons table==
{| class="wikitable font-size-table green-brown-table font-size-weight-table"
|-
!Template
!Normal
!Bold
!Italics
!Bold and italics
|-
|
|{{fs|100%|This is 100% font size.}}
|{{fs|100%|This is 100% font size.}}
|{{fs|100%|This is 100% font size.}}
|{{fs|100%|This is 100% font size.}}
|-
|
|{{fs|96%|This is 96% font size.}}
|{{fs|96%|This is 96% font size.}}
|{{fs|96%|This is 96% font size.}}
|{{fs|96%|This is 96% font size.}}
|-
|{{tl|fine block}} and {{tl|fine}}
|{{fs|92%|This is 92% font size.}}
|{{fs|92%|This is 92% font size.}}
|{{fs|92%|This is 92% font size.}}
|{{fs|92%|This is 92% font size.}}
|-
|
|{{fs|88%|This is 88% font size.}}
|{{fs|88%|This is 88% font size.}}
|{{fs|88%|This is 88% font size.}}
|{{fs|88%|This is 88% font size.}}
|-
|
|{{fs|84%|This is 84% font size.}}
|{{fs|84%|This is 84% font size.}}
|{{fs|84%|This is 84% font size.}}
|{{fs|84%|This is 84% font size.}}
|-
|{{tl|smaller}}
|{{fs|80%|This is 80% font size.}}
|{{fs|80%|This is 80% font size.}}
|{{fs|80%|This is 80% font size.}}
|{{fs|80%|This is 80% font size.}}
|-
|
|{{fs|76%|This is 76% font size.}}
|{{fs|76%|This is 76% font size.}}
|{{fs|76%|This is 76% font size.}}
|{{fs|76%|This is 76% font size.}}
|-
|
|{{fs|72%|This is 72% font size.}}
|{{fs|72%|This is 72% font size.}}
|{{fs|72%|This is 72% font size.}}
|{{fs|72%|This is 72% font size.}}
|-
|{{tl|x-smaller}} {{tl|x-smaller block}}
|{{fs|68%|This is 68% font size.}}
|{{fs|68%|This is 68% font size.}}
|{{fs|68%|This is 68% font size.}}
|{{fs|68%|This is 68% font size.}}
|-
|{{tl|xx-smaller}} {{tl|xx-smaller block}}
|{{fs|58%|This is 58% font size.}}
|{{fs|58%|This is 58% font size.}}
|{{fs|58%|This is 58% font size.}}
|{{fs|58%|This is 58% font size.}}
|}
== Fonts smaller than 100% with proportional line heights ==
{| class="wikitable font-size-table green-brown-table"
|-
|+ Line height of 100% font size is 140%
|-
! Template
! Font size
! Line height
! Block
! Inline
! Comments
|-
| {{tl|fs70}}
| 70%
| inherited
|
| {{tick|10}}
| used for fractions {{tl|sfrac}} inline, no paragraph padding
|-
| {{tl|fs75}}
| 75%
| inherited
|
| {{tick|10}}
| no paragraph padding
|-
| {{tl|fs80}}
| 80%
| 112%
| {{tick|10}}
|
| .50em padding before and after single paragraph
|-
| {{tl|fs80/s}} & {{tl|fs80/e}}
| 80%
| 112%
| {{tick|10}}
|
| .50em padding before and after single paragraph
|-
| {{tl|fs85}}
| 85%
| 119%
|{{tick|10}}
|
| .50em padding before and after a single paragraph
|-
| {{tl|fs85/s}} & {{tl|fs85/e}}
| 85%
| 119%
| {{tick|10}}
|
| .50em padding before and after spanning multiple paragraph(s) or page(s)
|-
| {{tl|fs90}}
| 90%
| 126%
| {{tick|10}}
|
| .50em padding included before and after wrapped text.
|-
| {{tl|fs90/s}} & {{tl|fs90/e}}
| 90%
| 126%
| {{tick|10}}
|
| .50em padding before and after spanning multiple paragraph(s) or page(s)
|-
|}
==See also==
* [[Help:Templates]]
[[Category:Template templates]]
[[Category:Help]]
tmagzvh1egrsdaktposxqgyk2xtiwfw
سانچہ:M-larger
10
13075
32296
2025-08-12T03:56:07Z
en>CalendulaAsteraceae
0
32296
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=110%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
kyze4u40lguir8y85u5e8vc0s3yf8x2
32297
32296
2026-04-22T02:15:29Z
Satdeep Gill
85
[[:en:Template:M-larger]] سے 1 نسخہ درآمد کیا گیا
32296
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=110%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
kyze4u40lguir8y85u5e8vc0s3yf8x2
سانچہ:Xxx-smaller
10
13076
32298
2025-08-12T03:57:39Z
en>CalendulaAsteraceae
0
32298
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=50%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
3n37rfat4sxh1m4uwsvfq4q4jquf991
32299
32298
2026-04-22T02:15:29Z
Satdeep Gill
85
[[:en:Template:Xxx-smaller]] سے 1 نسخہ درآمد کیا گیا
32298
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=50%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
3n37rfat4sxh1m4uwsvfq4q4jquf991
معاونت:Font size templates/styles.css
12
13077
32300
2026-01-02T17:54:48Z
en>Tosca-the-engineer
0
remove width:50em; from .relative-size-help
32300
sanitized-css
text/css
.relative-size-help {
margin:auto;
text-align:justify;
}
.font-size-table {
margin:auto;
border-collapse:collapse;
line-height:inherit;
}
.font-size-template-table th, .font-size-template-table td {
padding:0 1em;
}
.font-size-template-table td:nth-child(3),
.font-size-template-table td:nth-child(4) {
text-align:right;
}
.green-brown-table, .green-brown-table td {
background-color:#ECFCF4;
color: #202122;
border:1px solid #966;
}
.green-brown-table caption, .green-brown-table th {
background-color:#DDCCAA;
color: #202122;
border:1px solid #966;
}
.green-brown-table caption {
padding-top:0.5em;
padding-bottom:0.5em;
}
.font-size-weight-table tr > :first-child,
.font-size-weight-table tr > :nth-child(2) {
font-weight:normal;
}
.font-size-weight-table tr > :nth-child(3) {
font-weight:bold;
}
.font-size-weight-table tr > :nth-child(4) {
font-weight:normal;
font-style:italic;
}
.font-size-weight-table tr > :nth-child(5) {
font-weight:bold;
font-style:italic;
}
c882tyosjafyrs4fpxuglq9wx4ybzyl
32301
32300
2026-04-22T02:15:29Z
Satdeep Gill
85
[[:en:Help:Font_size_templates/styles.css]] سے 1 نسخہ درآمد کیا گیا
32300
sanitized-css
text/css
.relative-size-help {
margin:auto;
text-align:justify;
}
.font-size-table {
margin:auto;
border-collapse:collapse;
line-height:inherit;
}
.font-size-template-table th, .font-size-template-table td {
padding:0 1em;
}
.font-size-template-table td:nth-child(3),
.font-size-template-table td:nth-child(4) {
text-align:right;
}
.green-brown-table, .green-brown-table td {
background-color:#ECFCF4;
color: #202122;
border:1px solid #966;
}
.green-brown-table caption, .green-brown-table th {
background-color:#DDCCAA;
color: #202122;
border:1px solid #966;
}
.green-brown-table caption {
padding-top:0.5em;
padding-bottom:0.5em;
}
.font-size-weight-table tr > :first-child,
.font-size-weight-table tr > :nth-child(2) {
font-weight:normal;
}
.font-size-weight-table tr > :nth-child(3) {
font-weight:bold;
}
.font-size-weight-table tr > :nth-child(4) {
font-weight:normal;
font-style:italic;
}
.font-size-weight-table tr > :nth-child(5) {
font-weight:bold;
font-style:italic;
}
c882tyosjafyrs4fpxuglq9wx4ybzyl
سانچہ:Xxxx-smaller
10
13078
32302
2025-08-12T03:57:53Z
en>CalendulaAsteraceae
0
32302
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=41%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
gdj5dsp8q3zrihqgpts2aalqthjqpkb
32303
32302
2026-04-22T02:15:29Z
Satdeep Gill
85
[[:en:Template:Xxxx-smaller]] سے 1 نسخہ درآمد کیا گیا
32302
wikitext
text/x-wiki
<includeonly>{{font-size-base|font-size=41%|style={{{style|}}}|1={{{1}}}}}</includeonly><noinclude>
{{documentation|Template:X-smaller/doc}}
</noinclude>
gdj5dsp8q3zrihqgpts2aalqthjqpkb
سانچہ:Block center
10
13079
32304
2025-06-15T17:01:29Z
en>Uzume
0
+align-last
32304
wikitext
text/x-wiki
{{block center/s
| class = {{{class|}}}
| width = {{{width|}}}
| height = {{{height|}}}
| align = {{{talign|{{{align|}}}}}}
| align-last = {{{talign-last|{{{align-last|}}}}}}
| max-width = {{{max-width|}}}
| style = {{{style|}}}
| title = {{{title|}}}
}}
{{{text|{{{body|{{{1}}}}}}}}}
{{block center/e}}<noinclude>{{Documentation}}</noinclude>
71bs9etn1wpa9jp7b8lmmzmy6tcf524
32305
32304
2026-04-22T02:15:43Z
Satdeep Gill
85
[[:en:Template:Block_center]] سے 1 نسخہ درآمد کیا گیا
32304
wikitext
text/x-wiki
{{block center/s
| class = {{{class|}}}
| width = {{{width|}}}
| height = {{{height|}}}
| align = {{{talign|{{{align|}}}}}}
| align-last = {{{talign-last|{{{align-last|}}}}}}
| max-width = {{{max-width|}}}
| style = {{{style|}}}
| title = {{{title|}}}
}}
{{{text|{{{body|{{{1}}}}}}}}}
{{block center/e}}<noinclude>{{Documentation}}</noinclude>
71bs9etn1wpa9jp7b8lmmzmy6tcf524
سانچہ:Gap
10
13080
32306
2024-04-29T11:06:20Z
en>Great Brightstar
0
New method without character
32306
wikitext
text/x-wiki
<onlyinclude><span class="wst-gap __gap {{{class|}}}" style="display:inline-block; inline-size:{{{1|2em}}}"></span></onlyinclude><noinclude>
{{documentation}}
</noinclude>
dayxo3fkl6lodm6yac4b81n8xpe82xa
32307
32306
2026-04-22T02:15:44Z
Satdeep Gill
85
[[:en:Template:Gap]] سے 1 نسخہ درآمد کیا گیا
32306
wikitext
text/x-wiki
<onlyinclude><span class="wst-gap __gap {{{class|}}}" style="display:inline-block; inline-size:{{{1|2em}}}"></span></onlyinclude><noinclude>
{{documentation}}
</noinclude>
dayxo3fkl6lodm6yac4b81n8xpe82xa
سانچہ:Block center/styles.css
10
13081
32308
2025-10-05T07:46:08Z
en>CalendulaAsteraceae
0
Protected "[[Template:Block center/styles.css]]": High traffic page or template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32308
sanitized-css
text/css
.wst-block-center {
display:block;
margin:0 auto;
padding:0;
position:relative;
/* width:fit-content; */
max-width:100%;
height:auto;
text-align:initial;
}
.wst-block-center-title {
display:inline-block;
width:100%;
text-align:center;
}
1c2vxdzblkm3uqswy2pouxnzlwmhbfb
32309
32308
2026-04-22T02:15:44Z
Satdeep Gill
85
[[:en:Template:Block_center/styles.css]] سے 1 نسخہ درآمد کیا گیا
32308
sanitized-css
text/css
.wst-block-center {
display:block;
margin:0 auto;
padding:0;
position:relative;
/* width:fit-content; */
max-width:100%;
height:auto;
text-align:initial;
}
.wst-block-center-title {
display:inline-block;
width:100%;
text-align:center;
}
1c2vxdzblkm3uqswy2pouxnzlwmhbfb
سانچہ:Bc
10
13082
32310
2011-08-05T06:59:50Z
en>Blurpeace
0
create
32310
wikitext
text/x-wiki
#REDIRECT [[Template:Block center]]
a2vxsc7tmq02qcb5q2qypup3dr0sh6o
32311
32310
2026-04-22T02:15:44Z
Satdeep Gill
85
[[:en:Template:Bc]] سے 1 نسخہ درآمد کیا گیا
32310
wikitext
text/x-wiki
#REDIRECT [[Template:Block center]]
a2vxsc7tmq02qcb5q2qypup3dr0sh6o
سانچہ:Block center/s
10
13083
32312
2025-11-05T05:15:39Z
en>CalendulaAsteraceae
0
Protected "[[Template:Block center/s]]": High traffic page or template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
32312
wikitext
text/x-wiki
<templatestyles src="Template:Block center/styles.css" /><div class="wst-block-center {{{class|}}}" {{optional style
| width = {{#if:{{{width|}}}|{{{width}}}|fit-content}}<!--here because it's not allowed in the stylesheet; can't do {{{width|fit-content}}} because it's a pass-through parameter-->
| height = {{{height|}}}
| text-align = {{{talign|{{{align|}}}}}}
| text-align-last = {{{talign-last|{{{align-last|}}}}}}
| max-width = {{{max-width|}}}
| style = {{{style|}}}
}}>{{#if:{{{title|}}}|<div class="wst-block-center-title">{{{title}}}</div>[[Category:Pages using center block with title parameter]]|}}<!--
-->{{#if:{{{height|}}}|[[Category:Pages using center block with height parameter]]}}<!--
-->{{#if:{{{width|}}}|[[Category:Pages using center block with width parameter]]}}<!--
-->{{#if:{{{max-width|}}}|[[Category:Pages using center block with max-width parameter]]}}<!--
-->{{#if:{{{align|}}}{{{talign|}}}|[[Category:Pages using center block with align parameter]]}}<!--
-->{{#if:{{{align-last|}}}{{{talign-last|}}}|[[Category:Pages using center block with align-last parameter]]}}<!--
-->{{#if:{{{style|}}}|[[Category:Pages using center block with style parameter]]}}<!--
-->{{#if:{{{class|}}}|[[Category:Pages using center block with class parameter]]}}<!--
--><noinclude>{{div end}}{{documentation}}</noinclude>
65w3hqmwhax1mc136133j5iit0txwtw
32313
32312
2026-04-22T02:15:44Z
Satdeep Gill
85
[[:en:Template:Block_center/s]] سے 1 نسخہ درآمد کیا گیا
32312
wikitext
text/x-wiki
<templatestyles src="Template:Block center/styles.css" /><div class="wst-block-center {{{class|}}}" {{optional style
| width = {{#if:{{{width|}}}|{{{width}}}|fit-content}}<!--here because it's not allowed in the stylesheet; can't do {{{width|fit-content}}} because it's a pass-through parameter-->
| height = {{{height|}}}
| text-align = {{{talign|{{{align|}}}}}}
| text-align-last = {{{talign-last|{{{align-last|}}}}}}
| max-width = {{{max-width|}}}
| style = {{{style|}}}
}}>{{#if:{{{title|}}}|<div class="wst-block-center-title">{{{title}}}</div>[[Category:Pages using center block with title parameter]]|}}<!--
-->{{#if:{{{height|}}}|[[Category:Pages using center block with height parameter]]}}<!--
-->{{#if:{{{width|}}}|[[Category:Pages using center block with width parameter]]}}<!--
-->{{#if:{{{max-width|}}}|[[Category:Pages using center block with max-width parameter]]}}<!--
-->{{#if:{{{align|}}}{{{talign|}}}|[[Category:Pages using center block with align parameter]]}}<!--
-->{{#if:{{{align-last|}}}{{{talign-last|}}}|[[Category:Pages using center block with align-last parameter]]}}<!--
-->{{#if:{{{style|}}}|[[Category:Pages using center block with style parameter]]}}<!--
-->{{#if:{{{class|}}}|[[Category:Pages using center block with class parameter]]}}<!--
--><noinclude>{{div end}}{{documentation}}</noinclude>
65w3hqmwhax1mc136133j5iit0txwtw
سانچہ:Block center/e
10
13084
32314
2024-06-10T02:21:56Z
en>CalendulaAsteraceae
0
footer param is unused
32314
wikitext
text/x-wiki
#redirect[[Template:Div end]]
exllz7k5cunac41zi64n3793tmll7bx
32315
32314
2026-04-22T02:15:45Z
Satdeep Gill
85
[[:en:Template:Block_center/e]] سے 1 نسخہ درآمد کیا گیا
32314
wikitext
text/x-wiki
#redirect[[Template:Div end]]
exllz7k5cunac41zi64n3793tmll7bx
سانچہ:-
10
13085
32316
2022-09-10T22:03:57Z
en>SnowyCinema
0
Changed redirect target from [[Masses]] to [[Template:Clear]]
32316
wikitext
text/x-wiki
#REDIRECT [[Template:Clear]]
321aaofzzzl6ha5uj7sf2v4753r6ydi
32317
32316
2026-04-22T02:15:45Z
Satdeep Gill
85
[[:en:Template:-]] سے 1 نسخہ درآمد کیا گیا
32316
wikitext
text/x-wiki
#REDIRECT [[Template:Clear]]
321aaofzzzl6ha5uj7sf2v4753r6ydi
سانچہ:Block center/doc
10
13086
32318
2026-03-08T16:08:00Z
en>Alien333
0
clean up now that center block redirects here (no need for all the ifexprs)
32318
wikitext
text/x-wiki
{{documentation subpage}}{{#ifeq:{{ROOTPAGENAME}}|Block center|{{template shortcut|bc}}}}
{{uses TemplateStyles|Template:{{ROOTPAGENAME}}/styles.css}}
{{div-based-template|class={{#ifeq:{{ROOTPAGENAME}}|Block center|.wst-block-center|.wst-center-block}}}}
{{#switch:{{PAGENAME}}
|Center block/s|Center block/s/sandbox={{high use|39845}}
|Center block|Center block/sandbox={{high use|22552}}
|Block center/s|Block center/s/sandbox={{high use|233347}}
|Block center|Block center/sandbox|#default={{high use|125207}}
}}
==Usage==
This template places a block of text in the center of the page, without affecting the text alignment within that block.
{{tl|bc}} is a shorter form of this template that redirects here.
===Comparison of {{tl|Block center}} and {{tl|Center}}===
This template retains the current text alignment (usually left), but moves the entire block of text into the center. To change to centered text alignment, use {{tl|center}} instead.
'''Blockcenter''':
{{{{ROOTPAGENAME}}|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
'''Center''':
{{center|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
===Parameters===
All parameters are optional except for the text.
* {{parameter|1}}, {{parameter|text}}, {{parameter|body}}: the text to be placed centrally as a block.
* {{parameter|title}}: title of the block.
* {{parameter|width}}: the width of the block (needs units which are valid CSS units).
* {{parameter|max-width}}: the maximum width of the block (needs units which are valid CSS units).
* {{parameter|height}}: the height of the block (needs units which are valid CSS units). Use adds pages to [[:Category:Pages using center block with height parameter]].
* {{parameter|align}}: the text alignment within the block. One of <code>left</code>, <code>right</code>, <code>center</code>, <code>justify</code>; default is unspecified and so inherits from the parent.
* {{parameter|align-last}}: the text alignment of last line within the block. One of <code>left</code>, <code>right</code>, <code>center</code>, <code>justify</code>; default is unspecified and so inherits from the parent.
* {{parameter|class}}: additional CSS classes, which can be used in conjunction with [[Help:Page styles|index CSS]]. The classes <code>wst-block-center</code> and <code>wst-block-center-title</code> are always applied to the block and the title respectively.
* {{parameter|style}}: additional CSS styles (prefer a class if the style is re-used within a work).
===={{parameter|title}}====
Where there is a need to give the title of the work, an optional "title" parameter can be used. Sometimes this is will center the title better than a stand-alone line will; other times not - it usually depends on if a fixed width (next example) is forced or not.
{{doc example/s}}
<pre>{{block center|title=Lorem Ipsum|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}</pre>
{{Block center|title=Lorem Ipsum|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
{{doc example/e}}
===={{parameter|width}}====
Where there is a requirement to fix the width of the block, an optional "width" parameter can be used. Sometimes this is required to force a wider width when line wrap occurs.
{{doc example/s}}
<pre>{{block center|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}</pre>
{{Block center|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
{{doc example/e}}
For exactly the same "spacing" as rendered by normal paragraph(s) before and/or after the template-inserted content:
{{doc example/s}}
<pre><p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{block center|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p></pre>
<p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{bc|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p>
{{doc example/e}}
Note: this will force the width even when the page is narrower than the given width, up to the maximum specified by {{parameter|max-width}}, or 100% if that's not given.
Note: generally, <em>avoid using percentages</em>, as this will probably be unreasonably narrow on small screens. If the content is text, prefer text-relative CSS units, such as ''em''. See [[H:PXWIDTH]] for more details.
===={{parameter|max-width}}====
This parameter provides a <em>maximum</em> width for the block, such that no matter how wide the parent container, the centered block will be no wider than this. Very often, this is a better choice than {{parameter|width}}, because it allows content to shrink on smaller screens like e-readers.
{{doc example/s}}
<pre>{{block center|max-width=15em|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna}}</pre>
{{block center|max-width=15em|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna}}
{{doc example/e}}
However, if the parent container is <em>smaller</em> that this value, the block will shrink as normal:
{{doc example/s}}
<pre><div style="width:10em; margin:auto;">
{{block center|max-width=15em|
Lorem ipsum dolor sit amet, consectetur adipisicing elit
}}
</div></pre>
<div style="width:10em; margin:auto;">
{{Block center|max-width=15em|
Lorem ipsum dolor sit amet, consectetur adipisicing elit
}}
</div>
{{doc example/e}}
The two parameters can be combined. In this case, the width will be set according to the {{parameter|width}} parameter on small screens (below the max-width value), and then will be limited to the {{parameter|max-width}} value on large screens. Note that the width value has to change according to the parent size, so it's normally a percentage value (often 100%).
This is useful when there are floated blocks that don't cause the block to expand to the correct width, but where it's still desirable for the block to shrink on smaller screens:
{{doc example/s}}
<pre><div style="width:100%; border:1px dashed green;">
{{block center|max-width=40em|width=100%
|Wide parent: max-width of 40em applies.{{-}}{{float right|''Text on the right.''}}
}}
</div></pre>
<div style="width:100%; border:1px dashed green;">
{{Block center|max-width=40em|width=100%
|Wide parent: max-width of 40em applies.{{-}}{{float right|''Text on the right.''}}
}}
</div>
{{doc example/e}}
{{doc example/s}}
<pre><div style="width:30em; margin:auto; border:1px dashed green;">
{{block center|max-width=40em|width=100%
|Narrow parent: 100% width{{-}}{{float right|''Text on the right.''}}
}}
</div></pre>
<div style="width:30em; margin:auto; border:1px dashed green;">
{{Block center|max-width=40em|width=100%
|Narrow parent: 100% width{{-}}{{float right|''Text on the right.''}}
}}
</div>
{{doc example/e}}
===={{parameter|height}}====
{{doc example/s}}
<pre>{{block center|height=15em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}</pre>
{{Block center|height=15em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
{{doc example/e}}
===={{parameter|align}}====
The text alignment within the (overall) centered block may be controlled using this parameter.
{{doc example/s}}
<pre>{{block center|align=right|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}</pre>
{{Block center|align=right|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}
{{doc example/e}}
===={{parameter|style}}====
Where there is a need to specify the style of the text, an optional "style" parameter can be used. This parameter takes the same style attributes that can be set for any table.
{{doc example/s}}
<pre>{{block center|style=font-style:italic|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}</pre>
{{Block center|style=font-style:italic|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}
{{doc example/e}}
For slightly larger "spacing" between normal paragraph(s) before &/or after the template-inserted content:
{{doc example/s}}
<pre><p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{block center|style=max-width:25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p></pre>
<p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{Block center|style=max-width:25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p>
{{doc example/e}}
===Spanning multiple pages===
If you use many separate block centers you will find that every page has a slightly different alignment; however, this template cannot be left "dangling" and closed on another page to create one big block center. If you have a multipage block center, you can use {{tl|Block center/s}} and {{tl|Block center/e}} to open and close it on each page. Every page must have one of each, one at the start and one at the end. However, you may place one or both of them in the header or footer, so they will not be transcluded to the main namespace. When the pages are all transcluded, you will end up with just one {{tl|Block center/s}} and just one {{tl|Block center/e}} at the start and end of the section, respectively. See [[Help:Page breaks]] for more information.
====First page====
'''Header'''
Nothing is required in the header
'''Body'''
<pre>{{block center/s}}</pre>
Start of the block center text. Contents of the block center goes here.
'''Footer'''
<pre>{{block center/e}}</pre>
====Middle pages====
'''Header'''
<pre>{{block center/s}}</pre>
'''Body'''
Contents of the block center go here; this continues the previous page.
'''Footer'''
<pre>{{block center/e}}</pre>
====Last page====
'''Header'''
<pre>{{block center/s}}</pre>
'''Body'''
Contents of the block center go here; this continues the previous page. Last bit of block center text.
<pre>{{block center/e}}</pre>
'''Footer'''
Nothing is required in the footer of the last page.
== Tracking categories ==
* [[:Category:Pages using center block with title parameter]]
* [[:Category:Pages using center block with style parameters]]
** [[:Category:Pages using center block with class parameter]]
** [[:Category:Pages using center block with height parameter]]
** [[:Category:Pages using center block with width parameter]]
** [[:Category:Pages using center block with max-width parameter]]
** [[:Category:Pages using center block with align parameter]]
** [[:Category:Pages using center block with align-last parameter]]
** [[:Category:Pages using center block with style parameter]]
==See also==
* {{tl|block left}}
* {{tl|block right}}<includeonly>
[[Category:Formatting templates]]
[[Category:Templates applying classes for page styles]]
</includeonly>
== TemplateData ==
{{templatedata header}}
<templatedata>
{
"params": {
"class": {
"label": "class",
"description": "Additional CSS classes, which can be used in conjunction with index CSS",
"type": "line"
},
"width": {
"label": "width",
"description": "The width of the block (needs units which are valid CSS units)",
"type": "line"
},
"align": {
"aliases": [
"talign"
],
"label": "align",
"description": "The text alignment within the block",
"suggestedvalues": [
"left",
"center",
"right",
"justify"
],
"type": "line",
"default": "inherit"
},
"align-last": {
"aliases": [
"talign-last"
],
"label": "align-last",
"description": "The text alignment of the last line within the block",
"suggestedvalues": [
"left",
"center",
"right",
"justify"
],
"type": "line",
"default": "inherit"
},
"max-width": {
"type": "line",
"description": "The maximum width of the block (needs units which are valid CSS units)"
},
"style": {
"label": "style",
"description": "Additional CSS styles",
"type": "line"
},
"title": {
"label": "title",
"description": "Title of the block",
"type": "content"
},
"height": {
"type": "line",
"description": "The height of the block (needs units which are valid CSS units)"
},
"text": {
"aliases": [
"1",
"body"
],
"description": "Content to place in a centered block",
"type": "content",
"required": true
}
},
"format": "block",
"description": "Render content in a centered block",
"paramOrder": [
"text",
"title",
"class",
"height",
"width",
"max-width",
"align",
"align-last",
"style"
]
}
</templatedata>
pft8j6cx3093d3a33kqhvwcvsdx8ujc
32319
32318
2026-04-22T02:15:45Z
Satdeep Gill
85
[[:en:Template:Block_center/doc]] سے 1 نسخہ درآمد کیا گیا
32318
wikitext
text/x-wiki
{{documentation subpage}}{{#ifeq:{{ROOTPAGENAME}}|Block center|{{template shortcut|bc}}}}
{{uses TemplateStyles|Template:{{ROOTPAGENAME}}/styles.css}}
{{div-based-template|class={{#ifeq:{{ROOTPAGENAME}}|Block center|.wst-block-center|.wst-center-block}}}}
{{#switch:{{PAGENAME}}
|Center block/s|Center block/s/sandbox={{high use|39845}}
|Center block|Center block/sandbox={{high use|22552}}
|Block center/s|Block center/s/sandbox={{high use|233347}}
|Block center|Block center/sandbox|#default={{high use|125207}}
}}
==Usage==
This template places a block of text in the center of the page, without affecting the text alignment within that block.
{{tl|bc}} is a shorter form of this template that redirects here.
===Comparison of {{tl|Block center}} and {{tl|Center}}===
This template retains the current text alignment (usually left), but moves the entire block of text into the center. To change to centered text alignment, use {{tl|center}} instead.
'''Blockcenter''':
{{{{ROOTPAGENAME}}|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
'''Center''':
{{center|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
===Parameters===
All parameters are optional except for the text.
* {{parameter|1}}, {{parameter|text}}, {{parameter|body}}: the text to be placed centrally as a block.
* {{parameter|title}}: title of the block.
* {{parameter|width}}: the width of the block (needs units which are valid CSS units).
* {{parameter|max-width}}: the maximum width of the block (needs units which are valid CSS units).
* {{parameter|height}}: the height of the block (needs units which are valid CSS units). Use adds pages to [[:Category:Pages using center block with height parameter]].
* {{parameter|align}}: the text alignment within the block. One of <code>left</code>, <code>right</code>, <code>center</code>, <code>justify</code>; default is unspecified and so inherits from the parent.
* {{parameter|align-last}}: the text alignment of last line within the block. One of <code>left</code>, <code>right</code>, <code>center</code>, <code>justify</code>; default is unspecified and so inherits from the parent.
* {{parameter|class}}: additional CSS classes, which can be used in conjunction with [[Help:Page styles|index CSS]]. The classes <code>wst-block-center</code> and <code>wst-block-center-title</code> are always applied to the block and the title respectively.
* {{parameter|style}}: additional CSS styles (prefer a class if the style is re-used within a work).
===={{parameter|title}}====
Where there is a need to give the title of the work, an optional "title" parameter can be used. Sometimes this is will center the title better than a stand-alone line will; other times not - it usually depends on if a fixed width (next example) is forced or not.
{{doc example/s}}
<pre>{{block center|title=Lorem Ipsum|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}</pre>
{{Block center|title=Lorem Ipsum|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
{{doc example/e}}
===={{parameter|width}}====
Where there is a requirement to fix the width of the block, an optional "width" parameter can be used. Sometimes this is required to force a wider width when line wrap occurs.
{{doc example/s}}
<pre>{{block center|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}</pre>
{{Block center|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br/>
Aenean commodo ligula eget dolor.
Aenean massa.}}
{{doc example/e}}
For exactly the same "spacing" as rendered by normal paragraph(s) before and/or after the template-inserted content:
{{doc example/s}}
<pre><p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{block center|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p></pre>
<p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{bc|width=25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p>
{{doc example/e}}
Note: this will force the width even when the page is narrower than the given width, up to the maximum specified by {{parameter|max-width}}, or 100% if that's not given.
Note: generally, <em>avoid using percentages</em>, as this will probably be unreasonably narrow on small screens. If the content is text, prefer text-relative CSS units, such as ''em''. See [[H:PXWIDTH]] for more details.
===={{parameter|max-width}}====
This parameter provides a <em>maximum</em> width for the block, such that no matter how wide the parent container, the centered block will be no wider than this. Very often, this is a better choice than {{parameter|width}}, because it allows content to shrink on smaller screens like e-readers.
{{doc example/s}}
<pre>{{block center|max-width=15em|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna}}</pre>
{{block center|max-width=15em|Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna}}
{{doc example/e}}
However, if the parent container is <em>smaller</em> that this value, the block will shrink as normal:
{{doc example/s}}
<pre><div style="width:10em; margin:auto;">
{{block center|max-width=15em|
Lorem ipsum dolor sit amet, consectetur adipisicing elit
}}
</div></pre>
<div style="width:10em; margin:auto;">
{{Block center|max-width=15em|
Lorem ipsum dolor sit amet, consectetur adipisicing elit
}}
</div>
{{doc example/e}}
The two parameters can be combined. In this case, the width will be set according to the {{parameter|width}} parameter on small screens (below the max-width value), and then will be limited to the {{parameter|max-width}} value on large screens. Note that the width value has to change according to the parent size, so it's normally a percentage value (often 100%).
This is useful when there are floated blocks that don't cause the block to expand to the correct width, but where it's still desirable for the block to shrink on smaller screens:
{{doc example/s}}
<pre><div style="width:100%; border:1px dashed green;">
{{block center|max-width=40em|width=100%
|Wide parent: max-width of 40em applies.{{-}}{{float right|''Text on the right.''}}
}}
</div></pre>
<div style="width:100%; border:1px dashed green;">
{{Block center|max-width=40em|width=100%
|Wide parent: max-width of 40em applies.{{-}}{{float right|''Text on the right.''}}
}}
</div>
{{doc example/e}}
{{doc example/s}}
<pre><div style="width:30em; margin:auto; border:1px dashed green;">
{{block center|max-width=40em|width=100%
|Narrow parent: 100% width{{-}}{{float right|''Text on the right.''}}
}}
</div></pre>
<div style="width:30em; margin:auto; border:1px dashed green;">
{{Block center|max-width=40em|width=100%
|Narrow parent: 100% width{{-}}{{float right|''Text on the right.''}}
}}
</div>
{{doc example/e}}
===={{parameter|height}}====
{{doc example/s}}
<pre>{{block center|height=15em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}</pre>
{{Block center|height=15em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
{{doc example/e}}
===={{parameter|align}}====
The text alignment within the (overall) centered block may be controlled using this parameter.
{{doc example/s}}
<pre>{{block center|align=right|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}</pre>
{{Block center|align=right|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}
{{doc example/e}}
===={{parameter|style}}====
Where there is a need to specify the style of the text, an optional "style" parameter can be used. This parameter takes the same style attributes that can be set for any table.
{{doc example/s}}
<pre>{{block center|style=font-style:italic|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}</pre>
{{Block center|style=font-style:italic|<poem>
Lorem ipsum dolor sit amet,
{{gap}}consectetuer adipiscing elit.
Aenean commodo ligula eget dolor;
{{gap}}Aenean massa.
</poem>}}
{{doc example/e}}
For slightly larger "spacing" between normal paragraph(s) before &/or after the template-inserted content:
{{doc example/s}}
<pre><p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{block center|style=max-width:25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p></pre>
<p>By clicking the “Save page” button, you are agreeing to the Terms of Use, the Privacy Policy, and you irrevocably agree to release your contribution under the CC-BY-SA 3.0 License and the GFDL. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.</p>
{{Block center|style=max-width:25em|Lorem ipsum dolor sit amet, consectetuer adipiscing elit.<br>
Aenean commodo ligula eget dolor.
Aenean massa.}}
<p>Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.</p>
{{doc example/e}}
===Spanning multiple pages===
If you use many separate block centers you will find that every page has a slightly different alignment; however, this template cannot be left "dangling" and closed on another page to create one big block center. If you have a multipage block center, you can use {{tl|Block center/s}} and {{tl|Block center/e}} to open and close it on each page. Every page must have one of each, one at the start and one at the end. However, you may place one or both of them in the header or footer, so they will not be transcluded to the main namespace. When the pages are all transcluded, you will end up with just one {{tl|Block center/s}} and just one {{tl|Block center/e}} at the start and end of the section, respectively. See [[Help:Page breaks]] for more information.
====First page====
'''Header'''
Nothing is required in the header
'''Body'''
<pre>{{block center/s}}</pre>
Start of the block center text. Contents of the block center goes here.
'''Footer'''
<pre>{{block center/e}}</pre>
====Middle pages====
'''Header'''
<pre>{{block center/s}}</pre>
'''Body'''
Contents of the block center go here; this continues the previous page.
'''Footer'''
<pre>{{block center/e}}</pre>
====Last page====
'''Header'''
<pre>{{block center/s}}</pre>
'''Body'''
Contents of the block center go here; this continues the previous page. Last bit of block center text.
<pre>{{block center/e}}</pre>
'''Footer'''
Nothing is required in the footer of the last page.
== Tracking categories ==
* [[:Category:Pages using center block with title parameter]]
* [[:Category:Pages using center block with style parameters]]
** [[:Category:Pages using center block with class parameter]]
** [[:Category:Pages using center block with height parameter]]
** [[:Category:Pages using center block with width parameter]]
** [[:Category:Pages using center block with max-width parameter]]
** [[:Category:Pages using center block with align parameter]]
** [[:Category:Pages using center block with align-last parameter]]
** [[:Category:Pages using center block with style parameter]]
==See also==
* {{tl|block left}}
* {{tl|block right}}<includeonly>
[[Category:Formatting templates]]
[[Category:Templates applying classes for page styles]]
</includeonly>
== TemplateData ==
{{templatedata header}}
<templatedata>
{
"params": {
"class": {
"label": "class",
"description": "Additional CSS classes, which can be used in conjunction with index CSS",
"type": "line"
},
"width": {
"label": "width",
"description": "The width of the block (needs units which are valid CSS units)",
"type": "line"
},
"align": {
"aliases": [
"talign"
],
"label": "align",
"description": "The text alignment within the block",
"suggestedvalues": [
"left",
"center",
"right",
"justify"
],
"type": "line",
"default": "inherit"
},
"align-last": {
"aliases": [
"talign-last"
],
"label": "align-last",
"description": "The text alignment of the last line within the block",
"suggestedvalues": [
"left",
"center",
"right",
"justify"
],
"type": "line",
"default": "inherit"
},
"max-width": {
"type": "line",
"description": "The maximum width of the block (needs units which are valid CSS units)"
},
"style": {
"label": "style",
"description": "Additional CSS styles",
"type": "line"
},
"title": {
"label": "title",
"description": "Title of the block",
"type": "content"
},
"height": {
"type": "line",
"description": "The height of the block (needs units which are valid CSS units)"
},
"text": {
"aliases": [
"1",
"body"
],
"description": "Content to place in a centered block",
"type": "content",
"required": true
}
},
"format": "block",
"description": "Render content in a centered block",
"paramOrder": [
"text",
"title",
"class",
"height",
"width",
"max-width",
"align",
"align-last",
"style"
]
}
</templatedata>
pft8j6cx3093d3a33kqhvwcvsdx8ujc
سانچہ:Templatedata header
10
13087
32320
2023-07-31T02:14:59Z
en>CalendulaAsteraceae
0
Redirected page to [[Template:TemplateDataHeader]]
32320
wikitext
text/x-wiki
#redirect[[Template:TemplateDataHeader]]
7n3va94rduk8q8fhwe3s5b1n4lm9242
32321
32320
2026-04-22T02:15:45Z
Satdeep Gill
85
[[:en:Template:Templatedata_header]] سے 1 نسخہ درآمد کیا گیا
32320
wikitext
text/x-wiki
#redirect[[Template:TemplateDataHeader]]
7n3va94rduk8q8fhwe3s5b1n4lm9242
میڈیاویکی:Proofreadpage pagenum template
8
13088
32324
2025-08-14T07:33:48Z
en>CalendulaAsteraceae
0
add docs
32324
wikitext
text/x-wiki
<includeonly><!--
Outer span: contains the page number as an ID, so you can link to pages by pagenumber in the ''original'' work
Also contains data- attributes for JS to pick up as needed.
--><span <!--
-->class="pagenum ws-pagenum" <!--
-->id="{{{num}}}" <!--
-->data-page-number="{{{num}}}" <!--
-->{{#if:{{{page|}}}|data-page-name="{{{page}}}" data-page-index="{{SUBPAGENAME:{{{page}}}}}" {{#if:{{{quality|}}}|data-page-quality="{{{quality}}}"}} title="{{urlencode:{{{page}}}|WIKI}}"}}<!--
-->><!--
Inner span with an id of pagenumberXXX, which allows to anchor to the page if you only know the page index in the file
(i.e. the XX in Page:Foo.djvu/XX)
--><span <!--
-->{{#if:{{{page|}}}|id="pageindex_{{SUBPAGENAME:{{{page}}}}}" }}<!--
-->class="pagenum-inner ws-noexport"><!--
-->​<!--
End the inner span
--></span><!--
End the outer span
--></span></includeonly><noinclude>{{documentation|Template:Proofreadpage pagenum template/doc}}</noinclude>
bmoq2hkpjfx8fvuixisrvq77ld1isg4
32325
32324
2026-04-22T02:17:27Z
Satdeep Gill
85
[[:en:MediaWiki:Proofreadpage_pagenum_template]] سے 1 نسخہ درآمد کیا گیا
32324
wikitext
text/x-wiki
<includeonly><!--
Outer span: contains the page number as an ID, so you can link to pages by pagenumber in the ''original'' work
Also contains data- attributes for JS to pick up as needed.
--><span <!--
-->class="pagenum ws-pagenum" <!--
-->id="{{{num}}}" <!--
-->data-page-number="{{{num}}}" <!--
-->{{#if:{{{page|}}}|data-page-name="{{{page}}}" data-page-index="{{SUBPAGENAME:{{{page}}}}}" {{#if:{{{quality|}}}|data-page-quality="{{{quality}}}"}} title="{{urlencode:{{{page}}}|WIKI}}"}}<!--
-->><!--
Inner span with an id of pagenumberXXX, which allows to anchor to the page if you only know the page index in the file
(i.e. the XX in Page:Foo.djvu/XX)
--><span <!--
-->{{#if:{{{page|}}}|id="pageindex_{{SUBPAGENAME:{{{page}}}}}" }}<!--
-->class="pagenum-inner ws-noexport"><!--
-->​<!--
End the inner span
--></span><!--
End the outer span
--></span></includeonly><noinclude>{{documentation|Template:Proofreadpage pagenum template/doc}}</noinclude>
bmoq2hkpjfx8fvuixisrvq77ld1isg4
سانچہ:Tag
10
13089
32326
2024-03-14T17:41:38Z
en>Uzume
0
[[Module:Tag]] renamed
32326
wikitext
text/x-wiki
{{#invoke:tag|tag}}<noinclude>
{{documentation}}
</noinclude>
d3glw6r9fc5knrakwu70teqsse6sc5p
32327
32326
2026-04-22T02:17:28Z
Satdeep Gill
85
[[:en:Template:Tag]] سے 1 نسخہ درآمد کیا گیا
32326
wikitext
text/x-wiki
{{#invoke:tag|tag}}<noinclude>
{{documentation}}
</noinclude>
d3glw6r9fc5knrakwu70teqsse6sc5p
ماڈیول:Tag
828
13090
32328
2024-03-19T17:23:05Z
en>Uzume
0
avoid misuse of "preprocess" to introduce the "nowiki" parser tag (and its strip marker) and instead use "mw.text.encode()" to escape the output in much the same way as the original template did; this again allows nested constructions like "{{tag|content={{tag}}}}"
32328
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local make_style_string = require('Module:Optional style').make_style_string
function p._tag(args)
local tag = args[1] or args.tag or 'tag'
local pair_aliases = {
['close'] = 'close',
['c'] = 'close',
['empty'] = 'empty',
['e'] = 'empty',
['s'] = 'empty',
['single'] = 'empty',
['v'] = 'empty',
['void'] = 'empty',
['open'] = 'open',
['o'] = 'open',
['pair'] = 'pair',
['p'] = 'pair'
}
local pair = pair_aliases[args[2] or args['pair']] or 'pair'
local wrapcode = yesno(args['wrap']) or false
local style = args.style
local attribs = args.attribs or args.params or ''
local content = args.content
-- Code tag
local code_class
if wrapcode then
code_class = 'class="wrap"'
else
code_class = 'class="nowrap"'
end
local code_style
if style == 'plain' then
code_style = make_style_string({['border'] = 'none', ['background'] = 'transparent'})
else
code_style = make_style_string({['style'] = style})
end
-- Opening tag
local tag_open
if pair == 'close' then
tag_open = ''
elseif tag == '!--' then
tag_open = '<!--'
if pair == 'empty' then
tag_open = tag_open .. ' -->'
end
else
tag_open = mw.text.trim('<' .. tag .. ' ' .. attribs)
if pair == 'empty' then
tag_open = tag_open .. ' />'
else
tag_open = tag_open .. '>'
end
end
-- Content between tags
local tag_content
if pair == 'empty' then
tag_content = ''
elseif pair == 'pair' then
tag_content = content or '...'
else
tag_content = content or ''
end
-- Closing tag
local tag_close
if pair == 'empty' or pair == 'open' then
tag_close = ''
elseif tag == '!--' then
tag_close = '-->'
else
tag_close = '</' .. tag .. '>'
end
return '<code ' .. mw.text.trim(code_class .. ' ' .. code_style) .. '>'
.. mw.text.encode(tag_open) .. tag_content .. mw.text.encode(tag_close)
.. '</code>'
end
function p.tag(frame)
return p._tag(getArgs(frame))
end
return p
894odv7h8lfcvlzbpg8wepgw4yxe7wk
32329
32328
2026-04-22T02:17:28Z
Satdeep Gill
85
[[:en:Module:Tag]] سے 1 نسخہ درآمد کیا گیا
32328
Scribunto
text/plain
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local make_style_string = require('Module:Optional style').make_style_string
function p._tag(args)
local tag = args[1] or args.tag or 'tag'
local pair_aliases = {
['close'] = 'close',
['c'] = 'close',
['empty'] = 'empty',
['e'] = 'empty',
['s'] = 'empty',
['single'] = 'empty',
['v'] = 'empty',
['void'] = 'empty',
['open'] = 'open',
['o'] = 'open',
['pair'] = 'pair',
['p'] = 'pair'
}
local pair = pair_aliases[args[2] or args['pair']] or 'pair'
local wrapcode = yesno(args['wrap']) or false
local style = args.style
local attribs = args.attribs or args.params or ''
local content = args.content
-- Code tag
local code_class
if wrapcode then
code_class = 'class="wrap"'
else
code_class = 'class="nowrap"'
end
local code_style
if style == 'plain' then
code_style = make_style_string({['border'] = 'none', ['background'] = 'transparent'})
else
code_style = make_style_string({['style'] = style})
end
-- Opening tag
local tag_open
if pair == 'close' then
tag_open = ''
elseif tag == '!--' then
tag_open = '<!--'
if pair == 'empty' then
tag_open = tag_open .. ' -->'
end
else
tag_open = mw.text.trim('<' .. tag .. ' ' .. attribs)
if pair == 'empty' then
tag_open = tag_open .. ' />'
else
tag_open = tag_open .. '>'
end
end
-- Content between tags
local tag_content
if pair == 'empty' then
tag_content = ''
elseif pair == 'pair' then
tag_content = content or '...'
else
tag_content = content or ''
end
-- Closing tag
local tag_close
if pair == 'empty' or pair == 'open' then
tag_close = ''
elseif tag == '!--' then
tag_close = '-->'
else
tag_close = '</' .. tag .. '>'
end
return '<code ' .. mw.text.trim(code_class .. ' ' .. code_style) .. '>'
.. mw.text.encode(tag_open) .. tag_content .. mw.text.encode(tag_close)
.. '</code>'
end
function p.tag(frame)
return p._tag(getArgs(frame))
end
return p
894odv7h8lfcvlzbpg8wepgw4yxe7wk
سانچہ:Proofreadpage pagenum template/doc
10
13091
32330
2025-08-14T07:37:06Z
en>CalendulaAsteraceae
0
32330
wikitext
text/x-wiki
{{Documentation subpage|[[MediaWiki:Proofreadpage pagenum template]]}}
<!--Categories at the bottom of this page; interwikis in Wikidata-->
{{high use|440930}}
== Usage ==
* This template generates page numbers with links for the {{tag|pages|empty}} command.
== See also ==
* [[mw:Help:Extension:ProofreadPage/Pages tag]]
<includeonly>{{Sandbox other||
<!-- Categories below this line; interwikis in Wikidata -->
}}</includeonly>
16zkemp9kxflaep5vra22xaoy3qzveh
32331
32330
2026-04-22T02:17:28Z
Satdeep Gill
85
[[:en:Template:Proofreadpage_pagenum_template/doc]] سے 1 نسخہ درآمد کیا گیا
32330
wikitext
text/x-wiki
{{Documentation subpage|[[MediaWiki:Proofreadpage pagenum template]]}}
<!--Categories at the bottom of this page; interwikis in Wikidata-->
{{high use|440930}}
== Usage ==
* This template generates page numbers with links for the {{tag|pages|empty}} command.
== See also ==
* [[mw:Help:Extension:ProofreadPage/Pages tag]]
<includeonly>{{Sandbox other||
<!-- Categories below this line; interwikis in Wikidata -->
}}</includeonly>
16zkemp9kxflaep5vra22xaoy3qzveh
میڈیاویکی:Proofreadpage header template
8
13092
32332
2025-08-17T19:44:28Z
en>CalendulaAsteraceae
0
move to module
32332
wikitext
text/x-wiki
<includeonly>{{#invoke:Proofreadpage header template|pp_header}}</includeonly><noinclude>{{documentation|Template:Proofreadpage header template/doc}}</noinclude>
quuvnzjfjcrh0ajetw8un6ly09e9xkw
32333
32332
2026-04-22T02:17:43Z
Satdeep Gill
85
[[:en:MediaWiki:Proofreadpage_header_template]] سے 1 نسخہ درآمد کیا گیا
32332
wikitext
text/x-wiki
<includeonly>{{#invoke:Proofreadpage header template|pp_header}}</includeonly><noinclude>{{documentation|Template:Proofreadpage header template/doc}}</noinclude>
quuvnzjfjcrh0ajetw8un6ly09e9xkw
سانچہ:Category link with count
10
13093
32334
2022-08-17T10:29:10Z
en>Xover
0
1 revision imported from [[:w:Template:Category_link_with_count]]: re-sync from enWP
32334
wikitext
text/x-wiki
[[:Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|<!--
-->{{#if:{{{name|}}}|{{{name}}}|Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}}}<!--
-->]] ({{PAGESINCATEGORY:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|{{{2|all}}}}})<noinclude>
{{Documentation}}
</noinclude>
t44qc0k3i1yz2ecwxpiksck04hyz7rx
32335
32334
2026-04-22T02:17:43Z
Satdeep Gill
85
[[:en:Template:Category_link_with_count]] سے 1 نسخہ درآمد کیا گیا
32334
wikitext
text/x-wiki
[[:Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|<!--
-->{{#if:{{{name|}}}|{{{name}}}|Category:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}}}<!--
-->]] ({{PAGESINCATEGORY:{{#invoke:string|replace|1={{{1}}}|2=^:?[Cc]ategory:|3=|plain=false}}|{{{2|all}}}}})<noinclude>
{{Documentation}}
</noinclude>
t44qc0k3i1yz2ecwxpiksck04hyz7rx
سانچہ:Clc
10
13094
32336
2021-03-26T19:05:42Z
en>Xover
0
create convenience redirect
32336
wikitext
text/x-wiki
#REDIRECT [[Template:Category link with count]]
092gm3mu5vr84eif0gc6y7q98csnc9h
32337
32336
2026-04-22T02:17:43Z
Satdeep Gill
85
[[:en:Template:Clc]] سے 1 نسخہ درآمد کیا گیا
32336
wikitext
text/x-wiki
#REDIRECT [[Template:Category link with count]]
092gm3mu5vr84eif0gc6y7q98csnc9h
سانچہ:Proofreadpage header template/doc
10
13095
32338
2025-10-01T19:55:44Z
en>CalendulaAsteraceae
0
/* Testing changes */
32338
wikitext
text/x-wiki
{{Documentation subpage|[[MediaWiki:Proofreadpage header template]]}}
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->
{{high use|15085}}
{{lua|Module:Proofreadpage header template}}
=== Usage ===
*This template generates headers for the <nowiki><pages/></nowiki> command, when it is called with "header".
*It takes its parameters from the index page.
*Parameters from the index page can be overridden in the "pages" command.
{{doc example|
<syntaxhighlight lang="wikitext"><pages index="foo" header author="bar" /></syntaxhighlight>
}}
=== Tracking categories ===
* {{clc|Pages using automatic headers}}
* {{clc|Pages using automatic headers with value parameter}}
=== Testing changes ===
<ol>
<li>Make changes in [[MediaWiki:Proofreadpage header template/sandbox]]. or [[Module:Proofreadpage header template/sandbox]].</li>
<li>Add the following code to your [[Special:MyPage/common.js|common.js]] page:
<syntaxhighlight lang="javascript">
var $tplTemplate = $('#wpTemplateSandboxTemplate');
var $tplPage = $('#wpTemplateSandboxPage');
if ($tplTemplate.prop('type') === 'hidden') {
$('#templatesandbox-editform').prepend('<legend>Preview page with this template</legend>');
$tplTemplate
.attr({
type: 'text',
size: '60',
spellcheck: 'true'
})
.wrap('<label>Template name: </label>')
.after('<br>');
$tplPage
.attr({
type: 'text',
size: '60',
'data-mw-searchsuggest': '{"wrapAsLink":false}',
class: 'mw-searchInput'
})
.wrap('<label>Page title: </label>')
.after(' <input name="wpTemplateSandboxPreview" value="Show preview" type="submit">');
}
</syntaxhighlight>
</li>
<li>Add something like the following code to [{{fullurl:Sandbox|redirect=no}} Sandbox]:
<syntaxhighlight lang="wikitext">
<pages index="Sandbox.djvu" include="10" tosection="Chapter 1" header=1 section-author="Charles Dickens" section-illustrator="Leo Tolstoy" section-translator="Death" section-year=1984 />
</syntaxhighlight>
</li>
<li>Without publishing, copy changes to [[MediaWiki:Proofreadpage header template]] or make it use the sandbox module.</li>
<li>Input Sandbox in the new "Page title" field of the editing box, and click "Show preview".</li>
</ol>
=== See also ===
* [[MediaWiki:Proofreadpage index data config.json]]
* [[mw:Help:Extension:ProofreadPage/Pages tag]]
<includeonly>
<!-- PLEASE ADD CATEGORIES BELOW THIS LINE AND INTERWIKIS IN WIKIDATA, THANKS -->
</includeonly>
18xb1gqt8k5huyxjargvrayos4fn79u
32339
32338
2026-04-22T02:17:43Z
Satdeep Gill
85
[[:en:Template:Proofreadpage_header_template/doc]] سے 1 نسخہ درآمد کیا گیا
32338
wikitext
text/x-wiki
{{Documentation subpage|[[MediaWiki:Proofreadpage header template]]}}
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE AND INTERWIKIS IN WIKIDATA -->
{{high use|15085}}
{{lua|Module:Proofreadpage header template}}
=== Usage ===
*This template generates headers for the <nowiki><pages/></nowiki> command, when it is called with "header".
*It takes its parameters from the index page.
*Parameters from the index page can be overridden in the "pages" command.
{{doc example|
<syntaxhighlight lang="wikitext"><pages index="foo" header author="bar" /></syntaxhighlight>
}}
=== Tracking categories ===
* {{clc|Pages using automatic headers}}
* {{clc|Pages using automatic headers with value parameter}}
=== Testing changes ===
<ol>
<li>Make changes in [[MediaWiki:Proofreadpage header template/sandbox]]. or [[Module:Proofreadpage header template/sandbox]].</li>
<li>Add the following code to your [[Special:MyPage/common.js|common.js]] page:
<syntaxhighlight lang="javascript">
var $tplTemplate = $('#wpTemplateSandboxTemplate');
var $tplPage = $('#wpTemplateSandboxPage');
if ($tplTemplate.prop('type') === 'hidden') {
$('#templatesandbox-editform').prepend('<legend>Preview page with this template</legend>');
$tplTemplate
.attr({
type: 'text',
size: '60',
spellcheck: 'true'
})
.wrap('<label>Template name: </label>')
.after('<br>');
$tplPage
.attr({
type: 'text',
size: '60',
'data-mw-searchsuggest': '{"wrapAsLink":false}',
class: 'mw-searchInput'
})
.wrap('<label>Page title: </label>')
.after(' <input name="wpTemplateSandboxPreview" value="Show preview" type="submit">');
}
</syntaxhighlight>
</li>
<li>Add something like the following code to [{{fullurl:Sandbox|redirect=no}} Sandbox]:
<syntaxhighlight lang="wikitext">
<pages index="Sandbox.djvu" include="10" tosection="Chapter 1" header=1 section-author="Charles Dickens" section-illustrator="Leo Tolstoy" section-translator="Death" section-year=1984 />
</syntaxhighlight>
</li>
<li>Without publishing, copy changes to [[MediaWiki:Proofreadpage header template]] or make it use the sandbox module.</li>
<li>Input Sandbox in the new "Page title" field of the editing box, and click "Show preview".</li>
</ol>
=== See also ===
* [[MediaWiki:Proofreadpage index data config.json]]
* [[mw:Help:Extension:ProofreadPage/Pages tag]]
<includeonly>
<!-- PLEASE ADD CATEGORIES BELOW THIS LINE AND INTERWIKIS IN WIKIDATA, THANKS -->
</includeonly>
18xb1gqt8k5huyxjargvrayos4fn79u