diff --git a/README.rst b/README.rst index f2bae9c..9d767ab 100644 --- a/README.rst +++ b/README.rst @@ -113,7 +113,26 @@ WikiLinks >>> wl WikiLink('[[new_title#new_fragmet]]') -All WikiLink properties support get, set, and delete operations. +All WikiLink properties support get, set, and delete operations. Categories are special cases of WikiLinks, in that they are prefixed with the category namespace, which is case insensitive and may be internationalized: + +.. code:: python + + >>> parsed = wtp.parse(""" + [[Category:Foo]] + [[Κατηγορία:Bar]] + [[Other link]] + """) + >>> categories = [ + wl + for wl + in parsed.wikilinks + if wl.title.partition(':')[0] + .strip() + .lower() + in ["category", "κατηγορία"] + ] + >>> categories + [WikiLink('[[Category:Foo]]'), WikiLink('[[Category:Bar]]')] Sections --------