Skip to content

Commit 4a6df75

Browse files
committed
Merge branch 'master' into self-hosted
2 parents ec577fa + 4c8ee58 commit 4a6df75

File tree

3 files changed

+53
-41
lines changed

3 files changed

+53
-41
lines changed

_includes/atts-global.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ <h3 id="common-global-attributes">Common global attributes</h3>
1111
{% endunless %}
1212
{% unless include.breakby == "" %}
1313
<dt><code>breakby="integer(s)"</code></dt>
14-
<dd>Used to group list items when separating by <code>break</code>. Possible values are lists of integers, like <code>2</code> (groups of 2 items) or <code>1,2</code> (alternate groups of 1 and 2 items).</dd>
14+
<dd>Used to group list items when separating by <code>break</code>. Possible values are lists of integers, like <code>2</code> (groups of 2 items) or <code>1,2</code> (alternate groups of 1 and 2 items). Otherwise, the value is evaluated on each loop and `break` happens as soon as it changes. Note that `string` must be enclosed in *double* quotes.</dd>
1515
<dd><strong>Default:</strong> {% if include.breakby == null %}1 (unset){% else %}{{ include.breakby }}{% endif %} (see <a href="/tags/tag-attributes-cross-reference#breakby">breakby cross-reference</a>). </dd>
16+
{% endunless %}
17+
{% unless include.breakform == "" %}
18+
<dt><code>breakform="form name"</code></dt>
19+
<dd>A form to be used as `break`, generally jointly with `breakby` attribute. The special `<+>` pattern in this form will be replaced with the list "chunk" accumulated when break happens.</dd>
20+
<dd><strong>Default:</strong> {% if include.breakform == null %}unset{% else %}{{ include.breakform }}{% endif %} (see <a href="/tags/tag-attributes-cross-reference#breakform">breakform cross-reference</a>). </dd>
1621
{% endunless %}
1722
<dt><code>class="class name"</code></dt>
1823
<dd>HTML <code>class</code> to apply to the wrapper.</dd>

tags/article.md

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: document
33
category: Tags
44
published: true
55
title: Article
6-
description: The basic article tag is used to output one or more articles depending on the attributes used.
6+
description: The context-sensitive article tag is used to output one or more articles.
77
tags:
88
- Article tags
99
---
@@ -21,7 +21,7 @@ tags:
2121
<txp:article />
2222
~~~
2323

24-
The basic **article** tag can be used as either a *single* tag or *container* tag and used to output one or more articles depending on the attributes used. Default attributes will be used when nothing specific is assigned.
24+
The powerful **article** tag can be used as either a *single* tag or *container* tag and used to output one or more articles depending on the context it is used and its attributes. Default attributes will be used when nothing specific is assigned.
2525

2626
It may be used as a *container* tag, in which case it must be specified as an opening and closing pair of tags, like this:
2727

