(sourcePath string)
| 219 | } |
| 220 | |
| 221 | func parseAndRenderSegs(sourcePath string) ([]*Seg, string) { |
| 222 | segs, filecontent := parseSegs(sourcePath) |
| 223 | lexer := whichLexer(sourcePath) |
| 224 | for _, seg := range segs { |
| 225 | if seg.Docs != "" { |
| 226 | seg.DocsRendered = markdown(seg.Docs) |
| 227 | } |
| 228 | if seg.Code != "" { |
| 229 | seg.CodeRendered = chromaFormat(seg.Code, sourcePath) |
| 230 | |
| 231 | // adding the content to the js code for copying to the clipboard |
| 232 | if strings.HasSuffix(sourcePath, ".go") { |
| 233 | seg.CodeForJs = strings.Trim(seg.Code, "\n") + "\n" |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | // we are only interested in the 'go' code to pass to play.golang.org |
| 238 | if lexer != "go" { |
| 239 | filecontent = "" |
| 240 | } |
| 241 | return segs, filecontent |
| 242 | } |
| 243 | |
| 244 | func parseExamples() []*Example { |
| 245 | var exampleNames []string |
no test coverage detected