siboom.rb
def convertInlineMarkup(string,o)
    i = 0
    inbold = false
    initalic = false
    output = ""
    while true
        pos = string.index('*',i)
        if !pos
            output += o.emit_text(string)
            break
        end
        if pos > 0 and string[(pos-1)..(pos-1)] == "\\"
            i = pos
            string = string[0..(pos-2)]+string[pos..-1]
            next
        end
        if string[(pos+1)..(pos+1)] == '*'
            output += o.emit_text(string[0..(pos-1)])
            output += inbold ? o.end_bold : o.start_bold
            inbold = !inbold
            i = 0
            string = string[(pos+2)..-1]
        else
            output += o.emit_text(string[0..(pos-1)])
            output += initalic ? o.end_italic : o.start_italic
            initalic = !initalic
            i = 0
            string = string[(pos+1)..-1]
        end
    end
    output += o.end_bold if inbold
    output += o.end_italic if initalic
    output
end
# This function converts a single line of the markup format into the target
# format using the output filter 'o'.
#
# Bold and Italic are the only two things handled here since there are no other
# "inline" markups.
This function converts a single line of the markup format into the target
format using the output filter 'o'.

Bold and Italic are the only two things handled here since there are no other
"inline" markups.
This function converts a single line of the markup format into the target format using the output filter ' o ' . Bold and Italic are the only two things handled here since there are no other " inline " markups .
def convertInlineMarkup(string,o)
    i = 0
    inbold = false
    initalic = false
    output = ""
    while true
        pos = string.index('*',i)
        if !pos
            output += o.emit_text(string)
            break
        end
        if pos > 0 and string[(pos-1)..(pos-1)] == "\\"
            i = pos
            string = string[0..(pos-2)]+string[pos..-1]
            next
        end
        if string[(pos+1)..(pos+1)] == '*'
            output += o.emit_text(string[0..(pos-1)])
            output += inbold ? o.end_bold : o.start_bold
            inbold = !inbold
            i = 0
            string = string[(pos+2)..-1]
        else
            output += o.emit_text(string[0..(pos-1)])
            output += initalic ? o.end_italic : o.start_italic
            initalic = !initalic
            i = 0
            string = string[(pos+1)..-1]
        end
    end
    output += o.end_bold if inbold
    output += o.end_italic if initalic
    output
end
def convertInlineMarkup ( string , o ) i = 0 inbold = false initalic = false output = "" while true pos = string . index ( '*' , i ) if ! pos output += o . emit_text ( string ) break end if pos > 0 and string [ ( pos - 1 ) .. ( pos - 1 ) ] == "\\" i = pos string = string [ 0 .. ( pos - 2 ) ] + string [ pos .. - 1 ] next end if string [ ( pos + 1 ) .. ( pos + 1 ) ] == '*' output += o . emit_text ( string [ 0 .. ( pos - 1 ) ] ) output += inbold ? o . end_bold : o . start_bold inbold = ! inbold i = 0 string = string [ ( pos + 2 ) .. - 1 ] else output += o . emit_text ( string [ 0 .. ( pos - 1 ) ] ) output += initalic ? o . end_italic : o . start_italic initalic = ! initalic i = 0 string = string [ ( pos + 1 ) .. - 1 ] end end output += o . end_bold if inbold output += o . end_italic if initalic output end
This function converts a single line of the markup format into the target
format using the output filter 'o'.
This function converts a single line of the markup format into the target format using the output filter ' o ' .
string
o