1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-03 17:39:25 +02:00

Getting closer to mw2html behaviour - replace escaped chars. Thanks to Steve and David.

This commit is contained in:
martynshaw99 2014-08-28 22:35:08 +00:00
parent 74763375fc
commit dfe26ec6e5

View File

@ -261,7 +261,7 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent,
// //
// The transformations are handled in mw2html by first applying // The transformations are handled in mw2html by first applying
// 'urllib.parse.quote_plus' (escape chars that are not in "always safe" list) // 'urllib.parse.quote_plus' (escape chars that are not in "always safe" list)
// then replacing escape characters (%xx and %25xx) with underscores, // then replacing escape characters (%xx) with underscores,
// and finally removing duplicate / redundant underscores. // and finally removing duplicate / redundant underscores.
// //
// The front page and 'quick_help' are treated as special cases and placed in // The front page and 'quick_help' are treated as special cases and placed in
@ -287,6 +287,12 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent,
// replace 'special characters' with underscores. // replace 'special characters' with underscores.
// RFC 2396 defines the characters a-z, A-Z, 0-9 and ".-_" as "always safe" // RFC 2396 defines the characters a-z, A-Z, 0-9 and ".-_" as "always safe"
// mw2html also replaces "-" with "_" so replace that too. // mw2html also replaces "-" with "_" so replace that too.
// If PageName contains a %xx code, mw2html will transform it:
// '%xx' => '%25xx' => '_'
re.Compile(wxT("%.."));
re.ReplaceAll(&releasePageName, (wxT("_")));
// Now replace all other 'not-safe' characters.
re.Compile(wxT("[^[:alnum:] . [:space:]]")); re.Compile(wxT("[^[:alnum:] . [:space:]]"));
re.ReplaceAll(&releasePageName, (wxT("_"))); re.ReplaceAll(&releasePageName, (wxT("_")));
// Replace spaces with "+" // Replace spaces with "+"
@ -302,7 +308,7 @@ void HelpSystem::ShowHelpDialog(wxWindow *parent,
// Other than index and quick_help, all on-line pages are in subdirectory 'HelpServerManDir'. // Other than index and quick_help, all on-line pages are in subdirectory 'HelpServerManDir'.
webHelpPath = wxT("http://")+HelpSystem::HelpHostname+HelpSystem::HelpServerManDir; webHelpPath = wxT("http://")+HelpSystem::HelpHostname+HelpSystem::HelpServerManDir;
} }
#if IS_ALPHA #if IS_ALPHA
webHelpPage = webHelpPath + PageName; webHelpPage = webHelpPath + PageName;
#else #else