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