]> Sergey Matveev's repositories - linksexp.git/blobdiff - main.go
Number of items in category
[linksexp.git] / main.go
diff --git a/main.go b/main.go
index 9fb4e203d1c5b5786d87a26b509370b4fd9a645b..1ef6d5da2916c84ea0a86d490c75c28ea54339e3 100644 (file)
--- a/main.go
+++ b/main.go
@@ -121,10 +121,19 @@ func main() {
        }
 
        fmt.Println("Updated:", time.Now().Format(time.RFC3339))
-       fmt.Println("@table @strong")
+
+       fmt.Println("@menu")
+       fmt.Println("Categories:")
+       for _, cat := range cats {
+               fmt.Printf("* %s (%d items): LinksCat%s\n", cat, len(data[cat]), cat)
+       }
+       fmt.Println("@end menu")
+
        for _, cat := range cats {
-               fmt.Println("@item", cat)
+               fmt.Println("@node", "LinksCat"+cat)
+               fmt.Println("@section Links category:", cat)
                fmt.Println("@multitable @columnfractions .05 .8 .1 .05")
+               fmt.Println("@headitem @tab @tab Other categories @tab Feed URLs")
                ents := data[cat]
                for n, ent := range ents {
                        catsOther := make([]string, 0)
@@ -138,7 +147,7 @@ func main() {
                                note = "(" + ent["Note"][0] + ")"
                        }
                        fmt.Printf(
-                               "  @item %d @tab @url{%s, %s} %s @tab %s @tab\n",
+                               "  @item %d @tab @url{%s,, %s} %s @tab %s @tab\n",
                                n, ent["URL"][0], ent["Title"][0], note,
                                strings.Join(catsOther, ", "),
                        )
@@ -146,7 +155,10 @@ func main() {
                        case 0:
                                fmt.Printf("    @emph{STATIC}\n")
                        case 1:
-                               fmt.Printf("    @url{%s, feed}\n", feeds[0])
+                               fmt.Printf(
+                                       "    @url{%s, feed}\n",
+                                       strings.ReplaceAll(feeds[0], "@", "@@"),
+                               )
                        default:
                                for i, feed := range feeds {
                                        fmt.Printf("    @url{%s, feed%d}\n", feed, i)
@@ -155,5 +167,4 @@ func main() {
                }
                fmt.Println("@end multitable")
        }
-       fmt.Println("@end table")
 }