<commit_before>module CodeRay
	module Encoders

	class HTML
		
		# This module is included in the output String from thew HTML Encoder.
		#
		# It provides methods like wrap, div, page etc.
		#
		# Remember to use #clone instead of #dup to keep the modules the object was
		# extended with.
		#
		# TODO: more doc.
		module Output

			class << self
				
				# This makes Output look like a class.
				#
				# Example:
				# 
				#  a = Output.new '<span class="co">Code</span>'
				#  a.wrap! :page
				def new string, element = nil
					output = string.clone.extend self
					output.wrapped_in = element
					output
				end
				
				# Raises an exception if an object that doesn't respond to to_str is extended by Output,
				# to prevent users from misuse. Use Module#remove_method to disable.
				def extended o
					warn "The Output module is intended to extend instances of String, not #{o.class}." unless o.respond_to? :to_str
				end

				def page_template_for_css css = :default
					css = CSS::DEFAULT_STYLESHEET if css == :default
					PAGE.apply 'CSS', css
				end

				# Define a new wrapper. This is meta programming.
				def wrapper *wrappers
					wrappers.each do |wrapper|
						define_method wrapper do |*args|
							wrap wrapper, *args
						end
						define_method(:"#{wrapper}!") do |*args|  
							wrap! wrapper, *args
						end
					end
				end
			end
<commit_msg>html_output.rb changed for silly rdoc, second try.<commit_after>module CodeRay
	module Encoders

	class HTML
		
		# This module is included in the output String from thew HTML Encoder.
		#
		# It provides methods like wrap, div, page etc.
		#
		# Remember to use #clone instead of #dup to keep the modules the object was
		# extended with.
		#
		# TODO: more doc.
		module Output

			class << self
				
				# This makes Output look like a class.
				#
				# Example:
				# 
				#  a = Output.new '<span class="co">Code</span>'
				#  a.wrap! :page
				def new string, element = nil
					output = string.clone.extend self
					output.wrapped_in = element
					output
				end
				
				# Raises an exception if an object that doesn't respond to to_str is extended by Output,
				# to prevent users from misuse. Use Module#remove_method to disable.
				def extended o
					warn "The Output module is intended to extend instances of String, not #{o.class}." unless o.respond_to? :to_str
				end

				def page_template_for_css css = :default
					css = CSS::DEFAULT_STYLESHEET if css == :default
					PAGE.apply 'CSS', css
				end

				# Define a new wrapper. This is meta programming.
				def wrapper *wrappers
					wrappers.each do |wrapper|
						define_method wrapper do |*args|
							wrap wrapper, *args
						end
						define_method "#{wrapper}!".to_sym do |*args|  
							wrap! wrapper, *args
						end
					end
				end
			end

{'fraction_non_alphanumeric': 0.07771469127040455, 'fraction_numerical': 0.0, 'mean_word_length': 2.4504283965728275, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1358601', 'n_tokens_mistral': 1123, 'n_tokens_neox': 837, 'n_words': 335}