summaryrefslogtreecommitdiff
path: root/bookpipeline/graph.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-08-28 19:30:53 +0100
committerNick White <git@njw.name>2019-08-28 19:30:53 +0100
commit8e75a646d1f8bb64379a67b1160d681768f3ec5f (patch)
tree080ccd8b7b944c655de91d810e1bb6b384f3f959 /bookpipeline/graph.go
parent48d894897894a010db1661259fa375e1be36e659 (diff)
Add standalone graph tool; confgraph
Diffstat (limited to 'bookpipeline/graph.go')
-rw-r--r--bookpipeline/graph.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/bookpipeline/graph.go b/bookpipeline/graph.go
index a4fdee0..4386218 100644
--- a/bookpipeline/graph.go
+++ b/bookpipeline/graph.go
@@ -23,12 +23,16 @@ type GraphConf struct {
Pgnum, Conf float64
}
-func Graph(confs map[string]*Conf, bookname string, w io.Writer) (error) {
+func Graph(confs map[string]*Conf, bookname string, w io.Writer) error {
// Organise confs to sort them by page
var graphconf []GraphConf
for _, conf := range confs {
name := filepath.Base(conf.Path)
- numend := strings.Index(name, "_")
+ var numend int
+ numend = strings.Index(name, "_")
+ if numend == -1 {
+ numend = strings.Index(name, ".")
+ }
pgnum, err := strconv.ParseFloat(name[0:numend], 64)
if err != nil {
continue