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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
goutil "git.gutmet.org/goutil.git/html"
|
|
||||||
"git.gutmet.org/goutil.git/misc"
|
|
||||||
"github.com/fsnotify/fsnotify"
|
|
||||||
"golang.org/x/net/html"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
goutil "git.gutmet.org/goutil.git/html"
|
||||||
|
"git.gutmet.org/goutil.git/misc"
|
||||||
|
"github.com/fsnotify/fsnotify"
|
||||||
|
"golang.org/x/net/html"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -143,13 +144,15 @@ func readHTML(filename string) book {
|
||||||
func clean(files []string) {
|
func clean(files []string) {
|
||||||
time.Sleep(30 * time.Second)
|
time.Sleep(30 * time.Second)
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
log.Println("Removing", file)
|
||||||
os.RemoveAll(file)
|
os.RemoveAll(file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func digest(dir string, created []string) {
|
func digest(dir string, created []string) {
|
||||||
for _, file := range created {
|
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)
|
b := readHTML(file)
|
||||||
if b.title != "" {
|
if b.title != "" {
|
||||||
err := misc.AppendToFile(filepath.Join(dir, BOOKFILE), b.yaml())
|
err := misc.AppendToFile(filepath.Join(dir, BOOKFILE), b.yaml())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user