]> git.wincent.com - wikitext.git/log
wikitext.git
10 years agoSimplify Wikitext_parser_sanitize_link_target
Wincent Colaiuta [Thu, 29 Nov 2012 07:50:56 +0000 (23:50 -0800)] 
Simplify Wikitext_parser_sanitize_link_target

Commit 778839e made the wiki_append_sanitized_link_target function more
flexible by making it accept a str_t instead of a parser_t. This in turn
means that we can simplify the Wikitext_parser_sanitize_link_target
function; it can deal with a str_t directly rather than working with a
throwaway parser_t.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
10 years agoTeach wiki_append_sanitized_link_target to take a str_t
Wincent Colaiuta [Thu, 29 Nov 2012 07:46:30 +0000 (23:46 -0800)] 
Teach wiki_append_sanitized_link_target to take a str_t

Rather than passing in a parser_t and assuming the text we want to
operate on is the one in the struct, pass in the link target str_t
explicitly. This added flexibility will make the
wiki_append_sanitized_link_target function suitable for wider use, which
I am presently going to do in order to fix a bug.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
10 years agoUpdate to RSpec 2.12.0
Wincent Colaiuta [Thu, 29 Nov 2012 06:56:25 +0000 (22:56 -0800)] 
Update to RSpec 2.12.0

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoUpdate some copyright year ranges
Wincent Colaiuta [Sun, 4 Mar 2012 00:50:52 +0000 (16:50 -0800)] 
Update some copyright year ranges

