Аноним
Вы не вошли
Обсуждение
Вклад
Создать учётную запись
Войти
J2MEdia
Поиск
Редактирование:
Шаблон:Infobox/doc
(раздел)
Материал из J2MEdia
Пространства имён
Шаблон
Обсуждение
Ещё
Ещё
Действия на странице
Читать
Править код
История
Внимание:
Вы не вошли в систему. Ваш IP-адрес будет общедоступен, если вы запишете какие-либо изменения. Если вы
войдёте
или
создадите учётную запись
, её имя будет использоваться вместо IP-адреса, наряду с другими преимуществами.
Анти-спам проверка.
Не
заполняйте это!
== Content parameters == === Title === There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended): ; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative. ; above : Text to put within the uppermost cell of the table. ; subheader(n) : additional title fields which fit below {{para|title}}} and {{para|above}}}, but before images. Examples: {{Infobox | name = Infobox/doc | title = Text in caption over infobox | subheader = Subheader of the infobox | header = (the rest of the infobox goes here) }} <syntaxhighlight lang="wikitext" style="overflow: auto;"> {{Infobox | name = {{subst:PAGENAME}} | title = Text in caption over infobox | subheader = Subheader of the infobox | header = (the rest of the infobox goes here) }} </syntaxhighlight> {{clear}} {{Infobox | name = Infobox/doc | above = Text in uppermost cell of infobox | subheader = Subheader of the infobox | subheader2 = Second subheader of the infobox | header = (the rest of the infobox goes here) }} <syntaxhighlight lang="wikitext" style="overflow: auto;"> {{Infobox | name = {{subst:PAGENAME}} | above = Text in uppermost cell of infobox | subheader = Subheader of the infobox | subheader2 = Second subheader of the infobox | header = (the rest of the infobox goes here) }} </syntaxhighlight> {{clear}} === Illustration images === ; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text. ; caption(n) : Text to put underneath the images. === Main data === ; header(n) : Text to use as a header in row n. ; label(n) : Text to use as a label in row n. ; data(n) : Text to display as data in row n. Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are: * {{para|class''(n)''}} {{para|header''(n)''}} * {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}} * {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}} See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below. ==== Number ranges ==== To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example: <syntaxhighlight lang="wikitext" style="overflow: auto;"> | header3 = Section 1 | label5 = Label A | data5 = Data A | label7 = Label C | data7 = Data C | header10 = Section 2 | label12 = Label D | data12 = Data D </syntaxhighlight> {{clear}} It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]]. There is no upper limit on numbers but there must be at most 50 between each used number. ==== Making data fields optional ==== A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so: <syntaxhighlight lang="wikitext" style="overflow: auto;"> | label5 = Population | data5 = {{{population|}}} </syntaxhighlight> {{clear}} This way if an article doesn't define the population parameter in its infobox the row won't be displayed. For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'": <syntaxhighlight lang="wikitext" style="overflow: auto;"> | label6 = Mass | data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }} </syntaxhighlight> {{clear}} For more on #if, see [[meta:ParserFunctions##if:|here]]. ==== Hiding headers when all its data fields are empty ==== You can also make headers automatically hide when their section is empty (has no data-row showing). Consider this situation: {{Infobox | title = Example: header with & without data | headerstyle = background: lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} <syntaxhighlight lang="wikitext" style="overflow: auto;"> {{Infobox | title = Example: header with & without data | headerstyle = background: lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} </syntaxhighlight> {{clear}} If you want hide the header when no {{para|data''N''}} values are present, use {{para|autoheaders|y}}: {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background: lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} <syntaxhighlight lang="wikitext" style="overflow: auto;"> {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background: lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} </syntaxhighlight> {{clear}} So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content. Note: if the data has empty css elements, like {{para|data|2=<span style="background:yellow;"></span>}}, this will be treated as non-empty (having data). If {{para|autoheaders|y}} but there are items that you {{em|do not}} want to trigger a header, place {{para|headerX|_BLANK_}}. This will serve as an empty header and separate it from the subsequent items. {{Infobox | title = Example: blank header with & without data | autoheaders = y | headerstyle = background: lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = _BLANK_ | label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5 }} <syntaxhighlight lang="wikitext" style="overflow: auto;"> {{Infobox | title = Example: blank header with & without data | autoheaders = y | headerstyle = background: lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = _BLANK_ | label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5 }} </syntaxhighlight> {{clear}} === Footer === ; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.
Описание изменений:
Обратите внимание, что все изменения в J2MEdia рассматриваются как выпущенные на условиях лицензии Creative Commons Attribution-ShareAlike (см.
J2MEdia:Авторские права
). Если вы не хотите, чтобы ваши тексты свободно распространялись и редактировались любым желающим, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений или скопировали их из источника в общественном достоянии или под совместимой лицензией.
Не размещайте без разрешения материалы, защищённые авторским правом!
Отменить
Справка по редактированию
(в новом окне)
Навигация
Навигация
Заглавная страница
Свежие правки
Случайная страница
Справка по MediaWiki
Вики-инструменты
Вики-инструменты
Служебные страницы
Инструменты для страниц
Инструменты для страниц
Инструменты страницы участника
Ещё
Ссылки сюда
Связанные правки
Сведения о странице
Журналы страницы