Coverage for src/lcdoc/mkdocs/lp/plugs/flowchart/__init__.py: 100.00%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

1""" 

2### `lightbox` 

3 

4""" 

5 

6 

7from lcdoc.tools import app lp|features/lp/plugs/flowchart/index.md

8 

9page_assets = { 

10 'mode': 'raphael', 

11 'header': '//flowchart.js.org/flowchart-latest.js', 

12} 

13 

14 

15C = '''<div id="%(id)s"></div>''' lp|features/lp/plugs/flowchart/index.md

16S = ''' 

17<script> 

18var code = '%(body)s'; 

19var diag = flowchart.parse(code); 

20diag.drawSVG('%(id)s', %(opts)s); 

21</script> 

22''' 

23 

24 

25def run(cmd, kw): lp|features/lp/plugs/flowchart/index.md

26 kw['opts'] = {} lp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.md

27 if isinstance(cmd, dict): lp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.md

28 kw['opts'] = cmd.get('opts', {}) lp|features/lp/plugs/flowchart/index.md

29 code = cmd['code'] lp|features/lp/plugs/flowchart/index.md

30 else: 

31 code = cmd lp|features/lp/plugs/flowchart/index.md

32 kw['body'] = "\\n'\n+ '".join([l for l in code.splitlines()]) lp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.md

33 div = C % kw lp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.md

34 return {'res': div, 'formatted': True, 'footer': S % kw} lp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.md