xref: /plugin/newpagefill/DOKU_EN (revision 9a36670832b754c53fa81850c7b00d5bb57a3705)
1====== Newpagefill Plugin ======
2
3---- plugin ----
4description: Page creation helper with prefill and @TITLE@ support
5author     : Valentin LORTET
6email      : contact@valentinlortet.fr
7type       : Action
8lastupdate : 2026-03-13
9compatible : Librarian
10depends    :
11conflicts  :
12similar    :
13tags       : Page, Creation, Template, Namespace, JavaScript
14
15downloadurl: https://github.com/Lortet/dokuwiki-plugin-newpagefill/zipball/master
16bugtracker : https://github.com/Lortet/dokuwiki-plugin-newpagefill/issues
17sourcerepo : https://github.com/Lortet/dokuwiki-plugin-newpagefill/
18donationurl:
19screenshot_img :
20----
21
22===== Installation =====
23
24Install the plugin from the [[plugin:extension|Extension Manager]].
25
26===== Description =====
27
28The **newpagefill** plugin adds a lightweight helper to create a new page:
29  * enter a title;
30  * automatically suggest a page ID;
31  * optionally enter the namespace;
32  * choose the creation mode depending on configuration;
33  * open the editor directly on the target page.
34
35It also complements the native DokuWiki template system:
36  * use ''_template.txt'' or ''__template.txt'' when available;
37  * add support for the ''@TITLE@'' placeholder in the injected content;
38  * fall back to a plugin-specific template when no native template exists.
39
40===== Settings =====
41
42^ Name ^ Description ^ Default value ^
43| template | Fallback template used when no native DokuWiki page template is found. | ''===== @TITLE@ ====='' |
44| default_start_mode | Default creation mode. | ''start'' |
45
46Possible values for ''default_start_mode'':
47  * ''ask'': show a selector in the dialog;
48  * ''start'': create a start page;
49  * ''none'': create a direct page;
50  * ''same'': create a subpage with the same name.
51
52===== Placeholders =====
53
54The plugin template may contain:
55  * ''@TITLE@'': title computed by the plugin (specific to newpagefill);
56  * all native DokuWiki placeholders: ''@ID@'', ''@NS@'', ''@PAGE@'', ''@USER@'', ''@DATE@'', etc. (handled by DokuWiki core, not by this plugin).
57
58===== @TITLE@ behaviour =====
59
60The value of ''@TITLE@'' is computed as follows:
61  * the request ''title'' value has priority;
62  * otherwise, the plugin tries to extract a title from the creation URL;
63  * if the created page is the namespace start page, the parent namespace name is used;
64  * ''_'' characters are replaced with spaces.
65
66===== Template compatibility =====
67
68The plugin follows this order:
69  * template already provided by DokuWiki;
70  * ''_template.txt'' in the target folder;
71  * ''__template.txt'' in the current or parent namespace;
72  * fallback template configured in the plugin.
73
74===== JavaScript function =====
75
76The plugin exposes the global function:
77
78<code javascript>
79window.NewPageFill.openCreatePageDialog(options)
80</code>
81
82Example:
83
84<code javascript>
85window.NewPageFill.openCreatePageDialog({
86  namespace: 'wiki:documentation',
87  initialTitle: 'New page'
88});
89</code>
90
91Useful options:
92  * ''namespace'': target DokuWiki namespace;
93  * ''initialTitle'': prefilled title;
94  * ''start'':
95    * ''undefined'' or ''null'': use the plugin configuration;
96    * ''@ask@'': force the mode choice dialog;
97    * ''true'': use the wiki start page;
98    * ''false'': create the page directly;
99    * ''@same@'': create a subpage with the same name as the page ID;
100    * any other string: create a subpage with that value;
101  * ''sepchar'': separator used to generate the page ID.
102
103If ''start'' is not provided and ''default_start_mode = ask'', the dialog offers:
104  * direct page;
105  * start page;
106  * subpage with the same name.
107