From e34d5ffea563fa14cbe05446c446920e76ded369 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Sat, 10 Sep 2022 14:01:25 -0400 Subject: [PATCH] Add substitute for method names --- scripts/api_doc_generator.rb | 27 ++++++++++++++++++++------- src/api.yaml | 4 ++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/scripts/api_doc_generator.rb b/scripts/api_doc_generator.rb index 3eba642..31ab544 100755 --- a/scripts/api_doc_generator.rb +++ b/scripts/api_doc_generator.rb @@ -235,17 +235,30 @@ def substitute(lang, str) str.gsub(/%%(.*?)%%/) do |m| cmd = $1.strip! - if lang == "cpp" - if cmd == 'null' - "nullptr" + if cmd =~ /method\(([^,]*),\s+([^\)]*)\)/ + obj = $1 + method = $2 + + display_name = if lang == "cpp" + "#{obj.CamelCase}::#{method.CamelCase}" else - gen_cpp_type_link(cmd) + "wgpu#{obj.CamelCase}#{method.CamelCase}" end + + "[#{display_name}](##{gen_anchor(obj)}-#{method.CamelCase})" else - if cmd == 'null' - "NULL" + if lang == "cpp" + if cmd == 'null' + "nullptr" + else + gen_cpp_type_link(cmd) + end else - gen_c_type_link(cmd) + if cmd == 'null' + "NULL" + else + gen_c_type_link(cmd) + end end end end diff --git a/src/api.yaml b/src/api.yaml index 3a5f433..8f9b9a5 100644 --- a/src/api.yaml +++ b/src/api.yaml @@ -119,12 +119,12 @@ enum: Factor is set to one minus the destionation alpha value.
`(1 - A_dst, 1 - A_dst, 1 - A_dst, 1 - A_dst)` constant: > - Factor is set to the constant value. + Factor is set to the constant value.
(See %% method(render pass encoder, set blend constant) %% for setting of the constant value.)
`(R_const, G_const, B_const, A_const)` one minus constant: > - Factor is set to one minus the constant value. + Factor is set to one minus the constant value.
(See %% method(render pass encoder, set blend constant) %% for setting of the constant value.)
`(1 - R_const, 1 - G_const, 1 - B_const, 1 - A_const)`