Sha256: 0036eff6c14570bf3920c3c4e8e98bee4ce640d396a83027d0828802e4cda342

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

# -*- ruby -*-
# frozen_string_literal: true
# vim: set noet nosta sw=4 ts=4 :

require 'uri'
require 'inversion/template' unless defined?( Inversion::Template )
require 'inversion/template/attrtag'

# Inversion strip tag.
#
# This tag strips markup from a template attribute.
#
# == Syntax
#
#   <?strip foo.bar ?>
#
class Inversion::Template::StripTag < Inversion::Template::AttrTag
	include Inversion::Escaping


	HTML_TAG = %r{
		<
			/?
			\p{Alnum}+
			(
				\s+
				\S+="[^\"]*"
			)*
			\s*
		>
	}xi


	### Render the method chains against the attributes of the specified +render_state+
	### and return them.
	def render( render_state )
		raw = super or return nil
		return raw.gsub(HTML_TAG, '')
	end

end # class Inversion::Template::StripTag

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rdoc-generator-sixfish-0.3.1 lib/inversion/template/striptag.rb
rdoc-generator-sixfish-0.3.0 lib/inversion/template/striptag.rb
rdoc-generator-sixfish-0.2.1 lib/inversion/template/striptag.rb
rdoc-generator-sixfish-0.2.0 lib/inversion/template/striptag.rb
rdoc-generator-sixfish-0.1.0 lib/inversion/template/striptag.rb