Macro SearchInPagesAndSort - Usage examples
Contents
Simple tasks tracker, multiple pages
Given a page named 'ProjectAbc', containing:
----------8<--------------------------------------------------
- Action Items
[Alan] to launch this task
[Alan] to do this urgent thing
[Ben][Clara] do this as background task
- Deadlines
2003-03-12
[Alan][Clara]: deliver 1st version of the Release X
---------->8--------------------------------------------------
- Action Items
...and a page named 'ProjectXyz', containing:
----------8<--------------------------------------------------
[Denise] Development of task Xyz
[Eric] Tests of feature F
[Eric] Tests of feature E
---------->8--------------------------------------------------
...using the macro in like this:
* Action items [[SearchInPagesAndSort(p="Project.*", st="{[123]}", sk="\[[A-Za-z_]*\]")]] * Deadlines [[SearchInPagesAndSort(p="Project.*", st="<!>")]] * Completed tasks [[SearchInPagesAndSort(p="Project.*", st="(\./)", sk="\[[A-Za-z_]*\]")]]
... will produce:
----------8<--------------------------------------------------
- Action items
- [Alan]
[Alan] to do this urgent thing ProjectAbc
[Alan] to launch this task ProjectAbc
- [Ben]
[Ben][Clara] do this as background task ProjectAbc
- [Clara]
[Ben][Clara] do this as background task ProjectAbc
- [Denise]
[Denise] Development of task Xyz ProjectXyz
- [Eric]
[Eric] Tests of feature F ProjectXyz
- [Alan]
- Deadlines
2003-03-12
[Alan][Clara]: deliver 1st version of the Release X ProjectAbc
- Completed tasks
- [Eric]
[Eric] Tests of feature E ProjectXyz
- [Eric]
---------->8--------------------------------------------------
- Action items
Task tracker with tasks groups, single page
Given a page name 'MyPage' containing:
----------8<--------------------------------------------------
- -ABC- Some tasks:
(due:2003-12-16) [Mike] Do this
- -XYZ- Other tasks:
(due:2003-12-17) [John_Doe][Mike] Do that
---------->8--------------------------------------------------
- -ABC- Some tasks:
...the following macro call:
[[SearchInPagesAndSort(p="MyPage", st="{[123]}", sk="\[[A-Za-z_ -]*\]", nl=0, heading="-[a-zA-Z0-9]*-")]]
...will produce:
----------8<--------------------------------------------------
- [John_Doe]
(due:2003-12-17) [John_Doe][Mike] Do that -XYZ-
- [Mike]
(due:2003-12-16) [Mike] Do this -ABC-
(due:2003-12-17) [John_Doe][Mike] Do that -XYZ-
---------->8--------------------------------------------------
- [John_Doe]
Simple bug tracker
I used the macro to exchange bug tracking feedback, as a bridge between our Bugzilla and our customer's proprietary system.
Given a page named 'ProjectXyzBugs', containing lines with format:
* #BUG_CODE {STATUS} Summary
* WHO @DATE@ > Feedback
* ...----------8<--------------------------------------------------
#OSA00023
Program freezes if you cancel too soon
Dev 2004-11-09 > I have seen a potential race condtion in the log. I will investigate further.
QA 2004-11-11 > Could reproduce this behavior on various CPUs
Dev 2004-11-12 > Fixed.
QA 2004-11-14 > Confirmed!
#OMM00154
CHT, CHS, KOR - Application is not localized in these languages
Dev 2004-11-08 > Was not requested by marketing
Dev 2004-11-11 > Any comment/decision ?
QA 2004-11-14 > Close it!
#OVP00033
Devices are not autodetected
Dev > Known limitation, to be corrected (maybe) for next update
Dev 2004-10-20 > Bug confirmed and still present
Dev 2004-10-22 > Fixed in last release
QA 2004-11-08 > Fix confirmed! Issue closed!
---------->8--------------------------------------------------
...using the macro in like this:
* Open bugs, by prio, with last feedback: [[SearchInPagesAndSort(pages="ProjectXyzBugs$", searchtext="{[123]}", sortkey="{[123]}", nolinks=1, noheader=1, nbsubs=-1)]] * Cancelled bugs, by code, with 2 first feedbacks: [[SearchInPagesAndSort(pages="ProjectXyzBugs$", searchtext="{X}", sortkey="#[A-Z][A-Z][A-Z][0-9][0-9]*", nolinks=1, noheader=1, nbsubs=2)]] * All bugs, by code, with whole feedback: [[SearchInPagesAndSort(pages="ProjectXyzBugs$", searchtext="#[A-Z][A-Z][A-Z][0-9][0-9]*", sortkey="#[A-Z][A-Z][A-Z][0-9][0-9]*", nolinks=1, noheader=1, nbsubs='all')]]
...will produce:
----------8<--------------------------------------------------
- Open bugs, by prio, with last feedback:
#OVP00033
Devices are not autodetected
- ..
QA 2004-11-08 > Fix confirmed! Issue closed!
#OSA00023
Program freezes if you cancel too soon
- ..
QA 2004-11-14 > Confirmed!
- Cancelled bugs, by code, with 2 first feedbacks:
#OMM00154
CHT, CHS, KOR - Application is not localized in these languages
Dev 2004-11-08 > Was not requested by marketing
Dev 2004-11-11 > Any comment/decision ?
- ..
- All bugs, by code, with whole feedback:
#OMM00154
CHT, CHS, KOR - Application is not localized in these languages
Dev 2004-11-08 > Was not requested by marketing
Dev 2004-11-11 > Any comment/decision ?
QA 2004-11-14 > Close it!
#OSA00023
Program freezes if you cancel too soon
Dev 2004-11-09 > I have seen a potential race condtion in the log. I will investigate further.
QA 2004-11-11 > Could reproduce this behavior on various CPUs
Dev 2004-11-12 > Fixed.
QA 2004-11-14 > Confirmed!
#OVP00033
Devices are not autodetected
Dev > Known limitation, to be corrected (maybe) for next update
Dev 2004-10-20 > Bug confirmed and still present
Dev 2004-10-22 > Fixed in new release
QA 2004-11-08 > Fix confirmed! Issue closed!
---------->8--------------------------------------------------
- Open bugs, by prio, with last feedback:
Page list with summary
- Suppose you have notes of meetings named like this:
containing a line like this:
1. Topic: a brief summary of the meeting goal
Then the following macro call:
[[SearchInPagesAndSort(p="Nom[0-9].*", ep="(Template|EditorBackup)$", st='[ a1.]*Topic:', r=1, fs=1, f="|| @PN@ || @FT:[ a1.]*Topic:(.*)@ ||\\n" )]]
will produce something like this:Brainstorming on PrjX
Official transfer of the PrjZ source
Migration from CVS to SVN
Minutes of General Meeting
Post-Mortem PrjY (Integration Date: Jan. 10th to Jan 31st)
Wiki Nom conventions, PrjX acceptance tests
Source Code Management, Wiki and guidelines
Definition of the Production / Integration entities
discussion for preparation of a memo for features investigations of CMS
CMS monthly coordination
Product Change Process Kikc-off meeting
Document management system
- Explanation of arguments:
p="Nom[0-9].*"
Find wanted pages
ep="(Template|EditorBackup)$"
Exclude unwanted pages matching above regex
st='[ a1.]*Topic:'
Find the "Topic(s):" line in found pages
f="|| @PN@ || @FT:[ a1.]*Topic:(.*)@ ||\\n"
Format the result as a table with page name as 1st column, and text following "Topic(s):" as 2nd column (the "(.*)" regex group)
fs=1
Sort on the formatted result
r=1
Reverse-sort, to have latest pages first
Page list with headers
- We want to search action items like:
[Alan] to launch this task
This macro call:
[[SearchInPagesAndSort(p="MyPage", st="{[123]}", sk="\[[A-Za-z_ -]*\]", f="|| @PN@ || @ST@ || @FT:{[123]}(.*)@ ||\\n", hf="||||||||<#e0e0e0> @KT@ ||\\n")]]
will produce something like this:- Explanation of arguments:
p="MyPage"
Target page
st="{[123]}"
Find the priority smileys in found page
sk="\[[A-Za-z_ -]*\]"
Sort by [Names]
f="|| @PN@ || @ST@ || @FT:{[123]}(.*)@ ||\\n"
Format the result as a table with page, search text match, found text after the prio smiley
hf="||||||||<#e0e0e0> @KT@ ||\\n"
Format headers to span the whole row, and display [Name]
Discussion
a useful (yet not perfect) example to show the headings of pages ;
<<SearchInPagesAndSort(p=".*", ExcludePages = "TagFlagged", containing="TagFlagged", st='\= ', headerformat="||<rowbgcolor=\"lightgray\"> Name || Title ||\n", format="|| [[@PN@]] || @FT:.*\=(.*).*\=@ ||\n", formatsort=1, unique=1)>>
however, when reversing the order
<<SearchInPagesAndSort(p=".*", ExcludePages = "TagFlagged", containing="TagFlagged", st='\= ', headerformat="||<rowbgcolor=\"lightgray\"> Name || Title ||\n", format="|| [[@PN@]] || @FT:.*\=(.*).*\=@ ||\n", formatsort=1, unique=1, reverse=0)>>
, the header goes now to the bottom.these pages use the [[ syntax which should be changed to << for newer moin versions. I can do that. -- LaurentPerrinet 2012-03-13 14:28:53