mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-12-05 00:00:34 +00:00
Merge pull request #24 from erizocosmico/fix/bail-out-if-not-enough-lines
data: bailout in some cases if there arent enough lines
This commit is contained in:
commit
dc6fc02209
@ -209,6 +209,9 @@ func isCompiledCoffeeScript(path, ext string, content []byte) bool {
|
|||||||
|
|
||||||
firstLine := getFirstLine(content)
|
firstLine := getFirstLine(content)
|
||||||
lastLines := getLines(content, -2)
|
lastLines := getLines(content, -2)
|
||||||
|
if len(lastLines) < 2 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if string(firstLine) == "(function() {" &&
|
if string(firstLine) == "(function() {" &&
|
||||||
string(lastLines[1]) == "}).call(this);" &&
|
string(lastLines[1]) == "}).call(this);" &&
|
||||||
@ -675,9 +678,11 @@ func isGeneratedHTML(_, ext string, content []byte) bool {
|
|||||||
lines := getLines(content, 30)
|
lines := getLines(content, 30)
|
||||||
|
|
||||||
// Pkgdown
|
// Pkgdown
|
||||||
for _, l := range lines[:2] {
|
if len(lines) >= 2 {
|
||||||
if bytes.Contains(l, []byte("<!-- Generated by pkgdown: do not edit by hand -->")) {
|
for _, l := range lines[:2] {
|
||||||
return true
|
if bytes.Contains(l, []byte("<!-- Generated by pkgdown: do not edit by hand -->")) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user