[DRE-commits] [ruby-builder] 01/06: Imported Upstream version 3.2.2
Marc Dequènes
duck at moszumanska.debian.org
Sat Jan 4 02:19:55 UTC 2014
This is an automated email from the git hooks/post-receive script.
duck pushed a commit to branch master
in repository ruby-builder.
commit d8a1861ffc8e53c4b677cb66b54b37379d51ba83
Author: Marc Dequènes (Duck) <Duck at DuckCorp.org>
Date: Fri Jan 3 19:15:28 2014 +0100
Imported Upstream version 3.2.2
---
CHANGES | 107 ++++++++
MIT-LICENSE | 20 ++
README.md | 258 ++++++++++++++++++
Rakefile | 195 +++++++++++++
checksums.yaml.gz | Bin 0 -> 268 bytes
doc/jamis.rb | 591 ++++++++++++++++++++++++++++++++++++++++
doc/releases/builder-1.2.4.rdoc | 31 +++
doc/releases/builder-2.0.0.rdoc | 46 ++++
doc/releases/builder-2.1.1.rdoc | 58 ++++
lib/builder/version.rb | 2 +-
lib/builder/xmlbase.rb | 16 +-
metadata.yml | 87 +++---
rakelib/publish.rake | 17 ++
rakelib/tags.rake | 62 +++++
14 files changed, 1436 insertions(+), 54 deletions(-)
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..0f608fe
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,107 @@
+= Change Log
+
+== Version 3.2.0
+
+* Ruby 2.0 compatibility changes.
+
+* Allow single quoted attributes.
+
+== Version 3.1.0
+
+* Included the to_xs arity patch needed for weird Rails compatibility
+ issue.
+
+* Escaping newlines in attributes now.
+
+* Allow method caching
+
+== Version 3.0.0
+
+* Ruby 1.9 compatiblity issues.
+
+== Version 2.2.0
+
+* Applied patch from Thijs van der Vossen to allow UTF-8 encoded
+ output when the encoding is UTF-8 and $KCODE is UTF8.
+
+== Version 2.1.2
+
+* Fixed bug where private methods in kernel could leak through using
+ tag!(). Thanks to Hagen Overdick for finding and diagnosing this
+ bug.
+
+== Version 2.1.1
+
+* Fixed typo in XmlMarkup class docs (ident => indent). (from Martin
+ Fowler).
+* Removed extra directory indirection from legacy CVS to SVN move.
+* Removed some extraneous tabs from source.
+* Fixed test on private methods in blankslate to differentiate between
+ targetted and untargetted private methods.
+* Removed legacy capture of @self in XmlBase (@self was used back when
+ we used instance eval).
+* Added additional tests for global functions (both direct and included).
+
+== Version 2.1.0
+
+* Fixed bug in BlankSlate where including a module into Object could
+ cause methods to leak into BlankSlate.
+* Made BlankSlate available as its own gem. Currently the builder gem
+ still directly includes the BlankSlate code.
+* Added reveal capability to BlankSlate.
+
+== Version 2.0.0
+
+* Added doc directory
+* Added unit tests for XmlEvents.
+* Added XChar module and used it in the _escape method.
+* Attributes are now quoted by default when strings. Use Symbol
+ attribute values for unquoted behavior.
+
+== Version 1.2.4
+
+* Added a cdata! command to an XML Builder (from Josh Knowles).
+
+== Version 1.2.3
+
+The attributes in the <?xml ... ?> instruction will be ordered:
+version, encoding, standalone.
+
+== Version 1.2.2
+
+Another fix for BlankSlate. The Kernal/Object traps added in 1.2.1
+failed when a method was defined late more than once. Since the
+method was already marked as removed, another attempt to undefine it
+raised an error. The fix was to check the list of instance methods
+before attempting the undef operation. Thanks to Florian Gross and
+David Heinemeier Hansson for the patch.
+
+== Version 1.2.1
+
+BlankSlate now traps method definitions in Kernel and Object to avoid
+late method definitions inadvertently becoming part of the definition
+of BlankSlate as well.
+
+== Version 1.2.0
+
+Improved support for entity declarations by allowing nested
+declarations and removal of the attribute processing.
+
+Added namespace support.
+
+== Version 1.1.0
+
+Added support for comments, entity declarations and processing instructions.
+
+== Version 1.0.0
+
+Removed use of <tt>instace_eval</tt> making the use of XmlMarkup much
+less prone to error.
+
+== Version 0.1.1
+
+Bug fix.
+
+== Version 0.1.0
+
+Initial version release.
diff --git a/MIT-LICENSE b/MIT-LICENSE
new file mode 100644
index 0000000..7d9be51
--- /dev/null
+++ b/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2003-2012 Jim Weirich (jim.weirich at gmail.com)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..81928cc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,258 @@
+# Project: Builder
+
+## Goal
+
+Provide a simple way to create XML markup and data structures.
+
+## Classes
+
+Builder::XmlMarkup:: Generate XML markup notation
+Builder::XmlEvents:: Generate XML events (i.e. SAX-like)
+
+**Notes:**
+
+* An <tt>Builder::XmlTree</tt> class to generate XML tree
+ (i.e. DOM-like) structures is also planned, but not yet implemented.
+ Also, the events builder is currently lagging the markup builder in
+ features.
+
+## Usage
+
+```ruby
+ require 'rubygems'
+ require_gem 'builder', '~> 2.0'
+
+ builder = Builder::XmlMarkup.new
+` xml = builder.person { |b| b.name("Jim"); b.phone("555-1234") }
+ xml #=> <person><name>Jim</name><phone>555-1234</phone></person>
+```
+
+or
+
+```ruby
+ require 'rubygems'
+ require_gem 'builder'
+
+ builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
+ builder.person { |b| b.name("Jim"); b.phone("555-1234") }
+ #
+ # Prints:
+ # <person>
+ # <name>Jim</name>
+ # <phone>555-1234</phone>
+ # </person>
+```
+
+## Compatibility
+
+### Version 2.0.0 Compatibility Changes
+
+Version 2.0.0 introduces automatically escaped attribute values for
+the first time. Versions prior to 2.0.0 did not insert escape
+characters into attribute values in the XML markup. This allowed
+attribute values to explicitly reference entities, which was
+occasionally used by a small number of developers. Since strings
+could always be explicitly escaped by hand, this was not a major
+restriction in functionality.
+
+However, it did surprise most users of builder. Since the body text is
+normally escaped, everybody expected the attribute values to be
+escaped as well. Escaped attribute values were the number one support
+request on the 1.x Builder series.
+
+Starting with Builder version 2.0.0, all attribute values expressed as
+strings will be processed and the appropriate characters will be
+escaped (e.g. "&" will be translated to "&"). Attribute values
+that are expressed as Symbol values will not be processed for escaped
+characters and will be unchanged in output. (Yes, this probably counts
+as Symbol abuse, but the convention is convenient and flexible).
+
+Example:
+
+```ruby
+ xml = Builder::XmlMarkup.new
+ xml.sample(:escaped=>"This&That", :unescaped=>:"Here&There")
+ xml.target! =>
+ <sample escaped="This&That" unescaped="Here&There"/>
+```
+
+### Version 1.0.0 Compatibility Changes
+
+Version 1.0.0 introduces some changes that are not backwards
+compatible with earlier releases of builder. The main areas of
+incompatibility are:
+
+* Keyword based arguments to +new+ (rather than positional based). It
+ was found that a developer would often like to specify indentation
+ without providing an explicit target, or specify a target without
+ indentation. Keyword based arguments handle this situation nicely.
+
+* Builder must now be an explicit target for markup tags. Instead of
+ writing
+
+```ruby
+ xml_markup = Builder::XmlMarkup.new
+ xml_markup.div { strong("text") }
+```
+
+ you need to write
+
+```ruby
+ xml_markup = Builder::XmlMarkup.new
+ xml_markup.div { xml_markup.strong("text") }
+```
+
+* The builder object is passed as a parameter to all nested markup
+ blocks. This allows you to create a short alias for the builder
+ object that can be used within the block. For example, the previous
+ example can be written as:
+
+```ruby
+ xml_markup = Builder::XmlMarkup.new
+ xml_markup.div { |xml| xml.strong("text") }
+```
+
+* If you have both a pre-1.0 and a post-1.0 gem of builder installed,
+ you can choose which version to use through the RubyGems
+ +require_gem+ facility.
+
+```ruby
+ require_gem 'builder', "~> 0.0" # Gets the old version
+ require_gem 'builder', "~> 1.0" # Gets the new version
+```
+
+## Features
+
+* XML Comments are supported ...
+
+```ruby
+ xml_markup.comment! "This is a comment"
+ #=> <!-- This is a comment -->
+```
+
+* XML processing instructions are supported ...
+
+```ruby
+ xml_markup.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
+ #=> <?xml version="1.0" encoding="UTF-8"?>
+```
+
+ If the processing instruction is omitted, it defaults to "xml".
+ When the processing instruction is "xml", the defaults attributes
+ are:
+
+ <b>version</b>: 1.0
+ <b>encoding</b>: "UTF-8"
+
+ (NOTE: if the encoding is set to "UTF-8" and $KCODE is set to
+ "UTF8", then Builder will emit UTF-8 encoded strings rather than
+ encoding non-ASCII characters as entities.)
+
+* XML entity declarations are now supported to a small degree.
+
+```ruby
+ xml_markup.declare! :DOCTYPE, :chapter, :SYSTEM, "../dtds/chapter.dtd"
+ #=> <!DOCTYPE chapter SYSTEM "../dtds/chapter.dtd">
+```
+
+ The parameters to a declare! method must be either symbols or
+ strings. Symbols are inserted without quotes, and strings are
+ inserted with double quotes. Attribute-like arguments in hashes are
+ not allowed.
+
+ If you need to have an argument to declare! be inserted without
+ quotes, but the argument does not conform to the typical Ruby
+ syntax for symbols, then use the :"string" form to specify a symbol.
+
+ For example:
+
+```ruby
+ xml_markup.declare! :ELEMENT, :chapter, :"(title,para+)"
+ #=> <!ELEMENT chapter (title,para+)>
+```
+
+ Nested entity declarations are allowed. For example:
+
+```ruby
+ @xml_markup.declare! :DOCTYPE, :chapter do |x|
+ x.declare! :ELEMENT, :chapter, :"(title,para+)"
+ x.declare! :ELEMENT, :title, :"(#PCDATA)"
+ x.declare! :ELEMENT, :para, :"(#PCDATA)"
+ end
+
+ #=>
+
+ <!DOCTYPE chapter [
+ <!ELEMENT chapter (title,para+)>
+ <!ELEMENT title (#PCDATA)>
+ <!ELEMENT para (#PCDATA)>
+ ]>
+```
+
+* Some support for XML namespaces is now available. If the first
+ argument to a tag call is a symbol, it will be joined to the tag to
+ produce a namespace:tag combination. It is easier to show this than
+ describe it.
+
+```ruby
+ xml.SOAP :Envelope do ... end
+```
+
+ Just put a space before the colon in a namespace to produce the
+ right form for builder (e.g. "<tt>SOAP:Envelope</tt>" =>
+ "<tt>xml.SOAP :Envelope</tt>")
+
+* String attribute values are <em>now</em> escaped by default by
+ Builder (<b>NOTE:</b> this is _new_ behavior as of version 2.0).
+
+ However, occasionally you need to use entities in attribute values.
+ Using a symbol (rather than a string) for an attribute value will
+ cause Builder to not run its quoting/escaping algorithm on that
+ particular value.
+
+ (<b>Note:</b> The +escape_attrs+ option for builder is now
+ obsolete).
+
+ Example:
+
+```ruby
+ xml = Builder::XmlMarkup.new
+ xml.sample(:escaped=>"This&That", :unescaped=>:"Here&There")
+ xml.target! =>
+ <sample escaped="This&That" unescaped="Here&There"/>
+```
+
+* UTF-8 Support
+
+ Builder correctly translates UTF-8 characters into valid XML. (New
+ in version 2.0.0). Thanks to Sam Ruby for the translation code.
+
+ You can get UTF-8 encoded output by making sure that the XML
+ encoding is set to "UTF-8" and that the $KCODE variable is set to
+ "UTF8".
+
+```ruby
+ $KCODE = 'UTF8'
+ xml = Builder::Markup.new
+ xml.instruct!(:xml, :encoding => "UTF-8")
+ xml.sample("Iñtërnâtiônàl")
+ xml.target! =>
+ "<sample>Iñtërnâtiônàl</sample>"
+```
+
+## Links
+
+| Description | Link |
+| :----: | :----: |
+| Documents | http://builder.rubyforge.org/ |
+| Github Clone | git://github.com/jimweirich/builder.git |
+| Issue / Bug Reports | https://github.com/jimweirich/builder/issues?state=open |
+
+## Contact
+
+| Description | Value |
+| :----: | :----: |
+| Author | Jim Weirich |
+| Email | jim.weirich at gmail.com |
+| Home Page | http://onestepback.org |
+| License | MIT Licence (http://www.opensource.org/licenses/mit-license.html) |
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..b082fbe
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,195 @@
+# Rakefile for rake -*- ruby -*-
+
+# Copyright 2004, 2005, 2006 by Jim Weirich (jim at weirichhouse.org).
+# All rights reserved.
+
+# Permission is granted for use, copying, modification, distribution,
+# and distribution of modified versions of this work as long as the
+# above copyright notice is included.
+
+require 'rake/clean'
+require 'rake/testtask'
+begin
+ require 'rubygems'
+ require 'rubygems/package_task'
+ require 'rdoc/task'
+rescue Exception
+ nil
+end
+
+require './lib/builder/version'
+
+# Determine the current version of the software
+
+CLOBBER.include('pkg', 'html')
+CLEAN.include('pkg/builder-*').include('pkg/blankslate-*').exclude('pkg/*.gem')
+
+PKG_VERSION = Builder::VERSION
+
+SRC_RB = FileList['lib/**/*.rb']
+
+# The default task is run if rake is given no explicit arguments.
+
+desc "Default Task"
+task :default => :test_all
+
+# Test Tasks ---------------------------------------------------------
+
+desc "Run all tests"
+task :test_all => [:test_units]
+task :ta => [:test_all]
+
+task :tu => [:test_units]
+
+Rake::TestTask.new("test_units") do |t|
+ t.test_files = FileList['test/test*.rb']
+ t.libs << "."
+ t.verbose = false
+end
+
+# Create a task to build the RDOC documentation tree.
+
+if defined?(RDoc)
+ rd = RDoc::Task.new("rdoc") { |rdoc|
+ rdoc.rdoc_dir = 'html'
+ rdoc.title = "Builder for Markup"
+ rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc'
+ rdoc.rdoc_files.include('lib/**/*.rb', '[A-Z]*', 'doc/**/*.rdoc').exclude("TAGS")
+ rdoc.template = 'doc/jamis.rb'
+ }
+else
+ rd = Struct.new(:rdoc_files).new([])
+end
+
+# ====================================================================
+# Create a task that will package the Rake software into distributable
+# gem files.
+
+PKG_FILES = FileList[
+ '[A-Z]*',
+ 'doc/**/*',
+ 'lib/**/*.rb',
+ 'test/**/*.rb',
+ 'rakelib/**/*'
+]
+PKG_FILES.exclude('test/test_cssbuilder.rb')
+PKG_FILES.exclude('lib/builder/css.rb')
+PKG_FILES.exclude('TAGS')
+
+BLANKSLATE_FILES = FileList[
+ 'lib/blankslate.rb',
+ 'test/test_blankslate.rb'
+]
+
+if ! defined?(Gem)
+ puts "Package Target requires RubyGEMs"
+else
+ spec = Gem::Specification.new do |s|
+
+ #### Basic information.
+
+ s.name = 'builder'
+ s.version = PKG_VERSION
+ s.summary = "Builders for MarkUp."
+ s.description = %{\
+Builder provides a number of builder objects that make creating structured data
+simple to do. Currently the following builder objects are supported:
+
+* XML Markup
+* XML Events
+}
+
+ s.files = PKG_FILES.to_a
+ s.require_path = 'lib'
+
+ s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ }
+
+ s.has_rdoc = true
+ s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
+ s.rdoc_options <<
+ '--title' << 'Builder -- Easy XML Building' <<
+ '--main' << 'README.rdoc' <<
+ '--line-numbers'
+
+ s.author = "Jim Weirich"
+ s.email = "jim.weirich at gmail.com"
+ s.homepage = "http://onestepback.org"
+ s.license = 'MIT'
+ end
+
+ blankslate_spec = Gem::Specification.new do |s|
+
+ #### Basic information.
+
+ s.name = 'blankslate'
+ s.version = PKG_VERSION
+ s.summary = "Blank Slate base class."
+ s.description = %{\
+BlankSlate provides a base class where almost all of the methods from Object and
+Kernel have been removed. This is useful when providing proxy object and other
+classes that make heavy use of method_missing.
+}
+
+ s.files = BLANKSLATE_FILES.to_a
+ s.require_path = 'lib'
+
+ s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ }
+
+ s.has_rdoc = true
+ s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
+ s.rdoc_options <<
+ '--title' << 'BlankSlate -- Base Class for building proxies.' <<
+ '--main' << 'README.rdoc' <<
+ '--line-numbers'
+
+ s.author = "Jim Weirich"
+ s.email = "jim.weirich at gmail.com"
+ s.homepage = "http://onestepback.org"
+ s.license = 'MIT'
+ end
+
+ namespace 'builder' do
+ Gem::PackageTask.new(spec) do |t|
+ t.need_tar = false
+ end
+ end
+
+ namespace 'blankslate' do
+ Gem::PackageTask.new(blankslate_spec) do |t|
+ t.need_tar = false
+ end
+ end
+
+ task :package => [:remove_tags, 'builder:package', 'blankslate:package']
+end
+
+task :remove_tags do
+ rm "TAGS" rescue nil
+end
+
+# RCov ---------------------------------------------------------------
+begin
+ require 'rcov/rcovtask'
+
+ Rcov::RcovTask.new do |t|
+ t.libs << "test"
+ t.rcov_opts = [
+ '-xRakefile', '--text-report'
+ ]
+ t.test_files = FileList[
+ 'test/test*.rb'
+ ]
+ t.output_dir = 'coverage'
+ t.verbose = true
+ end
+rescue LoadError
+ # No rcov available
+end
+
+desc "Install the jamis RDoc template"
+task :install_jamis_template do
+ require 'rbconfig'
+ dest_dir = File.join(Config::CONFIG['rubylibdir'], "rdoc/generators/template/html")
+ fail "Unabled to write to #{dest_dir}" unless File.writable?(dest_dir)
+ install "doc/jamis.rb", dest_dir, :verbose => true
+end
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
new file mode 100644
index 0000000..6f4d318
Binary files /dev/null and b/checksums.yaml.gz differ
diff --git a/doc/jamis.rb b/doc/jamis.rb
new file mode 100644
index 0000000..a00b583
--- /dev/null
+++ b/doc/jamis.rb
@@ -0,0 +1,591 @@
+module RDoc
+module Page
+
+FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif"
+
+STYLE = <<CSS
+a {
+ color: #00F;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #77F;
+ text-decoration: underline;
+}
+
+body, td, p {
+ font-family: %fonts%;
+ background: #FFF;
+ color: #000;
+ margin: 0px;
+ font-size: small;
+}
+
+#content {
+ margin: 2em;
+}
+
+#description p {
+ margin-bottom: 0.5em;
+}
+
+.sectiontitle {
+ margin-top: 1em;
+ margin-bottom: 1em;
+ padding: 0.5em;
+ padding-left: 2em;
+ background: #005;
+ color: #FFF;
+ font-weight: bold;
+ border: 1px dotted black;
+}
+
+.attr-rw {
+ padding-left: 1em;
+ padding-right: 1em;
+ text-align: center;
+ color: #055;
+}
+
+.attr-name {
+ font-weight: bold;
+}
+
+.attr-desc {
+}
+
+.attr-value {
+ font-family: monospace;
+}
+
+.file-title-prefix {
+ font-size: large;
+}
+
+.file-title {
+ font-size: large;
+ font-weight: bold;
+ background: #005;
+ color: #FFF;
+}
+
+.banner {
+ background: #005;
+ color: #FFF;
+ border: 1px solid black;
+ padding: 1em;
+}
+
+.banner td {
+ background: transparent;
+ color: #FFF;
+}
+
+h1 a, h2 a, .sectiontitle a, .banner a {
+ color: #FF0;
+}
+
+h1 a:hover, h2 a:hover, .sectiontitle a:hover, .banner a:hover {
+ color: #FF7;
+}
+
+.dyn-source {
+ display: none;
+ background: #FFE;
+ color: #000;
+ border: 1px dotted black;
+ margin: 0.5em 2em 0.5em 2em;
+ padding: 0.5em;
+}
+
+.dyn-source .cmt {
+ color: #00F;
+ font-style: italic;
+}
+
+.dyn-source .kw {
+ color: #070;
+ font-weight: bold;
+}
+
+.method {
+ margin-left: 1em;
+ margin-right: 1em;
+ margin-bottom: 1em;
+}
+
+.description pre {
+ padding: 0.5em;
+ border: 1px dotted black;
+ background: #FFE;
+}
+
+.method .title {
+ font-family: monospace;
+ font-size: large;
+ border-bottom: 1px dashed black;
+ margin-bottom: 0.3em;
+ padding-bottom: 0.1em;
+}
+
+.method .description, .method .sourcecode {
+ margin-left: 1em;
+}
+
+.description p, .sourcecode p {
+ margin-bottom: 0.5em;
+}
+
+.method .sourcecode p.source-link {
+ text-indent: 0em;
+ margin-top: 0.5em;
+}
+
+.method .aka {
+ margin-top: 0.3em;
+ margin-left: 1em;
+ font-style: italic;
+ text-indent: 2em;
+}
+
+h1 {
+ padding: 1em;
+ border: 1px solid black;
+ font-size: x-large;
+ font-weight: bold;
+ color: #FFF;
+ background: #007;
+}
+
+h2 {
+ padding: 0.5em 1em 0.5em 1em;
+ border: 1px solid black;
+ font-size: large;
+ font-weight: bold;
+ color: #FFF;
+ background: #009;
+}
+
+h3, h4, h5, h6 {
+ padding: 0.2em 1em 0.2em 1em;
+ border: 1px dashed black;
+ color: #000;
+ background: #AAF;
+}
+
+.sourcecode > pre {
+ padding: 0.5em;
+ border: 1px dotted black;
+ background: #FFE;
+}
+
+CSS
+
+XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+}
+
+HEADER = XHTML_PREAMBLE + <<ENDHEADER
+<html>
+ <head>
+ <title>%title%</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%" />
+ <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
+
+ <script language="JavaScript" type="text/javascript">
+ // <![CDATA[
+
+ function toggleSource( id )
+ {
+ var elem
+ var link
+
+ if( document.getElementById )
+ {
+ elem = document.getElementById( id )
+ link = document.getElementById( "l_" + id )
+ }
+ else if ( document.all )
+ {
+ elem = eval( "document.all." + id )
+ link = eval( "document.all.l_" + id )
+ }
+ else
+ return false;
+
+ if( elem.style.display == "block" )
+ {
+ elem.style.display = "none"
+ link.innerHTML = "show source"
+ }
+ else
+ {
+ elem.style.display = "block"
+ link.innerHTML = "hide source"
+ }
+ }
+
+ function openCode( url )
+ {
+ window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
+ }
+ // ]]>
+ </script>
+ </head>
+
+ <body>
+ENDHEADER
+
+FILE_PAGE = <<HTML
+<table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'>
+ <tr><td>
+ <table width="100%" border='0' cellpadding='0' cellspacing='0'><tr>
+ <td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br />%short_name%</td>
+ <td align="right">
+ <table border='0' cellspacing="0" cellpadding="2">
+ <tr>
+ <td>Path:</td>
+ <td>%full_path%
+IF:cvsurl
+ (<a href="%cvsurl%">CVS</a>)
+ENDIF:cvsurl
+ </td>
+ </tr>
+ <tr>
+ <td>Modified:</td>
+ <td>%dtm_modified%</td>
+ </tr>
+ </table>
+ </td></tr>
+ </table>
+ </td></tr>
+</table><br>
+HTML
+
+###################################################################
+
+CLASS_PAGE = <<HTML
+<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
+ <td class="file-title"><span class="file-title-prefix">%classmod%</span><br />%full_name%</td>
+ <td align="right">
+ <table cellspacing=0 cellpadding=2>
+ <tr valign="top">
+ <td>In:</td>
+ <td>
+START:infiles
+HREF:full_path_url:full_path:
+IF:cvsurl
+ (<a href="%cvsurl%">CVS</a>)
+ENDIF:cvsurl
+END:infiles
+ </td>
+ </tr>
+IF:parent
+ <tr>
+ <td>Parent:</td>
+ <td>
+IF:par_url
+ <a href="%par_url%">
+ENDIF:par_url
+%parent%
+IF:par_url
+ </a>
+ENDIF:par_url
+ </td>
+ </tr>
+ENDIF:parent
+ </table>
+ </td>
+ </tr>
+ </table>
+HTML
+
+###################################################################
+
+METHOD_LIST = <<HTML
+ <div id="content">
+IF:diagram
+ <table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center">
+ %diagram%
+ </td></tr></table>
+ENDIF:diagram
+
+IF:description
+ <div class="description">%description%</div>
+ENDIF:description
+
+IF:requires
+ <div class="sectiontitle">Required Files</div>
+ <ul>
+START:requires
+ <li>HREF:aref:name:</li>
+END:requires
+ </ul>
+ENDIF:requires
+
+IF:toc
+ <div class="sectiontitle">Contents</div>
+ <ul>
+START:toc
+ <li><a href="#%href%">%secname%</a></li>
+END:toc
+ </ul>
+ENDIF:toc
+
+IF:methods
+ <div class="sectiontitle">Methods</div>
+ <ul>
+START:methods
+ <li>HREF:aref:name:</li>
+END:methods
+ </ul>
+ENDIF:methods
+
+IF:includes
+<div class="sectiontitle">Included Modules</div>
+<ul>
+START:includes
+ <li>HREF:aref:name:</li>
+END:includes
+</ul>
+ENDIF:includes
+
+START:sections
+IF:sectitle
+<div class="sectiontitle"><a nem="%secsequence%">%sectitle%</a></div>
+IF:seccomment
+<div class="description">
+%seccomment%
+</div>
+ENDIF:seccomment
+ENDIF:sectitle
+
+IF:classlist
+ <div class="sectiontitle">Classes and Modules</div>
+ %classlist%
+ENDIF:classlist
+
+IF:constants
+ <div class="sectiontitle">Constants</div>
+ <table border='0' cellpadding='5'>
+START:constants
+ <tr valign='top'>
+ <td class="attr-name">%name%</td>
+ <td>=</td>
+ <td class="attr-value">%value%</td>
+ </tr>
+IF:desc
+ <tr valign='top'>
+ <td> </td>
+ <td colspan="2" class="attr-desc">%desc%</td>
+ </tr>
+ENDIF:desc
+END:constants
+ </table>
+ENDIF:constants
+
+IF:attributes
+ <div class="sectiontitle">Attributes</div>
+ <table border='0' cellpadding='5'>
+START:attributes
+ <tr valign='top'>
+ <td class='attr-rw'>
+IF:rw
+[%rw%]
+ENDIF:rw
+ </td>
+ <td class='attr-name'>%name%</td>
+ <td class='attr-desc'>%a_desc%</td>
+ </tr>
+END:attributes
+ </table>
+ENDIF:attributes
+
+IF:method_list
+START:method_list
+IF:methods
+<div class="sectiontitle">%type% %category% methods</div>
+START:methods
+<div class="method">
+ <div class="title">
+IF:callseq
+ <a name="%aref%"></a><b>%callseq%</b>
+ENDIF:callseq
+IFNOT:callseq
+ <a name="%aref%"></a><b>%name%</b>%params%
+ENDIF:callseq
+IF:codeurl
+[ <a href="javascript:openCode('%codeurl%')">source</a> ]
+ENDIF:codeurl
+ </div>
+IF:m_desc
+ <div class="description">
+ %m_desc%
+ </div>
+ENDIF:m_desc
+IF:aka
+<div class="aka">
+ This method is also aliased as
+START:aka
+ <a href="%aref%">%name%</a>
+END:aka
+</div>
+ENDIF:aka
+IF:sourcecode
+<div class="sourcecode">
+ <p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p>
+ <div id="%aref%_source" class="dyn-source">
+<pre>
+%sourcecode%
+</pre>
+ </div>
+</div>
+ENDIF:sourcecode
+</div>
+END:methods
+ENDIF:methods
+END:method_list
+ENDIF:method_list
+END:sections
+</div>
+HTML
+
+FOOTER = <<ENDFOOTER
+ </body>
+</html>
+ENDFOOTER
+
+BODY = HEADER + <<ENDBODY
+ !INCLUDE! <!-- banner header -->
+
+ <div id="bodyContent">
+ #{METHOD_LIST}
+ </div>
+
+ #{FOOTER}
+ENDBODY
+
+########################## Source code ##########################
+
+SRC_PAGE = XHTML_PREAMBLE + <<HTML
+<html>
+<head><title>%title%</title>
+<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
+<style>
+.ruby-comment { color: green; font-style: italic }
+.ruby-constant { color: #4433aa; font-weight: bold; }
+.ruby-identifier { color: #222222; }
+.ruby-ivar { color: #2233dd; }
+.ruby-keyword { color: #3333FF; font-weight: bold }
+.ruby-node { color: #777777; }
+.ruby-operator { color: #111111; }
+.ruby-regexp { color: #662222; }
+.ruby-value { color: #662222; font-style: italic }
+ .kw { color: #3333FF; font-weight: bold }
+ .cmt { color: green; font-style: italic }
+ .str { color: #662222; font-style: italic }
+ .re { color: #662222; }
+</style>
+</head>
+<body bgcolor="white">
+<pre>%code%</pre>
+</body>
+</html>
+HTML
+
+########################## Index ################################
+
+FR_INDEX_BODY = <<HTML
+!INCLUDE!
+HTML
+
+FILE_INDEX = XHTML_PREAMBLE + <<HTML
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
+<style>
+<!--
+ body {
+ background-color: #EEE;
+ font-family: #{FONTS};
+ color: #000;
+ margin: 0px;
+ }
+ .banner {
+ background: #005;
+ color: #FFF;
+ padding: 0.2em;
+ font-size: small;
+ font-weight: bold;
+ text-align: center;
+ }
+ .entries {
+ margin: 0.25em 1em 0 1em;
+ font-size: x-small;
+ }
+ a {
+ color: #00F;
+ text-decoration: none;
+ white-space: nowrap;
+ }
+ a:hover {
+ color: #77F;
+ text-decoration: underline;
+ }
+-->
+</style>
+<base target="docwin">
+</head>
+<body>
+<div class="banner">%list_title%</div>
+<div class="entries">
+START:entries
+<a href="%href%">%name%</a><br>
+END:entries
+</div>
+</body></html>
+HTML
+
+CLASS_INDEX = FILE_INDEX
+METHOD_INDEX = FILE_INDEX
+
+INDEX = XHTML_PREAMBLE + <<HTML
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>%title%</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
+</head>
+
+<frameset cols="20%,*">
+ <frameset rows="15%,35%,50%">
+ <frame src="fr_file_index.html" title="Files" name="Files" />
+ <frame src="fr_class_index.html" name="Classes" />
+ <frame src="fr_method_index.html" name="Methods" />
+ </frameset>
+IF:inline_source
+ <frame src="%initial_page%" name="docwin">
+ENDIF:inline_source
+IFNOT:inline_source
+ <frameset rows="80%,20%">
+ <frame src="%initial_page%" name="docwin">
+ <frame src="blank.html" name="source">
+ </frameset>
+ENDIF:inline_source
+ <noframes>
+ <body bgcolor="white">
+ Click <a href="html/index.html">here</a> for a non-frames
+ version of this page.
+ </body>
+ </noframes>
+</frameset>
+
+</html>
+HTML
+
+end
+end
+
+
diff --git a/doc/releases/builder-1.2.4.rdoc b/doc/releases/builder-1.2.4.rdoc
new file mode 100644
index 0000000..a1cf54f
--- /dev/null
+++ b/doc/releases/builder-1.2.4.rdoc
@@ -0,0 +1,31 @@
+= Builder 1.2.4 Released.
+
+Added a "CDATA" method to the XML Markup builder (from Josh Knowles).
+
+== What is Builder?
+
+Builder::XmlMarkup allows easy programmatic creation of XML markup.
+For example:
+
+ builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
+ builder.person { |b| b.name("Jim"); b.phone("555-1234") }
+ puts builder.target!
+
+will generate:
+
+ <person>
+ <name>Jim</name>
+ <phone>555-1234</phone>
+ </person>
+
+== Availability
+
+The easiest way to get and install builder is via RubyGems ...
+
+ gem install builder (you may need root/admin privileges)
+
+== Thanks
+
+* Josh Knowles for the cdata! patch.
+
+-- Jim Weirich
diff --git a/doc/releases/builder-2.0.0.rdoc b/doc/releases/builder-2.0.0.rdoc
new file mode 100644
index 0000000..ed9e086
--- /dev/null
+++ b/doc/releases/builder-2.0.0.rdoc
@@ -0,0 +1,46 @@
+= Builder 2.0.0 Released.
+
+== Changes in 2.0.0
+
+* UTF-8 characters in data are now correctly translated to their XML
+ equivalents. (Thanks to Sam Ruby)
+
+* Attribute values are now escaped by default. See the README
+ file for details.
+
+<b>NOTE:</b> The escaping attribute values by default is different
+than in previous releases of Builder. This makes version 2.0.0
+somewhat incompatible with the 1.x series of Builder. If you use "&",
+"<", or ">" in attributes values, you may have to change your
+code. (Essentially you remove the manual escaping. The new way is
+easier, believe me).
+
+== What is Builder?
+
+Builder::XmlMarkup is a library that allows easy programmatic creation
+of XML markup. For example:
+
+ builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
+ builder.person { |b| b.name("Jim"); b.phone("555-1234") }
+
+will generate:
+
+ <person>
+ <name>Jim</name>
+ <phone>555-1234</phone>
+ </person>
+
+== Availability
+
+The easiest way to get and install builder is via RubyGems ...
+
+ gem install builder (you may need root/admin privileges)
+
+== Thanks
+
+* Sam Ruby for the XChar module and the related UTF-8 translation
+ tools.
+* Also to Sam Ruby for gently persuading me to start quoting attribute
+ values.
+
+-- Jim Weirich
diff --git a/doc/releases/builder-2.1.1.rdoc b/doc/releases/builder-2.1.1.rdoc
new file mode 100755
index 0000000..dbbf121
--- /dev/null
+++ b/doc/releases/builder-2.1.1.rdoc
@@ -0,0 +1,58 @@
+= Builder 2.1.1 Released.
+
+Release 2.1.1 of Builder is mainly a bug fix release.
+
+== Changes in 2.1.1
+
+* Added <tt>reveal</tt> capability to BlankSlate.
+
+* Fixed a bug in BlankSlate where including a module into Object could
+ cause methods to leak into BlankSlate.
+
+* Fixed typo in XmlMarkup class docs (from Martin Fowler).
+
+* Fixed test on private methods to differentiate between targetted and
+ untargetted private methods.
+
+* Removed legacy capture of @self in XmlBase (@self was used back when
+ we used instance eval).
+
+* Added additional tests for global functions (both direct and
+ included).
+
+* Several misc internal cleanups, including rearranging the source
+ code tree.
+
+<b>NOTE:</b> The escaping attribute values by default is different
+than in previous releases of Builder. This makes version 2.0.x
+somewhat incompatible with the 1.x series of Builder. If you use "&",
+"<", or ">" in attributes values, you may have to change your
+code. (Essentially you remove the manual escaping. The new way is
+easier, believe me).
+
+== What is Builder?
+
+Builder::XmlMarkup is a library that allows easy programmatic creation
+of XML markup. For example:
+
+ builder = Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2)
+ builder.person { |b| b.name("Jim"); b.phone("555-1234") }
+
+will generate:
+
+ <person>
+ <name>Jim</name>
+ <phone>555-1234</phone>
+ </person>
+
+== Availability
+
+The easiest way to get and install builder is via RubyGems ...
+
+ gem install builder (you may need root/admin privileges)
+
+== Thanks
+
+* Martin Fowler for spotting some typos in the documentation.
+
+-- Jim Weirich
diff --git a/lib/builder/version.rb b/lib/builder/version.rb
index d4ddf30..cbe7bc4 100644
--- a/lib/builder/version.rb
+++ b/lib/builder/version.rb
@@ -2,7 +2,7 @@ module Builder
VERSION_NUMBERS = [
VERSION_MAJOR = 3,
VERSION_MINOR = 2,
- VERSION_BUILD = 0,
+ VERSION_BUILD = 2,
]
VERSION = VERSION_NUMBERS.join(".")
end
diff --git a/lib/builder/xmlbase.rb b/lib/builder/xmlbase.rb
index 5ea1560..8f03a82 100644
--- a/lib/builder/xmlbase.rb
+++ b/lib/builder/xmlbase.rb
@@ -17,14 +17,14 @@ module Builder
# Create an XML markup builder.
#
- # out:: Object receiving the markup. +out+ must respond to
- # <tt><<</tt>.
- # indent:: Number of spaces used for indentation (0 implies no
- # indentation and no line breaks).
- # initial:: Level of initial indentation.
- # encoding:: When <tt>encoding</tt> and $KCODE are set to 'utf-8'
- # characters aren't converted to character entities in
- # the output stream.
+ # out :: Object receiving the markup. +out+ must respond to
+ # <tt><<</tt>.
+ # indent :: Number of spaces used for indentation (0 implies no
+ # indentation and no line breaks).
+ # initial :: Level of initial indentation.
+ # encoding :: When <tt>encoding</tt> and $KCODE are set to 'utf-8'
+ # characters aren't converted to character entities in
+ # the output stream.
def initialize(indent=0, initial=0, encoding='utf-8')
@indent = indent
@level = initial
diff --git a/metadata.yml b/metadata.yml
index 37089db..99e401e 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,38 +1,41 @@
---- !ruby/object:Gem::Specification
+--- !ruby/object:Gem::Specification
name: builder
-version: !ruby/object:Gem::Version
- hash: 15
- prerelease:
- segments:
- - 3
- - 2
- - 0
- version: 3.2.0
+version: !ruby/object:Gem::Version
+ version: 3.2.2
platform: ruby
-authors:
+authors:
- Jim Weirich
autorequire:
bindir: bin
cert_chain: []
-
-date: 2013-02-23 00:00:00 Z
+date: 2013-06-01 00:00:00.000000000 Z
dependencies: []
-
description: |
Builder provides a number of builder objects that make creating structured data
simple to do. Currently the following builder objects are supported:
-
+
* XML Markup
* XML Events
-
email: jim.weirich at gmail.com
executables: []
-
extensions: []
-
-extra_rdoc_files: []
-
-files:
+extra_rdoc_files:
+- CHANGES
+- MIT-LICENSE
+- README.md
+- Rakefile
+- doc/releases/builder-1.2.4.rdoc
+- doc/releases/builder-2.0.0.rdoc
+- doc/releases/builder-2.1.1.rdoc
+files:
+- CHANGES
+- MIT-LICENSE
+- README.md
+- Rakefile
+- doc/jamis.rb
+- doc/releases/builder-1.2.4.rdoc
+- doc/releases/builder-2.0.0.rdoc
+- doc/releases/builder-2.1.1.rdoc
- lib/blankslate.rb
- lib/builder.rb
- lib/builder/blankslate.rb
@@ -49,44 +52,38 @@ files:
- test/test_method_caching.rb
- test/test_namecollision.rb
- test/test_xchar.rb
+- rakelib/publish.rake
+- rakelib/tags.rake
homepage: http://onestepback.org
-licenses:
+licenses:
- MIT
+metadata: {}
post_install_message:
-rdoc_options:
+rdoc_options:
- --title
- Builder -- Easy XML Building
- --main
- README.rdoc
- --line-numbers
-require_paths:
+require_paths:
- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
-required_rubygems_version: !ruby/object:Gem::Requirement
- none: false
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- hash: 3
- segments:
- - 0
- version: "0"
+required_ruby_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - '>='
+ - !ruby/object:Gem::Version
+ version: '0'
+required_rubygems_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - '>='
+ - !ruby/object:Gem::Version
+ version: '0'
requirements: []
-
rubyforge_project:
-rubygems_version: 1.8.24
+rubygems_version: 2.0.3
signing_key:
-specification_version: 3
+specification_version: 4
summary: Builders for MarkUp.
-test_files:
+test_files:
- test/test_blankslate.rb
- test/test_eventbuilder.rb
- test/test_markupbuilder.rb
diff --git a/rakelib/publish.rake b/rakelib/publish.rake
new file mode 100644
index 0000000..9849e0d
--- /dev/null
+++ b/rakelib/publish.rake
@@ -0,0 +1,17 @@
+# Optional publish task for Rake
+
+require 'rake/contrib/sshpublisher'
+require 'rake/contrib/rubyforgepublisher'
+
+publisher = Rake::CompositePublisher.new
+publisher.add Rake::RubyForgePublisher.new('builder', 'jimweirich')
+publisher.add Rake::SshFilePublisher.new(
+ 'linode',
+ 'htdocs/software/builder',
+ '.',
+ 'builder.blurb')
+
+desc "Publish the Documentation to RubyForge."
+task :publish => [:rdoc] do
+ publisher.upload
+end
diff --git a/rakelib/tags.rake b/rakelib/tags.rake
new file mode 100644
index 0000000..93b47df
--- /dev/null
+++ b/rakelib/tags.rake
@@ -0,0 +1,62 @@
+#!/usr/bin/env ruby
+
+module Tags
+ extend Rake::DSL if defined?(Rake::DSL)
+
+ PROG = ENV['TAGS'] || 'ctags'
+
+ RAKEFILES = FileList['Rakefile', '**/*.rake']
+
+ FILES = FileList['**/*.rb', '**/*.js'] + RAKEFILES
+ FILES.exclude('pkg', 'dist')
+
+ PROJECT_DIR = ['.']
+
+ RVM_GEMDIR = File.join(`rvm gemdir`.strip, "gems")
+ SYSTEM_DIRS = File.exists?(RVM_GEMDIR) ? RVM_GEMDIR : []
+
+ module_function
+
+ # Convert key_word to --key-word.
+ def keyword(key)
+ k = key.to_s.gsub(/_/, '-')
+ (k.length == 1) ? "-#{k}" : "--#{k}"
+ end
+
+ # Run ctags command
+ def run(*args)
+ opts = {
+ :e => true,
+ :totals => true,
+ :recurse => true,
+ }
+ opts = opts.merge(args.pop) if args.last.is_a?(Hash)
+ command_args = opts.map { |k, v|
+ (v == true) ? keyword(k) : "#{keyword(k)}=#{v}"
+ }.join(" ")
+ sh %{#{Tags::PROG} #{command_args} #{args.join(' ')}}
+ end
+end
+
+namespace "tags" do
+ desc "Generate an Emacs TAGS file"
+ task :emacs, [:all] => Tags::FILES do |t, args|
+ puts "Making Emacs TAGS file"
+ verbose(true) do
+ Tags.run(Tags::PROJECT_DIR)
+ Tags.run(Tags::RAKEFILES,
+ :language_force => "ruby",
+ :append => true)
+ if args.all
+ Tags::SYSTEM_DIRS.each do |dir|
+ Tags.run(dir,
+ :language_force => "ruby",
+ :append => true)
+ end
+ end
+ end
+ end
+end
+
+desc "Generate the TAGS file"
+task :tags, [:all] => ["tags:emacs"]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-builder.git
More information about the Pkg-ruby-extras-commits
mailing list