@@ -173,6 +173,8 @@ def initialize top_level, file_name, content, options, stats
173173 @classes = load_variable_map :c_class_variables
174174 @singleton_classes = load_variable_map :c_singleton_class_variables
175175
176+ @markup = @options . markup
177+
176178 # class_variable => { function => [method, ...] }
177179 @methods = Hash . new { |h , f | h [ f ] = Hash . new { |i , m | i [ m ] = [ ] } }
178180
@@ -439,7 +441,7 @@ def do_includes
439441 next unless cls = @classes [ c ]
440442 m = @known_classes [ m ] || m
441443
442- comment = RDoc :: Comment . new '' , @top_level , :c
444+ comment = new_comment '' , @top_level , :c
443445 incl = cls . add_include RDoc ::Include . new ( m , comment )
444446 incl . record_location @top_level
445447 end
@@ -521,7 +523,7 @@ def find_alias_comment class_name, new_name, old_name
521523 \s *"#{ Regexp . escape new_name } "\s *,
522524 \s *"#{ Regexp . escape old_name } "\s *\) ;%xm
523525
524- RDoc :: Comment . new ( $1 || '' , @top_level , :c )
526+ new_comment ( $1 || '' , @top_level , :c )
525527 end
526528
527529 ##
@@ -560,7 +562,7 @@ def find_attr_comment var_name, attr_name, read = nil, write = nil
560562 ''
561563 end
562564
563- RDoc :: Comment . new comment , @top_level , :c
565+ new_comment comment , @top_level , :c
564566 end
565567
566568 ##
@@ -600,7 +602,7 @@ def find_body class_name, meth_name, meth_obj, file_content, quiet = false
600602
601603 case type
602604 when :func_def
603- comment = RDoc :: Comment . new args [ 0 ] , @top_level , :c
605+ comment = new_comment args [ 0 ] , @top_level , :c
604606 body = args [ 1 ]
605607 offset , = args [ 2 ]
606608
@@ -630,7 +632,7 @@ def find_body class_name, meth_name, meth_obj, file_content, quiet = false
630632
631633 body
632634 when :macro_def
633- comment = RDoc :: Comment . new args [ 0 ] , @top_level , :c
635+ comment = new_comment args [ 0 ] , @top_level , :c
634636 body = args [ 1 ]
635637 offset , = args [ 2 ]
636638
@@ -737,7 +739,7 @@ def find_class_comment class_name, class_mod
737739 comment = ''
738740 end
739741
740- comment = RDoc :: Comment . new comment , @top_level , :c
742+ comment = new_comment comment , @top_level , :c
741743 comment . normalize
742744
743745 look_for_directives_in class_mod , comment
@@ -782,7 +784,7 @@ def find_const_comment(type, const_name, class_name = nil)
782784 table [ const_name ] ||
783785 ''
784786
785- RDoc :: Comment . new comment , @top_level , :c
787+ new_comment comment , @top_level , :c
786788 end
787789
788790 ##
@@ -813,7 +815,7 @@ def find_override_comment class_name, meth_obj
813815
814816 return unless comment
815817
816- RDoc :: Comment . new comment , @top_level , :c
818+ new_comment comment , @top_level , :c
817819 end
818820
819821 ##
@@ -947,7 +949,7 @@ def handle_constants(type, var_name, const_name, definition)
947949
948950 new_comment = "#{ $1} #{ new_comment . lstrip } "
949951
950- new_comment = RDoc :: Comment . new new_comment , @top_level , :c
952+ new_comment = self . new_comment ( new_comment , @top_level , :c )
951953
952954 con = RDoc ::Constant . new const_name , new_definition , new_comment
953955 else
@@ -1222,4 +1224,9 @@ def scan
12221224 @top_level
12231225 end
12241226
1227+ def new_comment text = nil , location = nil , language = nil
1228+ RDoc ::Comment . new ( text , location , language ) . tap do |comment |
1229+ comment . format = @markup
1230+ end
1231+ end
12251232end
0 commit comments