The __HasTagOfPlugin__ (or simply "HasTagOf" in use) provides a query on the list of pages having a given tag, tags expressed using the TagPlugin. See also: TagPlugin, TagManager, TagCloudPlugin, [Burt Reynolds] ---- ! Syntax Creating a query for a single tag is pretty simple: {{{ [{HasTagOf tagname }] }}} The tag can ''optionally'' be wrapped in square brackets (since tags are also required to be wiki pages). There is an optional "{{output}}" parameter, see the next section. ! Simple Logic You can query on more than one tag where __all__ are required by listing them with {{AND}} operators between: {{{ [{HasTagOf tagname1 AND tagname2 }] }}} For example, {{{ [{HasTagOf Actor AND Honcho }] }}} [{HasTagOf Actor AND Honcho }] You can query on more than one tag where __any__ are required by listing them with {{OR}} operators between: {{{ [{HasTagOf tagname1 OR tagname2 }] }}} For example, {{{ [{HasTagOf Honcho OR Sidekick }] }}} [{HasTagOf Honcho OR Sidekick }] You can query on pages that don't contain a tag using the {{NOT}} operator: {{{ [{HasTagOf NOT tagname1 }] }}} For example (using the 'output' parameter, described below), {{{ [{HasTagOf output='count' NOT Honcho }] }}} [{HasTagOf output='count' NOT Honcho }] The {{AND}}, {{OR}}, and {{NOT}} logical operators can be combined (using parentheses as necessary) to create more complicated logical queries, e.g., {{{ [{HasTagOf (( tagname1 AND tagname2 ) OR ( tagname3 NOT tagname4 ) }] }}} ! Regular Expression Matching When a compile-time variable "permitRegex" is set true (the default), regular expression ("regex") matching is enabled. To match on a regular expression, wrap the regex pattern in square brackets. For example, to match any tags beginning with "Per", the regular expression "{{Per.*}}" would be used: {{{ [{HasTagOf [Per.*] }] }}} [{HasTagOf [Per.*] }] Note that a match on any tag is "{{{[.*]}}}", not "{{{[*]}}}". This returns all tagged pages, not the list of all tags. ---- ! Alternative Output Formats The output without any 'output' parameter will be wrapped in an HTML {{<div class='hastag'>}} element that permits CSS styling. If an 'output' parameter is specified this {{<div>}} wrapper is not included in the generated output. Options for the 'output' parameter value are: "none", "count", "list", "bullet", "number", "space", "comma", "colon" and "bar". The default (absent any parameter) is "list". (NOTE: the below demonstrations will fail if the plugin is not installed.) __None:__ {{{ [{HasTagOf output='none' Person }] }}} [{HasTagOf output='none' Person }] __Count:__ {{{ [{HasTagOf output='count' Person }] }}} [{HasTagOf output='count' Person }] __List:__ {{{ [{HasTagOf output='list' Person }] }}} [{HasTagOf output='list' Person }] __Bullet:__ {{{ [{HasTagOf output='bullet' Person }] }}} [{HasTagOf output='bullet' Person }] __Number:__ {{{ [{HasTagOf output='number' Person }] }}} [{HasTagOf output='number' Person }] __Space:__ {{{ [{HasTagOf output='space' Person }] }}} [{HasTagOf output='space' Person }] __Comma:__ {{{ [{HasTagOf output='comma' Person }] }}} [{HasTagOf output='comma' Person }] __Colon:__ {{{ [{HasTagOf output='colon' Person }] }}} [{HasTagOf output='colon' Person }] __Vertical Bar:__ {{{ [{HasTagOf output='bar' Person }] }}} [{HasTagOf output='bar' Person }] ! Case Testing Not quite sure how to handle this since we need to match page names case insensitively but we don't want our tags to all be lowercased. {{{ [{HasTagOf PERSON }] }}} [{HasTagOf output='comma' PERSON }] {{{ [{HasTagOf person }] }}} [{HasTagOf output='comma' person }] {{{ [{HasTagOf [P.*] }] }}} [{HasTagOf output='comma' [P.*] }] The presence of regex characters will force this as a regex match but {{{[p.*]}}} will only match wiki pages beginning with lowercase 'p', not uppercase. {{{ [{HasTagOf [p.*] }] }}} [{HasTagOf output='comma' [p.*] }] Doing an explicit regex match using the 'regex' parameter: {{{ [{HasTagOf regex='(A|P).*' }] }}} [{HasTagOf output='comma' regex='(A|P).*' }] ---- %%small This is a page related to the TagManager. %% [{Tag WikiPlugin NeocortextPlugin}]