Difference between revisions of "Template:RP Logs"

From From The Ashes Wiki
Jump to: navigation, search
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>== Usage ==
 
<noinclude>== Usage ==
 
<pre>
 
<pre>
{{ RP_Logs<|date> }}
+
{{ RP_Logs<|date><|cols=#> }}
 
</pre>
 
</pre>
  
Line 22: Line 22:
  
  
 +
<pre>
 +
{{ RP_Logs|cols=3 }}
 +
</pre>
 +
 +
Bulleted, no date, three columns.
 +
 +
 +
<pre>
 +
{{ RP_Logs|date|cols=2 }}
 +
</pre>
 +
No bullet, date shown, two columns.
 
=== Advanced Usage ===
 
=== Advanced Usage ===
 
Some people prefer to put descriptions of the logs, or otherwise adjust the way they're displayed.  If you wish to do this, create a page called YourName/AdvLog (i.e., if you're Bob, it would be Bob/AdvLog) and put your version there.  <!--For an example, feel free to look at [[Petra/AdvLog]] (currently done by hand) or [[Jai/AdvLog]] (currently done using the [[Template:LogList|LogList]] template) -- but please don't change them, of course!//--> Examples will be forthcoming.  Any log to which you link on your AdvLog page will be removed from the automatic list, so that you'll get a list beneath your edited version of only any logs you're in, but haven't yet added to your edited list.
 
Some people prefer to put descriptions of the logs, or otherwise adjust the way they're displayed.  If you wish to do this, create a page called YourName/AdvLog (i.e., if you're Bob, it would be Bob/AdvLog) and put your version there.  <!--For an example, feel free to look at [[Petra/AdvLog]] (currently done by hand) or [[Jai/AdvLog]] (currently done using the [[Template:LogList|LogList]] template) -- but please don't change them, of course!//--> Examples will be forthcoming.  Any log to which you link on your AdvLog page will be removed from the automatic list, so that you'll get a list beneath your edited version of only any logs you're in, but haven't yet added to your edited list.
[[category:Templates]]
+
[[Category:Template]]
</noinclude><includeonly>
+
</noinclude><includeonly>{{#vardefine:rows|{{{rows|100}}}}}{{#vardefine:year|0000}}{{#vardefine:block|1}}{{#vardefine:lognum|1}}{{#vardefine:thePage|{{#ifeq:{{{special}}}|all||{{#titleparts: {{PAGENAME}} | 1 | 1}} }} }}{{#dplvar:set|logLevel|{{#ifexist: {{#var:thePage}}/AdvLog|Adv|Bas}} }}{{#ifeq: {{#dplvar:logLevel}} | Adv |{{:{{#var:thePage}}/AdvLog}}| }}{{#dplvar:set|checkIt|{{uc:{{{1}}}}}}}{{#ifeq:{{#dplvar:checkIt}}|DATE|{{#dplvar:set|useDates|true}}|}}{{#css:
{{#css:
+
.loglist ul {
.colon::after {
+
    margin: 0;
     content: ": ";
+
    list-style-position: inside;
     display: inline-block;
+
}
     text-align: left;
+
.loglist.cols {
     width: 1em;
+
     columns: {{#ifeq:{{#dplvar:useDates}}|true|275px|200px}} {{{cols|1}}};
 +
    column-gap: 2em;
 +
     width: 100%;
 +
}
 +
.loglist.cols .listedlogs {
 +
     white-space: nowrap;
 +
}
 +
.loglist.cols .log {
 +
     width: 275px;
 +
    overflow: hidden;
 +
    text-overflow: ellipsis;
 
}
 
}
.loglist thead,
+
.loglist.cols .pager {
.loglist tfoot {
+
    display: none;
    display: none;
 
 
}
 
}
table.wikitable.loglist {
+
.loglist h2 {
     margin: 1em 0;
+
     break-inside: avoid;
     background-color: transparent;
+
     page-break-inside: avoid;
     border: none;
+
     -webkit-column-break-inside: avoid;
     border-collapse: collapse;
+
     column-span: all;
    color: inherit;
 
 
}
 
}
table.wikitable.loglist > tr > th,
+
.loglist h2:first-of-type {
table.wikitable.loglist > tr > td,
+
     margin-top: 0;
table.wikitable.loglist > * > tr > th,
 
table.wikitable.loglist > * > tr > td {
 
     border: none;
 
 
}
 
}
.loglist td {
+
.loglist .mw-headline {
     vertical-align: top;
+
     display: block;
 
}
 
}
}}{{#vardefine:thePage|{{#titleparts: {{PAGENAME}} | 1 | 1}} }}{{#dplvar:set|logLevel|{{#ifexist: {{#var:thePage}}/AdvLog|Adv|Bas}} }}{{#ifeq: {{#dplvar:logLevel}} | Adv |{{:{{#var:thePage}}/AdvLog}}| }}{{#dplvar:set|checkIt|{{uc:{{{1}}}}}}}{{#ifeq:{{#dplvar:checkIt}}|DATE|{{#dplvar:set|useDates|true}}|}}{{#dpl:
+
}}{{#arraydefine:loglist|{{#regex:{{#regexall:{{#dpl:
 
| namespace=
 
| namespace=
 
| linksto={{#var:thePage}}
 
| linksto={{#var:thePage}}
Line 64: Line 80:
 
| include={log}.dpl
 
| include={log}.dpl
 
| includetrim=true
 
| includetrim=true
| table=class="wikitable sortable loglist" id="presort",-,{{#ifeq:{{#dplvar:useDates}}|false|style="display: none;" |}}data-sort-type="date"¦Date,Log
+
| mode=inline
 +
| inlinetext=
 
| noresultsheader={{#ifeq: {{#dplvar:logLevel}} | Adv |&nbsp;|None yet!<br />Why not check out the [[Log Tutorial]]?}}
 
| noresultsheader={{#ifeq: {{#dplvar:logLevel}} | Adv |&nbsp;|None yet!<br />Why not check out the [[Log Tutorial]]?}}
 
| resultsheader={{#ifeq: {{#dplvar:logLevel}} | Adv | <center>'''Also:'''</center> \n| }}
 
| resultsheader={{#ifeq: {{#dplvar:logLevel}} | Adv | <center>'''Also:'''</center> \n| }}
}}</includeonly>
+
}}|/(\d{10}.+\^)/U|`}}|/\^/|}}|`|sort=asc}}
 +
<div class="loglist {{#if:{{{cols|}}}|cols|}}">{{#ifeq:{{#dplvar:useDates}}|true|<div|<ul}} class="listedlogs" id="Block1">{{#arrayprint:loglist||@@@@|{{#arraydefine:log|@@@@|~}}{{#ifeq:{{{years}}}|yes|{{#ifeq:{{#vardefineecho:newyear|{{#regex:{{#arrayindex:log|1}}|/\d{4}/}}}}|{{#var:year}}||<h2>{{#vardefineecho:year|{{#var:newyear}}}}</h2>}}|}}{{#ifeq:{{#dplvar:useDates}}|true|<div class="log">{{#arrayindex:log|1}}:|<li>}} [[{{#arrayindex:log|4}}|<span title="{{#regex:{{#regex:{{#regex:{{#arrayindex:log|3}}|/\[\[(.+)\x7C(.+)\]\]/|$2}}|/\[\[(.+)\]\]/|$1}}|/"/|&quot;}}">{{#arrayindex:log|5}}</span>]]{{#ifeq:{{#dplvar:useDates}}|true|</div>|</li>}}{{#vardefine:lognum|{{#expr:{{#var:lognum}}+1}}}}{{#ifexpr:{{#var:lognum}}>{{#var:rows}}|<div class="pager">{{#ifeq:{{#var:block}}|1||<span class="less">[[#Block{{#expr:{{#var:block}}-1}}|[less]]]</span>}}<span class="total">{{#expr:({{#var:block}}-1)*{{#var:rows}}+1}}-{{#expr:{{#var:block}}*{{#var:rows}}}} of {{#vardefineecho:total|{{#arraysize:loglist}}}}</span>{{#ifexpr:{{#var:block}}*{{#var:rows}}>={{#var:total}}||<span class="more">[[#Block{{#vardefineecho:block|{{#expr:{{#var:block}}+1}}}}|[more]]]</span>}}</div>{{#vardefine:lognum|1}}{{#ifeq:{{#dplvar:useDates}}|true|</div><div|</ul><ul}} class="listedlogs" id="Block{{#var:block}}">|}}}}{{#ifeq:{{#dplvar:useDates}}|true|</div>|</ul>}}</div>{{#ifeq:{{#arraysize:loglist}}|0|None yet! Why not check out the [[Template:Log|Log]] template and add some?}}</includeonly>

Latest revision as of 17:42, 15 April 2018

Usage

{{ RP_Logs<|date><|cols=#> }}

This template will automagically generate a list of all logs which link to the name of the page, in order from oldest to newest.

This is an adjustment of the similar template from Masquerade, which was itself based on the idea and a version of code from Haunted Memories.


Examples

{{ RP_Logs }}

The basic, default list. Bulleted, no date shown.


{{ RP_Logs|date }}

No bullet, date shown.


{{ RP_Logs|cols=3 }}

Bulleted, no date, three columns.


{{ RP_Logs|date|cols=2 }}

No bullet, date shown, two columns.

Advanced Usage

Some people prefer to put descriptions of the logs, or otherwise adjust the way they're displayed. If you wish to do this, create a page called YourName/AdvLog (i.e., if you're Bob, it would be Bob/AdvLog) and put your version there. Examples will be forthcoming. Any log to which you link on your AdvLog page will be removed from the automatic list, so that you'll get a list beneath your edited version of only any logs you're in, but haven't yet added to your edited list.