"time"
"go.cypherpunks.su/recfile/v3"
- "go.stargrave.org/sgblog"
+ sgblog "go.stargrave.org/sgblog/internal"
)
var hashFinder = regexp.MustCompile("([0-9a-f]{40})")
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/storer"
- "go.stargrave.org/sgblog"
+ sgblog "go.stargrave.org/sgblog/internal"
)
func main() {
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/vorlif/spreak"
- "go.stargrave.org/sgblog"
+ sgblog "go.stargrave.org/sgblog/internal"
)
var (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/vorlif/spreak"
- "go.stargrave.org/sgblog"
+ sgblog "go.stargrave.org/sgblog/internal"
)
var (
"github.com/go-git/go-git/v5/plumbing/storer"
"github.com/klauspost/compress/zstd"
"github.com/vorlif/spreak"
- "go.stargrave.org/sgblog"
"go.stargrave.org/sgblog/cmd/sgblog/atom"
+ sgblog "go.stargrave.org/sgblog/internal"
"lukechampine.com/blake3"
)
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
- "go.stargrave.org/sgblog"
+ sgblog "go.stargrave.org/sgblog/internal"
)
type TopicsCache map[string][]plumbing.Hash
--- /dev/null
+// SGBlog -- Git-backed CGI/UCSPI blogging/phlogging/gemlogging engine
+// Copyright (C) 2020-2025 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package internal
+
+import (
+ "bytes"
+ "fmt"
+
+ "go.cypherpunks.su/recfile/v3"
+)
+
+func ParseComments(data []byte) []string {
+ comments := []string{}
+ r := recfile.NewReader(bytes.NewReader(data))
+ for {
+ fields, err := r.Next()
+ if err != nil {
+ break
+ }
+ if len(fields) != 3 ||
+ fields[0].F != "From" ||
+ fields[1].F != "Date" ||
+ fields[2].F != "Body" {
+ continue
+ }
+ comments = append(comments, fmt.Sprintf(
+ "%s: %s\n%s: %s\n%s",
+ fields[0].F, fields[0].V,
+ fields[1].F, fields[1].V,
+ fields[2].V,
+ ))
+ }
+ return comments
+}
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-// SGBlog -- Git-backed CGI/UCSPI blogging/phlogging/gemlogging engine
-package sgblog
+package internal
import (
"bytes"
- "fmt"
"io"
- "sort"
- "text/scanner"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
- "go.cypherpunks.su/recfile/v3"
-)
-
-const (
- Version = "0.36.0"
- WhenFmt = "2006-01-02 15:04:05Z07:00"
)
-func ParseComments(data []byte) []string {
- comments := []string{}
- r := recfile.NewReader(bytes.NewReader(data))
- for {
- fields, err := r.Next()
- if err != nil {
- break
- }
- if len(fields) != 3 ||
- fields[0].F != "From" ||
- fields[1].F != "Date" ||
- fields[2].F != "Body" {
- continue
- }
- comments = append(comments, fmt.Sprintf(
- "%s: %s\n%s: %s\n%s",
- fields[0].F, fields[0].V,
- fields[1].F, fields[1].V,
- fields[2].V,
- ))
- }
- return comments
-}
-
-func ParseTopics(data []byte) []string {
- var s scanner.Scanner
- s.Init(bytes.NewBuffer(data))
- topics := []string{}
- for tok := s.Scan(); tok != scanner.EOF; tok = s.Scan() {
- topics = append(topics, s.TokenText())
- }
- sort.Strings(topics)
- return topics
-}
-
func GetNote(repo *git.Repository, tree *object.Tree, what plumbing.Hash) []byte {
if tree == nil {
return nil
--- /dev/null
+// SGBlog -- Git-backed CGI/UCSPI blogging/phlogging/gemlogging engine
+// Copyright (C) 2020-2025 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package internal
+
+import (
+ "bytes"
+ "sort"
+ "text/scanner"
+)
+
+func ParseTopics(data []byte) []string {
+ var s scanner.Scanner
+ s.Init(bytes.NewBuffer(data))
+ topics := []string{}
+ for tok := s.Scan(); tok != scanner.EOF; tok = s.Scan() {
+ topics = append(topics, s.TokenText())
+ }
+ sort.Strings(topics)
+ return topics
+}
--- /dev/null
+package internal
+
+const Version = "0.37.0"
--- /dev/null
+package internal
+
+const WhenFmt = "2006-01-02 15:04:05Z07:00"