Commits

Michael Granger committed 421b5d5 Merge

Automated merge with ssh://bitbucket.org/ged/hoe-manualgen

  • Participants
  • Parent commits 920fb80, 0ee61ea

Comments (0)

Files changed (5)

 \.DS_Store
 ^manual/(output|layouts|resources|lib)/
 ~$
-^ChangeLog
+^ChangeLog$
 
 ENV['VERSION'] ||= hoespec.spec.version.to_s
 
-begin
-	include Hoe::MercurialHelpers
-
-	### Task: prerelease
-	desc "Append the package build number to package versions"
-	task :pre do
-		rev = get_numeric_rev()
-		trace "Current rev is: %p" % [ rev ]
-		hoespec.spec.version.version << "pre#{rev}"
-		Rake::Task[:gem].clear
-
-		Gem::PackageTask.new( hoespec.spec ) do |pkg|
-			pkg.need_zip = true
-			pkg.need_tar = true
-		end
-	end
-
-	### Make the ChangeLog update if the repo has changed since it was last built
-	file '.hg/branch'
-	file 'ChangeLog' => '.hg/branch' do |task|
-		$stderr.puts "Updating the changelog..."
-		content = make_changelog()
-		File.open( task.name, 'w', 0644 ) do |fh|
-			fh.print( content )
-		end
-	end
-
-	# Rebuild the ChangeLog immediately before release
-	task :prerelease => 'ChangeLog'
-
-rescue NameError => err
-	task :no_hg_helpers do
-		fail "Couldn't define the :pre task: %s: %s" % [ err.class.name, err.message ]
-	end
-
-	task :pre => :no_hg_helpers
-	task 'ChangeLog' => :no_hg_helpers
-
-end
-

data/hoe-manualgen/lib/editorial-filter.rb

-#!/usr/bin/ruby 
-# 
+#!/usr/bin/ruby
+#
 # A manual filter to highlight content that needs editorial help.
-# 
+#
 # Authors:
 # * Michael Granger <ged@FaerieMUD.org>
-# 
-# 
+#
+#
 
 
 
 ### A filter for making editorial marks in manual content.
-### 
+###
 ### Editorial marks are XML processing instructions. There are several available types of
 ### marks:
 ###
 ###   <?ed "This is an editor's note." ?>
 ###   <?ed verify:"this content needs checking or verification" ?>
-### 
+###
 class Hoe::ManualGen::EditorialFilter < Hoe::ManualGen::PageFilter
-	
+
 	# PI	   ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
 	LinkPI = %r{
 		<\?
 			\s+
 			(\w+?)				# type of editorial mark [$1]
 			:?					# optional colon
-			"					
+			"
 				(.*?)           # content that should be edited [$2]
 			"
 			\s*
 		\?>
 	  }x
-	
-	
+
+
 	######
 	public
 	######
 			# Grab the tag values
 			mark_type = $1
 			content   = $2
-			
+
 			self.generate_mark( page, mark_type, content )
 		end
 	end
-	
-	
+
+
 	### Create an HTML fragment from the parsed LinkPI.
 	def generate_mark( current_page, mark_type, content )
 		return "%%(editorial %s-mark)%s%%" % [ mark_type, content ]
 	end
-	
-	
+
+
 end

data/hoe-manualgen/lib/examples-filter.rb

-#!/usr/bin/ruby 
-# 
+#!/usr/bin/ruby
+#
 # A collection of standard filters for the manual generation tasklib.
-# 
+#
 # Authors:
 #   Michael Granger <ged@FaerieMUD.org>
-# 
-# 
+#
+#
 
 # Dependencies deferred until #initialize
 
 
 ### A filter for inline example code or command-line sessions -- does
 ### syntax-checking for some languages and captioning.
-### 
+###
 ### Examples are enclosed in XML processing instructions like so:
 ###
 ###   <?example {language: ruby, testable: true, caption: "A fine example"} ?>
 ### This will be pulled out into a preformatted section in the HTML,
 ### highlighted as Ruby source, checked for valid syntax, and annotated with
 ### the specified caption. Valid keys in the example PI are:
