Login  Register

Re: Appendix sectnums

Posted by mojavelinux on Oct 14, 2013; 12:33am
URL: https://discuss.asciidoctor.org/Appendix-sectnums-tp706p803.html

On Thu, Oct 10, 2013 at 1:00 AM, pepijnve [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Both options look ok to me, but I think I'm leaning towards considering it a bug in the numbering.

Agreed.

 

If this is considered a bug, then what impact does that have on the sectnum for the appendix title? Currently 'Appendix A' is stored in the 'appendix-number' attribute. Should it become the sectnum instead then? Seems to make more sense than having an empty sectnum like in my patch, but it does require special handling when deriving the sectnum for child sections to avoid 'Appendix A.1'. 

I've implemented a solution that performs the work in the assign_index method. I outline the rules I followed in this comment:

 

The gap in the numbering that you suggested seems to make sense. As you said it's unlikely to occur, but when it does continuing the regular numbering where it left off seems the logical thing to do.

Just for completeness' sake I noticed that I forgot part of my patch. Here's the missing appendix_number function

def appendix_number
  entry = Array === attributes[:attribute_entries] && attributes[:attribute_entries].find { |entry| entry.name == 'appendix-number' }
  entry ? entry.value : nil
end

I took a similar approach, but found a simpler way to implement it by changing where I store the appendix-number. You can see the solution in this pull request:


Let me know what you think. If it looks good, I'll merge it in. If not, feel free to send a pull request to my issue-683 branch.

-Dan

--