Class: AlRtl::HtmlAttrsTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- AlRtl::HtmlAttrsTag
- Defined in:
- lib/al_rtl.rb
Overview
al_rtl_html_attrs % — goes inside the tag.
Always emits a lang, and adds dir="rtl" only for RTL pages. Emitting
dir="ltr" explicitly would be harmless but noisy; the default is already
ltr.
Instance Method Summary collapse
Instance Method Details
#render(context) ⇒ Object
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/al_rtl.rb', line 118 def render(context) site = context.registers[:site] page = context.registers[:page] attributes = [] tag = AlRtl.language_tag(site, page) attributes << %(lang="#{CGI.escapeHTML(tag)}") unless tag.empty? attributes << %(dir="rtl") if AlRtl.rtl?(site, page) attributes.join(" ") end |