File: table.py

package info (click to toggle)
yt 4.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,084 kB
  • sloc: python: 132,484; ansic: 5,628; cpp: 1,588; javascript: 352; makefile: 138; sh: 43; csh: 36
file content (111 lines) | stat: -rw-r--r-- 3,280 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
contents = [
    (
        "Getting Started",
        [
            ("welcome/index.html", "Welcome to yt!", "What's yt all about?"),
            (
                "orientation/index.html",
                "yt Orientation",
                "Quickly get up and running with yt: zero to sixty.",
            ),
            (
                "help/index.html",
                "How to Ask for Help",
                "Some guidelines on how and where to ask for help with yt",
            ),
            (
                "workshop.html",
                "Workshop Tutorials",
                "Videos, slides and scripts from the 2012 workshop covering many "
                + "aspects of yt, from beginning to advanced.",
            ),
        ],
    ),
    (
        "Everyday yt",
        [
            (
                "analyzing/index.html",
                "Analyzing Data",
                "An overview of different ways to handle and process data: loading "
                + "data, using and manipulating objects and fields, examining and "
                + "manipulating particles, derived fields, generating processed data, "
                + "time series analysis.",
            ),
            (
                "visualizing/index.html",
                "Visualizing Data",
                "An overview of different ways to visualize data: making projections, "
                + "slices, phase plots, streamlines, and volume rendering; modifying "
                + "plots; the fixed resolution buffer.",
            ),
            (
                "interacting/index.html",
                "Interacting with yt",
                "Different ways -- scripting, GUIs, prompts, explorers -- to explore "
                + "your data.",
            ),
        ],
    ),
    (
        "Advanced Usage",
        [
            (
                "advanced/index.html",
                "Advanced yt usage",
                "Advanced topics: parallelism, debugging, ways to drive yt, "
                + "developing",
            ),
            (
                "getting_involved/index.html",
                "Getting Involved",
                "How to participate in the community, contribute code and share "
                + "scripts",
            ),
        ],
    ),
    (
        "Reference Materials",
        [
            (
                "cookbook/index.html",
                "The Cookbook",
                "A bunch of illustrated examples of how to do things",
            ),
            (
                "reference/index.html",
                "Reference Materials",
                "A list of all bundled fields, API documentation, the Change Log...",
            ),
            ("faq/index.html", "FAQ", "Frequently Asked Questions: answered for you!"),
        ],
    ),
]

heading_template = r"""
<h2>%s</h2>
<table class="contentstable" align="center">
%s
</table>
"""

subheading_template = r"""
  <tr valign="top">
    <td width="25%%">
      <p>
        <a href="%s">%s</a>
      </p>
    </td>
    <td width="75%%">
      <p class="linkdescr">%s</p>
    </td>
  </tr>
"""

t = ""
for heading, items in contents:
    s = ""
    for subheading in items:
        s += subheading_template % subheading
    t += heading_template % (heading, s)
print(t)