\{\{([<>]?)toc\}\}<\/p>/i unless const_defined?(:TOC_RE) # Renders the TOC with given headings def replace_toc(text, headings) text.gsub!(TOC_RE) do if headings.empty? '' else div_class = 'toc' div_class << ' right' if $1 == '>' div_class << ' left' if $1 == '<' out = "
' end end end # # displays the current url plus an optional anchor # def full_url(anchor_name = '') return "##{anchor_name}" if current_request.nil? url_for pagination_params_whitelist.merge(anchor: anchor_name, only_path: true) rescue ActionController::UrlGenerationError # In a context outside params, we don't know what the relative anchor url is "##{anchor_name}" end def current_request request rescue nil end end end