mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
support:
isLyXFilename -> isLyXFilename isValidLaTeXFilename -> isValidLaTeXFileName isSGMLFilename -> isSGMLFileName git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34242 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
61fa96cbae
commit
bb59d0fd0a
@ -771,7 +771,7 @@ bool Buffer::readDocument(Lexer & lex)
|
||||
if (!params().master.empty()) {
|
||||
FileName const master_file = makeAbsPath(params().master,
|
||||
onlyPath(absFileName()));
|
||||
if (isLyXFilename(master_file.absFileName())) {
|
||||
if (isLyXFileName(master_file.absFileName())) {
|
||||
Buffer * master =
|
||||
checkAndLoadLyXFile(master_file, true);
|
||||
if (master) {
|
||||
|
@ -1112,7 +1112,7 @@ docstring const LaTeXFeatures::getIncludedFiles(string const & fname) const
|
||||
fi != end; ++fi)
|
||||
// FIXME UNICODE
|
||||
sgmlpreamble << "\n<!ENTITY " << fi->first
|
||||
<< (isSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
|
||||
<< (isSGMLFileName(fi->second) ? " SYSTEM \"" : " \"")
|
||||
<< makeRelPath(from_utf8(fi->second), basename) << "\">";
|
||||
|
||||
return sgmlpreamble.str();
|
||||
|
@ -3093,7 +3093,7 @@ void GuiDocument::dispatchParams()
|
||||
if (!params().master.empty()) {
|
||||
FileName const master_file = support::makeAbsPath(params().master,
|
||||
support::onlyPath(buffer().absFileName()));
|
||||
if (isLyXFilename(master_file.absFileName())) {
|
||||
if (isLyXFileName(master_file.absFileName())) {
|
||||
Buffer * master = checkAndLoadLyXFile(master_file);
|
||||
if (master) {
|
||||
if (master->isChild(const_cast<Buffer *>(&buffer())))
|
||||
|
@ -2092,7 +2092,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname)
|
||||
dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
|
||||
dlg.setButton2(qt_("Templates|#T#t"), toqstr(lyxrc.template_path));
|
||||
|
||||
if (!isLyXFilename(fname.absFileName()))
|
||||
if (!isLyXFileName(fname.absFileName()))
|
||||
fname.changeExtension(".lyx");
|
||||
|
||||
FileDialog::Result result =
|
||||
@ -2108,7 +2108,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname)
|
||||
if (fname.empty())
|
||||
return false;
|
||||
|
||||
if (!isLyXFilename(fname.absFileName()))
|
||||
if (!isLyXFileName(fname.absFileName()))
|
||||
fname.changeExtension(".lyx");
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ int writeExternal(InsetExternalParams const & params,
|
||||
string const absname = makeAbsPath(
|
||||
params.filename.outputFileName(buffer.filePath()), buffer.filePath()).absFileName();
|
||||
|
||||
if (!external_in_tmpdir && !isValidLaTeXFilename(absname)) {
|
||||
if (!external_in_tmpdir && !isValidLaTeXFileName(absname)) {
|
||||
lyx::frontend::Alert::warning(_("Invalid filename"),
|
||||
_("The following filename is likely to cause trouble "
|
||||
"when running the exported file through LaTeX: ") +
|
||||
|
@ -280,7 +280,7 @@ int InsetBibtex::latex(odocstream & os, OutputParams const & runparams) const
|
||||
<< endl;
|
||||
}
|
||||
} else if (!runparams.inComment && runparams.nice && not_from_texmf &&
|
||||
!isValidLaTeXFilename(database)) {
|
||||
!isValidLaTeXFileName(database)) {
|
||||
frontend::Alert::warning(_("Invalid filename"),
|
||||
_("The following filename is likely to cause trouble "
|
||||
"when running the exported file through LaTeX: ") +
|
||||
|
@ -589,7 +589,7 @@ string InsetGraphics::prepareFile(OutputParams const & runparams) const
|
||||
params().filename.outputFileName(masterBuffer->filePath()) :
|
||||
onlyFileName(temp_file.absFileName());
|
||||
|
||||
if (runparams.nice && !isValidLaTeXFilename(output_file)) {
|
||||
if (runparams.nice && !isValidLaTeXFileName(output_file)) {
|
||||
frontend::Alert::warning(_("Invalid filename"),
|
||||
_("The following filename is likely to cause trouble "
|
||||
"when running the exported file through LaTeX: ") +
|
||||
|
@ -423,7 +423,7 @@ Buffer * InsetInclude::loadIfNeeded() const
|
||||
child_buffer_ = 0;
|
||||
}
|
||||
|
||||
if (!isLyXFilename(included_file.absFileName()))
|
||||
if (!isLyXFileName(included_file.absFileName()))
|
||||
return 0;
|
||||
|
||||
Buffer * child = theBufferList().getBuffer(included_file);
|
||||
@ -505,7 +505,7 @@ int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const
|
||||
|
||||
if (!runparams.nice)
|
||||
incfile = mangled;
|
||||
else if (!isValidLaTeXFilename(incfile)) {
|
||||
else if (!isValidLaTeXFileName(incfile)) {
|
||||
frontend::Alert::warning(_("Invalid filename"),
|
||||
_("The following filename is likely to cause trouble "
|
||||
"when running the exported file through LaTeX: ") +
|
||||
@ -519,7 +519,7 @@ int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const
|
||||
//Don't try to load or copy the file if we're
|
||||
//in a comment or doing a dryrun
|
||||
} else if (isInputOrInclude(params()) &&
|
||||
isLyXFilename(included_file.absFileName())) {
|
||||
isLyXFileName(included_file.absFileName())) {
|
||||
//if it's a LyX file and we're inputting or including,
|
||||
//try to load it so we can write the associated latex
|
||||
if (!loadIfNeeded())
|
||||
@ -612,7 +612,7 @@ int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const
|
||||
exportfile);
|
||||
|
||||
// \input wants file with extension (default is .tex)
|
||||
if (!isLyXFilename(included_file.absFileName())) {
|
||||
if (!isLyXFileName(included_file.absFileName())) {
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName())
|
||||
@ -679,7 +679,7 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const &rp) const
|
||||
// (If we wanted to get really arcane, we could run some tex2html
|
||||
// converter on the included file. But that's just masochistic.)
|
||||
FileName const included_file = includedFilename(buffer(), params());
|
||||
if (!isLyXFilename(included_file.absFileName())) {
|
||||
if (!isLyXFileName(included_file.absFileName())) {
|
||||
frontend::Alert::warning(_("Unsupported Inclusion"),
|
||||
bformat(_("LyX does not know how to include non-LyX files when "
|
||||
"generating HTML output. Offending file:\n%1$s"),
|
||||
@ -789,7 +789,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
|
||||
string const included_file =
|
||||
includedFilename(buffer(), params()).absFileName();
|
||||
|
||||
if (isLyXFilename(included_file))
|
||||
if (isLyXFileName(included_file))
|
||||
writefile = changeExtension(included_file, ".sgml");
|
||||
else
|
||||
writefile = included_file;
|
||||
|
@ -55,19 +55,19 @@ using namespace std;
|
||||
namespace lyx {
|
||||
namespace support {
|
||||
|
||||
bool isLyXFilename(string const & filename)
|
||||
bool isLyXFileName(string const & filename)
|
||||
{
|
||||
return suffixIs(ascii_lowercase(filename), ".lyx");
|
||||
}
|
||||
|
||||
|
||||
bool isSGMLFilename(string const & filename)
|
||||
bool isSGMLFileName(string const & filename)
|
||||
{
|
||||
return suffixIs(ascii_lowercase(filename), ".sgml");
|
||||
}
|
||||
|
||||
|
||||
bool isValidLaTeXFilename(string const & filename)
|
||||
bool isValidLaTeXFileName(string const & filename)
|
||||
{
|
||||
string const invalid_chars("#$%{}()[]\"^");
|
||||
return filename.find_first_of(invalid_chars) == string::npos;
|
||||
|
@ -64,13 +64,13 @@ FileName const fileSearch(std::string const & path,
|
||||
search_mode mode = must_exist);
|
||||
|
||||
///
|
||||
bool isLyXFilename(std::string const & filename);
|
||||
bool isLyXFileName(std::string const & filename);
|
||||
|
||||
///
|
||||
bool isSGMLFilename(std::string const & filename);
|
||||
bool isSGMLFileName(std::string const & filename);
|
||||
|
||||
///
|
||||
bool isValidLaTeXFilename(std::string const & filename);
|
||||
bool isValidLaTeXFileName(std::string const & filename);
|
||||
|
||||
/** Returns the path of a library data file.
|
||||
Search the file name.ext in the subdirectory dir of
|
||||
|
Loading…
Reference in New Issue
Block a user