| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <title>Reusing gendoc scripts inside the same document: <fragment> tag</title> |
| <link rel="stylesheet" type="text/css" href="userguide.css"> |
| </head> |
| <body> |
| <h1>Reusing gendoc scripts inside the same document: <span class="codeHeading"><fragment></span> tag</h1> |
| <p>If a script section is used several times in a same document template, tag <span class="code"><fragment></span> |
| can be used to define the script section and its attributes.</p> |
| <p>It can then be called from <span class="code"><gendoc></span> tags |
| <strong><u>inside the same template document</u></strong></p> |
| <p><span class="code"><fragment></span> tag can contain the following attributes:</p> |
| <ul> |
| <li><strong>name (Mandatory)</strong> : the name to call to use the fragment</li> |
| <li><strong>importedBundles</strong> (Optional) : the <a href="bundles.html">external bundles</a> |
| needed in the fragment code (separated by <strong>;</strong>)</li> |
| <li><strong>importedFragments</strong> (Optional) : the fragments needed in |
| that fragment code (separated by <strong>;</strong>)</li> |
| <li><strong>removeClosingLine</strong>(Optional) : when this attribute is set to |
| ‘true’ the line containing the closing tag (<span class="code"></fragment></span>) |
| is removed during the generation</li> |
| </ul> |
| <br/> |
| <table class="xlsx" width="640"> |
| <tr> |
| <th></th><th>A</th><th width="20">B</th> |
| </tr> |
| <tr> |
| <th>1</th><td> |
| <span class="blue"><fragment name=’displayDiagram’ importedBundles=’commons;gmf;papyrus’><br/> |
|  <arg name=’element’ type=’uml::Element’/></span><br/> |
|  [for (d:Diagram|element.getPapyrusDiagrams())]<drop/><br/> |
| </td><td/></tr> |
| </tr> |
| <tr> |
| <tr> |
| <th>2</th> |
| <td> |
| Diagram [d.name/]: |
| </td><td width="20"/> |
| </tr> |
| <tr height="130" valign="top"> |
| <th>4</th><td> |
| <image object=’[d.getDiagram()/]’ maxH=’true’/> |
| </td> |
| <td width="20"/> |
| </tr> |
| <tr> |
| <th>4</th><td> |
|  [/for]<br/> |
| <span class="blue"></fragment></span><drop/> |
| </td> |
| <td width="20"/> |
| </tr> |
| <tr> |
| <th>5</th><td/><td/> |
| </tr> |
| <tr> |
| <th>6</th><td> |
| <gendoc><br/> |
|  [for(p:Package|Package.allInstances())]<drop/><br/> |
| </td> |
| <td/> |
| </tr> |
| <tr> |
| <th>7</th><td> |
| [p.name/] |
| </td><td/> |
| </tr> |
| <tr> |
| <th>8</th><td> |
| <span class="blue">[p.displayDiagram()/]</span> |
| </td><td/> |
| </tr> |
| <tr> |
| <th>9</th><td> |
|  [/for] <br/> |
| </gendoc> <drop/> |
| </td><td/> |
| </tr> |
| </table> |
| |
| </body> |
| </html> |