@@ -174,8 +174,7 @@ impl GodotXmlDocs {
174
174
// * [code]C[/code]
175
175
// * [signal C]
176
176
// Must run before others, as [code] will itself match the link syntax
177
- let no_link_regex =
178
- Regex :: new ( "\\ [code]([^.]+?)\\ [/code]|\\ [signal ([A-Za-z0-9_]+?)]" ) . unwrap ( ) ;
177
+ let no_link_regex = Regex :: new ( "\\ [signal ([A-Za-z0-9_]+?)]" ) . unwrap ( ) ;
179
178
180
179
// Covers:
181
180
// * [C]
@@ -201,11 +200,20 @@ impl GodotXmlDocs {
201
200
let godot_doc = godot_doc
202
201
. replace ( "[codeblock]" , "```gdscript" )
203
202
. replace ( "[/codeblock]" , "```" )
203
+ . replace ( "[code]" , "`" )
204
+ . replace ( "[/code]" , "`" )
204
205
. replace ( "[b]" , "**" )
205
206
. replace ( "[/b]" , "**" )
206
207
. replace ( "[i]" , "_" )
207
208
. replace ( "[/i]" , "_" ) ;
208
209
210
+ // Note: we currently don't use c[1], which would be the "kind" (method/member/constant/...)
211
+ // This one could be used to disambiguate the doc-link, e.g. [`{method}`][fn@Self::{method}]
212
+
213
+ // What currently doesn't work are "indexed properties" which are not also exposed as getters, e.g.
214
+ // https://docs.godotengine.org/en/stable/classes/class_area2d.html#properties 'gravity_point'
215
+ // This needs to be implemented first: https://github.com/godot-rust/godot-rust/issues/689
216
+
209
217
// URLs
210
218
let godot_doc = url_regex. replace_all ( & godot_doc, |c : & Captures | {
211
219
let url = & c[ 1 ] ;
@@ -218,31 +226,6 @@ impl GodotXmlDocs {
218
226
}
219
227
} ) ;
220
228
221
- // Note: we currently don't use c[1], which would be the "kind" (method/member/constant/...)
222
- // This one could be used to disambiguate the doc-link, e.g. [`{method}`][fn@Self::{method}]
223
-
224
- // What currently doesn't work are "indexed properties" which are not also exposed as getters, e.g.
225
- // https://docs.godotengine.org/en/stable/classes/class_area2d.html#properties 'gravity_point'
226
- // This needs to be implemented first: https://github.com/godot-rust/godot-rust/issues/689
227
-
228
- // `member` style (no link)
229
- let godot_doc = no_link_regex. replace_all ( & godot_doc, |c : & Captures | {
230
- let member = c. get ( 1 ) . or ( c. get ( 2 ) ) . unwrap ( ) . as_str ( ) ;
231
- format ! ( "`{member}`" , member = member)
232
- } ) ;
233
-
234
- // [Type] style
235
- let godot_doc = type_regex. replace_all ( & godot_doc, |c : & Captures | {
236
- let godot_ty = & c[ 2 ] ;
237
- let rust_ty = Self :: translate_type ( godot_ty) ;
238
-
239
- format ! (
240
- "[`{godot_ty}`][{rust_ty}]" ,
241
- godot_ty = godot_ty,
242
- rust_ty = rust_ty
243
- )
244
- } ) ;
245
-
246
229
// [Type::member] style
247
230
let godot_doc = class_member_regex. replace_all ( & godot_doc, |c : & Captures | {
248
231
let godot_ty = & c[ 2 ] ;
@@ -261,6 +244,23 @@ impl GodotXmlDocs {
261
244
format ! ( "[`{member}`][Self::{member}]" , member = & c[ 2 ] )
262
245
} ) ;
263
246
247
+ // `member` style (no link)
248
+ let godot_doc = no_link_regex. replace_all ( & godot_doc, |c : & Captures | {
249
+ format ! ( "`{member}`" , member = & c[ 1 ] )
250
+ } ) ;
251
+
252
+ // [Type] style
253
+ let godot_doc = type_regex. replace_all ( & godot_doc, |c : & Captures | {
254
+ let godot_ty = & c[ 2 ] ;
255
+ let rust_ty = Self :: translate_type ( godot_ty) ;
256
+
257
+ format ! (
258
+ "[`{godot_ty}`][{rust_ty}]" ,
259
+ godot_ty = godot_ty,
260
+ rust_ty = rust_ty
261
+ )
262
+ } ) ;
263
+
264
264
format ! ( "{}{}" , gdscript_note, godot_doc)
265
265
}
266
266
}
0 commit comments