initial parsing of zotero's rdf with etree
This commit is contained in:
parent
9c7f016f7d
commit
b668476c47
19
cmd/build.go
19
cmd/build.go
|
@ -2,7 +2,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"os"
|
||||
|
||||
"accorder/pkg/calibre"
|
||||
|
||||
|
@ -61,13 +61,16 @@ should be enough for the next successful build).`,
|
|||
panic(err)
|
||||
}
|
||||
root := doc.SelectElement("rdf:RDF")
|
||||
for _, bib := range root.FindElements("//*") {
|
||||
if bib.Space == "bib" {
|
||||
if strings.ToLower(bib.Tag) == "book" {
|
||||
fmt.Println(bib.Tag)
|
||||
fmt.Printf("%#v\n\n", bib)
|
||||
}
|
||||
}
|
||||
for _, z := range root.FindElements("[link:type]") {
|
||||
doc := etree.NewDocument()
|
||||
doc.SetRoot(z.Copy())
|
||||
fmt.Println("~ ~ ~ ~")
|
||||
fmt.Println(doc.WriteTo(os.Stdout))
|
||||
elm := root.FindElement(fmt.Sprintf("[@rdf:resource='%s']", z.SelectAttr("rdf:about").Value))
|
||||
doc.SetRoot(elm.Parent().Copy())
|
||||
fmt.Println("+++++")
|
||||
fmt.Println(doc.WriteTo(os.Stdout))
|
||||
fmt.Println("~ ~ ~ ~")
|
||||
}
|
||||
calibre.RenderStandaloneApp(calibrePath, librarianName, libraryUUID, librarySecret, jsonPath)
|
||||
},
|
||||
|
|
|
@ -3,7 +3,6 @@ package cmd
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
|
Loading…
Reference in New Issue