I recently worked on a project where it would be really convenient to create some dokuwik pages using a script on some html content. I ended up using the CPAN/Perl module to convert HTML content to dokuwiki content, and then script the process necessary to create the pages inside dokuwiki.
In general, for a page to exist in dokuwiki, it must have 3 files present – *must be all lowercase*:
data/pages/$namespace/$page.txt
data/meta/$namespace/$page.meta
data/meta/$namespace/$page.indexed
The contents of the indexed page was simple 7 without a line ending in my case.
And then, it’s very useful to link to the page off of another page so that it can be accessed by means other than the search box.
I ended up generating the dokuwiki pages files using a perl script and then scp’ing them to the dokuwiki server (~100 files). Once there, I copied them into a namespace directory and added them to the page that was there using a simple bash script.
# add all files to existing page for file in $(ls *.txt); do echo " * [[${file%%.txt}]]" >> $my_page.txt; done # # rename files to lowercase # - note that even with upper case characters in the page they # are referenced from, they must be lowercase files # for file in $(ls *.txt); do lowercase=$(echo ${file} | tr '[:upper:]' '[:lower:]'); mv ${file} ${lowercase}; done # create the indexed and meta files cd data/meta/$namespace/ for file in $(ls ../../../pages/$namespace/); do touch ${file%%.txt}.meta; echo -n "7" > ${file%%.txt}.indexed; done
Once I had used this process, all of the new pages showed up on the page they were linked from.
Leave a Reply