]> Nishi Git Mirror - aya.git/commitdiff
Fix tests
authorJames Mills <1290234+prologic@users.noreply.github.com>
Sat, 18 Mar 2023 07:40:46 +0000 (17:40 +1000)
committerJames Mills <1290234+prologic@users.noreply.github.com>
Sat, 18 Mar 2023 07:40:46 +0000 (17:40 +1000)
main.go
testdata/extensions/.test/index.html
testdata/ignore/.test/index.html
testdata/simple/.test/index.html
testdata/variables/.test/index.html

diff --git a/main.go b/main.go
index eb0967274ea1189458fd4137c004910eddbddbde..36cc25e77e1d70443189bdcaaf85dfc1dd5c6595 100644 (file)
--- a/main.go
+++ b/main.go
@@ -4,6 +4,7 @@ package main
 import (
        "bytes"
        "context"
+       "errors"
        "fmt"
        "io"
        "io/ioutil"
@@ -520,7 +521,9 @@ func buildAll(ctx context.Context, watch bool) error {
                        filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
                                // rebuild if changes to .zs/ or .zsignore
                                if (filepath.Base(path) == ZSIGNORE || filepath.Dir(path) == ZSDIR) && info.ModTime().After(lastModified) {
-                                       Ignore = ParseIgnoreFile(path)
+                                       if filepath.Base(path) == ZSIGNORE {
+                                               Ignore = ParseIgnoreFile(path)
+                                       }
                                        // reset lastModified to 0 so everything rebuidls
                                        lastModified = time.Unix(0, 0)
                                        return nil
@@ -623,7 +626,9 @@ func init() {
 func ParseIgnoreFile(fn string) *ignore.GitIgnore {
        obj, err := ignore.CompileIgnoreFile(ZSIGNORE)
        if err != nil {
-               log.WithError(err).Warnf("error parsing .zsignore: %s (using defaults)s", fn)
+               if !errors.Is(err, os.ErrNotExist) {
+                       log.WithError(err).Warnf("error parsing .zsignore: %s (using defaults)s", fn)
+               }
                return ignore.CompileIgnoreLines(DefaultIgnore)
        }
 
index 7dc7db444dacdcdfa49f3bb2aadd9076717e16f1..ef8cfcaa9c64f3514dba0c8fd35c57932a6b5db9 100644 (file)
@@ -2,7 +2,7 @@
        <head>
                <title>Hello World</title>
        </head>
-       <body><h1 id="hello-world">Hello World</h1>
+       <body><h1 id="hello-world">Hello World <a class="anchor" href="#hello-world">¶</a></h1>
 <p>Hello World!</p>
 </body>
 </html>
index 80b5a0dfb8c77882ec0449b5e13725180eed9c18..417c430bb28d9bbbec5e028f01675bd04ec7cb1f 100644 (file)
@@ -1,5 +1,5 @@
 <html>
-       <body><h1 id="simple">Simple</h1>
+       <body><h1 id="simple">Simple <a class="anchor" href="#simple">¶</a></h1>
 <p>Simple page</p>
 </body>
 </html>
index 80b5a0dfb8c77882ec0449b5e13725180eed9c18..417c430bb28d9bbbec5e028f01675bd04ec7cb1f 100644 (file)
@@ -1,5 +1,5 @@
 <html>
-       <body><h1 id="simple">Simple</h1>
+       <body><h1 id="simple">Simple <a class="anchor" href="#simple">¶</a></h1>
 <p>Simple page</p>
 </body>
 </html>
index 9307c9873800dc9693482946543538c4c1b3d952..25dfc33bff8c7a7dde1f3ac945dd60bfc7996f9a 100644 (file)
@@ -2,7 +2,7 @@
        <head>
                <title>Simple</title>
        </head>
-       <body><h1 id="simple">Simple</h1>
+       <body><h1 id="simple">Simple <a class="anchor" href="#simple">¶</a></h1>
 <p>Simple page</p>
 </body>
 </html>