case1
Options[f] = {"t" -> "0"}; f[___, OptionsPattern[]] := StringReplace["content", "t" :> OptionValue["t"]] f[] (* con0en0 *)
case2
rule = {"t" -> OptionValue["t1"]}; Options[gg] = {"t1" -> "T1", "t2" -> "1"}; gg[___, OptionsPattern[]] := StringReplace["content", rule] gg[1] (* con~~OptionValue[t1]~~en~~OptionValue[t1] *)
Here OptionValue
couldn't get the value of "t1"
So, how to make case 2 works like case 1?
I found one solution is
Options[gg]={"t1"->"T1","t2"->"1"};
gg[___,OptionsPattern[]]:=Hold[StringReplace]["content",rule]//ReleaseHold//Evaluate
Any simpler methods?