Macro LookupDictPagesAndSort

Description

Goal

The aim of the macro LookupDictPagesAndSort is to:

The macro is based heavily on ../SearchInPagesAndSort, but adapted to work more "wiki-like", using pages, page groups and page definitions.

Macro synopsis

Usage:

Search for 'lookuptext' definition in pages matching 'pages' pagegroup/regex, and sort the found definitions (=hits) in this order:

  1. substring of the hit matching 'sortkey'; group same matches of 'sortkey' by a header
  2. substring of the hit matching 'lookuptext'

Possible keywords:

Keywords can be also given in upper or lower cases, or abbreviated. Example: LookupText, lookuptext, LOOKUPTEXT, lt, LT, Pages, p, etc.

Download & Release Notes

Download

Release Version

Moin Version

Release Notes

LookupDictPagesAndSort.py

1.5.x and (possibly) earlier

HOWTO

Installing the macro

As usual, for any new macro:

  1. Download the latest code: LookupDictPagesAndSort.py

  2. Install in the Python location for MoinMoin macros (on a sample wiki on a Debian system: /var/lib/mywiki/data/plugin/macro/)

Examples

Sample 1:

Sample 2:

Tips

Sample 3:

See a reallife usage of this macro http://wiki.homebase.dk/Top100Books

Misc

Todos

Author, contact

For comments, please just add a note below - I am subscribed to this page!

Please do not "correct" the indentation of this page: It is in sync with the script itself.

FeedBack

Thanks for your work on this useful macro. I have a question about your first example. It seems like the macro needs another keyword argument in order to produce the output that you displayed as Known Books. You show the macro as:

[[LookupDictPagesAndSort(pages=".*Book$", lookuptext="Title")]]

However, this macro does not specify the grouping by author that is displayed in your results:

        Known books
          * A. Man
            * A rather interesting Book _AnInterestingBook_
            * A rather interesting Book _AnotherInterestingBook_
          * Some Fool
            * A pretty boring Book _AnotherBoringBook_

If my understanding is correct that an argument is missing from the example, could you please correct the macro to show what is needed to group books by author in this example? -- EMF 2024-11-24 22:22:01

I have tried to reproduce your sample 1 example in order to get a clearer picture of this macro's use. However, it does not report finding any of the pages. I know the macro itself is seen, as it inserts a useage synopsis when called with no arguments. Any suggestions how to troubleshoot? -Andrew


See also ../SearchInPagesAndSort - the "father" of this macro: Instead of operating on pages (using dict lookups for definitions::), it operates on lines (using regular expressions).

MoinMoin: MacroMarket/LookupDictPagesAndSort (last edited 2008-07-18 10:38:15 by JonasSmedegaard)