resource: Start Resources :counter first time they're used
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 27 Jan 2018 09:22:42 +0000 (10:22 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 27 Jan 2018 09:22:42 +0000 (10:22 +0100)
commit7b472e46084b603045b87cea870ffc73ac1cf7e7
tree34da0356f12344350555c44300dba8038061ece3
parent96e3fbcf23ceb946504d7e82ea08bf1c30b0fe5f
resource: Start Resources :counter first time they're used

This is less surprising and more flexible than the original implementation.

Given:

```toml
[[resources]]
  src = "documents/photo_specs.pdf"
  title = "Photo Specifications"
[[resources]]
  src = "**.pdf"
  name = "pdf-file-:counter"
```

Every `pdf` in the bundle will have an unique counter, but the `photo_specs.pdf` is still allowed to have its specific `title`.

If you change the above example to:

```toml
[[resources]]
  src = "documents/*specs.pdf"
  title = "Photo Specifications #:conter"
[[resources]]
  src = "**.pdf"
  name = "pdf-file-:counter"
```

We are talking about two different groups of documents, each with its own counters starting at 1.

Fixes #4335
resource/resource.go
resource/resource_test.go