Posts about moinmoin

2014-02-11 Converting MoinMoin pages to Nikola

I have another wiki to take notes. These are written using the MoinMoin syntax, which is nice, but I found no converter from MoinMoin to anything compatible with Nikola.

Following this post http://carreau.github.io/posts/06-NBconvert-Doc-Draft.html , I thought I might give it a try using ipython within nikola:

In [1]:
URL = 'http://invibe.net/cgi-bin/index.cgi/SciBlog/2005-10-29?action=print'

NOTE: this should not be tried with these URLS as they do not exist anymore...

Read more…

2012-01-07 installing MoinMoin on a OVH server

2012-01-07 13:15:51
  • due to a disruption on my previous server, I had to move in a rush to a new server.
  • choosing the right provider
  • getting a basic MoinMoin instance running
  • getting the path of the pages on the server using the explore.py script in http://wiki.python.org/jython/HelpOnInstalling/ApacheOnLinuxFtp
  • setting up an empty MoinMoin instance, using:
    • the following cgi-bin/index.cgi script:
       1 #!/usr/bin/python
       2
       3 import sys, os
       4
       5 sys.path.insert(0, '/homez.52/invibe/moin')
       6
       7 os.environ['FCGI_FORCE_CGI'] = 'N' # 'Y' for (slow) CGI, 'N' for FCGI
       8
       9 from MoinMoin.web.flup_frontend import CGIFrontEnd
      10 CGIFrontEnd().run()
    • setting up the right path in xikiconfig.py :
      1     data_dir = '/homez.52/invibe/moin/data/'
      2     data_underlay_dir = '/homez.52/invibe/moin/underlay_min/'
      3     url_prefix_static = '/moin_static193'
      4     url_mappings = {'/cgi-bin/index.cgi':'/LaurentPerrinet'}
    • note that I installed the htdocs as www/moin_static193
  • once functional, getting my old stuff on the new server
  • rewrite rule
  • overall, this process was not linear and quite frustrating as there is no ssh (only a ftp) access and absolutely no simple guide and worse, no logfile from apache (you see quite often an "error 500" without any cue as what is going wrong)

2011-07-06 scripting MoinMoin to get, change or rename pages

2011-07-06 20:37:46
  • MoinMoin is hugely useful for day to day use. Scripting is even better. Here, I show how to get, edit and rename pages on your wiki. To avoid bad surprise, this is based on a copy of the remote server using a local server with a wikiconfig.py script.
  • it heavily uses examples shown in http://moinmo.in/MoinAPI/Examples?highlight=%28xmlrpc%29
  • first define the server and import the library
    1 wikiurl = "http://localhost:8080"
    2 username, password = 'YourName', 'yur)s3cr3t-pwd'
    3
    4 import xmlrpclib
  • let's try to read a page
     1     pagename = u'NewsEvents' # not protected
     2     pagename = u'Publications/Perrinet06ciotat' # protected
     3     homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2", allow_none=True)
     4     auth_token = homewiki.getAuthToken(username, password)
     5     mc = xmlrpclib.MultiCall(homewiki)
     6     mc.applyAuthToken(auth_token)
     7     mc.getPage(pagename)
     8     result = mc()
     9     success, raw = tuple(result)
    10     if isinstance(result, tuple) and tuple(result)[0] == "SUCCESS":
    11         print "reading page '%s' : %s" % (pagename, tuple(result)[0])
    12     else:
    13         print tuple(result)[0]
  • and now to write another one
     1     pagename = u'TestingPage'
     2     text = """
     3     This is a line of TEXT
     4
     5 AND     This is another line of text
     6
     7     """
     8     homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2", allow_none=True)
     9     auth_token = homewiki.getAuthToken(username, password)
    10     mc = xmlrpclib.MultiCall(homewiki)
    11     mc.applyAuthToken(auth_token)
    12     mc.putPage(pagename, text)
    13     result = mc()
    14     if isinstance(result, tuple) and tuple(result)[0] == "SUCCESS":
    15         print "page '%s' created: %s" % (pagename, tuple(result)[0])
    16     else:
    17         print 'You did not change the page content, not saved!'
  • so we may now read a page, replace some text and write it
     1     old, new = 'Category', 'Tag'
     2
     3     homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2", allow_none=True)
     4     auth_token = homewiki.getAuthToken(username, password)
     5     mc = xmlrpclib.MultiCall(homewiki)
     6     mc.applyAuthToken(auth_token)
     7     mc.getPage(pagename)
     8     result = mc()
     9     if tuple(result)[0] == "SUCCESS":
    10         print "page '%s' to modify: %s" % (pagename, tuple(result)[0])
    11         raw = tuple(result)[1]
    12         if raw.find(old)>-1:
    13             raw = raw.replace(old, new)
    14 #            print raw
    15             mc.putPage(pagename, raw)
    16             result = mc()
    17             print result[0]
    18         else:
    19             print 'not modified'
    20     else:
    21         print tuple(result)[0]
  • let's now do that on the whole website
     1     old, new = '^= reference =$', '^== reference ==$'
     2     homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2", allow_none=True)
     3     auth_token = homewiki.getAuthToken(username, password)
     4     mc = xmlrpclib.MultiCall(homewiki)
     5     mc.applyAuthToken(auth_token)
     6     mc.getAllPages()#opts={'include_system':False, 'include_underlay':False})
     7     result = mc()
     8     pagelist = tuple(result)[1]
     9     for pagename in pagelist:
    10         homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2", allow_none=True)
    11         auth_token = homewiki.getAuthToken(username, password)
    12         mc = xmlrpclib.MultiCall(homewiki)
    13         mc.applyAuthToken(auth_token)
    14         mc.getPage(pagename)
    15         try:
    16             result = mc()
    17             if tuple(result)[0] == "SUCCESS":
    18                 raw = tuple(result)[1]
    19                 if raw.find(old)>-1:
    20                     raw = raw.replace(old, new)
    21                     mc.applyAuthToken(auth_token)
    22                     mc.putPage(pagename, raw)
    23                     result = mc()
    24                     print ":-) page '%s' modified: %s" % (pagename, tuple(result)[0])
    25             else:
    26                 print tuple(result)[0]
    27         except:
    28             print 'failed', pagename
  • let's now rename one page
    1     homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2", allow_none=True)
    2     auth_token = homewiki.getAuthToken(username, password)
    3     mc = xmlrpclib.MultiCall(homewiki)
    4     mc.applyAuthToken(auth_token)
    5     mc.renamePage(u'TestingPage', u'TestPage2')
    6     result = mc()
    7     print result[0]
  • and now some more pages (here to reflect changes in the links)
     1     homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2", allow_none=True)
     2     auth_token = homewiki.getAuthToken(username, password)
     3     mc = xmlrpclib.MultiCall(homewiki)
     4     old, new = 'Category', 'Tag'
     5     for pagename in homewiki.getAllPages():
     6         if pagename.find(old)>-1:
     7             mc = xmlrpclib.MultiCall(homewiki)
     8             mc.applyAuthToken(auth_token)
     9             mc.renamePage(pagename, pagename.replace(old, new))
    10             result = mc()
    11             print ":-) page '%s' modified: %s" % (pagename, tuple(result)[0])

