forked from inukshuk/latex-decode
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds features and umlaut dummy implementation
- Loading branch information
Showing
5 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'latex/decode' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 'äöü' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |