lib/kramdown/parser/kramdown/html_entity.rb in kramdown-0.7.0 vs lib/kramdown/parser/kramdown/html_entity.rb in kramdown-0.8.0

- old
+ new

@@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # #-- -# Copyright (C) 2009 Thomas Leitner <t_leitner@gmx.at> +# Copyright (C) 2009-2010 Thomas Leitner <t_leitner@gmx.at> # # This file is part of kramdown. # # kramdown is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,21 +18,21 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #++ # +require 'kramdown/parser/html' + module Kramdown module Parser class Kramdown - HTML_ENTITY_RE = /&([\w:][\-\w\d\.:]*);|&#(\d+);|&\#x([0-9a-fA-F]+);/ - # Parse the HTML entity at the current location. def parse_html_entity @src.pos += @src.matched_size @tree.children << Element.new(:entity, @src[1] || (@src[2] && @src[2].to_i) || @src[3].hex) end - define_parser(:html_entity, HTML_ENTITY_RE, '&') + define_parser(:html_entity, Kramdown::Parser::Html::Constants::HTML_ENTITY_RE, '&') end end end