#Hydra 0.2.0 Possible Bug

30 messages · Page 1 of 1 (latest)

distant lake
#

When using this it works fine, unless we have a empty heading (level 1), when on the page with the empty heading it puts the header of the title, when it should be leaving it empty, once I fill the heading with some text, the issue goes away.

#let getHeader() = {
  locate(loc => {
    let chapter = hydra(
      sel: heading.where(level: 1),
      display: (_, it) => {
        it.body
      },
      loc: loc,
    )
    
    let section = hydra(
      display: (context, element) => element.body,
      loc: loc,
    )
  
    return [
      #set text(size: 10pt)
      
      #if section != none and chapter != none and section != chapter {
        smallcaps(chapter); h(1fr); emph(section)
        line(stroke: gradient.linear(black, gray) + .5pt,length: 100%)
      } else if chapter != none {
        align(center, smallcaps(chapter))
        line(stroke: gradient.linear(gray, black).repeat(2, mirror: true) + .5pt, length: 100%)
      } else {
        [#line(length: 100%, stroke: .25pt)]
      }
    ]
  })
}```
#
  show heading.where(level: 1): it => [
    #pagebreak(weak: true)
    #set align(right)
    #set text(22pt)
    #underline(extent: 2pt)[
      #block(smallcaps(it.body))
      #v(0.4em)
    ]
  ]```
distant lake
#

@safe juniper c.c

#

I'm not sure if this is an issue with my getHeader() function or hydra itself

safe juniper
#

ah wrong issue

#

one sec

#

If the a page is empty the queries suddenly return wonky results

distant lake
#

hm, I'm guessing no workaround untill the issue is resolved

safe juniper
#

unfortunately no

#

try using #hide[.]

#

below the headings

#

it may fix the query result

#

I'll open an issue to mark this as an upstream problem

distant lake
#

Alright, atleast it's a known issue

safe juniper
#

#hide[.] works btw

#

unfortunate but well

distant lake
#

I'll use that if I'm going to keep my headings empty

safe juniper
distant lake
#

Do we have something like hide but like pagebreaks(weak), such that it only applies the #hide[.] on heading that don't have any text

#

I want to put the #hide[.] on #show heading.where(level: 1): it => [], but only make it apply for empty ones

#

I'm acutally suprised that putting hide inside the #show heading.where(level: 1): it => [] actually doesn't work

safe juniper
#

I don't think so

#

After all this is a bug, so once you actually add content it's correct.

#

So if you Wan it to be correct while drafting you will have to add this while the hug exists or juste ait till you have you document filled.

distant lake
#

Yea, I understand, thank you for the information and your time