-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added rst format via github-markup gem
- Loading branch information
Showing
8 changed files
with
91 additions
and
17 deletions.
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
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
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
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
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,17 @@ | ||
require 'github/markup' | ||
|
||
module Locomotive | ||
module Steam | ||
|
||
class RstService | ||
|
||
def to_html(text) | ||
return '' if text.blank? | ||
|
||
GitHub::Markup.render(".rst", text) | ||
end | ||
|
||
end | ||
|
||
end | ||
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
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
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,34 @@ | ||
require 'spec_helper' | ||
|
||
describe Locomotive::Steam::RstService do | ||
|
||
let(:service) { described_class.new } | ||
|
||
describe '#to_html' do | ||
|
||
let(:text) { <<-EOF | ||
Hello world! | ||
============ | ||
Lorem ipsum | ||
EOF | ||
} | ||
|
||
subject { service.to_html(text) } | ||
|
||
it do | ||
is_expected.to eq <<-EOF | ||
<h1 class="title">Hello world!</h1> | ||
<p>Lorem ipsum</p> | ||
EOF | ||
end | ||
|
||
describe 'no text' do | ||
|
||
let(:text) { nil } | ||
it { is_expected.to eq '' } | ||
end | ||
|
||
end | ||
|
||
end |