Sha256: 4dde98bb9d47d97caf495470bf67f6e373277fc03eef3da024a1b09b744517bf

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

module EltHelper
	def format(data)
		# for italics /.../ to _..._ \
				#.gsub(/(\s+)\/([\w\séèàûîùô]*)\//, '\\1_\\2_') \

		# ^here: data
		# /italic/
		# - listElement
		# in reply to:\n>
		# 1. numbered list
		text = auto_link data \
				.gsub(/^(\w*):\s/, ' \\1: ') \
				.gsub(/(\s+)\/([\w\s]*)\//, '\\1_\\2_') \
				.gsub(/^-\s/, '* ') \
				.gsub(/(:)(\n)(^>\s)/, '\\1\\2\\2\\3') \
				.gsub(/^\d+[\.-]\s+/, '# ') \
			if data != nil

		textiled = text.blank? ? "" : RedCloth.new(text).to_html
		if textiled[0..2] == "<p>" then textiled = textiled[3..-1] end
		if textiled[-4..-1] == "</p>" then textiled = textiled[0..-5] end
		return textiled

		"""
		hard_breaks = false
    auto_link textilize_without_paragraph(data \
        .gsub(/\&\#8211\;/, '* ') \
        .gsub(/^-\s/, '* ') \
        .gsub(/(\s+)\/([\w\séèàûîùô]*)\//, '\\1_\\2_') \
        .gsub(/[^\n]\n^>/, '') \
        .gsub(/^\d+[ \.-]+/, '# ') \
    # ).gsub(/(.{65,182})<br\s\/>/, \
		# ).gsub(/([\r\n\<\>=\w\d\s.\:;,$*?!\-ôùûéèàêçïî\"\&#;()\/]{65,182})<br\s\/>([^>])/,
		  ) if data != nil
		"""
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parlement-0.1 app/helpers/elt_helper.rb
parlement-0.2 app/helpers/elt_helper.rb