Template:HnH forum link: Difference between revisions

From Ring of Brodgar
Jump to navigation Jump to search
m (+nts)
m (+Add a little bit of separation for line-wrapped boxes. (+0.1 above default used line-height).)
 
(5 intermediate revisions by 2 users not shown)
Line 8: Line 8:
   border-radius: 0.15em;
   border-radius: 0.15em;
   padding: 0.05em 0.2em;
   padding: 0.05em 0.2em;
  line-height: 1.7em;
   ">{{#switch: x
   ">{{#switch: x


  | {{#if: {{{aps|}}} |x}} = HnH Post-link: [http://www.havenandhearth.com/forum/viewtopic.php?{{{aps}}} "{{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}" {{#if:{{{date|}}}|(<i>{{{date}}}</i>)}}]
  | {{#if: {{{aps|}}} |x}} = HnH Post-link: [//www.havenandhearth.com/forum/viewtopic.php?{{{aps}}} {{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}{{#if:{{{date|}}}|&nbsp;(<i>{{{date}}}</i>)}}]


  | {{#if: {{{f|{{{forumid|}}}}}} ||
  | {{#if: {{{f|{{{forumid|}}}}}} ||
Line 16: Line 17:
       {{#if: {{{p|{{{postid|}}}}}} ||x}}
       {{#if: {{{p|{{{postid|}}}}}} ||x}}
     }}
     }}
   }} = HnH Fora-link: <strong style="color:red;">missing post-id</strong>
   }} = {{error|missing post-id|HnH Fora-link: }}


  | {{#if: {{{p|{{{postid|}}}}}} ||
  | {{#if: {{{p|{{{postid|}}}}}} ||
Line 22: Line 23:
       {{#if: {{{t|{{{topicid|}}}}}} ||x}}
       {{#if: {{{t|{{{topicid|}}}}}} ||x}}
     }}
     }}
   }} = HnH Fora-link: <strong style="color:red;">missing topic-id</strong>
   }} = {{error|missing topic-id|HnH Fora-link: }}


  | {{#if: {{{p|{{{postid|}}}}}} ||
  | {{#if: {{{p|{{{postid|}}}}}} ||
Line 28: Line 29:
       {{#if: {{{f|{{{forumid|}}}}}} ||x}}
       {{#if: {{{f|{{{forumid|}}}}}} ||x}}
     }}
     }}
   }} = HnH Fora-link: <strong style="color:red;">missing forum-id</strong>
   }} = {{error|missing forum-id|HnH Fora-link: }}


  | {{#if: {{{p|{{{postid|}}}}}} |x}} = HnH Post: [http://www.havenandhearth.com/forum/viewtopic.php?p={{{p|{{{postid}}}}}}#p{{{p|{{{postid}}}}}} "{{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}" {{#if:{{{date|}}}|(<i>{{{date}}}</i>)}}]
  | {{#if: {{{p|{{{postid|}}}}}} |x}} = HnH Post: [//www.havenandhearth.com/forum/viewtopic.php?p={{{p|{{{postid}}}}}}#p{{{p|{{{postid}}}}}} {{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}{{#if:{{{date|}}}|&nbsp;(<i>{{{date}}}</i>)}}]


  | {{#if: {{{t|{{{topicid|}}}}}} |x}} = HnH Topic: [http://www.havenandhearth.com/forum/viewtopic.php?f={{{f|{{{forumid}}}}}}&t={{{t|{{{topicid}}}}}} "{{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}" {{#if:{{{date|}}}|(<i>{{{date}}}</i>)}}]
  | {{#if: {{{t|{{{topicid|}}}}}} |x}} = HnH Topic: [//www.havenandhearth.com/forum/viewtopic.php?f={{{f|{{{forumid}}}}}}&t={{{t|{{{topicid}}}}}} {{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}{{#if:{{{date|}}}|&nbsp;(<i>{{{date}}}</i>)}}]


  | {{#if: {{{f|{{{forumid|}}}}}} |x}} = HnH Forum: [http://www.havenandhearth.com/forum/viewforum.php?f={{{f|{{{forumid}}}}}} "{{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}"]
  | {{#if: {{{f|{{{forumid|}}}}}} |x}} = HnH Forum: [//www.havenandhearth.com/forum/viewforum.php?f={{{f|{{{forumid}}}}}} {{#if:{{{title|}}}|<b>{{{title}}}</b>|<i>no title</i>}}]


  | <strong style="color:red;">???</strong>
  | {{error|???}}
}}</span></includeonly
}}</span></includeonly


Line 45: Line 46:
* '''t''' or '''topicid''': topic-id in forum. (''needs f/forumid parameter'')
* '''t''' or '''topicid''': topic-id in forum. (''needs f/forumid parameter'')
* '''p''' or '''postid''': post-id of post. (''see yellow-icon at top-right corner of related post'')
* '''p''' or '''postid''': post-id of post. (''see yellow-icon at top-right corner of related post'')
* '''title''': Optional, title of other short remark. Defaults to "''no title''" ("|" character in title need to be escaped ...)
* '''title''': Optional (''well kinda''), title or other short remark. Defaults to "''no title''" (any "|" character in the title need to be changed to <code>&amp;#x7C;</code>)
* '''date''': Optional. (''but useful in the long run, especially the year'')
* '''date''': Optional. (''but useful in the long run, especially the year'')


Line 106: Line 107:
  | <code><nowiki>{{HFL|t=45128}}</nowiki></code>
  | <code><nowiki>{{HFL|t=45128}}</nowiki></code>
  | => Foo {{{{PAGENAME}}|t=45128}} bar.
  | => Foo {{{{PAGENAME}}|t=45128}} bar.
|-
|&nbsp;
|-
| <code><nowiki>{{HFL|p=586368|title=Foo &amp;#x7C; Bar}}</nowiki></code>
| => Foo {{{{PAGENAME}}|p=586368|title=Foo &#x7C; Bar}} bar.<!--
|-
| <code><nowiki>{{HFL|p=586368|title=Foo &amp;#124; Bar}}</nowiki></code> ... (fails)
| => Foo {{{{PAGENAME}}|p=586368|title=Foo &#124; Bar}} bar.
|-
| <code><nowiki>{{HFL|p=586368|title=Foo {{!}} Bar}}</nowiki></code> ... (fails).
| => Foo {{{{PAGENAME}}|p=586368|title=Foo {{!}} Bar}} bar. -->
  |}
  |}
<!--
:nts: On trailing "bar" text cases that don't show a leading space, there is an additional space before the 'external-link-icon. Odd stuff. Probably some internal wiki thing. Related trigger(s): unknown.
-->


<noinclude>
<noinclude>

Latest revision as of 11:31, 17 January 2023


Parameters
  • f or forumid: sub-forum-id in HnH fora.
  • t or topicid: topic-id in forum. (needs f/forumid parameter)
  • p or postid: post-id of post. (see yellow-icon at top-right corner of related post)
  • title: Optional (well kinda), title or other short remark. Defaults to "no title" (any "|" character in the title need to be changed to &#x7C;)
  • date: Optional. (but useful in the long run, especially the year)


  • aps: Optional. Alternative Parameter String. (allows for direct input of any fora (viewtopic) parameters) (overwrites f, t and p input)
    • PS: Do strip the "sid" parameter if its in your link. Its a tracker thing, and has no practical use here at RoB, ... other than to bloat the aps string.


Notes
  • Not supporting forum "start" parameter. Use post-id variant for that.
    • Forum-id and topic-id parameters are ignored when post-id parameter is used.
  • Not sure if Forum-link on its own is that useful. (ie: forum-link without topic-id) (included as fallback variant)
  • HFL redirect not active yet (ie: use long name for testing)


Usage/Preview/Debug
{{HFL|f=39}} => Foo HnH Forum: no title bar.
{{HFL|f=39|title=Announcements}} => Foo HnH Forum: Announcements bar.
 
{{HFL|f=39|t=45128}} => Foo HnH Topic: no title bar.
{{HFL|f=39|t=45128|title=Le Petit Fix}} => Foo HnH Topic: Le Petit Fix bar.
{{HFL|f=39|t=45128|title=Le Petit Fix|date=2015-11-10}} => Foo HnH Topic: Le Petit Fix (2015-11-10) bar.
 
{{HFL|p=586368}} => Foo HnH Post: no title bar.
{{HFL|p=586368|title=Le Petit Fix}} => Foo HnH Post: Le Petit Fix bar.
{{HFL|p=586368|title=Le Petit Fix|date=Nov 10, 2015}} => Foo HnH Post: Le Petit Fix (Nov 10, 2015) bar.
 
{{HFL|aps=f=39&t=45128&start=10#p586381|... => Foo HnH Post-link: title (date) bar.
 
{{HFL}} => Foo HnH Fora-link: missing post-id bar.
{{HFL|t=45128}} => Foo HnH Fora-link: missing forum-id bar.
 
{{HFL|p=586368|title=Foo &#x7C; Bar}} => Foo HnH Post: Foo | Bar bar.