Giter VIP home page Giter VIP logo

Comments (3)

SuzanneSoy avatar SuzanneSoy commented on June 3, 2024

It seems that the bug comes from these two lines:

(+ 1 (for/sum ([i (in-list (cdr number))]) (if (not (string? i)) 1 0)))))

    (define/public (number-depth number)
      (if (null? number)
          0
          (+ 1 (for/sum ([i (in-list (cdr number))]) (if (not (string? i)) 1 0))))) ;; ignores strings here

(define depth (+ (number-depth number) (or (render-part-depth) 0)))

          (define depth (+ (number-depth number) (or (render-part-depth) 0)))

not
The number-depth function computes how many "segments" compose the number, and ignores strings (it seems that one should instead return a list of two strings to obtain the correct behaviour, but this is not documented). However, I understand that the depth of the section should depend on the whole number, including the strings and #f values, so (length number) should be used instead of number-depth, again, if I understand correctly what's going on here.

Note that the following document, which returns #f instead of strings, correctly nests SubAA and SubAB as subsections of SecA, so I don't really see why strings are treated as an exception here.

#lang scribble/manual
@require[scribble/core]
@(define my-numberer
   (make-numberer (λ (current parents)
                    (values #f
                            (add1 current))) 1))
@(define s (style #f (list my-numberer)))
@title{Foo}
@(table-of-contents)
@section[#:style s]{SecA}
@subsection{SubAA}
@subsection{SubAB}
@section[#:style s]{SecB}
@section[#:style s]{SecC}

from scribble.

mflatt avatar mflatt commented on June 3, 2024

Is this the same doc issue as #96, or is something more needed here?

from scribble.

SuzanneSoy avatar SuzanneSoy commented on June 3, 2024

Using a list of two strings does "solve" the problem, but when a single string is returned, I don't see why the subsections would need to bebe lifted one level up.

If I understand correctly, the single-string case can be used for things like "First part", "Second part", where we wouldn't want a "First.2.5" section, which would be a nonsensical numbering. I suppose that we nevertheless do want subparts of these "grouper" parts to show up as actual subparts, not as sibblings.

from scribble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.