= Macro SearchInPagesAndSort - Usage examples = <> == Simple tasks tracker, multiple pages == Given a page named 'ProjectAbc', containing: {{{----------8<--------------------------------------------------}}} 1. Action Items 1. {2} [Alan] to launch this task 1. {1} [Alan] to do this urgent thing 1. {3} [Ben][Clara] do this as background task 1. Deadlines 1. 2003-03-12 [Alan][Clara]: deliver 1st version of the Release X {{{---------->8--------------------------------------------------}}} ...and a page named 'ProjectXyz', containing: {{{----------8<--------------------------------------------------}}} * {2} [Denise] Development of task Xyz * {1} [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] * {1} [Alan] to do this urgent thing ProjectAbc * {2} [Alan] to launch this task ProjectAbc * [Ben] * {3} [Ben][Clara] do this as background task ProjectAbc * [Clara] * {3} [Ben][Clara] do this as background task ProjectAbc * [Denise] * {2} [Denise] Development of task Xyz ProjectXyz * [Eric] * {1} [Eric] Tests of feature F ProjectXyz * Deadlines * 2003-03-12 [Alan][Clara]: deliver 1st version of the Release X ProjectAbc * Completed tasks * [Eric] * (./) [Eric] Tests of feature E ProjectXyz {{{---------->8--------------------------------------------------}}} == Task tracker with tasks groups, single page == Given a page name 'MyPage' containing: {{{----------8<--------------------------------------------------}}} * -ABC- Some tasks: * {1} (due:2003-12-16) [Mike] Do this * -XYZ- Other tasks: * {2} (due:2003-12-17) [John_Doe][Mike] Do that {{{---------->8--------------------------------------------------}}} ...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] * {2} (due:2003-12-17) [John_Doe][Mike] Do that -XYZ- * [Mike] * {1} (due:2003-12-16) [Mike] Do this -ABC- * {2} (due:2003-12-17) [John_Doe][Mike] Do that -XYZ- {{{---------->8--------------------------------------------------}}} == 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 {2} 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 {X} 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 {1} 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 {1} Devices are not autodetected ... * QA 2004-11-08 > Fix confirmed! Issue closed! * #OSA00023 {2} Program freezes if you cancel too soon ... * QA 2004-11-14 > Confirmed! * Cancelled bugs, by code, with 2 first feedbacks: * #OMM00154 {X} 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 {X} 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 {2} 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 {1} 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--------------------------------------------------}}} == Page list with summary == * Suppose you have notes of meetings named like this: Nom20050315Topic 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: || Nom20050311ProductManagement || Brainstorming on PrjX || || Nom20050311CmsProject || Official transfer of the PrjZ source || || Nom20050308CmsProject || Migration from CVS to SVN || || Nom20050303GeneralMeetings || Minutes of General Meeting || || Nom20050228IntegrationQa || Post-Mortem PrjY (Integration Date: Jan. 10th to Jan 31st) || || Nom20050221IntegrationQa || Wiki Nom conventions, PrjX acceptance tests || || Nom20050209DevelopmentCulture || Source Code Management, Wiki and guidelines || || Nom20050208CorporateOrganization || Definition of the Production / Integration entities || || Nom20050207ProductManagement || discussion for preparation of a memo for features investigations of CMS || || Nom20050201CmsProject || CMS monthly coordination || || Nom20050126ProductChangeProcess || Product Change Process Kikc-off meeting || || Nom20050124Docsys || 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: 1. {2} [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: ||||||||<#e0e0e0> [John_Doe] || || MyPage || {2} || (due:2003-12-17) [John_Doe][Mike] Do that || ||||||||<#e0e0e0> [Mike] || || MyPage || {1} || (due:2003-12-16) [Mike] Do this || || MyPage || {2} || (due:2003-12-17) [John_Doe][Mike] Do that || * 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 ; {{{ < Name || Title ||\n", format="|| [[@PN@]] || @FT:.*\=(.*).*\=@ ||\n", formatsort=1, unique=1)>> }}} * however, when reversing the order {{{ < 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 <>