source: rtems-tools/doc/asciidoc/examples/website/newtables.txt @ f91e023

4.104.115
Last change on this file since f91e023 was f91e023, checked in by Chris Johns <chrisj@…>, on 02/17/14 at 07:04:46

Add the documentation.

  • Property mode set to 100644
File size: 19.1 KB
Line 
1AsciiDoc New tables
2===================
3
4*New in version 8.3.0*
5
6I've finally come up with a 'new tables' syntax that I'm happy with
7and can at last remove this footnote from the 'User Guide': ``The
8current table syntax is overly complicated and unwieldy to edit,
9hopefully a more usable syntax will appear in future versions of
10AsciiDoc.''
11
12.Update
13*********************************************************************
14The following additions were made at AsciiDoc 8.4.4:
15
16- Cell column and row spanning.
17- Styles can be applied per cell.
18- Vertical cell alignment can be applied to columns and cells.
19
20See the examples at the end of this document.
21*********************************************************************
22
23At first glance it doesn't look much different to the old syntax but
24it's a lot more flexible, easier to enter and supports a lot of column
25styles (for example the 'asciidoc' style supports AsciiDoc block and
26inline elements).  The old tables syntax has been deprecated but is
27currently still processed.  Here are some examples of AsciiDoc 'new
28tables':
29
30.Simple table
31[width="15%"]
32|=======
33|1 |2 |A
34|3 |4 |B
35|5 |6 |C
36|=======
37
38.AsciiDoc source
39---------------------------------------------------------------------
40[width="15%"]
41|=======
42|1 |2 |A
43|3 |4 |B
44|5 |6 |C
45|=======
46---------------------------------------------------------------------
47
48
49.Table with title, header and footer
50[width="40%",frame="topbot",options="header,footer"]
51|======================
52|Column 1 |Column 2
53|1        |Item 1
54|2        |Item 2
55|3        |Item 3
56|6        |Three items
57|======================
58
59.AsciiDoc source
60---------------------------------------------------------------------
61.An example table
62[width="40%",frame="topbot",options="header,footer"]
63|======================
64|Column 1 |Column 2
65|1        |Item 1
66|2        |Item 2
67|3        |Item 3
68|6        |Three items
69|======================
70---------------------------------------------------------------------
71
72
73.Columns formatted with strong, monospaced and emphasis styles
74[width="50%",cols=">s,^2m,^2e",frame="topbot",options="header,footer"]
75|==========================
76|      2+|Columns 2 and 3
77|1       |Item 1  |Item 1
78|2       |Item 2  |Item 2
79|3       |Item 3  |Item 3
80|4       |Item 4  |Item 4
81|footer 1|footer 2|footer 3
82|==========================
83
84.AsciiDoc source
85---------------------------------------------------------------------
86.An example table
87[width="50%",cols=">s,^2m,^2e",frame="topbot",options="header,footer"]
88|==========================
89|      2+|Columns 2 and 3
90|1       |Item 1  |Item 1
91|2       |Item 2  |Item 2
92|3       |Item 3  |Item 3
93|4       |Item 4  |Item 4
94|footer 1|footer 2|footer 3
95|==========================
96---------------------------------------------------------------------
97
98.A table with externally sourced CSV data
99[format="csv",cols="^1,4*2",options="header"]
100|===================================================
101ID,Customer Name,Contact Name,Customer Address,Phone
102include::customers.csv[]
103|===================================================
104
105.AsciiDoc source
106---------------------------------------------------------------------
107 [format="csv",cols="^1,4*2",options="header"]
108 |===================================================
109 ID,Customer Name,Contact Name,Customer Address,Phone
110 include::customers.csv[]
111 |===================================================
112---------------------------------------------------------------------
113
114
115.DVS formatted table
116[width="70%",format="dsv"]
117|====================================
118root:x:0:0:root:/root:/bin/bash
119daemon:x:1:1:daemon:/usr/sbin:/bin/sh
120bin:x:2:2:bin:/bin:/bin/sh
121sys:x:3:3:sys:/dev:/bin/sh
122sync:x:4:65534:sync:/bin:/bin/sync
123games:x:5:60:games:/usr/games:/bin/sh
124|====================================
125
126.AsciiDoc source
127---------------------------------------------------------------------
128[width="70%",format="dsv"]
129|====================================
130root:x:0:0:root:/root:/bin/bash
131daemon:x:1:1:daemon:/usr/sbin:/bin/sh
132bin:x:2:2:bin:/bin:/bin/sh
133sys:x:3:3:sys:/dev:/bin/sh
134sync:x:4:65534:sync:/bin:/bin/sync
135games:x:5:60:games:/usr/games:/bin/sh
136|====================================
137---------------------------------------------------------------------
138
139
140.Horizontal and vertical source data
141[width="80%",cols="3,^2,^2,10",options="header"]
142|=========================================================
143|Date |Duration |Avg HR |Notes
144
145|22-Aug-08 |10:24 | 157 |
146Worked out MSHR (max sustainable heart rate) by going hard
147for this interval.
148
149|22-Aug-08 |23:03 | 152 |
150Back-to-back with previous interval.
151
152|24-Aug-08 |40:00 | 145 |
153Moderately hard interspersed with 3x 3min intervals (2min
154hard + 1min really hard taking the HR up to 160).
155
156|=========================================================
157
158Short cells can be entered horizontally, longer cells vertically.  The
159default behavior is to strip leading and trailing blank lines within a
160cell. These characteristics aid readability and data entry.
161
162.AsciiDoc source
163---------------------------------------------------------------------
164.Windtrainer workouts
165[width="80%",cols="3,^2,^2,10",options="header"]
166|=========================================================
167|Date |Duration |Avg HR |Notes
168
169|22-Aug-08 |10:24 | 157 |
170Worked out MSHR (max sustainable heart rate) by going hard
171for this interval.
172
173|22-Aug-08 |23:03 | 152 |
174Back-to-back with previous interval.
175
176|24-Aug-08 |40:00 | 145 |
177Moderately hard interspersed with 3x 3min intervals (2min
178hard + 1min really hard taking the HR up to 160).
179
180|=========================================================
181---------------------------------------------------------------------
182
183
184.Default and verse styles
185[cols=",^v",options="header"]
186|===================================
187|Default paragraphs |Centered verses
1882*|Per id.
189
190Consul *necessitatibus* per id,
191consetetur, eu pro everti postulant
192homero verear ea mea, qui.
193
194Consul *necessitatibus* per id,
195consetetur, eu pro everti postulant
196homero verear ea mea, qui.
197|===================================
198
199.AsciiDoc source
200---------------------------------------------------------------------
201[cols=",^v",options="header"]
202|===================================
203|Default paragraphs |Centered verses
2042*|Per id.
205
206Consul *necessitatibus* per id,
207consetetur, eu pro everti postulant
208homero verear ea mea, qui.
209
210Consul *necessitatibus* per id,
211consetetur, eu pro everti postulant
212homero verear ea mea, qui.
213|===================================
214---------------------------------------------------------------------
215
216
217.Horizontal and vertial headings
218[cols="h,4*",options="header",width="50%"]
219|==================================
220|      |West |Central |East | Total
221|Q1    |270  |292     |342  | 904
222|Q2    |322  |276     |383  | 981
223|Q3    |298  |252     |274  | 824
224|Q4    |344  |247     |402  | 993
225|==================================
226
227.AsciiDoc source
228---------------------------------------------------------------------
229.Horizontal and vertial headings
230[cols="h,4*",options="header",width="50%"]
231|==================================
232|      |West |Central |East | Total
233|Q1    |270  |292     |342  | 904
234|Q2    |322  |276     |383  | 981
235|Q3    |298  |252     |274  | 824
236|Q4    |344  |247     |402  | 993
237|==================================
238---------------------------------------------------------------------
239
240
241.AsciiDoc style in first column, Literal in second
242[cols="asciidoc,literal",options="header",grid="cols"]
243|==================================
244|Output markup |AsciiDoc source
2452*|
246Consul *necessitatibus* per id,
247consetetur, eu pro everti postulant
248homero verear ea mea, qui.
249
250-----------------------------------
251Consul *necessitatibus* per id,
252consetetur, eu pro everti postulant
253homero verear ea mea, qui.
254-----------------------------------
255
256.Code filter example
257[source,python]
258-----------------------------------
259''' A multi-line
260    comment.'''
261def sub_word(mo):
262    ''' Single line comment.'''
263    word = mo.group('word')
264    if word in keywords[language]:
265        return quote + word + quote
266    else:
267        return word
268-----------------------------------
269
270- Lorem ipsum dolor sit amet,
271  consectetuer adipiscing elit.
272  * Fusce euismod commodo velit.
273  * Qui in magna commodo, est labitur
274    dolorum an. Est ne magna primis
275    adolescens. Sit munere ponderum
276    dignissim et. Minim luptatum et vel.
277  * Vivamus fringilla mi eu lacus.
278  * Donec eget arcu bibendum nunc
279    consequat lobortis.
280- Nulla porttitor vulputate libero.
281  . Fusce euismod commodo velit.
282  . Vivamus fringilla mi eu lacus.
283
284|==================================
285
286.AsciiDoc source
287[listing]
288.....................................................................
289[cols="asciidoc,literal",options="header",grid="cols"]
290|==================================
291|Output markup |AsciiDoc source
2922*|
293Consul *necessitatibus* per id,
294consetetur, eu pro everti postulant
295homero verear ea mea, qui.
296
297-----------------------------------
298Consul *necessitatibus* per id,
299consetetur, eu pro everti postulant
300homero verear ea mea, qui.
301-----------------------------------
302
303.Code filter example
304[source,python]
305-----------------------------------
306''' A multi-line
307    comment.'''
308def sub_word(mo):
309   ''' Single line comment.'''
310    word = mo.group('word')
311    if word in keywords[language]:
312        return quote + word + quote
313    else:
314        return word
315-----------------------------------
316
317- Lorem ipsum dolor sit amet,
318  consectetuer adipiscing elit.
319  * Fusce euismod commodo velit.
320  * Qui in magna commodo, est labitur
321    dolorum an. Est ne magna primis
322    adolescens. Sit munere ponderum
323    dignissim et. Minim luptatum et vel.
324  * Vivamus fringilla mi eu lacus.
325  * Donec eget arcu bibendum nunc
326    consequat lobortis.
327- Nulla porttitor vulputate libero.
328  . Fusce euismod commodo velit.
329  . Vivamus fringilla mi eu lacus.
330
331|==================================
332.....................................................................
333
334
335.Cell containing lots of example markup elements
336|====================================================================
337|'URLs':
338http://www.methods.co.nz/asciidoc/[The AsciiDoc home page],
339http://www.methods.co.nz/asciidoc/,
340mailto:joe.bloggs@foobar.com[email Joe Bloggs],
341joe.bloggs@foobar.com,
342callto:joe.bloggs[].
343
344'Link': See <<X1,AsciiDoc source>>.
345
346'Emphasized text', *Strong text*, +Monospaced text+, ``Quoted text''.
347
348'Subscripts and superscripts': e^{amp}#960;i^+1 = 0. H~2~O and x^10^.
349Some ^super text^ and ~some sub text~
350
351'Replacements': (C) copyright, (TM) trademark, (R) registered trademark,
352-- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
353double arrow, <= left double arrow.
354|====================================================================
355
356[[X1]]
357.AsciiDoc source
358---------------------------------------------------------------------
359|====================================================================
360|'URLs':
361http://www.methods.co.nz/asciidoc/[The AsciiDoc home page],
362http://www.methods.co.nz/asciidoc/,
363mailto:joe.bloggs@foobar.com[email Joe Bloggs],
364joe.bloggs@foobar.com,
365callto:joe.bloggs[].
366
367'Link': See <<X1,AsciiDoc source>>.
368
369'Emphasized text', *Strong text*, +Monospaced text+, ``Quoted text''.
370
371'Subscripts and superscripts': e^{amp}#960;i^+1 = 0. H~2~O and x^10^.
372Some ^super text^ and ~some sub text~
373
374'Replacements': (C) copyright, (TM) trademark, (R) registered trademark,
375-- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
376double arrow, <= left double arrow.
377|====================================================================
378---------------------------------------------------------------------
379
380
381.Nested table
382[width="75%",cols="1,2a"]
383|==============================================
384|Normal cell
385
386|Cell with nested table
387
388[cols="2,1"]
389!==============================================
390!Nested table cell 1 !Nested table cell 2
391!==============================================
392
393|==============================================
394
395.AsciiDoc source
396---------------------------------------------------------------------
397[width="75%",cols="1,2a"]
398|==============================================
399|Normal cell
400
401|Cell with nested table
402
403[cols="2,1"]
404!==============================================
405!Nested table cell 1 !Nested table cell 2
406!==============================================
407
408|==============================================
409---------------------------------------------------------------------
410
411
412.Spans, alignments and styles
413[cols="e,m,^,>s",width="25%"]
414|================
415|1 >s|2 |3 |4
416^|5 2.2+^.^|6 .3+<.>m|7
417^|8
418|9 2+>|10
419|================
420
421.AsciiDoc source
422---------------------------------------------------------------------
423.Spans, alignments and styles
424[cols="e,m,^,>s",width="25%"]
425|================
426|1 >s|2 |3 |4
427^|5 2.2+^.^|6 .3+<.>m|7
428^|8
429|9 2+>|10
430|================
431---------------------------------------------------------------------
432
433.Three panes
434[cols="a,2a"]
435|==================================
436|
437[float]
438Top Left Pane
439~~~~~~~~~~~~~
440Consul *necessitatibus* per id,
441consetetur, eu pro everti postulant
442homero verear ea mea, qui.
443
444Consul *necessitatibus* per id,
445consetetur, eu pro everti postulant
446homero verear ea mea, qui.
447
448.2+|
449[float]
450Right Pane
451~~~~~~~~~~
452Consul *necessitatibus* per id,
453consetetur, eu pro everti postulant
454homero verear ea mea, qui.
455
456-----------------------------------
457Consul *necessitatibus* per id,
458consetetur, eu pro everti postulant
459homero verear ea mea, qui.
460-----------------------------------
461
462.Code filter example
463[source,python]
464-----------------------------------
465''' A multi-line
466    comment.'''
467def sub_word(mo):
468    ''' Single line comment.'''
469    word = mo.group('word')
470    if word in keywords[language]:
471        return quote + word + quote
472    else:
473        return word
474-----------------------------------
475
476- Lorem ipsum dolor sit amet,
477  consectetuer adipiscing elit.
478  * Fusce euismod commodo velit.
479  * Qui in magna commodo, est labitur
480    dolorum an. Est ne magna primis
481    adolescens. Sit munere ponderum
482    dignissim et. Minim luptatum et vel.
483  * Vivamus fringilla mi eu lacus.
484  * Donec eget arcu bibendum nunc
485    consequat lobortis.
486- Nulla porttitor vulputate libero.
487  . Fusce euismod commodo velit.
488  . Vivamus fringilla mi eu lacus.
489
490|
491[float]
492Bottom Left Pane
493~~~~~~~~~~~~~~~~
494Consul *necessitatibus* per id,
495consetetur, eu pro everti postulant
496homero verear ea mea, qui.
497
498Consul *necessitatibus* per id,
499consetetur, eu pro everti postulant
500homero verear ea mea, qui.
501
502- Lorem ipsum dolor sit amet,
503  consectetuer adipiscing elit.
504  * Fusce euismod commodo velit.
505  * Qui in magna commodo, est labitur
506    dolorum an. Est ne magna primis
507    adolescens. Sit munere ponderum
508    dignissim et. Minim luptatum et vel.
509  * Vivamus fringilla mi eu lacus.
510  * Donec eget arcu bibendum nunc
511    consequat lobortis.
512- Nulla porttitor vulputate libero.
513  . Fusce euismod commodo velit.
514  . Vivamus fringilla mi eu lacus.
515
516|==================================
517
518.AsciiDoc source
519[listing]
520.....................................................................
521.Three panes
522[cols="a,2a"]
523|==================================
524|
525[float]
526Top Left Pane
527~~~~~~~~~~~~~
528Consul *necessitatibus* per id,
529consetetur, eu pro everti postulant
530homero verear ea mea, qui.
531
532Consul *necessitatibus* per id,
533consetetur, eu pro everti postulant
534homero verear ea mea, qui.
535
536.2+|
537[float]
538Right Pane
539~~~~~~~~~~
540Consul *necessitatibus* per id,
541consetetur, eu pro everti postulant
542homero verear ea mea, qui.
543
544-----------------------------------
545Consul *necessitatibus* per id,
546consetetur, eu pro everti postulant
547homero verear ea mea, qui.
548-----------------------------------
549
550.Code filter example
551[source,python]
552-----------------------------------
553''' A multi-line
554    comment.'''
555def sub_word(mo):
556    ''' Single line comment.'''
557    word = mo.group('word')
558    if word in keywords[language]:
559        return quote + word + quote
560    else:
561        return word
562-----------------------------------
563
564- Lorem ipsum dolor sit amet,
565  consectetuer adipiscing elit.
566  * Fusce euismod commodo velit.
567  * Qui in magna commodo, est labitur
568    dolorum an. Est ne magna primis
569    adolescens. Sit munere ponderum
570    dignissim et. Minim luptatum et vel.
571  * Vivamus fringilla mi eu lacus.
572  * Donec eget arcu bibendum nunc
573    consequat lobortis.
574- Nulla porttitor vulputate libero.
575  . Fusce euismod commodo velit.
576  . Vivamus fringilla mi eu lacus.
577
578|
579[float]
580Bottom Left Pane
581~~~~~~~~~~~~~~~~
582Consul *necessitatibus* per id,
583consetetur, eu pro everti postulant
584homero verear ea mea, qui.
585
586Consul *necessitatibus* per id,
587consetetur, eu pro everti postulant
588homero verear ea mea, qui.
589
590- Lorem ipsum dolor sit amet,
591  consectetuer adipiscing elit.
592  * Fusce euismod commodo velit.
593  * Qui in magna commodo, est labitur
594    dolorum an. Est ne magna primis
595    adolescens. Sit munere ponderum
596    dignissim et. Minim luptatum et vel.
597  * Vivamus fringilla mi eu lacus.
598  * Donec eget arcu bibendum nunc
599    consequat lobortis.
600- Nulla porttitor vulputate libero.
601  . Fusce euismod commodo velit.
602  . Vivamus fringilla mi eu lacus.
603
604|==================================
605.....................................................................
606
607
608== Combinations of 'align', 'frame', 'grid', 'valign' and 'halign' attributes
609
610:frame: all
611:grid: all
612:halign: left
613:valign: top
614
615[options="header"]
616|====
617||frame | grid |valign |halign
618v|&nbsp;
619&nbsp;
620&nbsp;
621|{frame} | {grid} |{valign} |{halign}
622|====
623
624.AsciiDoc source
625---------------------------------------------------------------------
626:frame: all
627:grid: all
628:halign: left
629:valign: top
630
631[options="header"]
632|====
633||frame | grid |valign |halign
634v|&nbsp;
635&nbsp;
636&nbsp;
637|{frame} | {grid} |{valign} |{halign}
638|====
639---------------------------------------------------------------------
640
641
642:frame: sides
643:grid: rows
644:halign: center
645:valign: middle
646
647.Table test
648[width="50%",options="header"]
649|====
650||frame | grid |valign |halign
651v|&nbsp;
652&nbsp;
653&nbsp;
654|{frame} | {grid} |{valign} |{halign}
655|====
656
657.AsciiDoc source
658---------------------------------------------------------------------
659:frame: sides
660:grid: rows
661:halign: center
662:valign: middle
663
664.Table test
665[width="50%",options="header"]
666|====
667||frame | grid |valign |halign
668v|&nbsp;
669&nbsp;
670&nbsp;
671|{frame} | {grid} |{valign} |{halign}
672|====
673---------------------------------------------------------------------
674
675
676:frame: topbot
677:grid: cols
678:halign: right
679:valign: bottom
680
681[align="right",width="50%",options="header"]
682|====
683||frame | grid |valign |halign
684v|&nbsp;
685&nbsp;
686&nbsp;
687|{frame} | {grid} |{valign} |{halign}
688|====
689
690.AsciiDoc source
691---------------------------------------------------------------------
692:frame: topbot
693:grid: cols
694:halign: right
695:valign: bottom
696
697[align="right",width="50%",options="header"]
698|====
699||frame | grid |valign |halign
700v|&nbsp;
701&nbsp;
702&nbsp;
703|{frame} | {grid} |{valign} |{halign}
704|====
705---------------------------------------------------------------------
706
707
708:frame: none
709:grid: none
710:halign: left
711:valign: top
712
713[align="center",width="50%",options="header"]
714|====
715||frame | grid |valign |halign
716v|&nbsp;
717&nbsp;
718&nbsp;
719|{frame} | {grid} |{valign} |{halign}
720|====
721
722.AsciiDoc source
723---------------------------------------------------------------------
724:frame: none
725:grid: none
726:halign: left
727:valign: top
728
729[align="center",width="50%",options="header"]
730|====
731||frame | grid |valign |halign
732v|&nbsp;
733&nbsp;
734&nbsp;
735|{frame} | {grid} |{valign} |{halign}
736|====
737---------------------------------------------------------------------
738
739:frame!:
740:grid!:
741:halign!:
742:valign!:
743
Note: See TracBrowser for help on using the repository browser.