[Pmwiki-users] Re: Utility Request
Christian Ridderström
chr
Sun Apr 18 16:01:21 CDT 2004
On Sun, 18 Apr 2004, Steven Leite wrote:
> Anybody have any ideas?
I was in a similar situation 6 months ago when I moved the LyX wiki site
from MoinMoin to PmWiki. Here's what I did:
* Wrote a script (get.sh) that downloaded a MoinMoin page to a file and
ran a filter (sed) on it.
* Wrote a function 'lyx-save-as' for Emacs/pmwiki-mode (lyx-save-as is
basically a wrapper function that knows the URI of where to save the
buffer so that I don't have to enter the lyx URI all the time).
Then for each page, I did the following:
* Ran the script to get the page (saving the page to e.g. PageName.pmwiki)
* Opened the file in Emacs (the .pmwiki extension starts pmwiki-mode).
* Made any changes that the script/filter hadn't fixed.
* Ran the function 'lyx-save-as' from within Emacs that saved the page to
a new page at the lyx wiki site.
This solution worked well for me.
/Christian
--
Christian Ridderstr?m http://www.md.kth.se/~chr
-------------- next part --------------
#
#
# Second pass converting from MoinMoin
#
# La''''''T''''''eX -> LaTeX
s/La''''''T''''''eX/[=LaTeX=]/
s/La''''''T''''''eX/[=LaTeX=]/
# '''''' ->
s/''''''//
s/''''''//
# LyX -> [=LyX=]
s/\([^a-zA-Z0-9=]\)LyX\([^a-zA-Z0-9]\)/\1[=LyX=]\2/
s/\([^a-zA-Z0-9=]\)LyX\([^a-zA-Z0-9]\)/\1[=LyX=]\2/
s/\([^a-zA-Z0-9=]\)LyX\([^a-zA-Z0-9]\)/\1[=LyX=]\2/
s/\([^a-zA-Z0-9=]\)LyX\([^a-zA-Z0-9]\)/\1[=LyX=]\2/
s/^LyX\([^a-zA-Z0-9]\)/[=LyX=]\1/
s/\([^a-zA-Z0-9]\)LyX$/\1[=LyX=]/
# [[TableOfContents]] ->
s/\[\[TableOfContents]]/ [= [[TableOfContents]] =]/
-------------- next part --------------
#!/usr/local/bin/tcsh
#
set URL0=http://ev-en.org/wiki/moin.cgi
if("$1" == "") then
cat <<EOF
Converts input from MoinMoin-syntax to PmWiki syntax.
Ex:
$0:t LyxFAQnew
Gets page LyxFAQnew from $URL0 and saves it as LyxFAQnew.pmwiki
EOF
exit 0
endif
#
set P0=$0:h
set sedFile=~/Private/bin/MoinMoin2PmWiki.sed
set beQuiet=1
set Verbose=1
set WGETF=()
set page=$1
set URI=$URL0/$page
set tmpFile=/tmp/MM.$$
if($beQuiet) set WGETF=($WGETF -q)
if($Verbose) printf "Retrieving %s\n" "$URI"
wget $WGETF -O $tmpFile $URI\?action=raw
if($?) then
printf "Error while retrieving %1\n" "$URI"
exit -1
endif
sed -f $sedFile $tmpFile > $tmpFile.1
sed -f syntax.sed $tmpFile.1 > $page.pmwiki
More information about the pmwiki-users
mailing list