File tree 8 files changed +14
-15
lines changed
8 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ def inspect
61
61
62
62
def type ; :extra_file end
63
63
64
+ def source_type ; :ruby end
65
+
66
+ def parent ; YARD ::Registry . root end
67
+
64
68
def ==( other )
65
69
return false unless self . class === other
66
70
other . filename == filename
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def serialized_path(object)
51
51
return object if object . is_a? ( String )
52
52
53
53
if object . is_a? ( CodeObjects ::ExtraFileObject )
54
- fspath = [ 'file.' + object . name + ( extension . empty? ? '' : ".#{ extension } " ) ]
54
+ fspath = [ '_file' , object . name + ( extension . empty? ? '' : ".#{ extension } " ) ]
55
55
else
56
56
objname = object != YARD ::Registry . root ? mapped_name ( object ) : "top-level-namespace"
57
57
objname += '_' + object . scope . to_s [ 0 , 1 ] if object . is_a? ( CodeObjects ::MethodObject )
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def serialized_path(object)
20
20
when CodeObjects ::ConstantObject , CodeObjects ::ClassVariableObject
21
21
serialized_path ( object . namespace ) + "##{ object . name } -#{ object . type } "
22
22
when CodeObjects ::ExtraFileObject
23
- super ( object ) . gsub ( /^file \. / , 'file/' )
23
+ super ( object ) . gsub ( /^_file \/ / , 'file/' )
24
24
else
25
25
super ( object )
26
26
end
Original file line number Diff line number Diff line change 66
66
it "handles ExtraFileObject's" do
67
67
s = Serializers ::FileSystemSerializer . new
68
68
e = CodeObjects ::ExtraFileObject . new ( 'filename.txt' , '' )
69
- expect ( s . serialized_path ( e ) ) . to eq 'file. filename.html'
69
+ expect ( s . serialized_path ( e ) ) . to eq '_file/ filename.html'
70
70
end
71
71
72
72
it "differentiates instance and class methods from serialized path" do
Original file line number Diff line number Diff line change @@ -415,12 +415,12 @@ def parse_link(link)
415
415
expect ( parse_link ( resolve_links ( "{file:TEST.txt#abc}" ) ) ) . to eq (
416
416
:inner_text => "TEST" ,
417
417
:title => "TEST" ,
418
- :href => "file. TEST.html#abc"
418
+ :href => "_file/ TEST.html#abc"
419
419
)
420
420
expect ( parse_link ( resolve_links ( "{file:TEST.txt title}" ) ) ) . to eq (
421
421
:inner_text => "title" ,
422
422
:title => "title" ,
423
- :href => "file. TEST.html"
423
+ :href => "_file/ TEST.html"
424
424
)
425
425
end
426
426
Original file line number Diff line number Diff line change 8
8
generate_assets
9
9
serialize ( '_index.html' )
10
10
options . files . each_with_index do |file , _i |
11
- serialize_file ( file , file . title )
11
+ serialize_file ( file )
12
12
end
13
13
14
14
options . delete ( :objects )
@@ -48,6 +48,7 @@ def serialize_onefile
48
48
# Generate the index document for the output
49
49
# @params [Hash] options contains data and flags that influence the output
50
50
def serialize_index ( options )
51
+ options . object = Registry . root
51
52
Templates ::Engine . with_serializer ( 'index.html' , options . serializer ) do
52
53
T ( 'layout' ) . run ( options . merge ( :index => true ) )
53
54
end
@@ -57,18 +58,12 @@ def serialize_index(options)
57
58
# the README file or files specified on the command-line.
58
59
#
59
60
# @param [File] file object to be saved to the output
60
- # @param [String] title currently unused
61
61
#
62
62
# @see layout#diskfile
63
- def serialize_file ( file , title = nil ) # rubocop:disable Lint/UnusedMethodArgument
64
- options . object = Registry . root
63
+ def serialize_file ( file )
65
64
options . file = file
66
- outfile = 'file.' + file . name + '.html'
67
-
68
65
serialize_index ( options ) if file == options . readme
69
- Templates ::Engine . with_serializer ( outfile , options . serializer ) do
70
- T ( 'layout' ) . run ( options )
71
- end
66
+ serialize ( file )
72
67
options . delete ( :file )
73
68
end
74
69
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def init
23
23
class << options . serializer
24
24
define_method ( :serialized_path ) do |object |
25
25
if CodeObjects ::ExtraFileObject === object
26
- super ( object ) . sub ( /^file \. / , '' ) . downcase
26
+ super ( object ) . sub ( /^_file \/ / , '' ) . downcase
27
27
else
28
28
super ( object )
29
29
end
You can’t perform that action at this time.
0 commit comments