module Snippr
Snippr::I18n
¶ ↑
Provides support for I18n
snippr files.
Snippr::LinkHelper¶ ↑
This module can be included to get functionality to adjust links.
Snippr::MetaData
¶ ↑
Handles Snippr's YAML Front Matter inspired by Jekyll. Useful for passing meta information about a Snip
to the app.
Snippr::Normalizer
¶ ↑
Provides methods to normalize snippr path elements.
Snippr::Normalizer::DeRester
¶ ↑
“Redirects” REST path elements that are accessed via POST (create, update destroy) with their corresponding GET elements (new, edit, show) so that when eg create is rendered due to an error in the action, it just looks exactly like the new page it was issued from.
Snippr::Path
¶ ↑
Provides methods for dealing with the path to snippr files.
Snippr::Processor
¶ ↑
Provides methods to process snippr content.
Snippr::Processor::Dynamics
¶ ↑
Replaces {placeholder} placeholders in the content with values taken from the given opts.
Snippr::Processor::Functions
¶ ↑
Processes several functions in {command:options} syntax.
Snippr::Processor::Links
¶ ↑
Adjusts URLs in links.
Snippr::Processor::Wikilinks
¶ ↑
Replaces links in [url|title] syntax with real links.
Snippr
¶ ↑
File based content management¶ ↑
A snippr file is a piece of HTML or raw text to be included in a website. They are plain text files stored on the file system. Snippr
files end with “.snip” and are read from the Snippr
path.
Snippr::ViewHelper
¶ ↑
This module is automatically included into ActionView::Base
when using the Snippr
component with Rails
. It provides a snippr
helper method for loading snippr files.
%h1 Topup successful .topup.info = snippr :topup, :success %h1 Conditional output - snippr :topup, :conditional_snippr do |snip| #cond= snip
Attributes
Sets the logger to use.
Public Instance Methods
Returns the regular expressions used to determine which urls to exclude from adjustment.
# File lib/snippr/snippr.rb, line 40 def adjust_urls_except Links.adjust_urls_except end
Sets the regular expressions used to determine which urls to exclude from adjustment.
# File lib/snippr/snippr.rb, line 45 def adjust_urls_except=(adjust_urls_except) Links.adjust_urls_except = adjust_urls_except end
Sets whether to use I18n
snippr files.
# File lib/snippr/snippr.rb, line 35 def i18n=(enabled) I18n.enabled = enabled end
Returns whether to use I18n
snippr files.
# File lib/snippr/snippr.rb, line 30 def i18n? I18n.enabled? end
Lists all snips inside a snippr directory specified by path parts.
# File lib/snippr/snippr.rb, line 64 def list(*args) Path.list(*args) end
Expects the name of a snippr file. Also accepts a Hash of placeholders to be replaced with dynamic values.
# File lib/snippr/snippr.rb, line 59 def load(*args) Snip.new(*args) end
Returns the logger. Uses the Rails
logger when available or falls back to a custom logger.
# File lib/snippr/snippr.rb, line 53 def logger @logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT) end
Returns the path to the snippr files (from JVM properties if available).
# File lib/snippr/snippr.rb, line 12 def path Path.path end
Sets the path to the snippr files.
# File lib/snippr/snippr.rb, line 17 def path=(path) Path.path = path end
# File lib/snippr/snippr.rb, line 25 def tardis_enabled Tardis.enabled end
# File lib/snippr/snippr.rb, line 21 def tardis_enabled=(bool_or_block) Tardis.enabled = bool_or_block end