File tree Expand file tree Collapse file tree 8 files changed +14
-15
lines changed
Expand file tree Collapse file tree 8 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ def inspect
6161
6262 def type ; :extra_file end
6363
64+ def source_type ; :ruby end
65+
66+ def parent ; YARD ::Registry . root end
67+
6468 def ==( other )
6569 return false unless self . class === other
6670 other . filename == filename
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def serialized_path(object)
5151 return object if object . is_a? ( String )
5252
5353 if object . is_a? ( CodeObjects ::ExtraFileObject )
54- fspath = [ 'file.' + object . name + ( extension . empty? ? '' : ".#{ extension } " ) ]
54+ fspath = [ '_file' , object . name + ( extension . empty? ? '' : ".#{ extension } " ) ]
5555 else
5656 objname = object != YARD ::Registry . root ? mapped_name ( object ) : "top-level-namespace"
5757 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)
2020 when CodeObjects ::ConstantObject , CodeObjects ::ClassVariableObject
2121 serialized_path ( object . namespace ) + "##{ object . name } -#{ object . type } "
2222 when CodeObjects ::ExtraFileObject
23- super ( object ) . gsub ( /^file \. / , 'file/' )
23+ super ( object ) . gsub ( /^_file \/ / , 'file/' )
2424 else
2525 super ( object )
2626 end
Original file line number Diff line number Diff line change 6666 it "handles ExtraFileObject's" do
6767 s = Serializers ::FileSystemSerializer . new
6868 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'
7070 end
7171
7272 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)
415415 expect ( parse_link ( resolve_links ( "{file:TEST.txt#abc}" ) ) ) . to eq (
416416 :inner_text => "TEST" ,
417417 :title => "TEST" ,
418- :href => "file. TEST.html#abc"
418+ :href => "_file/ TEST.html#abc"
419419 )
420420 expect ( parse_link ( resolve_links ( "{file:TEST.txt title}" ) ) ) . to eq (
421421 :inner_text => "title" ,
422422 :title => "title" ,
423- :href => "file. TEST.html"
423+ :href => "_file/ TEST.html"
424424 )
425425 end
426426
Original file line number Diff line number Diff line change 88 generate_assets
99 serialize ( '_index.html' )
1010 options . files . each_with_index do |file , _i |
11- serialize_file ( file , file . title )
11+ serialize_file ( file )
1212 end
1313
1414 options . delete ( :objects )
@@ -48,6 +48,7 @@ def serialize_onefile
4848# Generate the index document for the output
4949# @params [Hash] options contains data and flags that influence the output
5050def serialize_index ( options )
51+ options . object = Registry . root
5152 Templates ::Engine . with_serializer ( 'index.html' , options . serializer ) do
5253 T ( 'layout' ) . run ( options . merge ( :index => true ) )
5354 end
@@ -57,18 +58,12 @@ def serialize_index(options)
5758# the README file or files specified on the command-line.
5859#
5960# @param [File] file object to be saved to the output
60- # @param [String] title currently unused
6161#
6262# @see layout#diskfile
63- def serialize_file ( file , title = nil ) # rubocop:disable Lint/UnusedMethodArgument
64- options . object = Registry . root
63+ def serialize_file ( file )
6564 options . file = file
66- outfile = 'file.' + file . name + '.html'
67-
6865 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 )
7267 options . delete ( :file )
7368end
7469
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def init
2323 class << options . serializer
2424 define_method ( :serialized_path ) do |object |
2525 if CodeObjects ::ExtraFileObject === object
26- super ( object ) . sub ( /^file \. / , '' ) . downcase
26+ super ( object ) . sub ( /^_file \/ / , '' ) . downcase
2727 else
2828 super ( object )
2929 end
You can’t perform that action at this time.
0 commit comments