-### 
+###
 ### language::
 ###   Specifies which (machine) language the example is in.
 ### testable::
 ### caption::
 ###   A small blurb to put below the pulled-out example in the HTML.
 class Hoe::ManualGen::ExamplesFilter < Hoe::ManualGen::PageFilter
-	
+
 	DEFAULTS = {
 		:language     => :ruby,
 		:line_numbers => :inline,
 			)?
 		\?>
 	  }x
-	
+
 	EndPI = %r{ <\? end (?: \s+ example )? \s* \?> }x
 
 
 	### Defer loading of dependenies until the filter is loaded
 	def initialize( *args )
-		begin
-			require 'pathname'
-			require 'strscan'
-			require 'yaml'
-			require 'rcodetools/xmpfilter'
-			require 'digest/md5'
-			require 'tmpdir'
-			require 'erb'
-		rescue LoadError => err
-			unless Object.const_defined?( :Gem )
-				require 'rubygems'
-				retry
-			end
+		require 'pathname'
+		require 'strscan'
+		require 'yaml'
+		require 'rcodetools/xmpfilter'
+		require 'digest/md5'
+		require 'tmpdir'
+		require 'erb'
+	end
 
-			raise
-		end
-	end
-	
-	
+
 	######
 	public
 	######
 	### Process the given +source+ for <?example ... ?> processing-instructions, calling out
 	def process( source, page, metadata )
 		scanner = StringScanner.new( source )
-		
+
 		buffer = ''
 		until scanner.eos?
 			startpos = scanner.pos
-			
+
 			# If we find an example
 			if scanner.skip_until( ExamplePI )
 				contents = ''
-				
+
 				# Append the interstitial content to the buffer
 				if ( scanner.pos - startpos > scanner.matched.length )
 					offset = scanner.pos - scanner.matched.length - 1
 				# Append everything up to it to the buffer and save the contents of
 				# the tag
 				params = scanner[1]
-				
+
 				# Now find the end of the example or complain
 				contentpos = scanner.pos
 				scanner.skip_until( EndPI ) or
-					raise "Unterminated example at line %d" % 
+					raise "Unterminated example at line %d" %
 						[ scanner.string[0..scanner.pos].count("\n") ]
-				
+
 				# Now build the example and append to the buffer
 				if ( scanner.pos - contentpos > scanner.matched.length )
 					offset = scanner.pos - scanner.matched.length - 1
 		end
 		buffer << scanner.rest
 		scanner.terminate
-		
+
 		return buffer
 	end
-	
-	
+
+
 	### Filter out 'example' macros, doing syntax highlighting, and running
 	### 'testable' examples through a validation process appropriate to the
 	### language the example is in.
 		caption = options.delete( :caption )
 		content = ''
 		lang = options.delete( :language ).to_s
-		
+
 		# Test it if it's testable
 		if options[:testable]
 			content = test_content( body, lang, page )
 	end
 
 
-	### Parse an options hash for filtering from the given +args+, which can either 
-	### be a plain String, in which case it is assumed to be the name of the language the example 
+	### Parse an options hash for filtering from the given +args+, which can either
+	### be a plain String, in which case it is assumed to be the name of the language the example
 	### is in, or a Hash of configuration options.
 	def parse_options( args )
 		args = "{ #{args} }" unless args.strip[0] == ?{
 		end
 		return DEFAULTS.merge( args )
 	end
-	
+
 
 	### Test the given +content+ with a rule specific to the given +language+.
 	def test_content( body, language, page )
 			return body
 		end
 	end
-	
-		
+
+
 	### Test the specified Ruby content for valid syntax
 	def test_ruby_content( source, page )
 		# $stderr.puts "Testing ruby content..."
 		return "%s while testing: %s\n  %s" %
 			[ err.class.name, err.message, err.backtrace.join("\n  ") ]
 	end
-	
-	
+
+
 	### Test the specified YAML content for valid syntax
 	def test_yaml_content( source, metadata )
 		YAML.load( source )
 	else
 		return source
 	end
-	
-	
+
+
 	### Highlights the given +content+ in language +lang+.
 	def highlight( content, options, lang )
 		source = ERB::Util.html_escape( content )
 		return %Q{\n\n<pre class="brush:#{lang}">#{source}</pre>\n\n}
 	end
-	
+
 end