]> git.wincent.com - wikitext.git/log
wikitext.git
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>
13 years agoRakefile: simplify spec task by shelling out
Wincent Colaiuta [Sun, 25 Apr 2010 22:02:57 +0000 (00:02 +0200)] 
Rakefile: simplify spec task by shelling out

Just run "spec spec" directly rather than depending on special support
and configuration from RSpec's "spec" Rake task.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoAdd spec.opts file
Wincent Colaiuta [Sun, 25 Apr 2010 22:00:15 +0000 (00:00 +0200)] 
Add spec.opts file

This provides colorized output etc when running "spec spec" from the
command line.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoMake specs non-executable
Wincent Colaiuta [Sun, 25 Apr 2010 21:58:02 +0000 (23:58 +0200)] 
Make specs non-executable

These were originally intended to be run independently as Ruby scripts,
but in practice they are only run using the "spec" tool, so remove the
bang line and unset the executable bit.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoUse wikitext/rails as a substitute for rails/init
Wincent Colaiuta [Sun, 25 Apr 2010 20:12:06 +0000 (22:12 +0200)] 
Use wikitext/rails as a substitute for rails/init

Seeing as it seems that Rails 3 and Bundler no longer automatically
execute the "rails/init" file, users will now have to require
"wikitext/rails" if they want to get the functionality that was
previously activated from the "rails/init" file.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoUpdate documentation for 1.11 release
Wincent Colaiuta [Sun, 25 Apr 2010 19:54:12 +0000 (21:54 +0200)] 
Update documentation for 1.11 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoAdd wikitext_wrapper executable
Wincent Colaiuta [Sun, 25 Apr 2010 19:36:54 +0000 (21:36 +0200)] 
Add wikitext_wrapper executable

As mentioned in commit 4488c7b, in the library files we trust either the
packaging system (usually RubyGems) or the user to correctly set up the
LOAD_PATH so that all files will be found when included using simple
relative paths like "wikitext/version" and so on.

The specs and benchmarking scripts already explcitly set the LOAD_PATH
and use absolute paths where appropriate to ensure that the local
version is tested rather than some other version that might be installed
elsewhere on the system.

This commit addresses the last missing piece of the puzzle, the
"bin/wikitext" executable. That was also changed to trust the LOAD_PATH
and use shorter relative paths, and this will work for the installed
case because the packaging system (RubyGems) will actually set up a
wrapper in the user's PATH which sets up the LOAD_PATH appropraitely.

In local testing however, no such wrapper script is in place so trying
to run "bin/wikitext" will either fail (when no version is installed on
the system in th PATH) or will most likely use the wrong version (when
another version is found elsewhere).

So, for the purposes of local testing we here add a wrapper script that
achieves the same affect as the wrapper created by RubyGems during
installation: we set up a local LOAD_PATH and then fire off the real
executable.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoUse relative paths in "require" statements
Wincent Colaiuta [Sun, 25 Apr 2010 19:25:02 +0000 (21:25 +0200)] 
Use relative paths in "require" statements

Trust the packaging system (usually RubyGems) to set up the LOAD_PATH
appropriately, thus allowing us to use cleaner and simpler "require"
startements.

Note that the spec suite already explicitly sets up the LOAD_PATH so
that the version in the current working directory is tested and not any
other versions which may be installed elsewhere on the system.

The "bin/wikitext" executable, however, doesn't do any special setup so
it will use the installed version if it is found first in the load-path.
This isn't a problem for real installs because the packaging system (ie
RubyGems) sets up an appropriate wrapper executable to set up the
LOAD_PATH first. (For local testing, I still need to set up such a
wrapper.)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRemove repeated calls to expand_path
Wincent Colaiuta [Sun, 25 Apr 2010 18:45:57 +0000 (20:45 +0200)] 
Remove repeated calls to expand_path

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRakefile: run "make" target before "gem build"
Wincent Colaiuta [Mon, 19 Apr 2010 20:53:56 +0000 (22:53 +0200)] 
Rakefile: run "make" target before "gem build"

