Skip to content

Commit

Permalink
Adds features and umlaut dummy implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jul 5, 2011
1 parent 65471ab commit 94cd730
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
Gemfile.lock
7 changes: 7 additions & 0 deletions features/step_definitions/latex.rb
@@ -0,0 +1,7 @@
When /^I decode the string '([^']*)'$/ do |string|
@result = LaTeX.decode(string)
end

Then /^the result should be '([^']*)'$/ do |value|
@result.should == value
end
1 change: 1 addition & 0 deletions features/support/env.rb
@@ -0,0 +1 @@
require 'latex/decode'
7 changes: 7 additions & 0 deletions features/umlauts.feature
@@ -0,0 +1,7 @@
Feature: Decode LaTeX umlauts
As a hacker who works with LaTeX
I want to be able to decode LaTeX umlauts

Scenario: German umlauts
When I decode the string '\"a\"o\"u'
Then the result should be 'äöü'
5 changes: 4 additions & 1 deletion lib/latex/decode.rb
@@ -1,10 +1,13 @@
# coding: utf-8

require 'latex/decode/version'

module LaTeX
class << self
def decode (string)
string
return string unless string.is_a? String

string.gsub(/\\"a/, 'ä').gsub(/\\"o/, 'ö').gsub(/\\"u/, 'ü')
end
end
end

0 comments on commit 94cd730

Please sign in to comment.