2010-07-08 latex within moinmoin

2011-07-06 20:59:01
  • installation d'après http://johannes.sipsolutions.net/Projects/new-moinmoin-latex
  • pour s'adapter à ma distribution pdflatex, j'ai changé
    1 # last arg must have %s in it!
    2 latex_args = ("--interaction=nonstopmode -output-format dvi", "%s.tex")

    dans le parser sudo open -e  ~/WebSites/moin/data/plugin/parser/latex.py)

examples

This is a red square:

\usepackage{graphics,color}

%%end-prologue%%
\newsavebox{\mysquare}
\savebox{\mysquare}{\textcolor{red}{\rule{1in}{1in} } }
\usebox{\mysquare}

symboles

% Math-mode symbol & verbatim
\def\W#1#2{$#1{#2}$ &\tt\string#1\string{#2\string}}
\def\X#1{$#1$ &\tt\string#1}
\def\Y#1{$\big#1$ &\tt\string#1}
\def\Z#1{\tt\string#1}

% A non-floating table environment.
\makeatletter
\renewenvironment{table}%
   {\vskip\intextsep\parskip\z@
    \vbox\bgroup\centering\def\@captype{table}}%
   {\egroup\vskip\intextsep}
\makeatother

% All the tables are \label'ed in case this document ever gets some
% explanatory text written, however there are no \refs as yet. To save
% LaTeX-ing the file twice we go:
\renewcommand{\label}[1]{}

%%end-prologue%%
\begin{table}
\begin{tabular}{*8l}
\X\alpha        &\X\theta       &\X o           &\X\tau         \\
\X\beta         &\X\vartheta    &\X\pi          &\X\upsilon     \\
\X\gamma        &\X\gamma       &\X\varpi       &\X\phi         \\
\X\delta        &\X\kappa       &\X\rho         &\X\varphi      \\
\X\epsilon      &\X\lambda      &\X\varrho      &\X\chi         \\
\X\varepsilon   &\X\mu          &\X\sigma       &\X\psi         \\
\X\zeta         &\X\nu          &\X\varsigma    &\X\omega       \\
\X\eta          &\X\xi                                          \\
                                                                \\
\X\Gamma        &\X\Lambda      &\X\Sigma       &\X\Psi         \\
\X\Delta        &\X\Xi          &\X\Upsilon     &\X\Omega       \\
\X\Theta        &\X\Pi          &\X\Phi
\end{tabular}
\caption{Greek Letters}\label{greek}
\end{table}

ou

\begin{equation}
x^3 =\int_{0}^{\infty} f(x,y) dy
\end{equation}
  • et encore
    $$x^3 =\int_{0}^{\infty} f(x,y) dy + c$$

inline

Because people requested an easier way to enter latex, I've added the possibility to write $ ... $ to obtain inline formulas. This is equivalent to writing \$ ...\$ and has the same single-line limitation (but everything else isn't really useful in formulas anyway). In order to do this, install the inline\_latex.py parser add #format inline\_latex to your page (alternatively, configure the default parser to be ``inline\_latex). This parser accepts all regular wiki syntax, but additionally the $ ... $' syntax. Additionally, the ``inline_latex` formatter supports $$....$$ style formulas (still limited to a single line though!) which puts the formula into a paragraph on its own.

Note: in the nikola blog, this is directly accomplished by using ReST : \$\\lambda\$ = $lambda$