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