2 linksexp -- Texinfo/XBEL/OPML/urls autogeneration from recfile bookmark
3 Copyright (C) 2021-2023 Sergey Matveev <stargrave@stargrave.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, version 3 of the License.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 Type string `xml:"type,attr"`
28 Text string `xml:"text,attr"`
29 XmlUrl string `xml:"xmlUrl,attr"`
30 HtmlUrl string `xml:"htmlUrl,attr"`
31 Category string `xml:"category,attr,omitempty"`
35 XMLName xml.Name `xml:"opml"`
36 Version string `xml:"version,attr"`
37 Head string `xml:"head"`
38 Outlines []Outline `xml:"body>outline"`
41 func opml(data []map[string][]string) {
42 outlines := make([]Outline, 0, len(data))
43 for _, ent := range data {
44 for _, feed := range ent["Feed"] {
45 outlines = append(outlines, Outline{
47 Text: ent["Title"][0],
48 HtmlUrl: ent["URL"][0],
50 Category: strings.Join(ent["Category"], ","),
54 x := OPML{Version: "2.0", Outlines: outlines}
55 out, err := xml.MarshalIndent(&x, "", " ")
59 os.Stdout.WriteString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")