mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-19 14:43:05 -03:00
Sync to linguist 7.2.0: heuristics.yml support (#189)
Sync \w Github Linguist v7.2.0 Includes new way of handling `heuristics.yml` and all `./data/*` re-generated using Github Linguist [v7.2.0](https://github.com/github/linguist/releases/tag/v7.2.0) release tag. - many new languages - better vendoring detection - update doc on update&known issues.
This commit is contained in:
@ -2,13 +2,14 @@ package generator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// Documentation reads from fileToParse and builds source file from tmplPath. It complies with type File signature.
|
||||
func Documentation(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string) error {
|
||||
// Documentation generates regex matchers in Go for documentation files/dirs.
|
||||
// It is of generator.File type.
|
||||
func Documentation(fileToParse, _, outFile, tmplPath, tmplName, commit string) error {
|
||||
data, err := ioutil.ReadFile(fileToParse)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -20,13 +21,10 @@ func Documentation(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
if err := executeDocumentationTemplate(buf, regexpList, tmplPath, tmplName, commit); err != nil {
|
||||
err = executeTemplate(buf, tmplName, tmplPath, commit, nil, regexpList)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return formatedWrite(outPath, buf.Bytes())
|
||||
}
|
||||
|
||||
func executeDocumentationTemplate(out io.Writer, regexpList []string, tmplPath, tmplName, commit string) error {
|
||||
return executeTemplate(out, tmplName, tmplPath, commit, nil, regexpList)
|
||||
return formatedWrite(outFile, buf.Bytes())
|
||||
}
|
||||
|
Reference in New Issue
Block a user