File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -164,8 +164,12 @@ def save
164164 FileUtils . mkdir_p ( self . absolute_path ( "ch00" ) )
165165 @xrefs . each do |id_xref , section |
166166 path = self . absolute_path ( "ch00/#{ id_xref } .html" )
167- relurl = "#{ section . relative_url ( nil ) } ##{ id_xref } "
168- front_matter = { "redirect_to" => relurl }
167+ if section == 'redirect-to-en'
168+ url = "book/en/v2/ch00/#{ id_xref } "
169+ else
170+ url = "#{ section . relative_url ( nil ) } ##{ id_xref } "
171+ end
172+ front_matter = { "redirect_to" => url }
169173 File . open ( path , 'w' ) do |file |
170174 file . write ( self . wrap_front_matter ( front_matter ) )
171175 end
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ def genbook(language_code, &get_content)
134134 xlink = html . scan ( /href="1-.*?\. html\# (.*?)"/ )
135135 xlink &.each do |link |
136136 xref = link . first
137+ book . xrefs [ xref ] = 'redirect-to-en' if !book . xrefs [ xref ]
137138 begin
138139 html . gsub! ( /href="1-.*?\. html\# #{ xref } "/ , "href=\" {{< relurl \" #{ book_prefix } ch00/#{ xref } \" >}}\" " )
139140 rescue StandardError
@@ -144,6 +145,7 @@ def genbook(language_code, &get_content)
144145 xlink = html . scan ( /href="\# (.*?)"/ )
145146 xlink &.each do |link |
146147 xref = link . first
148+ book . xrefs [ xref ] = 'redirect-to-en' if !book . xrefs [ xref ]
147149 begin
148150 html . gsub! ( /href="\# #{ xref } "/ , "href=\" {{< relurl \" #{ book_prefix } ch00/#{ xref } \" >}}\" " )
149151 rescue StandardError
You can’t perform that action at this time.
0 commit comments