1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rdoc/markdown/literals_1_9.rb: Fix trailing whitespace.

Previously kpeg (which generates this file) added trailing
  whitespace, but this bug is now fixed.

* lib/rdoc/markdown.rb:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-09-19 00:00:01 +00:00
parent df7dac9174
commit e0030bd99d
3 changed files with 23 additions and 12 deletions

View file

@ -1,3 +1,12 @@
Thu Sep 19 08:59:41 2013 Eric Hodel <drbrain@segment7.net>
* lib/rdoc/markdown/literals_1_9.rb: Fix trailing whitespace.
Previously kpeg (which generates this file) added trailing
whitespace, but this bug is now fixed.
* lib/rdoc/markdown.rb: ditto.
Thu Sep 19 08:33:14 2013 Eric Hodel <drbrain@segment7.net>
* lib/rdoc: Update to RDoc 4.1.0.preview.1

View file

@ -194,7 +194,6 @@ class RDoc::Markdown
attr_reader :failing_rule_offset
attr_accessor :result, :pos
def current_column(target=pos)
if c = string.rindex("\n", target-1)
return target - c - 1

View file

@ -23,8 +23,7 @@ class RDoc::Markdown::Literals
# Prepares for parsing +str+. If you define a custom initialize you must
# call this method before #parse
def setup_parser(str, debug=false)
@string = str
@pos = 0
set_string str, 0
@memoizations = Hash.new { |h,k| h[k] = {} }
@result = nil
@failed_rule = nil
@ -37,7 +36,6 @@ class RDoc::Markdown::Literals
attr_reader :failing_rule_offset
attr_accessor :result, :pos
def current_column(target=pos)
if c = string.rindex("\n", target-1)
return target - c - 1
@ -71,6 +69,13 @@ class RDoc::Markdown::Literals
@string[start..@pos-1]
end
# Sets the string and current parsing position for the parser.
def set_string string, pos
@string = string
@string_size = string ? string.size : 0
@pos = pos
end
def show_pos
width = 10
if @pos < width
@ -177,19 +182,19 @@ class RDoc::Markdown::Literals
return nil
end
if "".respond_to? :getbyte
if "".respond_to? :ord
def get_byte
if @pos >= @string.size
if @pos >= @string_size
return nil
end
s = @string.getbyte @pos
s = @string[@pos].ord
@pos += 1
s
end
else
def get_byte
if @pos >= @string.size
if @pos >= @string_size
return nil
end
@ -238,8 +243,7 @@ class RDoc::Markdown::Literals
old_pos = @pos
old_string = @string
@pos = other.pos
@string = other.string
set_string other.string, other.pos
begin
if val = __send__(rule, *args)
@ -250,8 +254,7 @@ class RDoc::Markdown::Literals
end
val
ensure
@pos = old_pos
@string = old_string
set_string old_string, old_pos
end
end