1====== Examples for the Wrap Plugin ====== 2 3===== Basic syntax ===== 4 5An uppercase **%%<WRAP>%%** (or alternatively **%%<block>%%** or **%%<div>%%**) creates a **''div''** and should be used for **"big"** containers, **surrounding** paragraphs, lists, tables, etc. 6 7<code> 8<WRAP classes #id width :language> 9"big" content 10</WRAP> 11 12or 13<block classes #id width :language> 14"big" content 15</block> 16 17or 18<div classes #id width :language> 19"big" content 20</div> 21</code> 22 23A lowercase **%%<wrap>%%** (or alternatively **%%<inline>%%** or **%%<span>%%**) creates a **''span''** and should be used for **"small"** containers, **inside** paragraphs, lists, tables, etc. 24 25<code> 26<wrap classes #id width :language>"small" content</wrap> 27 28or 29<inline classes #id width :language>"small" content</inline> 30 31or 32<span classes #id width :language>"small" content</span> 33</code> 34 35:!: Please note, some things **won't work with lowercase spans**: 36 * **alignments** (including alignments generated by changing the text direction) 37 * **multi-columns** 38 * and **widths** 39if the according wrap isn't floated as well. 40 41A shorthand of uppercase **%%<WRAP />%%** and lowercase **%%<wrap />%%** are available if the container is empty or unnecessary. 42 43<code> 44<WRAP classes #id /> 45or 46<block classes #id /> 47or 48<div classes #id /> 49</code> 50 51and 52<code> 53<wrap classes #id /> 54or 55<inline classes #id /> 56or 57<span classes #id /> 58</code> 59 60===== Classes and Styles ===== 61 62 63==== Columns and Floats ==== 64 65You can have columns easily by adding the class ''column'' and a width, e.g. 66 <WRAP column 30%>...content...</WRAP> 67 68The example below uses the following structure: 69 70<code> 71<WRAP group> 72 73<WRAP third column>...content...</WRAP> 74<WRAP third column>...content...</WRAP> 75<WRAP third column>...content...</WRAP> 76 77</WRAP> 78</code> 79 80 81<WRAP group> 82<WRAP third column> 83=== Floating Options === 84 85Normally you would only need the class ''column'', but for more sophisticated uses (not only for columns, but for any other classes, like [[#boxes and notes]] as well) you can have several kinds of "floats": 86 87 * **''column''** is the same as ''left'' in LTR languages and the same as ''right'' in RTL languages 88 * **''left''** will let you float your wrap on the left 89 * **''right''** will let the wrap float right 90 * **''center''** will position the wrap in the horizontal center of the page 91</WRAP> 92 93<WRAP third column> 94=== Widths === 95 96You can set any valid widths (but only on divs): ''%, px, em, rem, ex, ch, vw, vh, pt, pc, cm, mm, in'', but most of the time you'd only want either 97 98^type^e.g.^note^ 99^''%''|''30%''|makes sense in most cases| 100^''px''|''420px''|makes sense if your container contains images with a certain width| 101^''em''|''20em''|makes sense if you like your wrap container to grow and shrink with the font size| 102 103</WRAP> 104<WRAP third column> 105=== Width Keywords === 106 107With certain width keywords you can fit your columns automatically to fill the available horizontal space. Those columns will also react to the screen size, so will be responsive and wrap underneath each other on mobile devices. 108 109There are four width keywords. These should not be combined with any other width, only ''third'' can be combined with ''twothirds''. 110 111 * **''half''** fits two columns in a row 112 * **''third''** fits three columns in a row 113 * **''quarter''** fits four columns in a row 114 * **''twothirds''** together with ''third'' fits a 2/3 and a 1/3 column in a row 115 116:!: Attention: In order to work properly, wraps with width keywords need an **additional ''%%<WRAP group>%%'' around a set** of them. If you mix several types in one group, you might need a ''%%<WRAP clear/>%%'' after a row. 117 118</WRAP> 119 120</WRAP> 121 122You can use the same options with spans (as each element that floats is automatically a block level element), but it probably doesn't make too much sense. :!: Widths on spans normally do not work (by design), but can make sense, when it is floating. 123 124:!: Attention: What is the difference between widths and width keywords and when is it best to use which? **Widths** can cause problems and will never fully add up, therefore will break the layout under some circumstances. (See [[http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug|box model]] for a technical explanation.) So, getting widths right will need some fiddling around and testing in various browsers. **Width keywords** on the other hand fit automatically and work better on mobile devices. But the drawback is that they need an extra wrap around them and don't work properly in older browsers (IE8 and under). 125 126All of those options will also work in the [[#boxes and notes]] wraps (see below). 127 128=== Old Emulated Headline (deprecated) === 129 130When the ''emulatedHeadlines'' config option is enabled, every ''%%//**__text like this__**//%%'' or ''%%//**like that**//%%'' will create an "emulated headline" within a wrap. This feature is deprecated and will be removed at some point as standard headlines within wraps are supported for a while now. 131 132If that config options is enabled and you need text that is bold and italic, simply use it the other way around: ''%%**//No Headline//**%%''. 133 134 135=== Multi-columns === 136 137<WRAP colmedium> 138Multi-columns work best in modern browsers (no IE9 and below) but should still be considered experimental as some browser behaviour is still inconsistent and buggy. 139 140Just use **''%%colsmall%%''** for small width columns, **''%%colmedium%%''** for medium width columns and **''%%collarge%%''** for large width columns. 141Or you can use **''%%col2%%''** for 2 columns, **''%%col3%%''** for 3 columns, **''%%col4%%''** for 4 columns and **''%%col5%%''** for 5 columns. 142The former type of column is determined by its width, the latter by its amount. The width-based columns are ideal for different layouts and device widths. 143 144:!: Note: Multi-columns don't make sense for spans. 145</WRAP> 146 147Don't use this for bigger columns containing more than just text. Use the [[#columns and floats]] mentioned above instead. 148 149 150==== Alignments ==== 151 152You can use these different text alignments: 153 154 * ''leftalign'' 155 * ''rightalign'' 156 * ''centeralign'' 157 * ''justify'' 158 159<WRAP centeralign> 160Center aligned text ... 161</WRAP> 162 163<WRAP rightalign> 164... and right aligned. 165</WRAP> 166 167<code> 168<WRAP centeralign> 169Center aligned text ... 170</WRAP> 171 172<WRAP rightalign> 173... and right aligned. 174</WRAP> 175</code> 176 177:!: You cannot add alignments to spans. 178 179 180==== Boxes and Notes ==== 181 182<WRAP round box 500px center> 183=== round box 500px center === 184 185 * ''box'' creates a box around the container and uses the colours from the template's ''style.ini'' as default colours (''%%__background_alt__%%'' and ''%%__text__%%'') 186 * any of the classes ''info'', ''tip'', ''important'', ''alert'', ''help'', ''download'', ''todo'' will add a special note container with a corresponding icon 187 * the classes ''danger'', ''warning'', ''caution'', ''notice'', ''safety'' use safety colours (and no icons) 188 * ''round'' can be added to anything with a background colour or a border and will only work in modern browsers (no IE8 and under) 189</WRAP> 190 191 192<WRAP info 300px left> 193=== Info === 194%%<WRAP info></WRAP>%% 195</WRAP> 196 197 198<WRAP tip 300px left> 199=== Tip === 200%%<WRAP tip></WRAP>%% 201</WRAP> 202 203 204<WRAP important 300px left> 205=== Important === 206%%<WRAP important></WRAP>%% 207</WRAP> 208 209 210<WRAP alert 300px left> 211=== Alert === 212%%<WRAP alert></WRAP>%% 213</WRAP> 214 215 216<WRAP round help 300px left> 217=== Help === 218%%<WRAP round help></WRAP>%% 219</WRAP> 220 221 222<WRAP download 300px left> 223=== Download === 224%%<WRAP download></WRAP>%% 225</WRAP> 226 227 228<WRAP todo 300px left> 229=== Todo === 230%%<WRAP todo></WRAP>%% 231</WRAP> 232 233 234<WRAP clear /> 235 236 237**Safety Notes:** 238 239Best only use simple markup in safety notes. 240 241<WRAP danger 30% left> 242=== Danger === 243%%<WRAP danger></WRAP>%% 244</WRAP> 245 246<WRAP warning 30% left> 247=== Warning === 248%%<WRAP warning></WRAP>%% 249</WRAP> 250 251<WRAP caution 30% left> 252=== Caution === 253%%<WRAP caution></WRAP>%% 254</WRAP> 255 256<WRAP round notice 30% left> 257=== Notice === 258%%<WRAP round notice></WRAP>%% 259</WRAP> 260 261<WRAP round safety 30% left> 262=== Safety === 263%%<WRAP round safety></WRAP>%% 264</WRAP> 265 266<WRAP clear /> 267 268 269You can use notes and boxes also inside text with spans like this: 270<wrap info>info</wrap>, <wrap help>help</wrap>, <wrap alert>alert</wrap>, <wrap important>important</wrap>, <wrap tip>tip</wrap>, <wrap download>download</wrap>, <wrap todo>todo</wrap> and <wrap round box>round box</wrap> and <wrap danger>danger</wrap>, <wrap warning>warning</wrap>, <wrap caution>caution</wrap>, <wrap notice>notice</wrap>, <wrap safety>safety</wrap>. 271 <wrap info>info</wrap>, <wrap help>help</wrap>, ... 272 273==== Marks ==== 274 275You can mark text as <wrap hi>highlighted</wrap>, <wrap lo>less significant</wrap> and <wrap em>especially emphasised</wrap>. 276 277 You can mark text as <wrap hi>highlighted</wrap>, <wrap lo>less significant</wrap> and <wrap em>especially emphasised</wrap>. 278 279:!: This might look ugly in some templates and should be adjusted accordingly. 280 281==== Tabs ==== 282 283You can create a row of tabs by simply wrapping a list of links in ''%%<WRAP tabs></WRAP>%%''. 284 285<WRAP tabs> 286 * [[Some page]] 287 * [[example|This page]] 288 * [[Another page]] 289</WRAP> 290 291 <WRAP tabs> 292 * [[Some page]] 293 * [[example|This page]] 294 * [[Another page]] 295 </WRAP> 296 297:!: Please note, the styling of these tabs depend on the template you are using and not on the wrap plugin. If you only see a list of links and no tabs, please make sure to add "tabs" to the ''noPrefix'' config option and that your template supports at least the 2012-01-25 "Angua" DokuWiki release. 298 299==== Miscellaneous ==== 300 301=== Clear float === 302 303After using any of the float classes, you might come across following text protruding into the space where only the floating containers should be. To prevent that, you should simply add this after your last column: 304 305 <WRAP clear /> 306 307=== Table width === 308 309You can set the width of a table via ''tablewidth'' as every table inside that wrap will always be 100% wide. This makes it possible to give tables any width by adding an additional width to the wrap (or none for 100%). 310 311<WRAP tablewidth 80%> 312^ Table ^ is ^ 313| 80% | wide | 314</WRAP> 315 316 <WRAP tablewidth 80%> 317 ^ Table ^ is ^ 318 | 80% | wide | 319 </WRAP> 320 321=== Indent === 322 323<wrap indent>This text will appear indented.</wrap> 324 325 <wrap indent>This text will appear indented.</wrap> 326 327=== Outdent === 328 329<wrap outdent>This text will appear "outdented".</wrap> 330 331 <wrap outdent>This text will appear "outdented".</wrap> 332 333=== Prewrap === 334 335<WRAP prewrap 250px> 336<code> 337Inside this code block the words will wrap to a new line although they are all in one line. 338</code> 339</WRAP> 340 341 <WRAP prewrap 250px> 342 <code> 343 Inside this code block the words will wrap to a new line although they are all in one line. 344 </code> 345 </WRAP> 346 347=== Spoiler === 348 349Here follows a spoiler: <wrap spoiler>Darth Vader is Luke's father.</wrap> 350 351 Here follows a spoiler: <wrap spoiler>Darth Vader is Luke's father.</wrap> 352 353Just select the text in the spoiler box to be able to read its content. 354 355=== Button links === 356 357A link that looks like a button: <wrap button>[[wiki:Syntax]]</wrap> 358 359 A link that looks like a button: <wrap button>[[wiki:Syntax]]</wrap> 360 361=== Hide === 362 363The following text is hidden: <wrap hide>John, please revise that sentence.</wrap> 364 365 The following text is hidden: <wrap hide>John, please revise that sentence.</wrap> 366 367:!: Warning: The text will still appear in the source code, in non-modern browsers and is searchable. Do not hide any security risky secrets with it! 368 369=== Pagebreak === 370 371The following will add a pagebreak: <WRAP pagebreak /> 372 373 The following will add a pagebreak: <WRAP pagebreak /> 374 375This has no effect on the browser screen. A [[http://reference.sitepoint.com/css/page-break-after|pagebreak]] will force a new page in printouts. 376 377=== Nopagebreak === 378 379The following will try to avoid a pagebreak: <WRAP nopagebreak>much content, belonging together (like a long table)</WRAP> 380 381 The following will try to avoid a pagebreak: <WRAP nopagebreak>much content, belonging together (like a long table)</WRAP> 382 383This also has no effect on the browser screen. It will try to [[http://reference.sitepoint.com/css/page-break-inside|avoid a page break]] in printouts. 384 385=== Noprint === 386 387<wrap noprint>This text appears on the screen, but not in print.</wrap> 388 389 <wrap noprint>This text appears on the screen, but not in print.</wrap> 390 391=== Onlyprint === 392 393<wrap onlyprint>This text does not appear on the screen, but only in print.</wrap> 394 395 <wrap onlyprint>This text does not appear on the screen, but only in print.</wrap> 396 397 398==== Combining and Nesting ==== 399 400You can combine and nest all classes and types of boxes, e.g. 401 402<WRAP box 350px right :en> 403===Outer box floats right === 404 405<WRAP 165px left> 406Inner nested box floats left and is partly <wrap em hi>__em__phasized and __hi__ghlighted with a nested <wrap notice>__notice__</wrap> inside</wrap>. 407</WRAP> 408 409Text inside outer right box, but beneath inner left box. 410 411<WRAP clear /> 412 413<WRAP round tip> 414Round tip box underneath, after a ''clear''. 415</WRAP> 416 417</WRAP> 418 419 420<code> 421<WRAP box 350px right :en> 422=== Outer box floats right === 423 424<WRAP 165px left> 425Inner nested box floats left and is partly <wrap em hi>__em__phasized and __hi__ghlighted with a nested <wrap notice>__notice__</wrap> inside</wrap>. 426</WRAP> 427 428Text inside outer right box, but beneath inner left box. 429 430<WRAP clear /> 431 432<WRAP round tip> 433Round tip box underneath, after a ''clear''. 434</WRAP> 435 436</WRAP> 437</code> 438 439 440===== Language and Text Direction ===== 441 442You can change the language and the reading direction of a wrap container by simply adding a colon followed by the language code, like this: 443 444<code> 445<WRAP :he> 446זה עברית. ((<wrap :en>This means "This is Hebrew.", at least according to [[http://translate.google.com/|Google Translate]].</wrap>)) 447</WRAP> 448</code> 449 450<WRAP :he> 451זה עברית. ((<wrap :en>This means "This is Hebrew.", at least according to [[http://translate.google.com/|Google Translate]].</wrap>)) 452</WRAP> 453 454The text direction (''rtl'', right to left or ''ltr'', left to right) will get inserted automatically and is solely dependent on the language. The list of currently supported languages is taken from: http://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code 455(If you specify a language not listed there, it simply won't do anything.) 456