Font const & running_font,
string & alien_script,
Layout const & style,
+ InsetLayout const & il,
pos_type & i,
pos_type end_pos,
unsigned int & column) const;
? textinset->hasCProtectContent(runparams.moving_arg)
&& !textinset->text().isMainText()
&& inset->lyxCode() != BRANCH_CODE
+ && !runparams.no_cprotect
+ && !inset->getLayout().noCProtect()
: false;
unsigned int count2 = basefont.latexWriteStartChanges(os, bparams,
rp, running_font,
Font const & running_font,
string & alien_script,
Layout const & style,
+ InsetLayout const & il,
pos_type & i,
pos_type end_pos,
unsigned int & column) const
{
char_type const c = owner_->getUChar(bparams, runparams, i);
- if (style.pass_thru || runparams.pass_thru || runparams.find_effective()
+ // Special case: URLs with hyperref need to escape backslash, # and % (#13012).
+ // Both a layout tag and a dedicated inset seem too much effort for this.
+ string const hr_url_escape_chars = "\\#%";
+ if (contains(hr_url_escape_chars, c) && runparams.use_hyperref && il.latexname() == "url"
+ && il.required().find("url") != il.required().end()) {
+ os << "\\";
+ os.put(c);
+ return;
+ }
+
+ if ((style.pass_thru || runparams.pass_thru || runparams.find_effective()
|| contains(style.pass_thru_chars, c)
- || contains(runparams.pass_thru_chars, c)) {
+ || contains(runparams.pass_thru_chars, c))
+ && !contains(runparams.no_pass_thru_chars, c)) {
if (runparams.find_effective()) {
switch (c) {
case '\\':
? textinset->hasCProtectContent(runparams.moving_arg)
&& !textinset->text().isMainText()
&& inInset().lyxCode() != BRANCH_CODE
+ && !runparams.no_cprotect
: false;
column += current_font.latexWriteStartChanges(ots, bparams,
runparams, basefont, last_font, false,
}
}
try {
- d->latexSpecialChar(os, bparams, rp, running_font,
- alien_script, style, i, end_pos, column);
+ d->latexSpecialChar(os, bparams, rp, running_font, alien_script,
+ style, inInset().getLayout(), i, end_pos, column);
} catch (EncodingException & e) {
if (runparams.dryrun) {
os << "<" << _("LyX Warning: ")
else if (c == META_INSET && (options & AS_STR_INSETS)) {
if (c == META_INSET && (options & AS_STR_PLAINTEXT)) {
LASSERT(runparams != nullptr, return docstring());
- if (runparams->find_effective() && getInset(i)->hasToString())
+ if (runparams->find_effective() && getInset(i)->findUsesToString())
getInset(i)->toString(os);
else
getInset(i)->plaintext(os, *runparams);