Sha256: 1b2be73cb7128387a1c1d97be3c0e5a4c946a9048dc7f03432d028f1e8528f89

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

- _title = title
- _id = (_id = id) && _title == '!' && !(local_attr? :id) ? nil : _id
- _roles = roles
/ TODO support build attribute here for more fine-grained control
/ QUESTION should build roles be applied to the section?
- _build_roles = (option? :build) ? ['build', 'build-items', *%w(fade vanish replace).map {|_r| _roles.delete _r }] : []
/ TODO alternate terms for "canvas" - pane, slide, panel
/ TODO also implement "surface" (alternate terms for "surface" - backdrop, screen)
- _style = nil
- if (_bg_img = pluck_first context: :image, role: 'canvas')
  - _style = %[background-image: url(#{image_uri _bg_img.attr(:target)}); background-size: #{(_bg_img.roles & %w[cover contain])[0] || 'cover'}; background-repeat: no-repeat]
section id=_id class=[*_roles, ('image' if _bg_img)] style=_style data-title=(local_attr :reftext) data-bespoke-backdrop=(local_attr 'backdrop-role')
  - content_for :content
    - unless (_title.start_with? '!') || (option? :conceal)
      - if (_title_obj = partition_title _title).subtitle?
        / QUESTION should we support fit option when there's a subtitle?
        header class=_build_roles
          h2=slice_text _title_obj.title
          h3=slice_text _title_obj.subtitle
      - else
          / QUESTION always wrap in span.line when option? :fit
          h2 class=[('fit' if option? :fit), *_build_roles] =slice_text _title_obj.title
    - unless (_content = content).empty?
      =_content
  - if (option? :enclose) || (document.attr? 'enclose-option')
    - _notes = pluck_first context: :sidebar, role: 'cue'
    .content
      - yield_content :content
    - if _notes
      =_notes.convert
  - else
    - yield_content :content

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asciidoctor-bespoke-1.0.0.alpha.2 templates/slim/section.html.slim