Class: DraftHtml

Inherits:
JekyllSupport::JekyllTag
  • Object
show all
Defined in:
lib/jekyll_draft/common/draft_html.rb

Constant Summary collapse

VERSION =
'0.1.0'.freeze
DRAFT_HTML =
'draft_html'.freeze

Instance Method Summary collapse

Instance Method Details

#render_implObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/jekyll_draft/common/draft_html.rb', line 5

def render_impl
  path_portion = @helper.parameter_specified? 'path_portion'
  page = path_portion ? page_match(path_portion) : @page

  is_draft = Jekyll::Draft.draft? page

  published_output = @helper.parameter_specified? 'published_output'
  return published_output if !is_draft && published_output
  return unless is_draft

  draft_output = @helper.parameter_specified? 'draft_output'
  return draft_output if draft_output

  draft_class = @helper.parameter_specified? 'class'
  dc = " #{draft_class}" if draft_class

  draft_style = @helper.parameter_specified? 'style'
  ds = " style='#{draft_style}'" if draft_style

  " <i class='jekyll_draft#{dc}'#{ds}>Draft</i>"
end