Attachment 'plantumi.py'
Download 1 # -*- coding: utf-8 -*-
2 """
3 MoinMoin - PlantUML a simple consumer of
4 a plantuml server
5 """
6
7 from posixpath import join
8 from plantweb.plantuml import compress_and_encode
9
10
11 Dependencies = []
12 SERVER_NAME = u'https://www.plantuml.com/plantuml'
13 IMG_FORMAT = u'png'
14
15
16 class Parser:
17
18 def __init__(self, raw, request, **kw):
19 self.raw = raw
20 self.request = request
21 self.style = None
22
23 def format(self, formatter):
24
25 request = self.request
26 raw = self.raw
27 try:
28 encoded = compress_and_encode(raw)
29 img_link = join(SERVER_NAME, IMG_FORMAT, encoded)
30 except ImportError:
31 self.request.write('<p>Make sure you have plantweb installed.')
32 return
33 style = self.style
34 if style is None:
35 style = 'default'
36 self.request.write(formatter.rawHTML(
37 '''<img src="%s" alt="">''' % img_link
38 ))
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.