Difference between revisions of "Issuepedia:Code/lib/links"
< Issuepedia:Code | lib
Jump to navigation
Jump to search
(→ShowTopic(topic,max): now trying to retrieve data) |
(→GetBrief(): updated syntax) |
||
(16 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | ===ShowLinkData()=== | ||
+ | This is a functionalized version of the code in [[Issuepedia:Code/show/link]]. Don't use that anymore; use this. | ||
+ | <func ShowLinkData> | ||
+ | |||
+ | <let name=wtDate>{{date|</let> | ||
+ | <let name=wtDate append copy=data[Date] /> | ||
+ | <let name=wtDate append>}}{{datecat|</let> | ||
+ | <let name=wtDate append copy=data[Date] /> | ||
+ | <let name=wtDate append>}}</let> | ||
+ | <if flag=$data[Author]> | ||
+ | <let name=wtAuth>[[</let> | ||
+ | <let name=wtAuth append copy=data[Author] /> | ||
+ | <let name=wtAuth append>]] ([[</let> | ||
+ | <let name=wtAuth append copy=data[Author] /> | ||
+ | <let name=wtAuth append>/writings|writings]]<sub>[[:category:</let> | ||
+ | <let name=wtAuth append copy=data[Author] /> | ||
+ | <let name=wtAuth append>/writings|cat]]</sub>)</let> | ||
+ | |||
+ | <let name=wtAuthCat>[[category:</let> | ||
+ | <let name=wtAuthCat append copy=data[Author] /> | ||
+ | <let name=wtAuthCat append>/writings]]</let> | ||
+ | </if> | ||
+ | |||
+ | <if flag=$data[Authors]> | ||
+ | <let name=auths copy=data[Authors] /> | ||
+ | <let name=wtAuthCat null /> | ||
+ | <for xps=$auths let=author> | ||
+ | <let name=wtAuth append> [[</let> | ||
+ | <let name=wtAuth append copy=author /> | ||
+ | <let name=wtAuth append>]] ([[</let> | ||
+ | <let name=wtAuth append copy=author /> | ||
+ | <let name=wtAuth append>/writings|writings]]<sub>[[:category:</let> | ||
+ | <let name=wtAuth append copy=author /> | ||
+ | <let name=wtAuth append>/writings|cat]]</sub>)</let> | ||
+ | |||
+ | <let name=wtAuthCat append>[[category:</let> | ||
+ | <let name=wtAuthCat append copy=author /> | ||
+ | <let name=wtAuthCat append>/writings]]</let> | ||
+ | </for> | ||
+ | </if> | ||
+ | <if flag=$data[Source]> | ||
+ | <let name=wtSource>[[</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>]] ([[</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>/articles|articles]]<sub>[[:category:</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>/articles|cat]]</sub>)</let> | ||
+ | </if> | ||
+ | |||
+ | <if flag=$docat> | ||
+ | <let name=wtDate append>[[category:</let> | ||
+ | <let name=wtDate append copy=data[Date] /> | ||
+ | <let name=wtDate append>]]</let> | ||
+ | |||
+ | <let name=wtAuth append copy=wtAuthCat /> | ||
+ | |||
+ | <let name=wtSource append>[[category:</let> | ||
+ | <let name=wtSource append copy=data[Source] /> | ||
+ | <let name=wtSource append>/articles]]</let> | ||
+ | </if> | ||
+ | |||
+ | Store data in page properties: | ||
+ | <let name=data self save /> | ||
+ | |||
+ | <let name=wtTitle>__NOEDITSECTION__ | ||
+ | ==</let> | ||
+ | <let name=wtTitle append copy=data[Title] /> | ||
+ | <let name=wtTitle append>==</let> | ||
+ | <if flag=$data[TextShort]> | ||
+ | <let name=wtTitle append> | ||
+ | ===longer text===</let> | ||
+ | <let name=wtTextShort> | ||
+ | ===shorter text=== | ||
+ | </let> | ||
+ | <let name=wtTextShort append copy=data[TextShort] /> | ||
+ | </if><else> | ||
+ | <let name=wtTextShort /> | ||
+ | </else> | ||
+ | |||
+ | <if flag=$data[wpage]> | ||
+ | <let name=wtLink>[[</let> | ||
+ | <let name=wtLink append copy=data[wpage] /> | ||
+ | <let name=wtLink append>]]</let> | ||
+ | </if><else> | ||
+ | <let name=wtLink append copy=data[URL] /> | ||
+ | </else> | ||
+ | <let name=topics copy=data[Topics] /> | ||
+ | <for xps=$topics let=topic> | ||
+ | <let name=wtTopics append> [[</let> | ||
+ | <let name=wtTopics append copy=topic /> | ||
+ | <let name=wtTopics append>]]</let> | ||
+ | |||
+ | <let name=wtCatgs append> [[:category:</let> | ||
+ | <let name=wtCatgs append copy=topic /> | ||
+ | <let name=wtCatgs append>|</let> | ||
+ | <let name=wtCatgs append copy=topic /> | ||
+ | <let name=wtCatgs append>]]</let> | ||
+ | |||
+ | <if flag=$docat> | ||
+ | <let name=wtCatgs append> [[category:</let> | ||
+ | <let name=wtCatgs append copy=topic /> | ||
+ | <let name=wtCatgs append>]]</let> | ||
+ | </if> | ||
+ | </for> | ||
+ | |||
+ | |||
+ | <if flag=$data[TitlePlain]> | ||
+ | <let name=TitleSort copy=data[TitlePlain] /> | ||
+ | </if><else> | ||
+ | <let name=TitleSort copy=data[Title] /> | ||
+ | </else> | ||
+ | <if flag=$docat> | ||
+ | <let name=cattag>[[category:data/links|</let> | ||
+ | <let name=cattag append copy=TitleSort /> | ||
+ | <let name=cattag append>]]</let> | ||
+ | </if> | ||
+ | |||
+ | <let name=display> | ||
+ | {| | ||
+ | |- | ||
+ | | align=right | '''Date''': || <get name=wtDate /> | ||
+ | |- | ||
+ | | align=right | '''Link''': || <get name=wtLink /> | ||
+ | </let> | ||
+ | |||
+ | <if flag=$wtAuth> | ||
+ | <let name=display append> | ||
+ | |- | ||
+ | | align=right | '''Author''': || <get name=wtAuth /></let> | ||
+ | </if> | ||
+ | <if flag=$wtSource> | ||
+ | <let name=display append> | ||
+ | |- | ||
+ | | align=right | '''Source''': || <get name=wtSource /></let> | ||
+ | </if> | ||
+ | <let name=display append> | ||
+ | |- | ||
+ | | align=right | '''Topics''': || <get name=wtTopics /> | ||
+ | |- | ||
+ | | align=right | '''Categories''': || <get name=wtCatgs /> | ||
+ | |} | ||
+ | </let> | ||
+ | <echo> | ||
+ | {{#set:page type=link}} | ||
+ | {{#set:format version=2.1}} | ||
+ | __NOEDITSECTION__ | ||
+ | ==Specs== | ||
+ | <get name=display /> | ||
+ | <get name=wtTitle /> | ||
+ | <get name=data index=Text /><get name=wtTextShort /><get name=cattag /><hide> | ||
+ | <let name=wtDate null /> | ||
+ | <let name=wtAuth null /> | ||
+ | <let name=wtSource null /> | ||
+ | <let name=wtTopics null /> | ||
+ | <let name=wtCatgs null /> | ||
+ | </echo> | ||
+ | </func> | ||
===GetBrief()=== | ===GetBrief()=== | ||
<func GetBrief> | <func GetBrief> | ||
Line 10: | Line 168: | ||
<let name=links.out append>|talk]]: </let> | <let name=links.out append>|talk]]: </let> | ||
− | <if flag=data[wpage]> | + | <if flag=$data[wpage]> |
<let name=wtLink>[[</let> | <let name=wtLink>[[</let> | ||
<let name=wtLink append copy=data[wpage] /> | <let name=wtLink append copy=data[wpage] /> | ||
Line 39: | Line 197: | ||
</func> | </func> | ||
+ | |||
===ShowRecent()=== | ===ShowRecent()=== | ||
+ | '''calls''': GetBrief() | ||
<func ShowRecent max> | <func ShowRecent max> | ||
<let name=idx /> | <let name=idx /> | ||
Line 46: | Line 206: | ||
<let name=pg_title val="@row.page_title" /> | <let name=pg_title val="@row.page_title" /> | ||
<let name=idx inc /> | <let name=idx inc /> | ||
− | <if not flag=noLoad> | + | <if not flag=$noLoad> |
<load page=$pg_title nocat /> | <load page=$pg_title nocat /> | ||
</if> | </if> | ||
− | <if flag=data[Title]> | + | <if flag=$data[Title]> |
<call GetBrief /> | <call GetBrief /> | ||
</if><else> | </if><else> | ||
Line 63: | Line 223: | ||
</for> | </for> | ||
</func> | </func> | ||
+ | |||
===ShowTopic_old(iTopic,iMax)=== | ===ShowTopic_old(iTopic,iMax)=== | ||
<func ShowTopic_old iTopic iMax> | <func ShowTopic_old iTopic iMax> | ||
Line 96: | Line 257: | ||
</for> | </for> | ||
</func> | </func> | ||
− | === | + | ===ShowTopic_old(topic,max)=== |
− | <func | + | This can be deleted if there are no problems with new ShowTopic(). |
+ | <func ShowTopic_old topic max> | ||
<let name=topic self with="_"> </let> | <let name=topic self with="_"> </let> | ||
Line 137: | Line 299: | ||
</for> | </for> | ||
</func> | </func> | ||
− | <func | + | ===ShowTopic(topic,max)=== |
+ | <func ShowTopic topic max> | ||
<let name=topic self with="_"> </let> | <let name=topic self with="_"> </let> | ||
Line 159: | Line 322: | ||
<let name=pg_name append>:</let> | <let name=pg_name append>:</let> | ||
<let name=pg_name append copy=pg_title /> | <let name=pg_name append copy=pg_title /> | ||
− | <let name=links. | + | <let name=data null /> |
+ | <let name=data load array page=$pg_title /> | ||
+ | <if flag=data[Title]> | ||
+ | <call GetBrief /> | ||
+ | </if><else> | ||
+ | <let name=links.out> | ||
* [[</let> | * [[</let> | ||
− | <let name=links. | + | <let name=links.out append copy=pg_title /> |
− | <let name=links. | + | <let name=links.out append>]]</let> |
− | < | + | </else> |
+ | <let name=exclude val=0 /> | ||
+ | <let name=links.rtn append copy=links.out /> | ||
</for> | </for> | ||
</func> | </func> |
Latest revision as of 11:32, 13 September 2012
ShowLinkData()
This is a functionalized version of the code in Issuepedia:Code/show/link. Don't use that anymore; use this.
> function showlinkdata() <= ()
GetBrief()
> function getbrief() <= ()
ShowRecent()
calls: GetBrief()
> function showrecent() <= ()
ShowTopic_old(iTopic,iMax)
> function showtopic_old() <= ()
ShowTopic_old(topic,max)
This can be deleted if there are no problems with new ShowTopic().
> function showtopic_old() <= ()
ShowTopic(topic,max)
> function showtopic() <= ()