Oh, geez, do I feel stupid - that was definitely the problem! Took out the "book|" expression from the chapter detection statement, and now everything displays correctly. Hooray!
Thanks so much for bearing with me here, Kovid! It's a little thing, but it was driving me utterly crazy, and goodness only knows how long it would have taken me to figure that out on my own.