mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* makeLatexName(): port to FileName.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21848 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c886bc68c2
commit
89435b2857
@ -392,8 +392,9 @@ Undo & Buffer::undo()
|
||||
|
||||
string Buffer::latexName(bool const no_path) const
|
||||
{
|
||||
string const name = changeExtension(makeLatexName(absFileName()), ".tex");
|
||||
return no_path ? onlyFilename(name) : name;
|
||||
FileName latex_name = makeLatexName(pimpl_->filename);
|
||||
return no_path ? latex_name.onlyFileName()
|
||||
: latex_name.absFilename();
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,12 +109,14 @@ string const latex_path(string const & original_path,
|
||||
|
||||
|
||||
// Substitutes spaces with underscores in filename (and path)
|
||||
string const makeLatexName(string const & file)
|
||||
FileName const makeLatexName(FileName const & file)
|
||||
{
|
||||
string name = onlyFilename(file);
|
||||
string const path = onlyPath(file);
|
||||
string name = file.onlyFileName();
|
||||
string const path = file.onlyPath().absFilename() + "/";
|
||||
|
||||
// ok so we scan through the string twice, but who cares.
|
||||
// FIXME: in Unicode time this will break for sure! There is
|
||||
// a non-latin world out there...
|
||||
string const keep = "abcdefghijklmnopqrstuvwxyz"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"@!'()*+,-./0123456789:;<=>?[]`|";
|
||||
@ -123,7 +125,9 @@ string const makeLatexName(string const & file)
|
||||
while ((pos = name.find_first_not_of(keep, pos)) != string::npos)
|
||||
name[pos++] = '_';
|
||||
|
||||
return addName(path, name);
|
||||
FileName latex_name(path + name);
|
||||
latex_name.changeExtension(".tex");
|
||||
return latex_name;
|
||||
}
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@ std::string const latex_path(std::string const & path,
|
||||
latex_path_dots dots = LEAVE_DOTS);
|
||||
|
||||
/// Substitutes active latex characters with underscores in filename
|
||||
std::string const makeLatexName(std::string const & file);
|
||||
FileName const makeLatexName(FileName const & file);
|
||||
|
||||
/** Put the name in quotes suitable for the current shell or python,
|
||||
depending on \p style. */
|
||||
|
Loading…
Reference in New Issue
Block a user