@@ -62,16 +62,16 @@ def wrap_front_matter(front_matter)
62
62
"#{ front_matter . to_yaml . sub ( "---\n " , "---\n #{ content_note } \n " ) } ---\n "
63
63
end
64
64
65
- def expand_l10n ( path , content , get_f_content , categories )
66
- content . gsub! ( /include::({build_dir}\/ )?(\S +)\. txt / ) do |line |
65
+ def expand_l10n ( path , content , get_f_content , categories , ext )
66
+ content . gsub! ( /include::({build_dir}\/ )?(\S +)\. #{ ext } / ) do |line |
67
67
line . gsub! ( "include::" , "" )
68
68
if categories [ line ]
69
69
new_content = categories [ line ]
70
70
else
71
71
new_content , new_path = get_f_content . call ( path , line )
72
72
end
73
73
if new_content
74
- expand_l10n ( new_path , new_content , get_f_content , categories )
74
+ expand_l10n ( new_path , new_content , get_f_content , categories , ext )
75
75
else
76
76
"\n \n [WARNING]\n ====\n Missing `#{ new_path } `\n \n See original version for this content.\n ====\n \n "
77
77
end
@@ -89,22 +89,24 @@ def index_l10n_doc(filter_tags, doc_list, get_content)
89
89
90
90
filter_tags . call ( rebuild , false ) . sort_by { |tag | Version . version_to_num ( tag . first [ 1 ..] ) } . each do |tag |
91
91
name , commit_sha , tree_sha , ts = tag
92
- puts "#{ name } : #{ ts } , #{ commit_sha [ 0 , 8 ] } , #{ tree_sha [ 0 , 8 ] } "
92
+ puts "#{ name } : #{ ts } , #{ commit_sha [ 0 , 8 ] } , #{ tree_sha [ 0 , 8 ] } " , ts
93
93
94
94
next if !rerun && l10n [ "committed" ] and l10n [ "committed" ] >= ts
95
95
96
96
l10n [ "commit_sha" ] = commit_sha
97
97
l10n [ "tree_sha" ] = tree_sha
98
98
l10n [ "committed" ] = ts
99
99
100
+ ext = ts < Time . parse ( '2025-03-03 18:00:56 +0100' ) ? 'txt' : 'adoc'
101
+
100
102
tag_files = doc_list . call ( tree_sha )
101
103
doc_files = tag_files . select do |ent |
102
104
ent . first =~
103
105
/^([-_\w ]+)\/ (
104
106
(
105
107
git.* |
106
108
scalar
107
- )\. txt )/x
109
+ )\. #{ ext } )/x
108
110
end
109
111
110
112
puts "Found #{ doc_files . size } entries"
@@ -126,7 +128,8 @@ def index_l10n_doc(filter_tags, doc_list, get_content)
126
128
full_path , sha = entry
127
129
ids = Set . new ( [ ] )
128
130
lang = File . dirname ( full_path )
129
- path = File . basename ( full_path , ".txt" )
131
+ path = File . basename ( full_path , ".#{ ext } " )
132
+ txt_path = path . sub ( /\. adoc$/ , '.txt' )
130
133
131
134
doc_path = "#{ SITE_ROOT } external/docs/content/docs/#{ path } "
132
135
@@ -141,7 +144,7 @@ def index_l10n_doc(filter_tags, doc_list, get_content)
141
144
142
145
content = get_content . call sha
143
146
categories = { }
144
- expand_l10n ( full_path , content , get_content_f , categories )
147
+ expand_l10n ( full_path , content , get_content_f , categories , ext )
145
148
content . gsub! ( /link:(?:technical\/ )?(\S *?)\. html(\# \S *?)?\[ (.*?)\] /m ) do |match |
146
149
check_paths . add ( "docs/#{ $1} /#{ lang } " )
147
150
"link:/docs/#{ $1} /#{ lang } #{ $2} [#{ $3} ]"
@@ -172,7 +175,9 @@ def index_l10n_doc(filter_tags, doc_list, get_content)
172
175
# HTML anchor on hdlist1 (i.e. command options)
173
176
html . gsub! ( /<dt class="hdlist1">(.*?)<\/ dt>/ ) do |_m |
174
177
text = $1. tr ( "^A-Za-z0-9-" , "" )
175
- anchor = "#{ path } -#{ text } "
178
+ # use txt_path for backward compatibility of already-existing
179
+ # deep links shared across the interwebs.
180
+ anchor = "#{ txt_path } -#{ text } "
176
181
# handle anchor collisions by appending -1
177
182
anchor += "-1" while ids . include? ( anchor )
178
183
ids . add ( anchor )
0 commit comments