xref: /plugin/newpagefill/README_EN.md (revision 9a36670832b754c53fa81850c7b00d5bb57a3705)
1*9a366708SLORTET# Newpagefill
2*9a366708SLORTET
3*9a366708SLORTET[���� Français](README.md) | ���� English | [���� Deutsch](README_DE.md) | [���� Español](README_ES.md)
4*9a366708SLORTET
5*9a366708SLORTETThe plugin can:
6*9a366708SLORTET- open a small page creation dialog with a title and page ID;
7*9a366708SLORTET- automatically suggest a page ID from the title;
8*9a366708SLORTET- prefill the new page with a plugin template if no native template exists;
9*9a366708SLORTET- extend native DokuWiki templates with `@TITLE@`.
10*9a366708SLORTET
11*9a366708SLORTET## Usage
12*9a366708SLORTET
13*9a366708SLORTETThe plugin adds a simpler page creation flow:
14*9a366708SLORTET- enter a title;
15*9a366708SLORTET- optionally enter a namespace if none was provided by the caller;
16*9a366708SLORTET- the plugin suggests a page ID;
17*9a366708SLORTET- it then opens the editor for the new page directly.
18*9a366708SLORTET
19*9a366708SLORTETIf a native DokuWiki template exists (`_template.txt` or `__template.txt`), it is used.
20*9a366708SLORTETOtherwise, the plugin applies its own configured fallback template.
21*9a366708SLORTET
22*9a366708SLORTET## Configuration
23*9a366708SLORTET
24*9a366708SLORTETIn the configuration manager:
25*9a366708SLORTET- `template`: fallback template used only when no native DokuWiki page template is found;
26*9a366708SLORTET- `default_start_mode`: default page creation mode (`ask`, `start`, `none`, `same`).
27*9a366708SLORTET
28*9a366708SLORTETThis template may contain:
29*9a366708SLORTET- `@TITLE@`: title computed by the plugin (specific to newpagefill);
30*9a366708SLORTET- all native DokuWiki placeholders: `@ID@`, `@NS@`, `@PAGE@`, `@USER@`, `@DATE@`, etc. (handled by DokuWiki core, not by this plugin).
31*9a366708SLORTET
32*9a366708SLORTET## `@TITLE@` behavior
33*9a366708SLORTET
34*9a366708SLORTETThe plugin fills `@TITLE@` as follows:
35*9a366708SLORTET- it first uses the `title` value if it exists;
36*9a366708SLORTET- otherwise, it tries to extract it from the creation URL;
37*9a366708SLORTET- if the created page is a start page such as `start`, it uses the parent namespace name;
38*9a366708SLORTET- `_` characters are converted to spaces.
39*9a366708SLORTET
40*9a366708SLORTET## DokuWiki template compatibility
41*9a366708SLORTET
42*9a366708SLORTETThe plugin respects the native template system:
43*9a366708SLORTET- `_template.txt`
44*9a366708SLORTET- `__template.txt`
45*9a366708SLORTET
46*9a366708SLORTETIt does not replace it.
47*9a366708SLORTETIt only adds support for `@TITLE@` — native DokuWiki placeholders (`@ID@`, `@NS@`, etc.) are handled by the core afterward.
48*9a366708SLORTET
49*9a366708SLORTET## Available JavaScript function
50*9a366708SLORTET
51*9a366708SLORTETThe plugin also exposes a global JavaScript function:
52*9a366708SLORTET
53*9a366708SLORTET```js
54*9a366708SLORTETwindow.NewPageFill.openCreatePageDialog(options)
55*9a366708SLORTET```
56*9a366708SLORTET
57*9a366708SLORTETExample:
58*9a366708SLORTET
59*9a366708SLORTET```js
60*9a366708SLORTETwindow.NewPageFill.openCreatePageDialog({
61*9a366708SLORTET  namespace: 'wiki:documentation',
62*9a366708SLORTET  initialTitle: 'New page'
63*9a366708SLORTET});
64*9a366708SLORTET```
65*9a366708SLORTET
66*9a366708SLORTETUseful options:
67*9a366708SLORTET- `namespace`: DokuWiki namespace where the page will be created. If not provided, the dialog lets the user enter it;
68*9a366708SLORTET- `initialTitle`: title prefilled when opening the dialog;
69*9a366708SLORTET- `start`:
70*9a366708SLORTET  - `undefined` or `null`: use the default mode configured in the plugin;
71*9a366708SLORTET  - `'@ask@'`: ask for the creation type even if a default mode exists;
72*9a366708SLORTET  - `true`: use the wiki start page, for example `start`;
73*9a366708SLORTET  - `false`: create the page directly;
74*9a366708SLORTET  - `'@same@'`: create a subpage with the same name as the page ID;
75*9a366708SLORTET  - any other string: create a subpage with that value;
76*9a366708SLORTET- `sepchar`: separator used to generate the page ID.
77*9a366708SLORTET
78*9a366708SLORTETIf `start` is not provided and `default_start_mode = ask`, the dialog shows three choices:
79*9a366708SLORTET- direct page;
80*9a366708SLORTET- start page;
81*9a366708SLORTET- subpage with the same name.
82