This is the reincarnation of commit 829011d, which fixed a subtle
problem with a missing file in the built gem.

We basically have to make sure that we've run the "make" target so that
all of the C files, including the Ragel-generated C file, is present in
the directory at the time "gem build" is called.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agogemspec: remove dependency on rake/gempackagetask
Wincent Colaiuta [Mon, 19 Apr 2010 20:42:20 +0000 (22:42 +0200)] 
gemspec: remove dependency on rake/gempackagetask

We don't need any of the bells and whistles of Rake's FileList, so can
just use Dir[].

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agogemspec: use more precise FileList specfication
Wincent Colaiuta [Mon, 19 Apr 2010 20:36:01 +0000 (22:36 +0200)] 
gemspec: use more precise FileList specfication

Make sure that any crud (things like .DS_Store files) that might be on
the filesystem doesn't get included in the gem.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agogemspec: update homepage attribute
Wincent Colaiuta [Mon, 19 Apr 2010 20:34:23 +0000 (22:34 +0200)] 
gemspec: update homepage attribute

There is still nothing very interesting on the Wikitext product page at
wincent.com, but it is still a more permanent home than rubyforge.org is
likely to be in the long term.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoExtract gemspec out into separate file
Wincent Colaiuta [Mon, 19 Apr 2010 20:31:16 +0000 (22:31 +0200)] 
Extract gemspec out into separate file

As recommended here for compatibility with Bundler's "install from Git
repo" feature:

  http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/

Note that while there is some disagreement in the comments on that post
about whether this is a clever or correct thing to do, in the present
case we are merely extracting the hand-edited gemspec out into a
separate file, not "checking in a generated file into the repo".

The change seems justified because it buys us compatibility with a
Bundler feature at no real cost.

Likewise, the other main complaint raised on a different post on the
same blog (ie. that building from Git repos can run into complications
where you end up with two different gems with different code but the
same version number) doesn't apply here because I have always used a
sane version numbering scheme, bumping the version number after each
release, so a released gem will never have the same version as an
intermediate version built directly from the repo:

  http://yehudakatz.com/2010/04/12/some-of-the-problems-bundler-solves/

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

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoFix CSS class of explicit mailto: URIs 1.10.1
Wincent Colaiuta [Sun, 21 Mar 2010 19:01:55 +0000 (20:01 +0100)] 
Fix CSS class of explicit mailto: URIs

Previously we only correctly handled "mailto" links when the link target
itself included the "mailto:" prefix.

In other cases, where the prefix was passed in separately, for example,
we did not apply the special CSS class.

Now we always check both the link target and the prefix to see if either
of them begins with "mailto:".

Fixes the spec failures reported in:

  https://wincent.com/issues/1389

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoRebuild with Ragel 6.6
Wincent Colaiuta [Sun, 21 Mar 2010 17:54:20 +0000 (18:54 +0100)] 
Rebuild with Ragel 6.6

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoDeclare development dependencies in gemspec
Wincent Colaiuta [Sun, 21 Mar 2010 17:38:01 +0000 (18:38 +0100)] 
Declare development dependencies in gemspec

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoFix builds on 64-bit Darwin platforms
Wincent Colaiuta [Sun, 21 Mar 2010 17:32:57 +0000 (18:32 +0100)] 
Fix builds on 64-bit Darwin platforms

Way back in ancient history when wikitext still used an ANTLR-generated
lexer, the evil commit 7a510102 added a horrible specific ARCHFLAGS
override to overcome the fact that ANTLR didn't produce Universal
binaries.

This worked fine on 32-bit machines, and the evil commit was allowed to
persist through the codebase for over two years, long after ANTLR was
ripped out and replaced with the vastly superior Ragel-generated lexer.

