karmi-markout 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 6
2
+ :patch: 7
3
3
  :major: 0
4
4
  :minor: 1
@@ -2,6 +2,7 @@ require 'rdiscount'
2
2
  require 'erb'
3
3
  require 'base64'
4
4
  require 'mime/types'
5
+ require 'cgi'
5
6
 
6
7
  module Markout
7
8
 
@@ -58,6 +59,10 @@ module Markout
58
59
  @document.history
59
60
  end
60
61
 
62
+ def h(html)
63
+ CGI::escapeHTML(html.to_s)
64
+ end
65
+
61
66
  private
62
67
 
63
68
  # TODO : Make 'alt' attribute optional
@@ -20,7 +20,7 @@
20
20
  <% if history %>
21
21
  <div id="history_header">
22
22
  <p>Last revision:
23
- <strong><%= history.revisions.first.subject %></strong>
23
+ <strong><%= h(history.revisions.first.subject) %></strong>
24
24
  <em>(<%= history.revisions.first.author %>, <%= history.revisions.first.date.strftime('%d/%m/%Y %H:%M') %>)</em> |
25
25
  <a href="#history">History</a>
26
26
  <!-- <strong class="new_revisions">(3 new)</strong> -->
@@ -39,7 +39,7 @@
39
39
  <h2>History</h2>
40
40
  <% history.revisions.each do |revision| %>
41
41
  <div id="revision_<%= revision.sha %>" class="revision">
42
- <h4><%= revision.date.strftime('%d/%m/%Y %H:%M') %> : <%= revision.subject %> (<%= revision.author %>)</h4>
42
+ <h4><%= revision.date.strftime('%d/%m/%Y %H:%M') %> : <%= h(revision.subject) %> (<%= revision.author %>)</h4>
43
43
  <div class="detail">
44
44
  <% if revision.message %><%= revision.message(:format => :html) %><% end %>
45
45
  <pre>
@@ -1,4 +1,5 @@
1
1
  require 'rdiscount'
2
+ require 'cgi'
2
3
 
3
4
  module Markout
4
5
 
@@ -27,7 +28,7 @@ module Markout
27
28
  def message(options={})
28
29
  case options[:format]
29
30
  when :html
30
- return RDiscount.new(@message).to_html
31
+ return RDiscount.new( CGI::escapeHTML(@message) ).to_html
31
32
  else
32
33
  return @message
33
34
  end
@@ -50,7 +51,7 @@ module Markout
50
51
 
51
52
  def inline_diff
52
53
  # FIXME: Cleanup
53
- output = %x[cd #{@repo.path} && git show --no-prefix --ignore-space-change --color-words #{@sha} 2>&1]
54
+ output = %x[cd #{@repo.path} && git show --no-prefix --ignore-space-at-eol --color-words #{@sha} 2>&1]
54
55
  if $?.success?
55
56
  return convert_bash_color_codes( output.gsub(/(.*)@@(.*)/m, '\2') )
56
57
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karmi-markout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-03 00:00:00 -07:00
12
+ date: 2009-08-21 00:00:00 -07:00
13
13
  default_executable: markout
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -73,6 +73,7 @@ files:
73
73
  - LICENSE
74
74
  has_rdoc: false
75
75
  homepage: http://github.com/karmi/markout
76
+ licenses:
76
77
  post_install_message:
77
78
  rdoc_options:
78
79
  - --charset=UTF-8
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
94
  requirements: []
94
95
 
95
96
  rubyforge_project:
96
- rubygems_version: 1.2.0
97
+ rubygems_version: 1.3.5
97
98
  signing_key:
98
99
  specification_version: 3
99
100
  summary: Sexy Markdown output