Commits

Michael Granger committed b71be24

Update for Hoe 3.

Comments (0)

Files changed (10)

+#!/usr/bin/env bash
+
+# This is an RVM Project .rvmrc file, used to automatically load the ruby
+# development environment upon cd'ing into the directory
+
+environment_id="ruby-1.9.3@hoe-manualgen"
+
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
+	&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]; then
+	echo "Using ${environment_id}"
+	. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+
+	if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]; then
+		. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
+	fi
+else
+	# If the environment file has not yet been created, use the RVM CLI to select.
+	if ! rvm --create use  "$environment_id"
+		then
+		echo "Failed to create RVM environment '${environment_id}'."
+		exit 1
+	fi
+fi
+
+filename=".rvm.gems"
+if [[ -s "$filename" ]]; then
+	rvm gemset import "$filename"
+fi
+
+

History.md

-## v0.1.1 [2011-06-29] Michael Granger <ged@FaerieMUD.org>
-
-* Bugfix: add trace function in a mixin for outputting based on rake -t.
-
-## v0.1.0 [2011-03-16] Michael Granger <ged@FaerieMUD.org>
-
-* Put page filters under the same namespace as the rest
-* More work on the meta-manual.
-* Add page filters to the API docs
-* Reorganized page filter plugins to be a bit more consistently-
-  named/located
-
-## 0.0.1 [2011-01-31] Michael Granger <ged@FaerieMUD.org>
-
-Initial release.
-
+== v0.2.0 [2012-03-21] Michael Granger <ged@FaerieMUD.org>
+
+* Updated for Hoe 3!
+
+
+== v0.1.1 [2011-06-29] Michael Granger <ged@FaerieMUD.org>
+
+* Bugfix: add trace function in a mixin for outputting based on rake -t.
+
+
+== v0.1.0 [2011-03-16] Michael Granger <ged@FaerieMUD.org>
+
+* Put page filters under the same namespace as the rest
+* More work on the meta-manual.
+* Add page filters to the API docs
+* Reorganized page filter plugins to be a bit more consistently-
+  named/located
+
+
+== v0.0.1 [2011-01-31] Michael Granger <ged@FaerieMUD.org>
+
+Initial release.
+

README.md

