Шаблон:Doc: различия между версиями

Материал из I2P-ilita вики
Перейти к навигацииПерейти к поиску
м
(скопировать статью из википедии)
 
(не показано 5 промежуточных версий 1 участника)
Строка 1: Строка 1:
<includeonly><div style="clear:both;background:#{{{bgcolor|FFEFD5}}};border:1px dotted #FFE4B5;padding:10px;margin-top:10px; height: auto;"><div style="float:right;padding-right:1em;"><span class="plainlinks" style="font-size:11px">{{#ifexist:{{SUBJECTPAGENAME}}/Документация|&#91;[[{{{1|{{SUBJECTPAGENAME}}/Документация}}}|просмотр]]&#93;&nbsp;&#91;[{{fullurl:{{{1|{{SUBJECTPAGENAME}}/Документация}}}|action=edit}} править]&#93;&nbsp;&#91;[{{fullurl:{{{1|{{SUBJECTPAGENAME}}/Документация}}}|action=history}} история]&#93;&nbsp;&#91;[{{fullurl:{{{1|{{SUBJECTPAGENAME}}/Документация}}}|action=purge}} обновить]&#93;}}</span></div><span style="font-size:11pt;line-height:11pt;">Документация</span>
<includeonly>{{doc/begin|{{SUBJECTSPACE}}:{{PAGENAME:{{{1|{{SUBJECTPAGENAME}}/doc}}}}}}}
----
{{#if: {{{1|}}}
{{#if: {{{1|}}} | {{:{{{1}}}}} | {{#ifexist:{{SUBJECTPAGENAME}}/Документация|{{{{SUBJECTPAGENAME}}/Документация}}|<span class="plainlinks" style="font-size:11pt;font-weight:bold;">[{{fullurl:{{SUBJECTPAGENAME}}/Документация|action=edit&redlink=1}} Заполнить описание…]</span>}}}}</div></includeonly><noinclude>{{doc}}</noinclude>
| {{#ifexist: {{{1}}}
  | {{{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}}}
  | {{#ifexist: {{SUBJECTSPACE}}:{{{1}}}
    | {{{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}}}
    | {{Документировать|{{{1}}}}}
    }}
  }}
| {{#ifexist: {{SUBJECTPAGENAME}}/doc
  | {{{{SUBJECTPAGENAME}}/doc}}
  | {{Документировать|{{SUBJECTPAGENAME}}/doc}}
  }}
}}
{{doc/end}}</includeonly><noinclude>
{{doc}}
</noinclude>

Текущая версия на 11:59, 25 июня 2023

<templatestyles src="Шаблон:Doc/styles.css" />

local getArgs = require('Module:Arguments').getArgs

local yesno = require('Module:Yesno') local compressSparseArray = require('Module:TableTools').compressSparseArray local p = {}

local function unpack(...) local frame = ... local args if type(frame.args) == 'table' then args = getArgs(frame) elseif type(frame) == 'table' then args = frame else args = {...} end return args end

function p._main(anchor, text, visible) local result = mw.html.create('span') :attr('id', anchor) :wikitext(text) if visible then result:addClass('highlight-target') end return tostring(result) end

function p.main(...) local args = unpack(...) local anchors = compressSparseArray(args) local text local visible = yesno(args.visible or args.v) if visible then text = args.text or args['текст'] or args[1] end

local result = text for i, v in ipairs(anchors) do result = p._main(anchors[i], result, visible) --[[ создание старого вида якорей для совместимости, см. Обсуждение шаблона:Якорь#Новые html5 ссылки и старые ]] local encoded_anchor = mw.uri.encode(anchors[i], 'WIKI'):gsub('%%', '.') if anchors[i] ~= encoded_anchor then result = p._main(encoded_anchor, result, visible) end end

return result end

return p
Документация
{{#if: || <templatestyles src="Шаблон:Действия для страницы/styles.css" /> }}

{{#if: | {{#ifexist: {{{1}}}

 | {{{{{1}}}||||}}
 | {{#ifexist: Шаблон:{{{1}}}
   | {{{{{1}}}||||}}
   | Шаблон:Документировать
   }}
 }}

| {{#ifexist: Шаблон:Doc/doc

 | Шаблон:Doc/doc
 | Шаблон:Документировать
 }}

}}

<templatestyles src="Шаблон:Doc/styles.css" />{{#ifexpr: 10 mod 2 = 1

| A test for all to see

|

}}