mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
InsetHyperlink.cpp: fix http://bugzilla.lyx.org/show_bug.cgi?id=5686
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28141 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f048ed70ee
commit
03264aab68
@ -84,6 +84,16 @@ int InsetHyperlink::latex(odocstream & os, OutputParams const & runparams) const
|
|||||||
url.replace(pos, 1, backslash + chars_url[k]);
|
url.replace(pos, 1, backslash + chars_url[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Replace the "\" character with a "/" because "\" is not allowed in
|
||||||
|
// URLs and by \href. Only do this when the following character
|
||||||
|
// is not also a "\", because "\\" is valid code
|
||||||
|
docstring const slash = from_ascii("/");
|
||||||
|
for (size_t i = 0, pos;
|
||||||
|
(pos = url.find('\\', i)) != string::npos;
|
||||||
|
i = pos + 2) {
|
||||||
|
if (url[pos + 1] != '\\')
|
||||||
|
url.replace(pos, 1, slash);
|
||||||
|
}
|
||||||
|
|
||||||
// add "http://" when the type is web (type = empty)
|
// add "http://" when the type is web (type = empty)
|
||||||
// and no "://" or "run:" is given
|
// and no "://" or "run:" is given
|
||||||
@ -100,7 +110,6 @@ int InsetHyperlink::latex(odocstream & os, OutputParams const & runparams) const
|
|||||||
// The characters in chars_name[] need to be changed to a command when
|
// The characters in chars_name[] need to be changed to a command when
|
||||||
// they are in the name field.
|
// they are in the name field.
|
||||||
if (!name.empty()) {
|
if (!name.empty()) {
|
||||||
|
|
||||||
// handle the "\" character, but only when the following character
|
// handle the "\" character, but only when the following character
|
||||||
// is not also a "\", because "\\" is valid code
|
// is not also a "\", because "\\" is valid code
|
||||||
docstring const textbackslash = from_ascii("\\textbackslash{}");
|
docstring const textbackslash = from_ascii("\\textbackslash{}");
|
||||||
@ -110,6 +119,8 @@ int InsetHyperlink::latex(odocstream & os, OutputParams const & runparams) const
|
|||||||
if (name[pos + 1] != '\\')
|
if (name[pos + 1] != '\\')
|
||||||
name.replace(pos, 1, textbackslash);
|
name.replace(pos, 1, textbackslash);
|
||||||
}
|
}
|
||||||
|
// The characters in chars_name[] need to be changed to a command when
|
||||||
|
// they are in the name field.
|
||||||
for (int k = 0; k < 6; k++) {
|
for (int k = 0; k < 6; k++) {
|
||||||
for (size_t i = 0, pos;
|
for (size_t i = 0, pos;
|
||||||
(pos = name.find(chars_name[k], i)) != string::npos;
|
(pos = name.find(chars_name[k], i)) != string::npos;
|
||||||
|
Loading…
Reference in New Issue
Block a user