Not logged in. · Lost password · Register
Forum: Non-English Discussion Chinese discussion RSS
解决Add New Page Plugin增加中文页面的问题
Avatar
wo2008 #1
Member since Jun 2010 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: 解决Add New Page Plugin增加中文页面的问题
最近才开始使用DokuWiki,发现Add New Page Plugin添加页面相当方便,不过很快发现了两个问题,现在把解决的经验介绍一下,希望对刚使用Dokuwiki的人有点帮助。

第1个问题:
一个中文命名空间下面有一个中文子命名空间的时候,addnewpage选择框无法显示子空间,这个在插件主页上有解决方法:http://www.dokuwiki.org/plugin:addnewpage,查找该页面中“Add page plugin doesn't work with non-English characters ”,按照其提供的方法修改syntax.php即可,但要注意,$r=$this->_getnslist($tns.'/'.urlencode($v['id']);语句后漏掉了一个“)”,需要加上。

第2个问题:
添加中文名字的空间或页面的时候,有很多名字无法正常显示或者无法添加,比如我要在根空间添加一个页面名为“文章精选”,结果页面名变成了“文章精”,如果换一个名字为“选”,则添加失败,变成编辑当前页了,但有个别字却能建立,比如“哀”,这让我很苦恼,后来受到第一个问题的启发,找到了解决方法。
方法是,修改addnewpage/script.js,使用encodeURI函数将页面名变成UTF-8编码,具体如下:

将函数
function setName() {
 document.getElementById("editform").setAttribute("action","?id="+document.getElementById('np_cat').value+':'+document.getElementById('addnewpage_title').value);
}

修改为
function setName() {
 document.getElementById("editform").setAttribute("action","?id="+encodeURI(document.getElementById('np_cat').value)+':'+encodeURI(document.getElementById('addnewpage_title').value));
}

即可解决中文名页面添加的问题。
This post was edited on 2010-06-15, 09:56 by wo2008.
Avatar
liu #2
Member since Sep 2011 · 5 posts
Group memberships: Members
Show profile · Link to this post
 你好,请教个问题,希望不吝赐教,我是dokuwiki 新手,现在我安装了个 addnewpage  插件,但是不能用,也没有 增加页面的对话框,你能帮我分析下原因吗?安装的方法是没有问题的。我安装别的插件可与用的。谢谢啊,
samwilson #3
User title: Human
Member since Oct 2011 · 44 posts · Location: Fremantle, Western Australia
Group memberships: Members
Show profile · Link to this post
The problem with file- and directory-name encoding should now be fixed. Please report any bugs if you're still getting errors: https://github.com/samwilson/dokuwiki-plugin-addnewpage/is…

Thanks!
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-08-25, 19:10:53 (UTC +02:00)