diff --git a/cmd/gutcontent/main.go b/cmd/gutcontent/main.go deleted file mode 100644 index 7bd4bb8..0000000 --- a/cmd/gutcontent/main.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Given a project gutenberg plaintext book on STDIN, this program prints just its content (ie with header and footer stripped) -*/ - -package main - -import ( - "bufio" - "fmt" - "os" - "strings" -) - -func main() { - s := bufio.NewScanner(os.Stdin) - inHeader := true - inFooter := false - skippedAll := true - for s.Scan() { - text := strings.TrimSpace(s.Text()) - if inFooter { - break - } - if strings.HasPrefix(text, "*** START") { - inHeader = false - continue - } - if inHeader { - continue - } - if strings.HasPrefix(text, "*** END") { - inFooter = true - continue - } - fmt.Println(text) - if skippedAll { - skippedAll = false - } - } - if skippedAll { - fmt.Fprintln(os.Stderr, "warning: found no text to print") - } -} diff --git a/templates/index.tmpl b/templates/index.tmpl index 775fc56..db50b74 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -110,7 +110,7 @@ a {
- +
diff --git a/web/assets/main.js b/web/assets/main.js index ce4be7f..2632a0c 100644 --- a/web/assets/main.js +++ b/web/assets/main.js @@ -33,14 +33,12 @@ class LineRemover extends Button { class LinePinner extends Button { connectedCallback() { - //this.innerText = "lock"; this.setAttribute("title", "pin line in place"); } click() { const l = this.closest("div.line"); l.classList.toggle("unpinned"); if (l.classList.contains("unpinned")) { - // this.innerText = "lock"; this.classList.remove("pinned"); this.setAttribute("title", "lock line in place"); } else { @@ -50,6 +48,19 @@ class LinePinner extends Button { } } +class LineRegenner extends Button { + connectedCallback() { + this.setAttribute("title", "regenerate just this line"); + } + click() { + const l = this.closest("div.line"); + if (!l.classList.contains("unpinned")) { + return; + } + l.regen() + } +} + class LineEditor extends Button { connected = false connectedCallback() { @@ -233,7 +244,6 @@ class SourceText extends HTMLDivElement { edited() { const line = this.parentElement; const text = line.querySelector(".linetext").innerText; - console.log(text); const orig = line.originalText; if (text == "" || (text != orig && !orig.includes(text))) { this.update({"Name": "original"}); @@ -411,6 +421,7 @@ customElements.define("theme-toggler", ThemeToggler, { extends: "a" }); customElements.define("source-text", SourceText, { extends: "div" }); customElements.define("line-remover", LineRemover, { extends: "button" }); customElements.define("line-pinner", LinePinner, { extends: "button" }); +customElements.define("line-regenner", LineRegenner, { extends: "button" }); customElements.define("line-editor", LineEditor, { extends: "button" }); customElements.define("line-adder", LineAdder, { extends: "button" }); customElements.define("poem-regenner", PoemRegenner, {extends: "button"}); diff --git a/web/web.go b/web/web.go index e58c886..5f4b950 100644 --- a/web/web.go +++ b/web/web.go @@ -12,6 +12,8 @@ import ( "github.com/vilmibm/trunkless/db" ) +// TODO detect max id on startup + type source struct { ID int64 Name string