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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"os"
|
||||||
|
|
||||||
"accorder/pkg/calibre"
|
"accorder/pkg/calibre"
|
||||||
|
|
||||||
|
@ -61,13 +61,16 @@ should be enough for the next successful build).`,
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
root := doc.SelectElement("rdf:RDF")
|
root := doc.SelectElement("rdf:RDF")
|
||||||
for _, bib := range root.FindElements("//*") {
|
for _, z := range root.FindElements("[link:type]") {
|
||||||
if bib.Space == "bib" {
|
doc := etree.NewDocument()
|
||||||
if strings.ToLower(bib.Tag) == "book" {
|
doc.SetRoot(z.Copy())
|
||||||
fmt.Println(bib.Tag)
|
fmt.Println("~ ~ ~ ~")
|
||||||
fmt.Printf("%#v\n\n", bib)
|
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)
|
calibre.RenderStandaloneApp(calibrePath, librarianName, libraryUUID, librarySecret, jsonPath)
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,6 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue