| 
									
										
										
										
											2016-08-20 23:02:09 +03:00
										 |  |  | #  pWiki Path
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | A Wiki is a set of _pages_, each uniquely defined by it's _title_. Titles  | 
					
						
							|  |  |  | are traditionally formatted as WikiWords. pWiki closely follows this  | 
					
						
							|  |  |  | culture, while not restricting either page title formatting nor page  | 
					
						
							|  |  |  | nesting (nested paths), though in the general case following the Wiki  | 
					
						
							|  |  |  | style is recommended. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Basic terminology
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **Path**   | 
					
						
							| 
									
										
										
										
											2016-08-17 17:55:49 +03:00
										 |  |  | _One or more strings (or parts) separated by "/" that identifies a view._ | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 17:55:49 +03:00
										 |  |  | We call the last _part_ in a path sequence a _title_. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | We call the sub-path without the _title_ a _basedir_ or simply _dir_. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | In pWiki, there is no distinction between a page and a _directory_, thus | 
					
						
							| 
									
										
										
										
											2016-08-17 17:55:49 +03:00
										 |  |  | we do not use the later term, instead, we may use the term _sub-page_. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 18:04:07 +03:00
										 |  |  | Paths are case sensitive. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | **Page**   | 
					
						
							| 
									
										
										
										
											2016-08-17 17:44:23 +03:00
										 |  |  | _A set of data associated with a path._ | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 18:04:07 +03:00
										 |  |  | A page is identified by it's path, but this does not require every | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | sub-path of that path to exist -- the full path is the identifier. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | Not every path _identifies_ a page, but every path _resolves_ to a page. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 18:04:07 +03:00
										 |  |  | Some pages are _bootstrapped_, i.e. are predefined in pWiki, these pages | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | can be overridden but can not be removed. This is done to make it simple  | 
					
						
							|  |  |  | to revert to the default state if something goes wrong. | 
					
						
							| 
									
										
										
										
											2016-08-17 06:08:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 17:55:49 +03:00
										 |  |  | **View**   | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | _A path that resolves to a page that may or may not be at (identified by)  | 
					
						
							|  |  |  | that specific path._ | 
					
						
							| 
									
										
										
										
											2016-08-17 17:55:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | A _view's_ path may match that of a specific page or may not match any | 
					
						
							|  |  |  | page directly, but any view will resolve to a page via the _acquisition  | 
					
						
							|  |  |  | process_ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 18:04:07 +03:00
										 |  |  | Any page is a view, every view resolves to a page, but not every view  | 
					
						
							|  |  |  | is a page. | 
					
						
							| 
									
										
										
										
											2016-08-17 17:55:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | (see: _Page acquisiton_ below) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | **\WikiWord**   | 
					
						
							|  |  |  | _A WikiWork is a specially formated string that is treated as a link in | 
					
						
							|  |  |  | page text_ | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | In pWiki a simple WikiWord is any string starting with a capital letter, | 
					
						
							|  |  |  | must contain at least and one more capital letter and can consist of  | 
					
						
							|  |  |  | letters, numbers, underscores (WikiWord itself is a good example) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | A WikiWord path (_WikiPath_) is a set of path parts separated by '/' the | 
					
						
							|  |  |  | first part must start with a capital letter and the rest can contain  | 
					
						
							|  |  |  | letters, numbers and/or underscores (example: Path/to/somepage). | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | _Note that this is not actually a part of the path specification but it  | 
					
						
							|  |  |  | is part of the Wiki culture and a convenient way to automatically link  | 
					
						
							|  |  |  | to pages (handled by pWiki macros when rendering pages)._ | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | **Special path characters**   | 
					
						
							|  |  |  | Titles of _user pages_ must not contain the leading underscore `_`  | 
					
						
							|  |  |  | character, such paths are used internally. | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Page acquisition
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 17:44:23 +03:00
										 |  |  | pWiki path system differs from how traditional file system paths are  | 
					
						
							| 
									
										
										
										
											2016-08-17 18:10:51 +03:00
										 |  |  | handled. In pWiki if a path does not reference a page directly (i.e.  | 
					
						
							|  |  |  | it's a _view_), a search is conducted to find an alternative page. This  | 
					
						
							|  |  |  | search is called _page acquisition_. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 17:44:23 +03:00
										 |  |  | **Acquisition process:**   | 
					
						
							|  |  |  | _A set of rules defining how a page is retrieved via a path._ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This is used as a simple and uniform mechanism to: | 
					
						
							|  |  |  | - Get default pages for specific situations   | 
					
						
							|  |  |  |   Like [Templates/EmptyPage] to handle the _page not found_ condition. | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | - Define generic templates/pages accessible by multiple pages in path   | 
					
						
							| 
									
										
										
										
											2016-08-17 17:44:23 +03:00
										 |  |  |   A good example would be the viewer used to show this page [Templates/\_view] | 
					
						
							| 
									
										
										
										
											2016-08-19 18:59:55 +03:00
										 |  |  |   and all of it's _chrome_ like the path in the header and links in the  | 
					
						
							|  |  |  |   footer <pwiki-comment>(seen: when viewing through pWiki)</pwiki-comment> | 
					
						
							| 
									
										
										
										
											2016-08-17 17:44:23 +03:00
										 |  |  | - Overload default templates/pages | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ### The acquisition order/rules:
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 1. if _path_ matches a specific page, target _page_ is found  | 
					
						
							|  |  |  | 1. if _path_ does not match a page: | 
					
						
							|  |  |  |   1. if _title_ matches a page in the parent _path_, _page_ is found | 
					
						
							|  |  |  |   1. repeat until we either have a match or reach root (empty _basedir_) | 
					
						
							|  |  |  | 1. if no match is found, check if title exists in [Templates] in _basedir_ | 
					
						
							|  |  |  | 1. if no match is found, check if title exists in [/System] | 
					
						
							|  |  |  | 1. if no match is found, repeat process for `EmptyPage` instead of _title_ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **Example:**   | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 06:08:24 +03:00
										 |  |  | For path `Path/To/Page` the following paths are checked in order  | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | and the first matching page is returned: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 17:27:31 +03:00
										 |  |  | - _Check path as-is then go up:_ | 
					
						
							|  |  |  |   - `Path/To/Page`  | 
					
						
							|  |  |  |   - `Path/Page` | 
					
						
							|  |  |  |   - `Page` | 
					
						
							|  |  |  | - _Check in `Templates`, in path and up:_ | 
					
						
							|  |  |  |   - `Path/To/Templates/Page` | 
					
						
							|  |  |  |   - `Path/Templates/Page` | 
					
						
							|  |  |  |   - `Templates/Page` | 
					
						
							|  |  |  | - _Check root `System`:_ | 
					
						
							|  |  |  |   - `System/Page` | 
					
						
							|  |  |  | - _Check `EmptyPage` in path, then in templates:_ | 
					
						
							|  |  |  |   - `Path/To/EmptyPage` | 
					
						
							|  |  |  |   - `Path/EmptyPage` | 
					
						
							|  |  |  |   - `EmptyPage` | 
					
						
							|  |  |  |   - `Path/To/Templates/EmptyPage` | 
					
						
							|  |  |  |   - `Path/Templates/EmptyPage` | 
					
						
							|  |  |  |   - `Templates/EmptyPage` _(This is guaranteed to exist)_ | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **Exceptions:** | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 17:27:31 +03:00
										 |  |  | - `System/settings` is global and _can not be overloaded_ for use as  | 
					
						
							|  |  |  | system configuration. This is done for security reasons. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Default pages
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | **EmptyPage**   | 
					
						
							|  |  |  | A page resolved when a page does not exist. Used as a template for  | 
					
						
							|  |  |  | new/empty pages. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This page is guaranteed to exist by the system. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Located at: Templates/EmptyPage | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **EmptyToDo**    | 
					
						
							|  |  |  | Used as a template for new/empty ToDo pages. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Located at: Templates/EmptyToDo | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **EmptyOutline**   | 
					
						
							|  |  |  | Used as a template for new/empty outline pages. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Located at: Templates/EmptyOutline | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **NoMatch**   | 
					
						
							|  |  |  | Returned when pattern matches no pages. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-28 20:37:07 +03:00
										 |  |  | ## Relative and absolute paths
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | pWiki follows the traditional path semantics with one addition, the ">>" | 
					
						
							| 
									
										
										
										
											2016-10-27 16:39:57 +03:00
										 |  |  | that is similar to ".." but works in the opposite direction, consuming  | 
					
						
							|  |  |  | the next, i.e. child, path element instead of parent. | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | To illustrate the relative and absolute mechanics: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-31 20:11:54 +03:00
										 |  |  | | Title				| Source Page | Path				  | Resolves to				| | 
					
						
							|  |  |  | |-------------------|-------------|-----------------------|-------------------------| | 
					
						
							|  |  |  | | "." - current		| \SourcePage | \\./Target/Page		  | \SourcePage/Target/Page | | 
					
						
							|  |  |  | | ".." - parent		| \SourcePage | \\../Target/Page	  | \Target/Page			| | 
					
						
							|  |  |  | | ">>"		| \SourcePage | >>\/Target/Page | \SourcePage/Page		| | 
					
						
							|  |  |  | | "/" - root dir	| \SourcePage | \/Target/Page		  | \/Target/Page			| | 
					
						
							| 
									
										
										
										
											2016-10-27 16:39:57 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | _Note that neither a leading ".." at root level, nor a trailing ">>"  | 
					
						
							|  |  |  | in any path, will have any effect, and will simply be ignored (e.g.  | 
					
						
							|  |  |  | "\/../Page" is same as "/Page" and "\Path/>>" is the same as "Path")_ | 
					
						
							| 
									
										
										
										
											2016-10-26 02:18:04 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 06:08:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-31 20:11:54 +03:00
										 |  |  | ## Path patterns
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | Path patterns are used to match/iterate multiple pages. The syntax is  | 
					
						
							|  |  |  | similar to path glob patterns. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-31 20:11:54 +03:00
										 |  |  | - "\*" - matches any page in a sub-path on one level | 
					
						
							|  |  |  | - "\*\*" - matches any page in a sub-path recursively | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Note that neither will match parts of paths that do not explicitly  | 
					
						
							|  |  |  | identify pages. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **Example:** | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | XXX revise... | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | For the following paths: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | WikiHome | 
					
						
							|  |  |  | SomePage | 
					
						
							|  |  |  | Path/to/OtherPage | 
					
						
							|  |  |  | Path/Page | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Patterns and their matches: | 
					
						
							|  |  |  | - `*` will match: | 
					
						
							|  |  |  | 	- WikiHome | 
					
						
							|  |  |  | 	- SomePage | 
					
						
							|  |  |  | - `**` will match: | 
					
						
							|  |  |  | 	- WikiHome | 
					
						
							|  |  |  | 	- SomePage | 
					
						
							|  |  |  | 	- Path/to/OtherPage | 
					
						
							|  |  |  | 	- Path/Page | 
					
						
							|  |  |  | - `\Path/*` will match: | 
					
						
							|  |  |  | 	- Path/Page | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Note that neither `\Path` nor `\Path/to` does not refer to any real pages, | 
					
						
							|  |  |  | thus neither is matched by any of the patterns explicitly. | 
					
						
							| 
									
										
										
										
											2016-08-17 06:08:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | ## Path actions
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | XXX path elements that perform actions on pages but do not actually  | 
					
						
							|  |  |  | correspond to actual pages. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Path variables
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | Path variables are resolved when path is resolved or accessed. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | **`$NOW`**   | 
					
						
							|  |  |  | Replaced with the current time. | 
					
						
							| 
									
										
										
										
											2016-08-17 06:08:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | _Also see the `\@now()` macro: [Doc/Macros]._ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | **`$PATH`**   | 
					
						
							|  |  |  | Replaced with current page path. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **`$BASE`**   | 
					
						
							|  |  |  | Replaced with current page basedir. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **`$TITLE`**   | 
					
						
							|  |  |  | Replaced with current page title. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-27 16:25:58 +03:00
										 |  |  | **`$INDEX`**   | 
					
						
							| 
									
										
										
										
											2016-10-28 23:28:50 +03:00
										 |  |  | Replaced with current page index in pattern matching. | 
					
						
							| 
									
										
										
										
											2016-08-17 05:56:24 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <!-- @filter(markdown) --> | 
					
						
							|  |  |  | <!-- vim:set ts=4 sw=4 ft=markdown spell : --> |