Reimar Bauer avatar Reimar Bauer committed b277658

docs: added XStatic Packages

Comments (0)

Files changed (1)


+XStatic Packages
+`XStatic <>`_ is a packaging standard 
+to package external (often 3rd party) static files as a python package. 
+So they are easily usable on all operating systems, 
+with any package management system or even without one.
+In many cases, those external static files are maintained by someone else (like jQuery
+javascript library or even much bigger js libraries or applications) and we
+definitely do not want to merge them into our project.
+For MoinMoin we require the following XStatic Packages in
+* `jquery <>`_
+  for jquery lib functions loaded in the template file base.html
+* `jquery_file_upload <>`_
+  loaded in the template file of index view. It allows to upload many files at once.
+* `ckeditor <>`_
+  used in template file modify_text_html. A WYSIWYG editor similar to word processing 
+  desktop editing applications.
+* `svgweb <>`_
+  used at base.html for enabling SVG support on many browsers.
+* `svgedit_moin <>`_
+  is loaded at template modify_svg-edit. It is a fast, web-based, Javascript-driven
+  SVG editor.
+* `twikidraw_moin <>`_
+  a Java applet loaded from template file of modify_twikidraw. It is a simple drawing editor.
+* `anywikidraw <>`_
+  a Java applet loaded from template file of modify_anywikidraw. It can be used for 
+  editing of drawings and diagrams on items.
+* `jquery_multi_download <>`_
+  used in the template of index view for multiple parallel downloads.
+These packages are imported in wikiconfig by ::
+    from xstatic.main import XStatic
+    mod_names = ['jquery', 'jquery_file_upload', 'ckeditor',
+                 'svgweb', 'svgedit_moin', 'twikidraw_moin',
+                 'anywikidraw', 'jquery_multi_download', ]
+    pkg = __import__('xstatic.pkg', fromlist=mod_names)
+    for mod_name in mod_names:
+        mod = getattr(pkg, mod_name)
+        xs = XStatic(mod, root_url='/static', provider='local', protocol='http')
+        serve_files.update([(, xs.base_dir)])
+In a template file you access the files of such a package by its module name ::
+    url_for('serve.files', name='the mod name', filename='the file to load')
+Adding XStatic Packages
+The following example shows how you can enable the additional package 
+`XStatic-MathJax <>`_ which is 
+used for mathml or latex formulas in items content.
+Just *pip install xstatic-mathjax* add the name 'mathjax' to mod_names in wikiconfig
+and add the required fragment in base.html::
+    <script type="text/x-mathjax-config">
+    MathJax.Hub.Config({
+        extensions: ["tex2jax.js"],
+        jax: ["input/TeX","output/HTML-CSS"],
+        tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
+    });
+    </script>
+    <script src="{{ url_for('serve.files', name='mathjax', filename='MathJax.js') }}"></script>
 Custom Themes
 In case you want to do major changes to how MoinMoin looks like (so just
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.