-# hoe-manualgen
-
-* http://deveiate.org/hoe-manualgen.html
-
-## Description
-
-A manual-generation plugin for Hoe.
-
-This is a plugin for [Hoe][hoe] that adds tasks and resources for
-generating a manual or cookbook.
-
-It's self-documenting, so for more, see [the latest manual for hoe-manualgen itself][hoe-manualgen-manual].
-
-
-## Installation
-
-    gem install hoe-manualgen
-
-
-## Contributing
-
-You can check out the current development source with Mercurial like so:
-
-	hg clone http://bitbucket.org/ged/hoe-manualgen
-
-Or if you prefer Git, via its Github mirror:
-
-	https://github.com/ged/hoe-manualgen
-
-After checking out the source, run:
-
-	$ rake newb
-
-This task will install any missing dependencies, run the tests/specs,
-and generate the API documentation.
-
-
-## License
-
-Copyright (c) 2010, 2011, Michael Granger
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-  this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-* Neither the name of the author/s, nor the names of the project's
-  contributors may be used to endorse or promote products derived from this
-  software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-[hoe]:http://seattlerb.rubyforge.org/hoe/
-[hoe-manualgen-manual]:http://deveiate.org/code/hoe-manualgen/
-
-
+= hoe-manualgen
+
+* http://deveiate.org/hoe-manualgen.html
+
+
+== Description
+
+A manual-generation plugin for Hoe.
+
+This is a plugin for Hoe[http://seattlerb.rubyforge.org/hoe/] that 
+adds tasks and resources for generating a manual or cookbook.
+
+It's self-documenting, so for more, see
+{the latest manual for hoe-manualgen itself}[http://deveiate.org/code/hoe-manualgen/].
+
+
+== Installation
+
+    gem install hoe-manualgen
+
+
+== Contributing
+
+You can check out the current development source with Mercurial like so:
+
+	hg clone http://bitbucket.org/ged/hoe-manualgen
+
+Or if you prefer Git, via its Github mirror:
+
+	https://github.com/ged/hoe-manualgen
+
+After checking out the source, run:
+
+	$ rake newb
+
+This task will install any missing dependencies, run the tests/specs,
+and generate the API documentation.
+
+
+== License
+
+Copyright (c) 2010-2012, Michael Granger
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+* Neither the name of the author/s, nor the names of the project's
+  contributors may be used to endorse or promote products derived from this
+  software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
 #!/usr/bin/env rake
 
+require 'pathname'
+
 begin
 	require 'hoe'
 rescue LoadError
 
 require 'rake/clean'
 
-Hoe.add_include_dirs 'lib'
+Hoe.add_include_dirs 'lib', 'data/hoe-manualgen'
 
 Hoe.plugin :mercurial
 Hoe.plugin :signing
 Hoe.plugins.delete :rubyforge
 
 hoespec = Hoe.spec 'hoe-manualgen' do
-	self.readme_file = 'README.md'
-	self.history_file = 'History.md'
+	self.readme_file = 'README.rdoc'
+	self.history_file = 'History.rdoc'
+	self.extra_rdoc_files = FileList[ '*.rdoc', 'data/hoe-manualgen/lib/*.rb' ]
 
 	self.developer 'Michael Granger', 'ged@FaerieMUD.org'
 
-	self.extra_deps.push *{
-		'hoe'        => "~> #{Hoe::VERSION[/^\d+\.\d+/]}",
-		'RedCloth'   => '~> 4.2',
-		'rcodetools' => '~> 0.8',
-	}
-	self.extra_dev_deps.push *{
-		'rspec'    => '~> 2.4',
-		'tidy-ext' => '~> 0.1',
-	}
+	self.dependency 'hoe', "~> #{Hoe::VERSION[/^\d+\.\d+/]}"
+	self.dependency 'RedCloth', '~> 4.2'
+	self.dependency 'rcodetools', '~> 0.8'
+
+	self.dependency 'tidy-ext', '~> 0.1', :developer
+
+	self.manual_lib_dir = Pathname.pwd + 'data/hoe-manualgen/lib'
 
 	self.spec_extras[:licenses] = ["BSD"]
-	self.spec_extras[:signing_key] = '/Volumes/Keys/ged-private_gem_key.pem'
-
 	self.require_ruby_version( '>=1.8.7' )
 
 	self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
-
-	self.extra_rdoc_files += Dir.glob( 'data/hoe-manualgen/lib/*.rb' )
 	self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
 end
 

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

 		<\?
 			api			# Instruction Target
 			\s+
-			(?:"					
+			(?:"
 				(.*?)   # Optional link text [$1]
 			":)?
 			(.*?)	    # Class name [$2]
 			return %{<a href="%s%s">%s</a>} % [
 				classuri,
 				make_anchor( methodname ),
-				link_text || (classname + methodname || '')
+				link_text || (classname + (methodname || ''))
 			]
 		else
 			link_text ||= classname

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

-#!/usr/bin/ruby 
-# 
+#!/usr/bin/ruby
+#encoding: utf-8
+#
 # 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
 
 
 			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 )
 		caption = %{<div class="caption">} + caption.to_s + %{</div>} if caption
 
 		return %{<notextile><div class="example #{lang}-example">%s%s</div></notextile>} %
-		 	[content, caption || '']
+			[content, caption || '']
 	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
 
 	include FileUtils::DryRun if Rake.application.options.dryrun
 
 	# Library version constant
-	VERSION = '0.1.1'
+	VERSION = '0.2.0'
 
 	# Version-control revision constant
 	REVISION = %q$Revision$
 		def cleanup( source )
 			require 'tidy'
 
-			Tidy.path = '/usr/lib/libtidy.dylib'
 			Tidy.open( TIDY_OPTIONS ) do |tidy|
 				tidy.options.output_xhtml = true
 
 		### Get (singleton) instances of the filters named in +filterlist+ and return them.
 		def load_filters( filterlist )
 			filterlist.flatten.collect do |key|
-				raise ArgumentError, "filter '#{key}' could not be loaded" unless
+				raise ArgumentError, "filter '#{key}' didn't load correctly" unless
 					Hoe::ManualGen::PageFilter.derivatives.key?( key )
 				Hoe::ManualGen::PageFilter.derivatives[ key ].instance
 			end
 
 	### Load the filter libraries provided in the given +libdir+
 	def load_filter_libraries( libdir )
+		trace "Loading filters from libdir: %p" % [ libdir ]
 		Pathname.glob( libdir.expand_path + '*.rb' ) do |filterlib|
 			trace "  loading filter library #{filterlib}"
 			require( filterlib )

manual/src/index.page

 
 h3. License
 
-Copyright © 2011, J. Random Hacker
+Copyright (c) 2011, J. Random Hacker
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification, are
 
 - @api@ := Generate links to API documentation. See <?api Hoe::ManualGen::APIFilter ?> for details.
 - @editorial@ := Insert editorial markup. See <?api Hoe::ManualGen::EditorialFilter ?> for details.
-- @examples@ := Insert example code with syntax highlighting, optional XMP filtering, and captioning. See <?api Hoe::ManualGen::ExampleFilter ?> for details.
+- @examples@ := Insert example code with syntax highlighting, optional XMP filtering, and captioning. See <?api Hoe::ManualGen::ExamplesFilter ?> for details.
 - @links@ := Insert automatically-generated links to other pages by page title or filename. See <?api Hoe::ManualGen::LinksFilter ?> for details.