| 238 | } |
| 239 | |
| 240 | func (p *DefaultJSDocument) parseInformalExportDefault(pageDir string, line string) (bool, error) { |
| 241 | exportData := strings.TrimSpace(strings.Split(line, string(ExportDefaultToken))[1]) |
| 242 | if len(exportData) == 0 { |
| 243 | return false, nil |
| 244 | } |
| 245 | if match := regexp.MustCompile("\\{|\\}|\\[|\\]|\\(|\\)"); !match.Match([]byte(exportData)) { |
| 246 | return false, nil |
| 247 | } |
| 248 | |
| 249 | pageName := formatPathToPageName(pageDir) |
| 250 | |
| 251 | p.AddOther(fmt.Sprintf("const %s = %s", pageName, exportData)) |
| 252 | p.scope[pageName] = &JsDocumentScope{ |
| 253 | Name: pageName, |
| 254 | Export: ExportDefault, |
| 255 | TokenType: ConstToken, |
| 256 | Args: make(JSDocArgList, 0), |
| 257 | } |
| 258 | |
| 259 | p.defaultExport = p.scope[pageName] |
| 260 | p.name = pageName |
| 261 | |
| 262 | return true, nil |
| 263 | } |
| 264 | |
| 265 | func isIndexPath(finalPath string) bool { |
| 266 | // first we check if it can be found locally |