From 96dfec471f7fd62e5239af3ad347d655295153cc Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 1 Nov 2010 21:54:20 +0000 Subject: [PATCH] Partially fix #5108. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35984 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetRef.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index 0982d5e5d5..73ee8cbbcb 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -77,21 +77,24 @@ docstring InsetRef::getFormattedCmd( docstring const & ref, docstring & label) const { static docstring const defcmd = from_ascii("\\ref"); - // default is that label is data - // we'll change it if need be - if (!buffer().params().use_refstyle) { - label = ref; - return from_ascii("\\prettyref"); - } - + static docstring const prtcmd = from_ascii("\\prettyref"); + docstring prefix; label = split(ref, prefix, ':'); + + // we have to have xxx:xxxxx... if (prefix.empty()) { LYXERR0("Label `" << label << "' contains no prefix."); label = ref; return defcmd; } + if (!buffer().params().use_refstyle) { + // \prettyref uses the whole label + label = ref; + return prtcmd; + } + // make sure the prefix is legal for a latex command int const len = prefix.size(); for (int i = 0; i < len; i++) {