do not require a .html suffix (Firefox doesn't save websites with such any more...)
This commit is contained in:
parent
ea53498cf1
commit
d9add1346f
13
ambrowse.go
13
ambrowse.go
|
@ -1,15 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
goutil "git.gutmet.org/goutil.git/html"
|
||||
"git.gutmet.org/goutil.git/misc"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"golang.org/x/net/html"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
goutil "git.gutmet.org/goutil.git/html"
|
||||
"git.gutmet.org/goutil.git/misc"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -143,13 +144,15 @@ func readHTML(filename string) book {
|
|||
func clean(files []string) {
|
||||
time.Sleep(30 * time.Second)
|
||||
for _, file := range files {
|
||||
log.Println("Removing", file)
|
||||
os.RemoveAll(file)
|
||||
}
|
||||
}
|
||||
|
||||
func digest(dir string, created []string) {
|
||||
for _, file := range created {
|
||||
if filepath.Ext(file) == ".html" && misc.PathExists(file) {
|
||||
log.Println("Digesting", file)
|
||||
if fileInfo, err := os.Stat(file); err == nil && !fileInfo.IsDir() {
|
||||
b := readHTML(file)
|
||||
if b.title != "" {
|
||||
err := misc.AppendToFile(filepath.Join(dir, BOOKFILE), b.yaml())
|
||||
|
|
Loading…
Reference in New Issue
Block a user