1====== JSON Generate Document Example ====== 2 3This is example for the [[https://www.dokuwiki.org/plugin:jsongendoc|JSON Generate Document Plugin]]. 4 5===== Generate new Dokuwiki page ===== 6Page will be generated from [[template]] and filled with selected JSON data. 7 8<code> 9<jsongendoc path=data template=template docname=result_#### select='0:name, 1:type'>[ 10 { 11 "name": "Caramel sauce", 12 "type": "sweet sauce", 13 "Ingredients": { 14 "sugar": "200 g", 15 "water": "2 spoons", 16 "cream": "250 ml" 17 } 18 }, 19 { 20 "name": "Ganache", 21 "type": "sweet sauce", 22 "Ingredients": { 23 "chocolate": "250 g", 24 "cream": "250 ml" 25 } 26 } 27]</jsongendoc> 28</code> 29<jsongendoc path=data template=template docname=result_#### select='0:name, 1:type'>[ 30 { 31 "name": "Caramel sauce", 32 "type": "sweet sauce", 33 "Ingredients": { 34 "sugar": "200 g", 35 "water": "2 spoons", 36 "cream": "250 ml" 37 } 38 }, 39 { 40 "name": "Ganache", 41 "type": "sweet sauce", 42 "Ingredients": { 43 "chocolate": "250 g", 44 "cream": "250 ml" 45 } 46 } 47]</jsongendoc> 48 49==== Result ==== 50 * [[result_caramel]] 51 * [[result_ganache]] 52 53 54===== Generate SVG document and download it ===== 55Document will be generated from [[template_svg]] and filled with selected JSON data. Data is already defined above. 56 57<code> 58<jsongendoc path=data mime=image/svg+xml template=template_svg docname=label.svg select='0:name, 1:type'> 59</jsongendoc> 60</code> 61<jsongendoc path=data mime=image/svg+xml template=template_svg docname=label.svg select='0:name, 1:type'> 62</jsongendoc> 63 64After pressing a button svg document can be downloaded. It can be stored to the client machine or opened with specific application. It depends on the browser settings. 65 66For example, svg document can be created with [[https://inkscape.org/|Inkscape]] and saved as svg file. File may already contain replacement patterns. Then text contents of the file can be just copied to dokuwiki template, which is referenced by ''<jsongendoc>'' 67