@@ -35,33 +35,28 @@ This is equivalent to putting the contained statements into a form named `my_for
3535

3636
The tag is context-sensitive, which means it will grab articles from the currently viewed section/category/author, etc.
3737

38-
When used on the front page, article's context will include articles from all sections set to display via 'Section appears on front page?' settings (see the Sections panel for more information).
38+
When used on the front page, article's context will include articles from all sections set to display via 'Section appears on default page?' settings (see the Sections panel for more information).
3939

40-
Note: `<txp:article />` is **not** the same as `<txp:article_custom />` - you can [check out the differences of that tag](/tags/article_custom) if you're unsure of the differences!
40+
Note: `<txp:article />` is **not** the same as `<txp:article_custom />` - you can [check out how that tag differs](/tags/article_custom) if you're unsure of the differences!
4141
{: .alert-block .information}
4242

4343
## Attributes
4444

45-
Tag will accept content/behaviour and presentation attributes (**case-sensitive**) as well as the {% include atts-global-link.html %}:
45+
The tag will accept the following content/behaviour and presentation attributes (**case-sensitive**) as well as the {% include atts-global-link.html %}:
4646

4747
`allowoverride="boolean"`
4848
: Whether to use override forms for the generated article list.
4949
: **Values:** `0` (no) or `1` (yes).
5050
: **Default:** `1`.
5151

52-
`breakby="integer or string"` <span class="footnote warning">v4.7.2+</span>
53-
: Used to group list items when separating by `break`. If its value is a list of integers, they will be used as groups size. For example, `2` (groups of 2 items) or `1,2` (alternate groups of 1 and 2 items).
54-
: Otherwise, the value is evaluated on each loop and `break` happens as soon as it changes. Note that `string` must be enclosed in *double* quotes (see Example 7).
55-
: **Default:** `1` (actually unset).
56-
57-
`breakform="form name"` <span class="footnote warning">v4.7.2+</span>
58-
: A form to be used as `break`, generally jointly with `breakby` attribute. The special `<+>` pattern in this form will be replaced with the list "chunk" accumulated when break happens (see Example 7).
59-
: **Default:** unset.
60-
6152
`customfieldname="value"`
6253
: Restrict to articles with specified value for specified custom field name. Replace `customfieldname` with the actual name of the custom field.
6354
: Important: Using dashes `-` or spaces may cause errors or render this feature ineffectual. Underscores in both custom field names and values are confirmed to work.
6455

56+
`exclude="article id(s) or field(s)"` <span class="footnote warning">v4.6.0+</span>
57+
: Exclude a specific article or list of articles (each ID separated by a comma), or the articles with matching fields (author, category, etc.).
58+
: **Default:** unset.
59+
6560
`form="form name"`
6661
: Use specified form template to process each article.
6762
: **Default:** `default`.
@@ -82,6 +77,16 @@ Tag will accept content/behaviour and presentation attributes (**case-sensitive*
8277
: Use specified form when page is displaying an article list.
8378
: **Default:** `article_listing`.
8479

80+
`match="field"` <span class="footnote warning">v4.6.0+</span>
81+
: Use comma-separated field(s) to match articles to the given URL parameters. Incoming variable names may be remapped by specifying the variable after an '=' sign. See Example 8.
82+
: **Values:** \\
83+
`category`. \\
84+
`category1`. \\
85+
`category2`. \\
86+
`keywords`. \\
87+
any custom field.
88+
: **Default:** unset.
89+
8590
`offset="integer"`
8691
: The number of articles to skip.
8792
: **Default:** `0`.
@@ -143,33 +148,9 @@ Each field in the `textpattern` database table can be used as a sort key.
143148
: **Values:** `past`, `future`, `any` (both `past` and `future`) or a [PHP-compatible date format](https://secure.php.net/manual/en/datetime.formats.php). In the latter case, `time` will be considered as the end date of the interval started by `month` or `expired` attribute.
144149
: **Default:** `past`.
145150

146-
### Common presentational attributes
147-
148-
These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
149-
150-
`break="value"` <span class="footnote warning">v4.0.7+</span>
151-
: Where value is an HTML element, specified without brackets (e.g. `break="li"`) or some string to separate list items.
152-
: **Default:** `br` (but see [break cross-reference](/tags/tag-attributes-cross-reference#break) for exceptions).
153-
154-
`class="class name"`
155-
: HTML `class` to apply to the `wraptag` attribute value.
156-
: **Default:** tag name or unset (see [class cross-reference](/tags/tag-attributes-cross-reference#class)).
157-
158-
`label="text"`
159-
: Label prepended to item.
160-
: **Default:** unset (but see [label cross-reference](/tags/tag-attributes-cross-reference#label) for exceptions).
161-
162-
`labeltag="element"`
163-
: HTML element to wrap (markup) label, specified without brackets (e.g. `labeltag="h3"`).
164-
: **Default:** unset.
165-
166-
`wraptag="element"` <span class="footnote warning">v4.0.7+</span>
167-
: HTML element to wrap (markup) list block, specified without brackets (e.g. `wraptag="ul"`).
168-
: **Default:** unset (but see [wraptag cross-reference](/tags/tag-attributes-cross-reference#wraptag) for exceptions).
169-
170151
### Note on 'article list' vs. 'individual article' context
171152

172-
The **article** tag is context-sensitive. It will produce different results depending on whether the page being viewed is an article list or an individual article. Article-list context includes the default (home) page, section front pages, and category pages. Individual-article context applies on an article page (i.e. a page with a URL like `https://example.com/archives/24/my-article`).
153+
The **article** tag is context-sensitive. It will produce different results depending on whether the page being viewed is an article list or an individual article. Article-list context includes the default (home) page, section landing pages, and category pages. Individual-article context applies on an article page (i.e. a page with a URL like `https://example.com/archives/24/my-article`).
173154

174155
## Examples
175156

@@ -292,15 +273,38 @@ In Textpattern [Page templates](/themes/page-templates-explained), add this tag
292273

293274
Other tags used: [section](/tags/section), [title](/tags/title).
294275

276+
### Example 8: Filter articles from the URL (v4.8.6+)
277+
278+
Adding `<input>` elements to your page in an HTML `<form>` allows you to search and filter articles by various parameters when the form is submitted. For example, you could send `?c=cat&keywords=some,keywords,list` to the URL and interpret it with this tag:
279+
280+
~~~ html
281+
<txp:article match="category, keywords" />
282+
~~~
283+
284+
Or, if you need to fine-tune, you can remap the `key` URL parameter first by passing `?c=cat&key[]=some&key[]=keywords&key[]=list` and then interpreting it with:
285+
286+
~~~ html
287+
<txp:article match="category1, keywords=key" />
288+
~~~
289+
290+
295291
## Genealogy
296292

293+
### Version 4.8.6
294+
295+
`match="keywords"` added.
296+
297297
### Version 4.7.2
298298

299299
`breakform` attribute added, `breakby` attribute modified.
300300

301301
### Version 4.7.0
302302

303-
`breakby` attribute added.
303+
`breakby` attribute added, `exclude` attribute modified.
304+
305+
### Version 4.6.0
306+
307+
`exclude` and `match` attributes added.
304308

305309
### Version 4.0.7
306310

tags/learning/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ Will output:
467467
`escape="url"`
468468
: URL-encode all characters except `.-_`.
469469

470+
`escape="db"` <span class="footnote warning">v4.8.6+</span>
471+
: Encode the content so it can safely be used as part of a database query.
472+
470473
`escape="json"`
471474
: JSON-encode, without the surrounding `""` quotes.
472475

0 commit comments

Comments
 (0)