changeset 477:71c9259de019

web: Add help pages to wiki.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 11 Oct 2018 23:24:36 -0700
parents 71114096433c
children 5d5a6832c4ec
files wikked/resources/help/Categories.md wikked/resources/help/Command Line Interface.md wikked/resources/help/Configuration.md wikked/resources/help/Creating Pages.md wikked/resources/help/Data Storage.md wikked/resources/help/Editing Pages.md wikked/resources/help/Formatting.md wikked/resources/help/Help Contents.md wikked/resources/help/History.md wikked/resources/help/Linking.md wikked/resources/help/Navigating.md wikked/resources/help/Page Includes.md wikked/resources/help/Page Metadata.md wikked/resources/help/Page Queries.md wikked/resources/help/Searching.md wikked/resources/help/Special Pages.md wikked/resources/help/User Pages.md wikked/templates/footer.html wikked/views/__init__.py
diffstat 18 files changed, 863 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Command Line Interface.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,10 @@
+
+Some operations require, or can optionally be accomplished with, Wikked's
+command line interface. This is a tool called "`wk`" that you can run in your
+terminal or console:
+
+    $ wk help
+    usage: wk [-h] [--root ROOT] [--debug] [--debugsql] [--quiet] [--log LOG]
+    ...
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Configuration.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,144 @@
+
+Wikked can be configured with a couple files:
+
+* `.wikirc`: this file, located at the root of your wiki, can be submitted into
+  revision control, so that various clones of the wiki have the same options
+  where it makes sense.
+
+* `.wiki/wikirc`: some options may have to be different depending on where you
+  run the wiki from. This file is a complementary variant of the `.wikirc` file,
+  but is contained in the ignored-by-default `.wiki` folder. As such it is meant
+  to store options valid only for a local installation.
+
+The `wikirc` file is meant to be written with an INI-style format:
+
+```
+[section1]
+water = good
+witches = really bad
+
+[section2]
+wish = be home
+```
+
+
+## Main Options
+
+The main Wikked options should be defined in a `[wiki]` section. Here are the
+supported options:
+
+* `main_page` (defaults to `Main page`): the name of the page that should be
+  displayed when people visit the root URL of your wiki. Page names are case
+  sensitive so watch out for the capitalization. 
+
+* `default_extension` (defaults to `md`): the file extension (and therefore
+  [[Formatting]] engine) to use by default when creating a new page. The default
+  values is `md` for [Markdown][].
+
+* `templates_dir` (defaults to `Templates`): by default, the `include` statement
+  (see [[Editing Pages]]) will first look into a templates directory for
+  a template of the given name. This is the name of that folder.
+
+Also see [[Advanced Options|Configuration#advanced-options]] below.
+
+
+## Permissions
+
+The `wikirc` file can also be used to define user permissions. This is done with
+the `[users]` section:
+
+    [users]
+    dorothy=PASSWORD_HASH
+
+The `PASSWORD_HASH` is, well, a password hash. You can generate one by using the
+`wk newuser` command (see [[Command Line Interface]]):
+
+    $ wkdev newuser dorothy
+    Password: ********
+    dorothy = $2a$12$7FR949jt9zq5iNwY5WAZAOzD7pK3P0f/NnrKHAys17HT1Omuk2Asu
+
+    (copy this into your .wikirc file)
+
+Once you have some users defined, you can give them some permissions, using the
+`[permissions]` section. Supported settings are:
+
+* `readers`: users able to read the wiki.
+* `writers`: users able to edit the wiki.
+
+Multiple usernames must be separated by a comma. You can also use `*` for "all
+users", and `anonymous` for unauthenticated visitors.
+
+The following example shows a wiki only accessible to registered users, and that
+can only be edited by `dorothy` and `toto`:
+
+    [permissions]
+    readers = *
+    writers = dorothy,toto
+
+Those settings can also be overriden at the page level using the `readers` and
+`writers` metadata. So you can still have a public landing page for the
+previously mentioned private wiki by adding this to `Main page.md`:
+
+    {%raw%}
+    {{readers: *,anonymous}}
+    {%endraw%}
+
+See [[Page Metadata]] for more information.
+
+
+## Ignored files
+
+The optional `ignore` section lets you define files or folders for Wikked to
+ignore (_i.e._ files that are not pages, or folder that don't contain pages).
+
+Each item in this section should be `name = pattern`, where `name` is irrelevant,
+and `pattern` is a glob-like pattern:
+
+    [ignore]
+    venv = venv
+    temp = *~
+    temp2 = *.swp
+
+This will ignore a `venv` folder or file at the root, or any file or folder
+anywhere that ends with `~` or `.swp`.
+
+
+## Advanced Options
+
+In addition to the [[Main Options|Configuration#main-options]] above, the
+following avanced wiki options are available. They's in the `[wiki]` section:
+
+* `indexer` (defaults to `whoosh`): The full-text indexer to use. Only
+  2 indexers are currently supported, `whoosh` (for [Whoosh][]) and `elastic`
+  (for [Elastic Search][elastic]).
+
+* `database` (defaults to `sql`): The database system to use for the cache.
+  Wikked currently only supports SQL, but see the next option below.
+
+* `database_url` (defaults to `sqlite:///%(root)s/.wiki/wiki.db`): the URL to
+  pass to [SQLAlchemy][] for connecting to the database. As you can see, the
+  default value will read or create an [SQLite][] file in the `.wiki` folder. If
+  you want to use a proper SQL server you can specify its URL and login
+  information instead. See the [SQLAlchemy connection string format][conn] for more
+  information.
+
+
+## Web Server Options
+
+Wikked runs on top of [Flask][], and for some advanced things (like hacking
+around with code), you may want to be able to configure the Flask app. For this,
+you can use the `.wiki/app.cfg` file.
+
+This file, if it exists, will be passed on to Flask. See the [Flask
+configuration documentation][flaskcfg] for more information.
+
+  
+ [flask]: http://flask.pocoo.org/
+ [flaskcfg]: http://flask.pocoo.org/docs/0.10/config/
+ [conn]: http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls 
+ [SQLite]: http://sqlite.org
+ [SQLAlchemy]: http://sqlalchemy.org
+ [whoosh]: https://bitbucket.org/mchaput/whoosh/wiki/Home
+ [elastic]: http://www.elasticsearch.org/
+ [markdown]: https://commonmark.org/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Creating Pages.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,55 @@
+
+You can create new pages quite easily in Wikked using one of the following
+methods:
+
+- Using the "_New Page_" menu item in the sidebar.
+- Using wiki links.
+- Using the URL.
+
+## New Page Creation
+
+When you click on the "_New Page_" menu entry in the sidebar, you'll be taken to
+an interface where you can fill in the new page's title and initial contents.
+As usual with any change, there will also be an opportunity to fill in the
+author's name and a description for the revision (which will show up in the
+[[History]]).
+
+If the page title contains a path separator (`/`), this will translate to
+creating the page inside a sub-folder whose name is what comes before the
+separator. So for example, creating a page called `Villains/Flying Monkeys` will
+create a page inside a `Villains` sub-folder, with the page itself being called
+`Flying Monkeys`.
+
+
+## Creation via Wiki Links
+
+An easy way to create a new page is to first reference it from another page,
+_i.e._ [[Editing]] a page, and [[Linking]] to an as-of-yet inexistent page.
+After saving the change, the new link should show up as red (to indicate
+a missing page), and you can click that to be offered the opportunity to create
+that page.
+
+This avoids having to fill in the appropriate folder and title in the "_New
+Page_" interface, and makes sure the new page is already reachable from the rest
+of the wiki.
+
+
+## Creation via URL
+
+This method is a bit more nerdy, but it works as well as the previous one. You
+just replace a page's title in your browser's URL bar with the title of the page
+you want to create. So for example, if you're on
+`https://yourwiki.net/read/Whatever` (a page titled "_Whatever_"), you can
+go to `https://yourwiki.net/read/Something Else` instead. Assuming a page titled
+"_Something Else_" doesn't exist already, you should get the standard "missing
+page" text which will let you create it right away.
+
+
+## Advanced Topics
+
+- There's nothing preventing you from using accented or non-latin characters for
+  a new page name, except for characters that would be invalid for a file name.
+  However, please note that most revision control systems are going to behave
+  badly if you'll be working with your repository on mixed systems (_i.e._
+  Windows, Mac, Linux).
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Data Storage.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,67 @@
+
+Wikked’s data is entirely stored in text files on disk. All you ever need, or
+should really care about, are those text files, and the source control
+repository which contains their history. Wikked may create some other files
+–- cache files, indices, etc. –- but they can always be safely deleted and
+re-created.
+
+Inside the wiki root directory, you will find:
+
+- Page files.
+- Source control files.
+- Configuration files.
+- Cache files.
+
+
+## Page Files
+
+If you look at your wiki, you should see a file called `Main page.md`, along
+with maybe other such text files that you added yourself, and sub-folders that 
+contain more of them.
+
+Each page's text is stored in a file whose name is the name of the page -- like
+that `Main page.md`. That name is important, since that's what you'll use for
+linking to it, and what will show up in that page's URL. A page named `Toto.md`
+would be available at the URL `/read/Toto`. See [[Creating Pages]] for more
+information.
+
+
+## Source Control Files
+
+Page files are also stored in a "source control management" tool (or SCM), which
+is what tracks their various versions as they are edited. The SCM usually stores
+files in a hidden sub-folder, like `.hg` or `.git` for [Mercurial] and [Git]
+respectively.
+
+There might also be a few other SCM files, like `.hgignore` or `.gitignore`, or
+any number of things Wikked, an SCM client application, or yourself created for
+a reason.
+
+Don't touch those files, as they're important (they store your pages' history).
+You can learn more about these files, and about the SCM you picked when you
+created your wiki, by using the wonders of the internet.
+
+
+## Configuration Files
+
+Wikked can be configured with some configuration files like the `.wikirc` file.
+There are no such files originally when you create a new wiki, but they can be
+created later to customize or add something. See [[Configuration]] for more
+information.
+
+
+## Cache Files
+
+There should be a `.wiki` folder in the wiki root directory. This folder is
+a cache, and can generally be safely deleted and re-created with the `wk reset`
+command (see [[Command Line Interface]]). You may however have some local
+configuration file(s) in there (see [[Configuration]]), so watch out before
+deleting that folder.
+
+
+
+
+
+[wikked]: https://bolt80.com/wikked/
+[mercurial]: https://www.mercurial-scm.org/
+[git]: https://git-scm.com/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Editing Pages.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,45 @@
+
+Editing pages in Wikked is super easy -- by design.
+
+1. Find the page you want to edit (see [[Navigating]]).
+2. Click on the "_Edit_" menu entry in the sidebar.
+3. Add or change something in the text editor.
+4. Click the "_Save_" button!
+
+
+## Editing in your Browser
+
+When you edit a page, it's a good idea to follow these simple rules:
+
+- Add a simple description to your changes before hitting the "_Save_" button.
+  This will help you sort through changes when you look at page histories.
+
+- Use the "_Preview_" button to check that you didn't make a typo,
+  [[Formatting]] mistake, or other simple error. This will help reduce the
+  number of "fix up" revisions that could clutter up the history.
+
+- Prefer editing pages while being logged in, or, if you're just running your
+  wiki locally, make sure you configured your SCM so that any commits are set to
+  be authored by you. This will make sure your wiki history is not full of
+  commits with your local IP address.
+
+
+## Editing in a Text Editor
+
+Wikked stores page data in text files, handled by a source control management
+system (SCM). This means you can also simply edit pages in your favourite text
+editor, and commit the changes using the SCM's standard commands. Sometimes this
+is easier than going through the web interface, especially when you need to make
+multiple changes to multiple files, like a "_search and replace_" type of
+operation.
+
+
+## Advanced Features
+
+Advanced editing features are available:
+
+- [[Page Metadata]]: adds information to pages, including categories,
+  permissions, and display options.
+- [[Page Includes]]: including a page inside another one.
+- [[Page Queries]]: listing pages matching a given metadata query.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Formatting.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,34 @@
+
+Formatting is the step of transforming "plain text" into something a bit more
+expressive, such as text with **bold words** and _emphasis_, headers and
+footnotes.
+
+
+
+## Markdown Formatting
+
+By default, formatting is done with [Markdown][1]. And although there are many
+resources available online, here is a quick primer:
+
+[1]: https://commonmark.org/help/
+
+
+| You type     | You get   |
+| ------------ | --------- |
+| `*Italics*` | *Italics* |
+| `**Bold**` | **Bold** |
+| `# Header 1` | <h1>Header 1</h1> |
+| `## Header 2` | <h2>Header 2</h2> |
+| `[A link](http://a.com)` | [A link](https://bolt80.com/wikked) |
+| `> Blockquote` | <blockquote>Blockquote</blockquote> |
+| `* List`<br/>`* List` | <ul><li>List</li><li>List</li></ul> |
+| `1. List`<br/>`2. List` | <ol><li>List</li><li>List</li></ol> |
+| `` `Inline code` `` | `Inline code` |
+
+
+## Specifying Formatting
+
+Formatting is driven by the page files' extensions. A file with a `.md`
+extension will be formatted with Markdown, whereas a file with a `.textile`
+extension would be formatted wiht Textile.
+
--- a/wikked/resources/help/Help Contents.md	Thu Oct 11 23:24:06 2018 -0700
+++ b/wikked/resources/help/Help Contents.md	Thu Oct 11 23:24:36 2018 -0700
@@ -2,6 +2,36 @@
 Welcome to the [Wikked][] help. These pages provide information and guidance
 about how to use your wiki.
 
+## Reading
 
-[wikked]: https://bolt80.com/wikked/
+- [[Navigating]] your wiki
+- [[Searching]] through pages
+- Looking at the [[History]] of pages
+
+## Editing
+
+- [[Editing Pages]]
+- [[Creating Pages]]
+- [[Linking]] to other content
+- [[Formatting]] your text
+- [[User Pages]]
+
+## Advanced Editing
 
+- [[Page Metadata]] customize aspects of a page
+- [[Page Includes]]
+- [[Page Queries]] list pages matching a query
+- [[Special Pages]]
+
+## Advanced Topics
+
+- [[Data Storage]]
+
+## Administration
+
+- [[Configuration]]
+- [[Command Line Interface]]
+
+
+[wikked]: https://bolt80.com/wikked
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/History.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,58 @@
+
+Every time you edit a page, Wikked stores a new _revision_ of the page. The
+series of revisions, going all the way back to the creation of a page,
+constitute the _history_ of a page.
+
+All the changes across all pages make up for the _history of the wiki_.
+
+
+## Page History
+
+You can generally see the history of a page by clicking the "_History_" entry in
+the sidebar. The history will be a list of revisions, where each revision is
+shown as:
+
+- An _identifier_ for the revision, which is how the source control management
+  system (SCM) knows about this revision. It depends on the SCM you chose when
+  creating your wiki -- with Mercurial it's going to be a revision hash, and
+  with Git it's going to be a commit SHA.
+
+- The date when the revision occured.
+
+- The author of the change. If the person who created or edited the page wasn't
+  logged in, the IP address will be stored instead.
+
+- A comment that the author may or may not have written when they created or
+  edited the page.
+
+- The ability to show the changes that the revision did to the page (_i.e._ the
+  difference between the page's prevision revision and the selected one), and
+  the ability to show the changes between two arbitrary revisions (_i.e._
+  selecting two revision and showing the difference between them).
+
+
+### Reverting to a Previous Revision
+
+The revision identifier will usually be a clickable link in a page's history,
+which shows you what the page's _raw text_ looked like at that point in time.
+
+There is also a button at the bottom of that page which lets you _revert_ the
+page to that revision. This will create a _new revision_ which effectively
+brings that page's text back to how it was.
+
+
+## Wiki History
+
+You can look at the entire wiki's history in the special [[special:/History]]
+page.
+
+That page will show you a similar list of revisions as with page histories, but
+with a different layout, because each revision will now also list the pages that
+were modified in each revision. Although someone editing pages through Wikked's
+web interface will only be able to change one page at a time, what sets Wikked
+apart from some other wikis is that pages are simple text files stored in
+a standard SCM like Git or Mercurial, so it's possible for some changes to have
+been done _outside_ of Wikked (using your text editor of choice), across several
+files at the same time. See [[Editing Pages]].
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Linking.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,88 @@
+
+A wiki is made up of pages that _link_ to each other, the same way normal web
+pages also link to each other. However, linking between pages inside your wiki
+(_a.k.a._ "_wikilinks_") is made a lot simpler.
+
+
+## Wikilink Syntax
+
+You can always create a normal link to a page's URL, using, say, the Markdown
+syntax for hyperlinks (if you're using Markdown in your wiki... see
+[[Formatting]]), but it's easier to use the wikilink syntax, which was designed
+to be quicker to write. It uses double square brackets surrounding the page's
+title, like so: `\[[Target Page]]`.
+
+This syntax supports a few variants and options, which you can see in the
+following table:
+
+| Link name     | Description         | Syntax          |
+| ------------- | ------------------- | --------------- |
+| Relative page link | A link to a wiki page in the same folder and endpoint as the current one. | `\[[Winged Monkeys]]`<br/>&nbsp;<br/>`\[[Villains/Winged Monkeys]]` |
+| Absolute page link | A link to a wiki page in the same endpoint as the current one. | `\[[/Winged Monkeys]]`<br/>&nbsp;<br/>`\[[/Villains/Winged Monkeys]]` |
+| Relative endpoint/page link | A link to a wiki page in a different endpoint, but with the same relative path. | `\[[refs:Winged Monkeys]]`<br/>&nbsp;<br/>`\[[refs:Villains/Winged Monkeys]]` |
+| Absolute endpoint/page link | A link to a fully-specified wiki page. | `\[[refs:/Winged Monkeys]]`<br/>&nbsp;<br/>`\[[refs:/Villains/Winged Monkeys]]` |
+| Piped link    | A link to a wiki page, but with a custom text. | `\[[a link|Winged Monkeys]]` |
+| Header link   | A link to a specified section in a wiki page. | `\[[Winged Monkeys#golden-cap]]` |
+| Child page link | A link to a "_child page_" of the current one.  | `\[[./Winged Monkeys]]` |
+| Parent page link | A link to a "_parent page_" of the current one.  | `\[[../Cities]]` |
+
+
+## Endpoints
+
+An "_endpoint_" in Wikked is a special place where you can put special pages.
+The bulk of your content is going to be outside of any such endpoints, but some
+pages like [[Categories]] are going to be at a given endpoint.
+
+Endpoints are also useful for either having different "views" on a page (like
+a "discussion" page to leave comments _about_ the page), or to create
+a different namespace for different things, without running into page name
+clashes.
+
+On disk, while a page is just stored in the wiki's root folder (or a subfolder
+of it), pages at, say, the `refs` endpoint, will be found in the `_meta/refs/`
+folder.
+
+
+## Relative and Absolute Wikilinks
+
+Relative wikilinks are those that don't have a "slash" character (`/`) at the
+beginning of the link. So `\[[Quadrants/Quadling Country]]` is a relative link,
+whereas `\[[/Oz/Quadrants/Quadling Country]]` is an absolute link.
+
+There are rules to relative wikilinks which are simple once you know that it
+maps to the files and folders on disk:
+
+- Absolute links are "anchored" in the current endpoint's root folder.
+- Relative links are "anchored" in the current page's folder.
+
+The term "current" means "taken from the page that contains the link we're
+talking about".
+
+### Absolute Wikilinks
+
+There's not much to say about absolute wikilinks since, by definition, they
+specify the entire path to the page, so Wikked doesn't do anything.
+
+Of note, if you want to fully specify the path to a page in the main part of the
+wiki (_i.e._ not at any endpoint), you can use an "empty endpoint" like so:
+`\[[:/Villains/Winged Monkeys]]`.
+
+### Relative Wikilinks
+
+Although the rules for relative wikilinks are simple, they are very powerful and
+a few examples are in order:
+
+| Source endpoint | Source path        | Link           | Where it leads you |
+| --------------- | ------------------ | -------------- | ------------------ |
+|                 | `/Villains`        | `Witches`      | `/Witches`         |
+|                 | `/Villains`        | `./Winged Monkeys` | `/Villains/Winged Monkeys` |
+|                 | `/Villains/Winged Monkeys` | `/Fighting Trees` | `/Villains/Fighting Trees` |
+|                 | `/Villains/Winged Monkeys` | `../Cities` | `/Cities` |
+|                 | `/Villains/Winged Monkeys` | `refs:Winged Monkeys` | `refs:/Villains/Winged Monkeys` |
+| `refs:`         | `/Villains/Winged Monkeys` | `Fighting Trees` | `refs:/Villains/Fighting Trees` |
+| `refs:`         | `/Villains/Winged Monkeys` | `:Winged Monkeys` | `/Villains/Fighting Trees` |
+
+Of special note:
+
+- `./` is a short-hand for `<name of current page>/`.
+- `../` gets you "up one folder".
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Navigating.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,60 @@
+
+Wikked's purpose is to be easy to browse and edit -- like a web-based notebook.
+
+To help with the "browsing" part, Wikked offers:
+
+- Easily spotted links in the page's text. 
+- A sidebar where you can quickly use the main features of your wiki, or search
+  for pages.
+
+
+## Links
+
+Links from a page are (with the default theme) shown in an easily spottable
+bright blue. You can learn about creating links on the [[Editing Pages]] and
+[[Linking]] help.
+
+Links that point to a page that doesn't exist yet will be shown in red. If you
+click on one of them, you'll be given the opportunity to create the missing page
+by simply writing its initial contents. For example, here's a link to 
+[[:/A Missing Page]] (assuming you haven't created a page by this name already!).
+
+Last, _external_ links, _i.e._ links that point to a page that doesn't belong to
+your wiki, will be shown with a little arrow next to the link. For example, here
+is a link to the [official Wikked website][1].
+
+
+## Sidebar
+
+The Wikked sidebar contains various entries depending on the currently displayed
+page, whether a user is logged in, and what permissions that user has. However,
+here is a list of items you would typically see:
+
+- **Home**: a quick way to get back to the main page of your wiki. That's
+  generally a page named `Main Page` but it could be different (see
+  [[Configuration]]).
+
+- **New Page**: creates a brand new page. See [[Creating Pages]].
+
+- **Edit**: edits the currently displayed page. See [[Editing Pages]].
+
+- **History**: shows the history of the currently displayed page. See
+  [[History]].
+
+- **Search box**: lets you search for content in your wiki. See [[Searching]].
+
+- **Pages linking here**: shows a list of pages that link to the current page.
+
+- **Upload file**: lets you upload a file (such as an image) for you to use in
+  a page. See [[Editing Pages]].
+
+- **Special pages**: opens a dashboard that links to a variety of informational,
+  administrative, or troubleshooting pages. See [[Special Pages]].
+
+- **Login/logout**: logs in or out of the wiki.
+
+- **Your user page**: when logged in, this leads you to your personal page. See
+  [[User Pages]].
+
+
+[1]: https://bolt80.com/wikked
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Page Includes.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,98 @@
+
+The [[Page Metadata]] syntax is also used for including pages into other pages.
+
+
+## Basic Include Syntax
+
+For instance, to include the `Warning` page in another page:
+
+    {%raw%}
+    {{include: Warning}}
+    {%endraw%}
+
+You can supply a relative or absolute page name to the `include` meta --
+[[Linking]] resolving rules apply. For convenience, however, if the path is
+_not_ absolute, Wikked will first look in the `/Templates` folder for a page of
+that name to include. If it doesn't find one, it will resolve the path as usual.
+
+> You can make Wikked look into a different folder than `/Templates` by changing
+> the `templates_dir` option in the configuration file. See [[Configuration]].
+
+
+## Templated Include
+
+The `include` metadata accepts arguments. For example, the `City of Oz`
+page may have this at the top:
+
+    {%raw%}
+    {{include: Warning
+        |a work in progress
+        |adding references
+    }}
+    {%endraw%}
+
+Those arguments can then be used by the included `/Templates/Warning` page:
+
+    {%raw%}
+    WARNING! This page is {{__args[0]}}.
+    You can help by {{__args[1]}}.
+    {%endraw%}
+
+This will make `City of Oz` print the following warning:
+
+    WARNING! This page is a work in progress.
+    You can help by adding references.
+
+As you can see, arguments are passed as an array named `__args`, and this can be
+inserted using double curly brackets. So {%raw%}`{{__args[0]}}`{%endraw%}
+inserts the first passed argument, {%raw%}`{{__args[1]}}`{%endraw%} inserts the
+second, and so on.
+
+You can also pass arguments by name:
+
+    {%raw%}
+    {{include: Presentation
+        |what=dog
+        |nickname=Toto
+    }}
+    {%endraw%}
+
+And use them by name in the included `/Templates/Presentation` template:
+
+    {%raw%}
+    This page is about a {{what}} named "{{nickname}}".
+    {%endraw%}
+
+In reality, when included, a page's text will be processed through [Jinja2][]
+templating so you can also use all kinds of fancy logic. For example, if you
+want to support a default warning message, and an optional information message,
+you can rewrite the `/Template/Warning` page like so:
+
+    {%raw%}
+    WARNING! This page is {{__args[0]|default('not ready')}}.
+    {%if __args[1]%}You can help by {{__args[1]}}.{%endif%}
+    {%endraw%}
+
+For more information about what you can do, refer to the [Jinja2 templating
+documentation][jinja2_tpl].
+
+  [jinja2]: http://jinja.pocoo.org/
+  [jinja2_tpl]: http://jinja.pocoo.org/docs/templates/
+
+
+## Included Metadata
+
+Pages with other pages included in them inherit the meta properties of the
+included pages. So if `/Templates/Presentation` has `{% raw %}{{category:
+Characters}}{% endraw %}`, then a page including it will _also_ be in the
+"Characters" category.
+
+You can tweak that behaviour:
+
+* Meta properties that start with `__` (double underscore) will be "local" or
+  "private" to that page, _i.e._ they won't be inherited by including pages.
+
+* Meta properties that start with `+` (plus sign) will only be "added" or
+  "given" to includnig pages, _i.e._ the current page won't have that property,
+  but pages including it will.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Page Metadata.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,64 @@
+
+In Wikked, "_page metadata_" is information _about_ a page. It may or may not be
+visible to a reader of that page, but it does affect what Wikked can do with it.
+
+
+## Syntax
+
+To assign metadata to a page, use `{%raw%}{{name: value}}{%endraw%}`. For
+instance:
+
+    {%raw%}
+    {{category: Witches}}
+    {%endraw%}
+
+You may need to assign a long value, like the summary of the page, which you may
+not want to write all in one single line. In that case, you can use multiple
+lines, but you need to put the closing double curly braces by themselves on the
+last line:
+
+    {%raw%}
+    {{summary: This page is about winged monkeys, who serve
+        the wicked witch of the west. They're not very bright
+        but they are extremely loyal.
+    }}
+    {%endraw%}
+
+> Note that the extra line to get to the closing braces won't be included
+> in the metadata. If you want the metadata value to end with an empty line,
+> you'll need to add one, effectively leaving an empty line before the closing
+> braces.
+
+Finally, you can also set a metadata without any value if the point is just to
+metaphorically flip a switch on the page. Just leave the value empty:
+
+    {%raw%}
+    {{is_villain: }}
+    {%endraw%}
+
+The syntax for metadata is also used for [[Page Includes]] and [[Page Queries]].
+
+
+## Well-Know Metadata
+
+Although most metadata you'll use will be for you only, some of it is used to
+tell Wikked to do something special.
+
+* `category`: Adds the current page to the given category. You can specify this
+  metadata multiple times to make the page part of multiple categories. Wikked
+  will show the categories of a page at the bottom.
+
+* `notitle`: If specified, Wikked won't show the title of this page. This
+  lets you use a banner graphic or some other way to present the page to
+  a visitor. This metadata doesn't need any value.
+
+* `redirect`: Redirects to another page. The link resolution rules apply to the
+  redirect target (see [[Linking]]).
+
+* `readers`: Specifies the users who can read this page. When not present, the
+  default readers for the wiki will be able to read the page. See
+  [[Configuration]].
+
+* `writers`: Similar to the previous metadata, but for the ability to edit
+  a page.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Page Queries.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,65 @@
+
+Page queries let you list pages in various ways, based on various criteria. It
+uses the [[Page Metadata]] syntax.
+
+
+## Basic Query Syntax
+
+The query metadata takes the name and value of another metadata to query on
+pages.  So for instance you can display a list of pages in the "_Witches_"
+category like so:
+
+    {%raw%}
+    {{query: category=Witches}}
+    {%endraw%}
+
+This will print a bullet list of the matching pages' titles, with a link to
+each. Of course you can match any other metadata -- not just "category".
+
+
+## Formatting Options
+
+You can customize how the list looks like by setting a number of arguments to
+the query. The argument syntax is similar to that of [[Page Includes]].
+
+Supported arguments are:
+
+* `__header`: The text to print before the list. The default is an empty line.
+* `__item`: The text to print for each matching page. It defaults to: `*
+  {%raw%}\[[{{title}}|{{url}}]]{%endraw%}` (which means, as per Markdown
+  formatting, that it will print a bulleted list of titles linking to each
+  page).
+* `__footer`: The text to print after the list. The default is an empty line.
+* `__empty`: The text to show when no pages match the query. It defaults to a
+  simple text saying that no page matched the query.
+
+So for example, to display a description of each page next to its link, where
+the description is taken from a `description` metadata on each matching page,
+you would do:
+
+    {%raw%}
+    {{query: category=Witches
+        |__item=* \[[{{title}}|{{url}}]]: {{description}}
+
+    }}
+    {%endraw%}
+
+Note the extra empty line so that each item has a line return at the end...
+otherwise, they would be all printed on the same line!
+
+When a query parameter gets too complicated, you can store it in a separate
+metadata property, as long as that property starts with a double underscore:
+
+    {%raw%}
+    {{__queryitem: * \[[{{title}}|{{url}}]]: {{description}} }}
+
+    {{query: category=Witches|__item=__queryitem}}
+    {%endraw%}
+
+For extra long item templates, you can use a dedicated page. For example, here's
+how you use the text in `/Templates/Witches Item` as the query item template:
+
+    {%raw%}
+    {{query: category=Witches|__item=\[[/Templates/Witches Item]]}}
+    {%endraw%}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Searching.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,24 @@
+
+The search box available on the sidebar is the quickest way to get around your
+wiki. 
+
+When you start typing something in it, it will search for that in
+real-time in all the wiki's pages' titles, showing you those pages' titles
+in a constantly updated drop-down list. You can use the arrow keys to select an
+entry, and the `Enter` or `Return` key to go to it.
+
+If none of the pages in the drop-down list look like what you're searching for, 
+you can press `Enter` or `Return` and get taken to the full list of search
+results.
+
+Please note that search has the following limitations:
+
+- Only the "raw text" of pages is indexed -- that's the text that's stored in
+  the page files, and the text that you see when you edit a page. This means
+  that any content brought into a page via queries, includes, and other such
+  "dynamic" features, _will not_ be searchable.
+
+- Search results are filtered based on the read permissions of the currently
+  logged-in user (or the anonymous user if nobody's logged in). If you search
+  for something contained in a page you don't have permission to read, that page
+  won't show up in the results.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/Special Pages.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,6 @@
+
+Special pages are listed in the [[special:/Dashboard]], available from the
+sidebar menu (see [[Navigating]]). These pages are very useful for
+a well-maintained wiki: they tell you about broken links, orphaned pages, and
+so on.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wikked/resources/help/User Pages.md	Thu Oct 11 23:24:36 2018 -0700
@@ -0,0 +1,10 @@
+
+When you are logged in, a link in the sidebar (see [[Navigating]]) will let you
+access your "_user page_".
+
+A user page is a page in the `user` endpoint whose name is your username. It is
+not private by default, but it's easy to make it so by specifying permissions
+like so: `{% raw %}{{readers: <username>}}{% endraw %}` (where `<username>` is
+your username). See [[Configuration]] for more information.
+
+
--- a/wikked/templates/footer.html	Thu Oct 11 23:24:06 2018 -0700
+++ b/wikked/templates/footer.html	Thu Oct 11 23:24:36 2018 -0700
@@ -1,6 +1,7 @@
 <footer role="navigation">
     <ul>
         <li><span class="wiki-icon"></span> Powered by <a href="http://bolt80.com/wikked/">Wikked</a></li>
+        <li><span class="wiki-icon"></span> <a href="{{nav.url_help}}">Help</a></li>
         {% if nav %}
         {% for e in nav.footers %}
         <li>{% if e.icon %}<span class="fa fa-{{e.icon}}"></span> {% endif %}<a href="{{e.url}}">{{e.title}}</a></li>
--- a/wikked/views/__init__.py	Thu Oct 11 23:24:06 2018 -0700
+++ b/wikked/views/__init__.py	Thu Oct 11 23:24:36 2018 -0700
@@ -40,7 +40,9 @@
     nav = {'extras': [], 'footers': []}
 
     nav['hide_menu'] = (
-            request.cookies.get('wiki-hide-nav') == '1')
+        request.cookies.get('wiki-hide-nav') == '1')
+
+    nav['url_help'] = url_for('read', url='help:/Help Contents')
 
     if home:
         nav['url_home'] = '/'