cmake build system: visiblity support for clang
[supercollider.git] / SCClassLibrary / Common / Helper / topicHelper.sc
blob534ad2dd0dc7d7a3fb4388bbe16efe404eac7e77
1 /*
2 // Helper, ClassHelper, UGenHelper, TopicHelper
3 // (In this file: TopicHelper)
4 // ________________________________
5 //
6 // Classes to auto generate help files following style guides.
7 // See Helper source for more comments
8 // started on 04/11/07 - andreavalle
9 */
11 TopicHelper {
13         // Topic si the simplest case.
14         // Just a replacement in the template
16         var <>topic, <>path ;
17         classvar text ;
19         *new { arg topic, path ;
20                         ^super.new.initTopicHelper( topic, path )
21         }
23         initTopicHelper { arg aTopic, aPath ;
24                 topic = aTopic ;
25                 path = aPath ;
26                 if ( path.isNil, {
27                         GUI.current.dialog.savePanel({ arg newPath ;
28                                  path = newPath ; {this.makeHelp}.defer })
29                         }, { this.makeHelp }) ;
31         }
33         createText {
34                 text = "
35 <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
36 <html>
37 <head>
38 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
39 <meta http-equiv=\"Content-Style-Type\" content=\"text/css\">
40 <title></title>
41 <meta name=\"Generator\" content=\"Cocoa HTML Writer\">
42 <meta name=\"CocoaVersion\" content=\"824.41\">
43 <style type=\"text/css\">
44 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
45 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
46 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
47 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
48 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
49 p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; color: #d40000}
50 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
51 p.p8 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco}
52 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px}
53 span.s1 {color: #000000}
54 span.s2 {color: #1200c4}
55 span.s3 {color: #d40000}
56 span.s4 {color: #1200c4}
57 span.s5 {text-decoration: underline ; color: #1200c4}
58 span.Apple-tab-span {white-space:pre}
59 </style>
60 </head>
61 <body>
62 <p class=\"p1\"><b>Some Topic</b></p>
63 <p class=\"p2\"><br></p>
64 <p class=\"p3\">Introductory prose discussing Some Topic.</p>
65 <p class=\"p2\"><br></p>
66 <p class=\"p4\"><b>Some aspect of Some Topic</b></p>
67 <p class=\"p2\"><br></p>
68 <p class=\"p3\">Prose discussion which leads to this example:</p>
69 <p class=\"p5\"><br></p>
70 <p class=\"p6\"><span class=\"s1\"><span class=\"Apple-tab-span\">      </span></span>// inline example</p>
71 <p class=\"p6\"><span class=\"s1\"><span class=\"Apple-tab-span\">      </span>b = </span><span class=\"s2\">SomeClass</span><span class=\"s1\">.new(s, 100, 2); <span class=\"Apple-tab-span\">        </span></span>// explanation of this line</p>
72 <p class=\"p6\"><span class=\"s1\"><span class=\"Apple-tab-span\">      </span>b.doSomething;<span class=\"Apple-tab-span\">    </span><span class=\"Apple-tab-span\">  </span><span class=\"Apple-tab-span\">  </span><span class=\"Apple-tab-span\">  </span></span>// explanation of this line</p>
73 <p class=\"p7\"><br></p>
74 <p class=\"p3\">Further discussion leading to the next bit of code which continues from the previous example:</p>
75 <p class=\"p5\"><span class=\"Apple-tab-span\"> </span></p>
76 <p class=\"p8\"><span class=\"Apple-tab-span\"> </span>b.doSomethingMore</p>
77 <p class=\"p8\"><span class=\"s3\"><span class=\"Apple-tab-span\">      </span></span>b.cleanUp;</p>
78 <p class=\"p2\"><br></p>
79 <p class=\"p4\"><b>Some other aspect</b></p>
80 <p class=\"p2\"><span class=\"Apple-converted-space\"></span></p>
81 <p class=\"p3\">More prose... Explains how <a href=\"../Core/Object.html\"><span class=\"s4\">Object</span></a> and <a href=\"../Language/Polymorphism.html\"><span class=\"s4\">Polymorphism</span></a> are very important to Some Topic.</p>
82 <p class=\"p2\"><br></p>
83 <p class=\"p3\"><b>See also: </b><a href=\"../ServerArchitecture/Buffer.html\"><span class=\"s5\">Buffer</span></a><b> </b>[other related help files]</p>
84 <p class=\"p2\"><br></p>
85 <p class=\"p4\"><b>More detailed examples</b></p>
86 <p class=\"p9\"><br></p>
87 <p class=\"p6\"><span class=\"s1\">b = </span><span class=\"s2\">SomeClass</span><span class=\"s1\">.new(s, 100, 2); <span class=\"Apple-tab-span\">    </span></span>// explanation of this line</p>
88 <p class=\"p6\"><span class=\"s1\">b.doSomething;<span class=\"Apple-tab-span\">        </span><span class=\"Apple-tab-span\">  </span><span class=\"Apple-tab-span\">  </span><span class=\"Apple-tab-span\">  </span></span>// explanation of this line</p>
89 <p class=\"p8\">b.cleanUp</p>
90 <p class=\"p7\"><br></p>
91 <p class=\"p8\">...</p>
92 </body>
93 </html>
94 "               .replace("Some Topic", topic) ;  // et voila
96         }
99         makeHelp {
100                 // see ClassHelper
101                 this.createText ;
102                 File.new(path, "w")
103                         .write(text)
104                         .close ;
105                 // and reopen thru topic.openHelpFile
106                 // open works if the path is a place where SC looks for Help files
107                 topic.openHelpFile
108         }