It's better when it's simple

User Tools

Site Tools


openas Plugin

Compatible with DokuWiki

  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" yes
  • 2014-09-29 "Hrun" yes
  • 2014-05-05 "Ponder Stibbons" yes

plugin File utility for moving/renaming files, saving copies, creating new pages from templates

Last updated on
Syntax, Action

Tagged with file, form, move, pagemove, rename, template


:!: External requirements: This plugin requires the following additional component that must be installed separately if you wish to use the templating facility: newpagetemplate

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. For manual installs, refer to Plugins on how to install plugins manually.


This plugin facilitates renaming (i.e. moving) pages, saving as (i.e. saving a page under a new name without deleting the original), and creating new pages from templates.

There are three syntax formats:

  1. newname is the page name with its namespace, as in :namespace:newname
  2. template is the name of a template which will be found in :pagetemplates
  3. newpagevars has this format: @macro_1@,value_1;@macro_2@,value_2;. . .
    • this follows the format of the newpagetemplate plugin for specifying macros and their substitution values.


The SaveAS form will create a new page from the old page but leave the old page in tact.


The MoveTO form will create a new page from the old page and delete the old page. However, it will not delete the old page unless it is certain that the new page is in place, so that there is no danger of losing the old page. The MoveTo form performs a limited page move: it preserves backlinks and implements a number of other features, as described below in the pagemove section.


The OpenAS form requires the newpagetemplate plugin. This form will open the page newname, using the specified template. The OpenAS feature assumes that all your templates will be found in the pagetemplates directory (i.e the :pagetemplates namespace). The newpagevars attribute follows the format described on the newpagetemplate page. Here is a sample:

 ~~OpenAS>hello_temp#homepagetemplate>@HI@,HOWDY!;@BYE@,Good Bye~~

This will open up the page :hello_temp, using the homepagetemplate (which is :pagetemplates:homepagetemplate) and it will fill in any of the substitution variables defined on the newpagetemplate plugin page, as well as the variables defined by newpagevars (which in this example are: @HI@ and @BYE). Please see the newpagetemplate page for complete details on using the newpagetemplate plugin.

There is an expanded syntax for this form of the plugin which gives it significantly greater flexiblity. See below.

How it works

Once the page with the syntax markup is saved, it will now show a yellow box with a link. Clicking on this link will perform the desired action. In the case of pages which have been moved or saved-as, the new page will already be created, but links will not be updated until the new page is accessed from the link in the yellow box. In the case of a page which has been moved, the original page will remain on the server until you have linked to the new page, at which time the old page will be deleted. In the case of new page templates, the new page will open with the macro values filled in. The ~~SaveAS>name~~ and ~~MoveTO>name~~ will be removed from the newly created pages.

Relative links will be re-written to the newly created file as absolute links. This is true of both the SaveAS and the MoveTO forms,


In the MoveTo option, all backlinks to the page being moved are updated to the page id of the new page.

The plugin takes into consideration page locking. So, if a page with backlinks is currently in use, it is not updated until the user with the lock exits the page. The original page remains in place until all of the pages with backlinks have been updated. Once all backlinks have been updated, the original page is removed.

Metadata and Indexing

This plugin does not update the Dokuwki history or indexing for the updated files. If you want to re-index your site, you can use the searchindex plugin.


The plugin in its present form does not update relative image links. If images are inserted using the media manager, this should not be an issue.


There is a backup system. A new meta directory is created: data/meta/openas, where the original backlink pages are stored. The pre-updated versions of these pages are created with the .mvd extension. And the page which has been moved to the new id is backed up with the .orig extension. The .orig and .mvd files are numbered, with the highest number being the most recent.

Expanded Syntax for the OpenAs Format

With the expanded syntax, it is not necessary to pre-insert the newpagevars and their values into the page, as described above. Instead you can create an HTML Form, from which th plugin will take the names of the variables and their values. The benefit of this, of course, is that the values are not pre-set by the plugin. Different values can be entered for each access of the form.

This is the expanded syntax.


:!: Important: SAVEAS_PAGE is a placeholder and must appear in your plugin markup exactly as illustrated above. It will place a textbox on your page which asks for the page id. The user will get a link to SAVEAS_PAGE. When the user clicks on the link, this placeholder will be replaced by the page id from the texbox. See the illustration below.

This format will create a Form with two text boxes. ReplacementVar is the name of a variable which is included in the template. So, for instance, if the ReplacementVar is NAME, then the plugin will replace @NAME@ in the template with the value entered into the textbox. You can create as many textboxes as you need.

Each instance of ~~OpenAsVAR>ReplacementVar~~ can be prefaced by a desciptive label, for instance:

   First Name: ~~OpenAsVAR>FNAME~~  

The Replacement variables are case-sensitive. There is one formatting feature, which will help to arrange the textboxes on your page; this is the Dokuwiki line-break: \\. The textboxes can be interspersed with text; you can use the line-breaks to help format the text.

You can use the ~~OpenAS>SAVEAS_PAGE#yourtemplate>~~ makup on its own. The link will redirect to a new page which has been captured from the page id textbox. It is also possible to include predefined values, as illustrated in the basic syntax form above. It is also possible to combine predefined values with values captured from the Form.




Name: ~~OpenAsVAR>name~~  

Age: ~~OpenAsVAR>AGE~~  \\ 

Address: ~~OpenAsVAR>ADDR1~~

Address 2: ~~OpenAsVAR>ADDR2~~  


~~OpenAS>wiki:SAVEAS_PAGE#yourtemplate>@HI@,Howdy!!;@BYE@,Good Bye~~


The Name, Age and Addr fields will be added to the HI and BYE fields. The HI and BYE are constants, pre-set, the others are set by the user and will differ from page to page.

Change Log


For discussion, please use the dokuwiki forum. There is also a discussion page.

plugin/openas.txt · Last modified: 2017-01-08 00:15 by turnermm