github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/tools/present/doc.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 /* 6 The present file format 7 8 Present files have the following format. The first non-blank non-comment 9 line is the title, so the header looks like 10 11 Title of document 12 Subtitle of document 13 15:04 2 Jan 2006 14 Tags: foo, bar, baz 15 <blank line> 16 Author Name 17 Job title, Company 18 joe@example.com 19 http://url/ 20 @twitter_name 21 22 The subtitle, date, and tags lines are optional. 23 24 The date line may be written without a time: 25 2 Jan 2006 26 In this case, the time will be interpreted as 10am UTC on that date. 27 28 The tags line is a comma-separated list of tags that may be used to categorize 29 the document. 30 31 The author section may contain a mixture of text, twitter names, and links. 32 For slide presentations, only the plain text lines will be displayed on the 33 first slide. 34 35 Multiple presenters may be specified, separated by a blank line. 36 37 After that come slides/sections, each after a blank line: 38 39 * Title of slide or section (must have asterisk) 40 41 Some Text 42 43 ** Subsection 44 45 - bullets 46 - more bullets 47 - a bullet with 48 49 *** Sub-subsection 50 51 Some More text 52 53 Preformatted text 54 is indented (however you like) 55 56 Further Text, including invocations like: 57 58 .code x.go /^func main/,/^}/ 59 .play y.go 60 .image image.jpg 61 .iframe http://foo 62 .link http://foo label 63 .html file.html 64 .caption _Gopher_ by [[http://www.reneefrench.com][Renée French]] 65 66 Again, more text 67 68 Blank lines are OK (not mandatory) after the title and after the 69 text. Text, bullets, and .code etc. are all optional; title is 70 not. 71 72 Lines starting with # in column 1 are commentary. 73 74 Fonts: 75 76 Within the input for plain text or lists, text bracketed by font 77 markers will be presented in italic, bold, or program font. 78 Marker characters are _ (italic), * (bold) and ` (program font). 79 Unmatched markers appear as plain text. 80 Within marked text, a single marker character becomes a space 81 and a doubled single marker quotes the marker character. 82 83 _italic_ 84 *bold* 85 `program` 86 _this_is_all_italic_ 87 _Why_use_scoped__ptr_? Use plain ***ptr* instead. 88 89 Inline links: 90 91 Links can be included in any text with the form [[url][label]], or 92 [[url]] to use the URL itself as the label. 93 94 Functions: 95 96 A number of template functions are available through invocations 97 in the input text. Each such invocation contains a period as the 98 first character on the line, followed immediately by the name of 99 the function, followed by any arguments. A typical invocation might 100 be 101 .play demo.go /^func show/,/^}/ 102 (except that the ".play" must be at the beginning of the line and 103 not be indented like this.) 104 105 Here follows a description of the functions: 106 107 code: 108 109 Injects program source into the output by extracting code from files 110 and injecting them as HTML-escaped <pre> blocks. The argument is 111 a file name followed by an optional address that specifies what 112 section of the file to display. The address syntax is similar in 113 its simplest form to that of ed, but comes from sam and is more 114 general. See 115 http://plan9.bell-labs.com/sys/doc/sam/sam.html Table II 116 for full details. The displayed block is always rounded out to a 117 full line at both ends. 118 119 If no pattern is present, the entire file is displayed. 120 121 Any line in the program that ends with the four characters 122 OMIT 123 is deleted from the source before inclusion, making it easy 124 to write things like 125 .code test.go /START OMIT/,/END OMIT/ 126 to find snippets like this 127 tedious_code = boring_function() 128 // START OMIT 129 interesting_code = fascinating_function() 130 // END OMIT 131 and see only this: 132 interesting_code = fascinating_function() 133 134 Also, inside the displayed text a line that ends 135 // HL 136 will be highlighted in the display; the 'h' key in the browser will 137 toggle extra emphasis of any highlighted lines. A highlighting mark 138 may have a suffix word, such as 139 // HLxxx 140 Such highlights are enabled only if the code invocation ends with 141 "HL" followed by the word: 142 .code test.go /^type Foo/,/^}/ HLxxx 143 144 The .code function may take one or more flags immediately preceding 145 the filename. This command shows test.go in an editable text area: 146 .code -edit test.go 147 This command shows test.go with line numbers: 148 .code -numbers test.go 149 150 play: 151 152 The function "play" is the same as "code" but puts a button 153 on the displayed source so the program can be run from the browser. 154 Although only the selected text is shown, all the source is included 155 in the HTML output so it can be presented to the compiler. 156 157 link: 158 159 Create a hyperlink. The syntax is 1 or 2 space-separated arguments. 160 The first argument is always the HTTP URL. If there is a second 161 argument, it is the text label to display for this link. 162 163 .link http://golang.org golang.org 164 165 image: 166 167 The template uses the function "image" to inject picture files. 168 169 The syntax is simple: 1 or 3 space-separated arguments. 170 The first argument is always the file name. 171 If there are more arguments, they are the height and width; 172 both must be present, or substituted with an underscore. 173 Replacing a dimension argument with the underscore parameter 174 preserves the aspect ratio of the image when scaling. 175 176 .image images/betsy.jpg 100 200 177 178 .image images/janet.jpg _ 300 179 180 181 caption: 182 183 The template uses the function "caption" to inject figure captions. 184 185 The text after ".caption" is embedded in a figcaption element after 186 processing styling and links as in standard text lines. 187 188 .caption _Gopher_ by [[http://www.reneefrench.com][Renée French]] 189 190 iframe: 191 192 The function "iframe" injects iframes (pages inside pages). 193 Its syntax is the same as that of image. 194 195 html: 196 197 The function html includes the contents of the specified file as 198 unescaped HTML. This is useful for including custom HTML elements 199 that cannot be created using only the slide format. 200 It is your responsibilty to make sure the included HTML is valid and safe. 201 202 .html file.html 203 204 */ 205 package present // import "golang.org/x/tools/present"