module Lucky::SpecialtyTags

Direct including types

Defined in:

lucky/tags/specialty_tags.cr

Instance Method Summary

Instance Method Detail

def canonical_link(href : String) : Nil #

Generates a canonical link tag to specify the "canonical" or "preferred" version of a page.


[View source]
def css_link(href, **options) : Nil #

Generates a link tag for a stylesheet at the path href.

Additional tag attributes can be passed in keyword arguments via options.


[View source]
def html_doctype : Nil #

Generates an HTML5 doctype tag.


[View source]
def js_link(src, **options) : Nil #

Generates a script tag for a file at path src.

Additional tag attributes can be passed in as keyword arguments via options.


[View source]
def nbsp(how_many : Int32 = 1) : Nil #

Generates an escaped HTML   entity for the number of times specified by how_many. By default it generates 1 non-breaking space character.

link "Home", to: Home::Index
span do
  nbsp
  text "|"
  nbsp
end
link "About", to: About::Index

Would generate Home | About


[View source]
def raw(string : String) : Nil #

Adds string directly to the rendered HTML with no escaping.

For example,

raw "<hopefully-something-safe>" # Renders "<hopefully-something-safe>"

For custom elements, it's recommended to use the tag method.

NOTE Should never be used to render unescaped user-generated data, as this can leave one vulnerable to cross-site scripting attacks.


[View source]
def responsive_meta_tag(**options) : Nil #

Generates a meta tag telling browsers to render the page as wide as the device screen/window and at an initial scale of 1.

Optional keyword arguments can be used to override these defaults, as well as specify additional properties. Please refer to MDN's documentation on the viewport meta tag for usage details.


[View source]
def utf8_charset : Nil #

Generates a meta tag to specify the character encoding as UTF-8.

It is highly encouraged to specify the character encoding as early in a page's as possible as some browsers only look at the first 1024 bytes to determine the encoding.


[View source]