Just the relevant project-wide files, the README and the LICENSE.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoBump version number post-release
Wincent Colaiuta [Sun, 4 Mar 2012 00:47:20 +0000 (16:47 -0800)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoBump version number for 3.0.1 release 3.0.1
Wincent Colaiuta [Sun, 4 Mar 2012 00:43:46 +0000 (16:43 -0800)] 
Bump version number for 3.0.1 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoAllow email addresses inside external link text
Wincent Colaiuta [Sun, 4 Mar 2012 00:25:21 +0000 (16:25 -0800)] 
Allow email addresses inside external link text

Previously we allowed:

  [mailto:user@example.com text]

but dealt poorly with:

  [mailto:user@example.com user@example.com]

While that might seem like a contrived example (because you could
dispense with the explicit external link entirely and instead rely on
the standard auto-linkification) it also meant that we couldn't handle
perfectly reasonable and useful input like:

  [mailto:user@example.com contact me at user@example.com for info]

Note the problem wasn't just limited to URIs with the "mailto:" schema;
we also choked on stuff like:

  [http://google.com/?q=user@example.com Google for user@example.com]

Reported here:

  https://wincent.com/issues/1955

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoBump version number post-release
Wincent Colaiuta [Fri, 11 Nov 2011 06:24:45 +0000 (22:24 -0800)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoPrepare for 3.0 release 3.0
Wincent Colaiuta [Thu, 10 Nov 2011 08:57:23 +0000 (00:57 -0800)] 
Prepare for 3.0 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
11 years agoFix for lines beginning with slashes in PRE blocks
Wincent Colaiuta [Thu, 10 Nov 2011 08:33:25 +0000 (00:33 -0800)] 
Fix for lines beginning with slashes in PRE blocks

I've fixed quite a few of these bugs over the years. I'd aimed to shake
them all out in commit 27681bab (back in 2008), but looks like I missed
one.

Fixes:
  https://wincent.com/issues/1891

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate docs for 3.0b release 3.0b
Wincent Colaiuta [Sat, 28 May 2011 07:36:44 +0000 (00:36 -0700)] 
Update docs for 3.0b release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRakefile: execute yardoc in bundle context
Wincent Colaiuta [Sat, 28 May 2011 07:26:37 +0000 (00:26 -0700)] 
Rakefile: execute yardoc in bundle context

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number for 3.0b release
Wincent Colaiuta [Sat, 28 May 2011 07:24:20 +0000 (00:24 -0700)] 
Bump version number for 3.0b release

Bumpig the major version number here because this is a
compatibility-breaking release (supporting only Rails 3.1.0 and above).
As Rails 3.1.0 isn't finalized yet, marking this one as a beta, as other
tweaks may be required by the time Rails 3.1.0 goes final.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoModernize version spec
Wincent Colaiuta [Sat, 28 May 2011 07:20:26 +0000 (00:20 -0700)] 
Modernize version spec

By "modernize" here I mean avoid an unnecessary "should"
for conciseness.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoWhitespace cleanup
Wincent Colaiuta [Sat, 28 May 2011 07:14:50 +0000 (00:14 -0700)] 
Whitespace cleanup

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRename spec/trash -> spec/.trash
Wincent Colaiuta [Sat, 28 May 2011 07:12:29 +0000 (00:12 -0700)] 
Rename spec/trash -> spec/.trash

This has a number of benefits:

  - things which search (like Command-T and ack) won't waste time
    looking at the enormous quantity of stuff that accumulates in the
    trash dir
  - RSpec won't try to run stuff buried deep down inside the trash dir,
    almost certainly breaking

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRakefile: run spec task in bundle context
Wincent Colaiuta [Sat, 28 May 2011 07:08:00 +0000 (00:08 -0700)] 
Rakefile: run spec task in bundle context

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBundle update RSpec (2.2.0 -> 2.6.0)
Wincent Colaiuta [Sat, 28 May 2011 06:15:51 +0000 (23:15 -0700)] 
Bundle update RSpec (2.2.0 -> 2.6.0)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoDrop support for Rails 3.0.x
Wincent Colaiuta [Sat, 28 May 2011 06:07:12 +0000 (23:07 -0700)] 
Drop support for Rails 3.0.x

In the interests of moving forward, older versions of Rails will
continue to be supported with the last Wikitext release (2.1.1, 2.1.x),
but the current version will only support Rails 3.1.0 and above.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAvoid another Rails 3.1 deprecation warning
Wincent Colaiuta [Sat, 28 May 2011 05:48:26 +0000 (22:48 -0700)] 
Avoid another Rails 3.1 deprecation warning

Specifically:

  DEPRECATION WARNING: Including Compilable in your template handler is
  deprecated. Since Rails 3, all the API your template handler needs to
  implement is to respond to #call.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAvoid a Rails 3.1 deprecation warning
Wincent Colaiuta [Sat, 28 May 2011 05:45:03 +0000 (22:45 -0700)] 
Avoid a Rails 3.1 deprecation warning

Specifically:

  DEPRECATION WARNING: Inheriting from ActionView::Template::Handler is
  deprecated. Since Rails 3, all the API your template handler needs to
  implement is to respond to #call.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRemove special case code for Rails 2
Wincent Colaiuta [Sat, 28 May 2011 05:44:34 +0000 (22:44 -0700)] 
Remove special case code for Rails 2

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRemove rails/init.rb
Wincent Colaiuta [Sat, 28 May 2011 05:37:43 +0000 (22:37 -0700)] 
Remove rails/init.rb

This used to be evaluated automatically under Rails 2, but this is no
longer the case with Rails 3.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoManage Arel version as well when setting up Rails test apps
Wincent Colaiuta [Sun, 15 May 2011 23:36:40 +0000 (16:36 -0700)] 
Manage Arel version as well when setting up Rails test apps

This gets the spec suite passing in a hopefully robust and independent,
"bundlerized" way, for Rails version 3.0.1 through 3.0.7. It even works
on the current "Edge" Rails.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoMore attempts at getting Bundlerized test Rails app working
Wincent Colaiuta [Sun, 15 May 2011 19:53:02 +0000 (12:53 -0700)] 
More attempts at getting Bundlerized test Rails app working

Trying with the latest Bundler (1.0.13) and RubyGems (1.8.2) I see the
test environment also winds up with GEM_PATH and GEM_HOME set, so be a
little more careful about how we clean the environment (note that before
we were going too far, cleaning the entire environment). We now clean
any environment variables starting with GEM_ or BUNDLE_.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate Bundle to get autotest working
Wincent Colaiuta [Sun, 15 May 2011 19:36:42 +0000 (12:36 -0700)] 
Update Bundle to get autotest working

Note that we must also add a .rspec file to get autodiscovery working.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd ZenTest as a development dependency so we can run autotest
Wincent Colaiuta [Sun, 15 May 2011 19:34:23 +0000 (12:34 -0700)] 
Add ZenTest as a development dependency so we can run autotest

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate Bundle with new Bundler (1.0.13)
Wincent Colaiuta [Sun, 15 May 2011 19:25:19 +0000 (12:25 -0700)] 
Update Bundle with new Bundler (1.0.13)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRemove has_rdoc from gemspec, as RubyGems 1.8 is complaining about it
Wincent Colaiuta [Sun, 15 May 2011 19:21:28 +0000 (12:21 -0700)] 
Remove has_rdoc from gemspec, as RubyGems 1.8 is complaining about it

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoFuture-proof version-number detection
Wincent Colaiuta [Sun, 15 May 2011 09:58:33 +0000 (02:58 -0700)] 
Future-proof version-number detection

With this we'll be good to go until Rails 10...

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRemove some dead code
Wincent Colaiuta [Sun, 15 May 2011 09:41:17 +0000 (02:41 -0700)] 
Remove some dead code

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBundlerize test Rails apps
Wincent Colaiuta [Sun, 15 May 2011 09:41:05 +0000 (02:41 -0700)] 
Bundlerize test Rails apps

This gets all versions 3.0.1 through 3.0.7 passing, although we still have
problems with "Edge" Rails.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoSet Rails app version aggressively
Wincent Colaiuta [Sun, 15 May 2011 09:40:23 +0000 (02:40 -0700)] 
Set Rails app version aggressively

It's the only way to be sure.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBe more verbose about raised exception if Rails spec set-up fails
Wincent Colaiuta [Sun, 15 May 2011 09:39:57 +0000 (02:39 -0700)] 
Be more verbose about raised exception if Rails spec set-up fails

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUse Wopen3.system method for convenience
Wincent Colaiuta [Sun, 15 May 2011 08:28:10 +0000 (01:28 -0700)] 
Use Wopen3.system method for convenience

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoDon't test against Rails 2 versions
Wincent Colaiuta [Sun, 15 May 2011 04:15:22 +0000 (21:15 -0700)] 
Don't test against Rails 2 versions

Testing against so many versions of Rails is proving to be a
maintenance nightmare, so we're going to change tack: I'll continue to
support the current 2.x series of the Wikitext gem, and it will work
perfectly with Rails 2.x.

I'll also be supporting a new 3.x series of the gem, which will support
only Rails 3.x. It is relatively easy to support multiple versions of
the gem, each tailored for a particular version of Rails, compared with
trying to get a single version fo the gem to support all versions (see
the hoops that Haml jumps through to do this).

Additionally, testing against so many versions is complicated even more
when Bundler is added to the equation. From here on I'll be
concentrating on making the Rails specs Bundler-aware, but evidently
only in the 3.x branch, and only against Rails 3.x.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate version numbers for Rails specs
Wincent Colaiuta [Sun, 15 May 2011 04:08:45 +0000 (21:08 -0700)] 
Update version numbers for Rails specs

Reformat for readability, add a couple of missing versions to the list,
and remove versions which we no longer test against.

We only test released versions, and it appears that some versions have
(eg. 2.3.2.1, 2.3.3.1) have been pulled from the gem servers (or at
least they no longer show up in the output of "gem list --remote --all
rails").

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoSilence warnings about already defined constant
Wincent Colaiuta [Sun, 15 May 2011 03:59:19 +0000 (20:59 -0700)] 
Silence warnings about already defined constant

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoFix typo in code comment
Wincent Colaiuta [Fri, 3 Dec 2010 16:09:02 +0000 (17:09 +0100)] 
Fix typo in code comment

See:

  https://wincent.com/issues/1754

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUpdate to RSpec 2.2 for faster spec runs
Wincent Colaiuta [Wed, 1 Dec 2010 14:31:02 +0000 (15:31 +0100)] 
Update to RSpec 2.2 for faster spec runs

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number post-release
Wincent Colaiuta [Sat, 6 Nov 2010 00:15:42 +0000 (01:15 +0100)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number for 2.1.1 release 2.1.1
Wincent Colaiuta [Sat, 6 Nov 2010 00:09:47 +0000 (01:09 +0100)] 
Bump version number for 2.1.1 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoClear RUBYOPT in spec environment to keep Bundler out
Wincent Colaiuta [Sat, 6 Nov 2010 00:08:39 +0000 (01:08 +0100)] 
Clear RUBYOPT in spec environment to keep Bundler out

Bundler injects itself into subprocesses, which wreaks havoc with our
Rails tests.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoFix another token-dropping bug
Wincent Colaiuta [Sat, 6 Nov 2010 00:07:05 +0000 (01:07 +0100)] 
Fix another token-dropping bug

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd another example for token-swallowing bug
Wincent Colaiuta [Fri, 5 Nov 2010 23:56:07 +0000 (00:56 +0100)] 
Add another example for token-swallowing bug

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoDon't drop unexpected token on the floor after failed external link
Wincent Colaiuta [Fri, 5 Nov 2010 23:51:12 +0000 (00:51 +0100)] 
Don't drop unexpected token on the floor after failed external link

This specifically arises after an EXT_LINK_START + PATH sequence. At
this point we expect a SPACE token, but if we don't get it, we were just
dropping it on the floor, which is bad.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRemove BASEDIR constant from spec_helper
Wincent Colaiuta [Sun, 17 Oct 2010 17:47:53 +0000 (19:47 +0200)] 
Remove BASEDIR constant from spec_helper

We can rely on Ruby itself to guard against double-evaluating the
spec_helper file seeing as we always require it as "spec_helper" and
rely on the load path being set up in order to find it.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoRemove explicit rubygems require from spec_helper
Wincent Colaiuta [Sun, 17 Oct 2010 17:46:38 +0000 (19:46 +0200)] 
Remove explicit rubygems require from spec_helper

As we should always be run via Bundler (specifically, bin/rspec) there
is no need to ever require rubygems explicitly as it will already have
been loaded and the load path set up by Bundler.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoDon't use absolute path when requiring spec_helper.rb
Wincent Colaiuta [Sun, 17 Oct 2010 17:42:59 +0000 (19:42 +0200)] 
Don't use absolute path when requiring spec_helper.rb

RSpec 2.0 adds the spec directory to the load path, so it is no longer
necessary to specify an absolute path in order to ensure that the helper
only gets evaluated once.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoUse Bundler to manage development environment
Wincent Colaiuta [Sun, 17 Oct 2010 15:41:32 +0000 (17:41 +0200)] 
Use Bundler to manage development environment

Note that this actually breaks many (all?) of the specs which run
in the scratch Rails environments set up to test the extension against
different versions of Rails.

This is because Bundler tries to apply the same restrictions to those
sub-environments as apply to the parent environment, so more changes
will be needed to adapt those Rails tests to work in a Bundler-dominated
world.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number post-release
Wincent Colaiuta [Sun, 17 Oct 2010 15:09:03 +0000 (17:09 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoBump version number for 2.1 release 2.1
Wincent Colaiuta [Sun, 17 Oct 2010 15:07:35 +0000 (17:07 +0200)] 
Bump version number for 2.1 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd docs and specs for external_link_rel attribute
Wincent Colaiuta [Sun, 17 Oct 2010 15:04:07 +0000 (17:04 +0200)] 
Add docs and specs for external_link_rel attribute

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd ability to override external_link_rel at parse time
Wincent Colaiuta [Sun, 17 Oct 2010 14:42:10 +0000 (16:42 +0200)] 
Add ability to override external_link_rel at parse time

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd ability to override external_link_rel via an accessor
Wincent Colaiuta [Sun, 17 Oct 2010 14:41:31 +0000 (16:41 +0200)] 
Add ability to override external_link_rel via an accessor

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoSwitch to RSpec 2.0
Wincent Colaiuta [Sun, 17 Oct 2010 13:23:08 +0000 (15:23 +0200)] 
Switch to RSpec 2.0

Signed-off-by: Wincent Colaiuta <win@wincent.com>
12 years agoAdd ability to add rel="nofollow" to external links
Mike Stangel [Sun, 17 Oct 2010 12:36:48 +0000 (14:36 +0200)] 
Add ability to add rel="nofollow" to external links

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRemove references to old (GPL) license
Wincent Colaiuta [Thu, 29 Jul 2010 07:25:48 +0000 (09:25 +0200)] 
Remove references to old (GPL) license

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoMake Yardoc upload site configurable
Wincent Colaiuta [Mon, 26 Jul 2010 17:26:01 +0000 (19:26 +0200)] 
Make Yardoc upload site configurable

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodocs: add list examples
Wincent Colaiuta [Sun, 11 Jul 2010 09:34:18 +0000 (11:34 +0200)] 
docs: add list examples

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoFormat all "pre" blocks for YARD
Wincent Colaiuta [Wed, 23 Jun 2010 16:12:20 +0000 (18:12 +0200)] 
Format all "pre" blocks for YARD

This means marking all non-Ruby "pre" blocks using a "!!!wikitext" or
"!!!html" marker.

At the moment there is no syntax highlighting for wikitext or HTML, so
those tags are effectively equivalent to "!!!plain", but the important
thing is that we stop YARD from inappropriately applying Ruby syntax
highlighting rules to non-ruby code, and if syntax highlighting for the
other languages is ever added, we will be ready for it.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump YARD requirement to 0.5.8
Wincent Colaiuta [Wed, 23 Jun 2010 15:34:47 +0000 (17:34 +0200)] 
Bump YARD requirement to 0.5.8

From the official announcement:

  Yesterday I released YARD 0.5.7. Unfortunately a few important bug fixes
  were omitted from the release because they were lost in the 0.6-master
  branch and I did not merge them back. That was a total screwup on my
  part. Hopefully this doesn't happen again (some extra specs were added
  to make sure this issue stays fixed).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRequire at least 0.5.7 of YARD
Wincent Colaiuta [Tue, 22 Jun 2010 06:37:34 +0000 (08:37 +0200)] 
Require at least 0.5.7 of YARD

0.5.7 is needed as it includes a fix for "!!!plain" syntax. See:

  http://groups.google.com/group/yardoc/browse_thread/thread/85c49739f6df5a84

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoHandle missing "add_development_dependency" by defining it
Wincent Colaiuta [Tue, 22 Jun 2010 06:35:56 +0000 (08:35 +0200)] 
Handle missing "add_development_dependency" by defining it

This will allow us to conveniently add requirements where needed.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: add custom title to generated documentation
Wincent Colaiuta [Sun, 13 Jun 2010 18:23:17 +0000 (20:23 +0200)] 
doc: add custom title to generated documentation

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agogit: ignore .yardoc directory
Wincent Colaiuta [Sun, 13 Jun 2010 17:45:03 +0000 (19:45 +0200)] 
git: ignore .yardoc directory

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoDRY up gemspec
Wincent Colaiuta [Sun, 13 Jun 2010 17:37:24 +0000 (19:37 +0200)] 
DRY up gemspec

Rather than repeating the gem names (4 of them), repeat the
"respond_to?" check (1 check) each time through the loop.

Speed not an issue, here, so just run the check every time
through the loop rather than sacrificing readability by
cluttering things up with a local variable.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoUse YARD for doc generation instead of RDoc
Wincent Colaiuta [Sun, 13 Jun 2010 17:34:39 +0000 (19:34 +0200)] 
Use YARD for doc generation instead of RDoc

The documentation is still going to require some tweaks, but this commit
switches over the build process to use YARD.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRemove RDoc hack notes; we're switching to YARD
Wincent Colaiuta [Sun, 13 Jun 2010 17:25:37 +0000 (19:25 +0200)] 
Remove RDoc hack notes; we're switching to YARD

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: wrap SAMPLE.txt
Wincent Colaiuta [Sun, 13 Jun 2010 11:19:36 +0000 (13:19 +0200)] 
doc: wrap SAMPLE.txt

For better display on narrow terminals.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: reference CHEATSHEET.txt from SAMPLE.txt
Wincent Colaiuta [Sun, 13 Jun 2010 11:16:33 +0000 (13:16 +0200)] 
doc: reference CHEATSHEET.txt from SAMPLE.txt

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: point out how to inspect translated sample markup
Wincent Colaiuta [Sun, 13 Jun 2010 11:14:41 +0000 (13:14 +0200)] 
doc: point out how to inspect translated sample markup

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number post-release
Wincent Colaiuta [Sun, 13 Jun 2010 10:44:18 +0000 (12:44 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number for 2.0 release 2.0
Wincent Colaiuta [Sun, 13 Jun 2010 10:29:44 +0000 (12:29 +0200)] 
Bump version number for 2.0 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: force the creation of a couple of hyperlinks
Wincent Colaiuta [Sun, 13 Jun 2010 10:15:39 +0000 (12:15 +0200)] 
doc: force the creation of a couple of hyperlinks

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: add missing option to parse documentation
Wincent Colaiuta [Sun, 13 Jun 2010 10:10:54 +0000 (12:10 +0200)] 
doc: add missing option to parse documentation

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: updates for "output_style" and HTML5 changes
Wincent Colaiuta [Sun, 13 Jun 2010 10:03:55 +0000 (12:03 +0200)] 
doc: updates for "output_style" and HTML5 changes

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBackend support for HTML5/XML output styles
Wincent Colaiuta [Sun, 13 Jun 2010 09:29:15 +0000 (11:29 +0200)] 
Backend support for HTML5/XML output styles

HTML5 has two output syntaxes, HTML and XML. Under HTML5 the HTML output
syntax is likely to be predominant, given that the XML syntax can only
be used if it is served with an appropriate MIME type (ie.
application/xml), and the vast majority of deployed web servers are
configured to use a text/html MIME type.

So, this dictates that for our 2.0 release we are going to default to
emitting HTML syntax, but allow the user to override the default and
emit XML syntax if required.

In practice, the only place in the code base where this necessitates a
change is the part where we emit "img" tags. In the XML syntax, these
tags should be self-closing; ie:

  <img src="foo.png" alt="Foo!" />

Whereas in the HTML syntax they should not (even if all user agents
accept them anyway); ie:

  <img src="foo.png" alt="Foo!">

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoAdd options for "output_style" (no backend yet)
Wincent Colaiuta [Sun, 13 Jun 2010 08:53:02 +0000 (10:53 +0200)] 
Add options for "output_style" (no backend yet)

Provide 3 means for users to specify an output style:

  (1) At initialization time:

      parser = Wikitext::Parser.new :output_style => :xml

  (2) By setting an instance variable via an accessor:

      parser = Wikitext::Parser.new
      parser.output_style = :xml

  (3) By passing in an override option at parse time:

      parser = Wikitext::Parser.new
      parser.parse input, :output_style => :xml

Note that at the moment this is just the option-handling code; the
actual behavior change hasn't been implemented yet.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRun specs under Rails 3.0.0.beta4
Wincent Colaiuta [Sat, 12 Jun 2010 23:01:35 +0000 (01:01 +0200)] 
Run specs under Rails 3.0.0.beta4

Note how that when targetting Rails 3 release versions, we can't use the
version number as the app name as we did with Rails 2.

This is because Rails 3 tries to turn the name into a constant, and
constants can't start with a number. To work around this we take such
version numbers and prepend them with a "v" to create a test app name;
this in turn can be "constantized" into "V300Beta4" or similar.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoMake "Edge Rails" specs work again
Wincent Colaiuta [Sat, 12 Jun 2010 22:22:30 +0000 (00:22 +0200)] 
Make "Edge Rails" specs work again

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoStart refactoring Rails specs
Wincent Colaiuta [Sat, 12 Jun 2010 20:37:22 +0000 (22:37 +0200)] 
Start refactoring Rails specs

The "Edge" Rails specs have been broken for a long time as we really
need a separate code path for these (too many changes in the underlying
machinery).

Lay the groundwork by renaming the existing working infrastructure as
a "rails2".

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoSimplify Rails 2 auto-initialization
Wincent Colaiuta [Sat, 12 Jun 2010 18:58:19 +0000 (20:58 +0200)] 
Simplify Rails 2 auto-initialization

Now that:

  require 'wikitext'

Effectively does the work that 'rails/init.rb' used to do, the latter
can now be reduced to just that:

  require 'wikitext'

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoAuto-initialize under Rails 3
Wincent Colaiuta [Sat, 12 Jun 2010 18:47:30 +0000 (20:47 +0200)] 
Auto-initialize under Rails 3

Under Rails 2 we get free auto-initialization behavior by including a
"rails/init.rb" file in our gem.

Under Rails 3 things have changed as described here:

  http://railsdispatch.com/posts/how-rails-3-enables-more-choices-part-1

Rails will effectively do a:

  require 'wikitext'

Early on in the application boot process. In our case, that effectively
means that the code in the C extension's Init_wikitext() function will
be evaluated.

So, in this commit, we replicate in C what we would have done in the
following manner if the Wikitext gem were just a pure Ruby project:

  if Object.const_defined? :ActiveSupport
    # we are running under Rails
    require 'wikitext/nil_class'
    require 'wikitext/string'

    if ActiveSupport.respond_to? :on_load
      # running under Rails 3
      ActiveSupport.on_load :action_view do
        require 'wikitext/rails_template_handler'
      end
    else
      # running under Rails 2
      require 'wikitext/rails_template_handler'
    end

Note that because one of the code paths involves passing in a block, we
have to define a couple of ancilliary helper functions and use
rb_iterate() to achieve the same effect in C.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoSplit String#wikitext_preprocess into a separate file
Wincent Colaiuta [Sat, 12 Jun 2010 16:08:10 +0000 (18:08 +0200)] 
Split String#wikitext_preprocess into a separate file

This has always been a bit of a wart, the fact that what is essentially
an application-specific preprocessing pass was included in our
"wikitext/strings" file.

Now, if you want the behavior you have to explicitly require
'wikitext/preprocess'.

As a side effect of this change, the file now serves as a nice example
of how to implement a custom preprocessing phase if you need it.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agorails/init.rb: trust LOAD_PATH
Wincent Colaiuta [Sat, 12 Jun 2010 15:46:55 +0000 (17:46 +0200)] 
rails/init.rb: trust LOAD_PATH

Rather than doing requires with absolute paths, trust the calling
environment (in this case, Rails 2) to set up the LOAD_PATH
appropriately.

This saves us later on re-requiring the same file with a different,
relative path and needlessly re-evaluating the same code.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRename rails.rb to rails_template_handler.rb
Wincent Colaiuta [Sat, 12 Jun 2010 15:43:47 +0000 (17:43 +0200)] 
Rename rails.rb to rails_template_handler.rb

To avoid confusion with "rails/init.rb" file elsewhere in the repo.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoFit "compile" method onto 1 line
Wincent Colaiuta [Sat, 12 Jun 2010 15:37:04 +0000 (17:37 +0200)] 
Fit "compile" method onto 1 line

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agodoc: initial updates for forthcoming 2.0 release
Wincent Colaiuta [Fri, 11 Jun 2010 16:49:39 +0000 (18:49 +0200)] 
doc: initial updates for forthcoming 2.0 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoEmit <code> rather than <tt> elements
Wincent Colaiuta [Fri, 11 Jun 2010 16:33:55 +0000 (18:33 +0200)] 
Emit <code> rather than <tt> elements

The <tt> element has been dropped from HTML5 and the recommendation is
to instead use more "semantic" elements such as <code>, <samp> and
<kbd>. As one of the major goals for the 2.0 release is to emit valid
HTML5, the <tt> element has to go.

Given that we are working with wikitext markup and the focus is on
simplicity, we won't be adding new syntax to enable the user to control
which of the three "semantic" tag alternatives is emitted.

Instead, we maintain the existing input markup options (that is,
backticks and <tt> elements will continue to be recognized) to maintain
compatibility with existing bodies of wikitext markup, and we choose
one of the three possible elements as a replacement for <tt>.

In the end, we're going with <code> because it seems to be the most
frequently used in the terrain where the wikitext module is used (online
wikis). A customization option to override this choice could be added in
the future, but I honestly don't expect there to be any demand for it.
Likewise, explicit support for <samp> and <kbd> tags could be added, but
I doubt there'll ever be a call for it, as the whole point of working in
wikitext markup is to have an easy-to-use format and not have to write
HTML tags.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRun Rails specs against many more versions of Rails 2
Wincent Colaiuta [Thu, 10 Jun 2010 18:41:05 +0000 (20:41 +0200)] 
Run Rails specs against many more versions of Rails 2

Previously we only ran against Rails 2.2.2 (the latest release at the
time the specs were written) and Rails "Edge".

In this commit we extend that to run against all versions of Rails 2
put out since the release of 2.2.2. The only exception to this is
version 2.3.0, which is marked as pending because it throws a Rack
exception. I am not sure if the version of Rack bundled with 2.3.0 has
some kind of bug, or this is an interaction with the versions of Rack
that are on my system (1.0.1 and 1.1.0) and might be getting
inadvertently pulled into the tests.

Note that we don't bother running the specs against versions of Rails
older than 2.2.2, because that came out in November 2008, and there is
not much sense in retroactively extending compatibility even further
backwards in time.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRestore template handler functionality in Rails 2
Wincent Colaiuta [Thu, 10 Jun 2010 17:55:47 +0000 (19:55 +0200)] 
Restore template handler functionality in Rails 2

As noted in commit 3fd2ea3, we fixed template handlers for Rails 3 but
did so at the expense of support for Rails 2.

This commit adds back the old Rails 2 code path as a fallback for when
the new code path is tried and fails in the absence of Rails 3.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoMove to Rails 3 template UI
Wincent Colaiuta [Wed, 9 Jun 2010 21:33:32 +0000 (23:33 +0200)] 
Move to Rails 3 template UI

It seems that under Rails 3 the old "self.call" method no longer works
in the same fashion. Previously returning the string "template.source.w"
worked because Rails, evidently, ended up eval'ing it in a context where
"template" resolved to the desired object.

In Rails 3, however, this is no longer the case, and it ends up trying
to call a "template" method on the controller, failing.

Googling for different template handlers shows that some use "render"
(for example, liquid) but I am unable to get any variant of "render" to
work under Rails 3.

On the other hand, the three handlers included with Rails itself (ERB,
Builder, and RJS) all use the "compile" method, as does Haml.

It's hard to tell from the scant in-code documentation, but it looks
like "compile" might be "the" supported way to write template handlers
for now. The only reference I can find to this online is this thread
from back in 2008:

  http://www.ruby-forum.com/topic/159810

In which Josh Peek says:

  I'd really like deprecate the TemplateHandler#render all together. If
  you think your handler can not be compiled, you always just compile in
  a delegate call to your "noncompilable" handler. This leaves us with
  only one method, compile.

So I am not sure if this is the "official" stance on the API, but in
light of the fact that I can't get anything else to work, I am going to
go with "compile" for now.

This unfortunately requires a somewhat ugly gsub call in order to escape
any single quotes that might be in the input, but it seems a necessary
evil. For example, a template with this wikitext markup:

  * don't you like this list?

Will be "compiled" to:

  '<ul>
    <li>don\'t you like this list?<li>
  </ul>
  '

Which when evaluated and emitted to the output steam becomes:

  <ul>
    <li>don't you like this list?</li>
  </ul>

Note that this commit makes things work with Rails 3 only, breaking
Rails 2 support. In a subsequent commit I plan to add in a conditional
code path that kicks in when running under Rails 2.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number post-release maint
Wincent Colaiuta [Wed, 9 Jun 2010 20:12:00 +0000 (22:12 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number for 1.12 release 1.12
Wincent Colaiuta [Wed, 9 Jun 2010 20:08:56 +0000 (22:08 +0200)] 
Bump version number for 1.12 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoUpdate release notes for 1.12 release
Wincent Colaiuta [Wed, 9 Jun 2010 20:04:41 +0000 (22:04 +0200)] 
Update release notes for 1.12 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoMark String#w and String#to_wikitext output as HTML safe
Wincent Colaiuta [Wed, 9 Jun 2010 19:33:58 +0000 (21:33 +0200)] 
Mark String#w and String#to_wikitext output as HTML safe

This applies only when running under Rails 3, or when the "html_safe"
method is otherwise available.

As these methods are the most commonly used methods for translating
wikitext markup to HTML in Rails applications, this should provide a
fairly convenient upgrade path for developers moving from Rails 2 to
Rails 3.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number post-release
Wincent Colaiuta [Sun, 25 Apr 2010 22:20:19 +0000 (00:20 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number for 1.11 release 1.11
Wincent Colaiuta [Sun, 25 Apr 2010 22:11:35 +0000 (00:11 +0200)] 
Bump version number for 1.11 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRakefile: Add missing ".gem" extension to "gem push" invocation
Wincent Colaiuta [Sun, 25 Apr 2010 22:13:05 +0000 (00:13 +0200)] 
Rakefile: Add missing ".gem" extension to "gem push" invocation

Signed-off-by: Wincent Colaiuta <win@wincent.com>