module List_number
def parse text
start_ul_rex = %r!
^\s*$\n # 空行 => \n
\n
^\#\s(\w*)\n # # list_start => - list_start
\n
!x
parse_text = text.gsub(start_ul_rex){|s| "\n\n- #$1
\n"}
end_ul_rex = %r!
^\#\s(\w*)\n # # list_end => - list_end
\n
^\s*$\n # 空行 =>
\n\n
!x
parse_text = parse_text.gsub(end_ul_rex){|s| "- #$1
\n\n\n"}
# * list => - list
parse_text = parse_text.gsub(/^\#\s(\w*)\n/){|s| "- #$1
\n"}
return text if parse_text == nil
parse_text
end
module_function :parse
end