Today on testing on a 64-bit Darwin machine for the first time I
discovered the evil, and this commit expurgates it.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number post-release
Wincent Colaiuta [Sun, 1 Nov 2009 15:59:37 +0000 (16:59 +0100)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoBump version number for 1.10 release 1.10
Wincent Colaiuta [Sun, 1 Nov 2009 14:59:49 +0000 (15:59 +0100)] 
Bump version number for 1.10 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoUpdate release notes for 1.10 release
Wincent Colaiuta [Sun, 1 Nov 2009 14:57:26 +0000 (15:57 +0100)] 
Update release notes for 1.10 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoTeach wikitext tool to accept file arguments
Wincent Colaiuta [Sun, 1 Nov 2009 13:26:55 +0000 (14:26 +0100)] 
Teach wikitext tool to accept file arguments

If additional arguments are supplied they will be interpreted as
files to be processed in non-interactive mode (and any input on STDIN
will be ignored).

This is the final part of ticket #1399; see:

  https://wincent.com/issues/1399

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoMove command-line tool code inside Wikitext::Tool namespace
Wincent Colaiuta [Sun, 1 Nov 2009 12:56:22 +0000 (13:56 +0100)] 
Move command-line tool code inside Wikitext::Tool namespace

This keeps the methods declared in the file out of the global namespace.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
13 years agoDon't require highline unless running in interactive mode
Wincent Colaiuta [Sun, 1 Nov 2009 12:50:40 +0000 (13:50 +0100)] 
Don't require highline unless running in interactive mode

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd non-interactive (piping) mode
Wincent Colaiuta [Sat, 19 Sep 2009 10:16:05 +0000 (12:16 +0200)] 
Add non-interactive (piping) mode

If input is from a pipe or output is to a pipe we enter non-interactive
mode and just process the input from STDIN and send it to STDOUT without
any prompts, looping, or colorization.

This is a partial implementation of the feature requested here:

  https://wincent.com/issues/1399

(The remaining part is to also accept filename arguments as a means of
entering non-interactive mode.)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoDon't require rubygems unless loading highline library fails
Wincent Colaiuta [Sat, 19 Sep 2009 09:58:25 +0000 (11:58 +0200)] 
Don't require rubygems unless loading highline library fails

Don't depend on rubygems unless necessary.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoPrint version when launching wikitext executable
Wincent Colaiuta [Sat, 19 Sep 2009 09:57:01 +0000 (11:57 +0200)] 
Print version when launching wikitext executable

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoInclude "wikitext" executable in Gem distribution
Wincent Colaiuta [Sat, 19 Sep 2009 09:47:43 +0000 (11:47 +0200)] 
Include "wikitext" executable in Gem distribution

The "wikitext" command-line tool has been in the repository for quite a
while, but never included in the Gem distribution. Included by user
request; see:

  https://wincent.com/issues/1398

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number post-release
Wincent Colaiuta [Thu, 6 Aug 2009 12:36:53 +0000 (14:36 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number for 1.9 release 1.9
Wincent Colaiuta [Thu, 6 Aug 2009 12:35:10 +0000 (14:35 +0200)] 
Bump version number for 1.9 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate RDoc for new "link_proc" feature
Wincent Colaiuta [Thu, 6 Aug 2009 12:33:46 +0000 (14:33 +0200)] 
Update RDoc for new "link_proc" feature

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRemove repetition of ID2SYM() and rb_intern()
Wincent Colaiuta [Thu, 6 Aug 2009 12:14:21 +0000 (14:14 +0200)] 
Remove repetition of ID2SYM() and rb_intern()

Use a couple of temporary variables to avoid the ugly repeated calls to
ID2SYM() and rb_intern() with exactly the same parameters each time.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoSilence compiler warning in StringValue
Wincent Colaiuta [Thu, 6 Aug 2009 12:11:21 +0000 (14:11 +0200)] 
Silence compiler warning in StringValue

Our use of "StringValue(j)", where "j" is of type "long" and the macro
wants a value of type "VALUE" ("unsigned long") produce a warning that
"pointer targets in passing argument 1 of ‘rb_string_value’ differ in
signedness".

Merely casting ("StringValue((VALUE)j)") doesn't work because
"StringValue" itself is a macro and produces this warning: "argument to
'&' not really an lvalue; this will be a hard error in the future".

So use a temporary variable to suppress the warning without having to
use a cast inside the macro.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoImplement "link_proc" option ("red link" support)
Wincent Colaiuta [Thu, 23 Jul 2009 20:41:27 +0000 (22:41 +0200)] 
Implement "link_proc" option ("red link" support)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAccept optional options hash on "nil.w"
Wincent Colaiuta [Fri, 19 Jun 2009 11:04:29 +0000 (13:04 +0200)] 
Accept optional options hash on "nil.w"

This can help us to avoid constructs like:

  text = attribute.empty? ? '' : attribute.w(:base_heading_level => 3)

We can instead just use:

  text = attribute.w :base_heading_level => 3

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUse fixed-width markup in release notes for class names etc
Wincent Colaiuta [Wed, 27 May 2009 15:49:24 +0000 (17:49 +0200)] 
Use fixed-width markup in release notes for class names etc

Make things more consistent with the rest of the documentation by using
fixed-width font markup for CSS class names and HTML tags in the release
notes (rather than using double quotes).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoRemove "not yet released" label from 1.8 heading in release notes
Wincent Colaiuta [Wed, 27 May 2009 15:48:03 +0000 (17:48 +0200)] 
Remove "not yet released" label from 1.8 heading in release notes

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number post-release
Wincent Colaiuta [Wed, 27 May 2009 15:45:35 +0000 (17:45 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number for 1.8 release 1.8
Wincent Colaiuta [Wed, 27 May 2009 15:39:34 +0000 (17:39 +0200)] 
Bump version number for 1.8 release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate release notes for version 1.8
Wincent Colaiuta [Wed, 27 May 2009 15:38:29 +0000 (17:38 +0200)] 
Update release notes for version 1.8

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoUpdate README for new PRE_START "lang" attribute
Wincent Colaiuta [Tue, 26 May 2009 20:28:18 +0000 (22:28 +0200)] 
Update README for new PRE_START "lang" attribute

Document the use of the "lang" attribute in PRE_START tags. Note that
contrary to what is said in the commit message for 024870e, uppercase
letters are in fact allowed in the attribute value.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoHandle optional "lang" attribute in PRE_START tags
Wincent Colaiuta [Tue, 26 May 2009 20:03:31 +0000 (22:03 +0200)] 
Handle optional "lang" attribute in PRE_START tags

In addition to the literal "<pre>" tag syntax accept a special syntax
which includes a "lang" attribute. This is used to markup a PRE_START
for syntax highlighting as a particular language; for example:

  <pre lang="ruby">def hello to="world"
    puts "Hello, #{to}"
  end</pre>

Would be translated to:

  <pre class="ruby-syntax">def hello to=&quot;world&quot;
    puts &quot;Hello, #{to}&quot;
  end</pre>

Note that language names must consist only of lower-case letters, and
"-syntax" is automatically appended, to prevent users from inserting
totally arbitrary CSS class names into the translated output. This means
that names like "ruby" and "c" will work, but that names like "obj-c" or
"ObjC" would have to be written as "objc".

In this implementation the required format for the PRE_START tag is very
strict; no excess whitespace is allowed within the tag. This has the
benefit that it is simple and fast, and doesn't require re-scanning the
token to see exactly where the value of the "lang" attribute begins and
ends.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoExtract repeated pattern into wiki_append_pre_start()
Wincent Colaiuta [Tue, 26 May 2009 19:30:22 +0000 (21:30 +0200)] 
Extract repeated pattern into wiki_append_pre_start()

This refactoring will make it easier to add code to handle CSS classes
in PRE_START tags (for syntax highlighting).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoReally change license header
Wincent Colaiuta [Thu, 21 May 2009 19:13:34 +0000 (21:13 +0200)] 
Really change license header

90de8af corrected the license header in the generated C file rather than
the Ragel source (I need to add an "rl" filetype to Ack so that I won't
overlook this kind of thing in the future).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoChange license header from GPL to BSD
Wincent Colaiuta [Thu, 21 May 2009 19:09:43 +0000 (21:09 +0200)] 
Change license header from GPL to BSD

This file was overlooked in the move to the BSD license (see commit
1155628).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoSwap README.rdoc and doc/README (symlink <--> file)
Wincent Colaiuta [Wed, 13 May 2009 21:09:44 +0000 (23:09 +0200)] 
Swap README.rdoc and doc/README (symlink <--> file)

Looks like a top-level symlink won't get picked up by GitHub,
so swap things around: make the top-level item be the real
file and the item in the "doc" subdirectory can be a symlink
(RDoc will continue to generate the HTML for the README as
before).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd README symlink at top level for GitHub mirror
Wincent Colaiuta [Wed, 13 May 2009 16:08:40 +0000 (18:08 +0200)] 
Add README symlink at top level for GitHub mirror

GitHub will automatically display any README found at the top
level of the tree, so set up a symlink (we'll see if it works)
from doc/README to README.rdoc.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoFix spelling error in comment
Wincent Colaiuta [Wed, 13 May 2009 09:30:20 +0000 (11:30 +0200)] 
Fix spelling error in comment

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoAdd ary_includes2, ary_includes3 functions
Wincent Colaiuta [Wed, 13 May 2009 09:04:16 +0000 (11:04 +0200)] 
Add ary_includes2, ary_includes3 functions

A fairly common pattern in the codebase is successively calling
the ary_includes function 1, 2 or 3 times. In the worst case
scenario this incurs 3 function calls and three array traversals
via a for-loop in the function.

Add 2 and 3-argument variants of the function so that we can
replace these instances with a single function call and a single
array traversal.

As shown in the benchmarking notes, this bumps the ary_includes
function from 4th place in the profile (where it was the "low-hanging
fruit") and right off the list.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number post-release
Wincent Colaiuta [Tue, 12 May 2009 23:14:05 +0000 (01:14 +0200)] 
Bump version number post-release

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoBump version number for 1.7 release 1.7
Wincent Colaiuta [Tue, 12 May 2009 22:44:49 +0000 (00:44 +0200)] 
Bump version number for 1.7 release

Normally "minor" version bumps (eg 1.6 to 1.7) are
reserved for versions which introduce new features
and "tiny" version bumps (eg 1.6 to 1.6.1) are for
maintenance (bugfix) releases.

This release doesn't contain any new features but
I am nevertheless bumping the "minor" version
number because the release does involve a fairly
major rewrite of the internals, and as such is
less conservative than a normal "maintenance"
update.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoChange remaining instances of "_Wikitext_" to "wiki_"
Wincent Colaiuta [Tue, 12 May 2009 22:34:57 +0000 (00:34 +0200)] 
Change remaining instances of "_Wikitext_" to "wiki_"

The remaining references mostly appear in comments. The one
significant change is the renaming of the "_Wikitext_token"
method to "wiki_token".

Signed-off-by: Wincent Colaiuta <win@wincent.com>
14 years agoChange internal function prefix from "_Wikitext_" to "wiki_"
Wincent Colaiuta [Tue, 12 May 2009 22:29:20 +0000 (00:29 +0200)] 
Change internal function prefix from "_Wikitext_" to "wiki_"

Follow the pattern already established in str.c/str.h and
ary.c/ary.h, and use a short lowercase prefix with no
leading underscore for "internal" functions (that is,
functions that are for use within the C part of the extension
and are not exposed as Ruby methods).

This buys us some horizontal space and makes keeping things
in a reasonable number of columns a bit easier.

Externally exported methods still follow the old pattern of
Module_class_method (eg. Wikitext_parser_parse).

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