MCPcopy Create free account
hub / github.com/audacity/audacity / LinkExpand

Function LinkExpand

libraries/lib-wx-init/HelpText.cpp:77–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77static wxString LinkExpand( const wxString & Text )
78{
79 wxString Temp = Text;
80 int i,j,k;
81 while( (i=Temp.First( wxT("[[") ))!= wxNOT_FOUND )
82 {
83 wxString Key = Temp.Mid(i+2);
84 j = Key.First( wxT("|") );
85 if( j==wxNOT_FOUND )
86 return Temp;
87 wxString LinkText = Key.Mid( j+1);
88 k = LinkText.First( wxT("]]") );
89 if( k==wxNOT_FOUND )
90 return Temp;
91 Key = Key.Mid( 0, j );
92 LinkText = LinkText.Mid( 0, k );
93
94 LinkText=wxString("<font color=") + HtmlColourOfIndex(clrSample) + wxT(">") +LinkText+"</font>";
95 wxString Replacement;
96 if( Key.StartsWith( wxT("file:") ))
97 {
98 Replacement = FileLink( Key.Mid( 5 ), LinkText );
99 }
100 else if( Key.StartsWith( wxT("http:") ))
101 {
102 Replacement = TypedLink( Key, LinkText );
103 }
104 else if( Key.StartsWith( wxT("https:") ))
105 {
106 Replacement = TypedLink( Key, LinkText );
107 }
108 else if( Key.StartsWith( wxT("mailto:") ))
109 {
110 Replacement = TypedLink( Key, LinkText );
111 }
112 else if( Key.StartsWith( wxT("*URL*") ))
113 {
114 Replacement = TypedLink( Key, LinkText );
115 }
116 else
117 {
118 Replacement = InnerLink( Key, LinkText );
119 }
120
121
122 Temp = Temp.Mid( 0, i ) + Replacement + Temp.Mid( i + j + k + 5 );// 5 for the [[|]]
123 }
124 return Temp;
125}
126
127TranslatableString TitleText( const wxString & Key )
128{

Callers 2

HelpTextFunction · 0.85
FormatHtmlTextFunction · 0.85

Calls 5

HtmlColourOfIndexFunction · 0.85
FileLinkFunction · 0.85
TypedLinkFunction · 0.85
InnerLinkFunction · 0.85
wxStringClass · 0.70

Tested by

no test coverage detected