Перевод этой страницы?:

Как переименовывать страницы в Dokuwiki?

Простейший способ «переименовать страницу» - это создать новую страницу с нужным именем, а на старой странице написать что-нибудь вроде

 Перемещено на [[страницу с новым названием]]

Если вы просто удалите старую страницу, то удалятся ссылки, которые на нее ссылаются. Чтобы исправить их, выведите список всех страниц, ссылающихся на старую и обновите ссылки на них.
Недостаток этого способа - заново будет вестись история изменений, архив версий для новой страницы.

Для автоматизации этого процесса, сохранения ссылок, перемещения истории изменений, старых версий и прочих метаданных воспользуйтесь плагином pagemove.

Вопросы

:?: Если переименовать страницу в файловой системе, будет ли перенесена история изменений этой страницы?
Ответ: Нет, так история страницы привязывается к ее имени, а не к файлу со страницей.

Оригинал

HOWTO: Rename Pages

:?: Is there a way to rename a page through DokuWiki?

The easy way

Renaming would possibly break a lot of links linking to the old page. Since DokuWiki doesn't know which pages link where this cannot be handled by DokuWiki. An easy way to «rename» a page is to simply create the new one and then change the content of the old page to something like this:

moved to [[newpage]]

Then visit the pages linking to the old page, and update them to refer to the new page. This can be done gradually.

Note that the old revisions will not be moved with that page. If you like to move them too, you should either write a script or use the plugin (see below).

On the file system

You can also rename/move the txt files in the file system, and the gz files in the attic. This will break links and metadata.

Using a Plugin

The pagemove plugin allows a simpler way for an administrator to move/rename pages.

:!: The pagemove plugin does not work currently and produces a lot of unwanted changes!

Using UNIX commands

Note: This tip assumes one is using a Unix-like OS with text file utilities installed, or is using Cygwin under Windows.

Note that following this tip prevents DokuWiki from keeping a coherent page history (old revisions). Remember to back up all raw text files and data.

How-To Rename a set of pages? Use sed regular expressions to match a filename pattern and replace it with a new filename pattern.

Example: Rename all pages starting with <project_name> to another prefix:

for f in `ls *.txt`; do sed -e 's:\[\[project_name\(.*\)\]\]:[[prj_code.\1]]:g' $f > $f.new; done
for f in `ls *.new | sed -e 's:\(.*\)\.new:\1:g'`; do mv $f.new $f; done
for f in `ls *.txt | sed -e 's:project_name\(.*\)\.txt:\1.txt:g'`; do mv project_name-$f prj_code-$f; done

Explanation:

  • The first command uses sed to find all occurrences of a DokuWiki FreeLink that starts with project_name and replaces them with a new FreeLink that is like the old one except that instead of prefix project_name it has prefix prj_code.
  • The second command is used to replace the old raw text files (with old FreeLink) with the new raw text files (with new FreeLink).
  • Finally, the third command renames the files that match those FreeLinks, by replacing the prefix project_name with prefix prj_code in their filename.
ru/tips/howto-rename-pages.txt · Последние изменения: 2012/03/22 23:15 — 95.79.94.229
 
За исключением случаев, когда указано иное, содержимое этой вики предоставляется на условиях следующей лицензии: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate