mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Module categories, for Pavel.
Do free free to change the categories. I just did these ones for testing, really. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31033 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d92ff67005
commit
7035f4cabb
@ -854,6 +854,7 @@ def checkModulesConfig():
|
||||
## It has been automatically generated by configure
|
||||
## Use "Options/Reconfigure" if you need to update it after a
|
||||
## configuration change.
|
||||
## "ModuleName" "filename" "Description" "Packages" "Requires" "Excludes" "Category"
|
||||
''')
|
||||
# build the list of available modules
|
||||
foundClasses = []
|
||||
@ -880,17 +881,19 @@ def processModuleFile(file, bool_docbook):
|
||||
#DescriptionEnd
|
||||
#Requires: [list of required modules]
|
||||
#Excludes: [list of excluded modules]
|
||||
The last two lines are optional
|
||||
#Category: [category name]
|
||||
The last three lines are optional (though do give a category).
|
||||
We expect output:
|
||||
"ModuleName" "filename" "Description" "Packages" "Requires" "Excludes"
|
||||
"ModuleName" "filename" "Description" "Packages" "Requires" "Excludes" "Category"
|
||||
'''
|
||||
p = re.compile(r'\DeclareLyXModule\s*(?:\[([^]]*?)\])?{(.*)}')
|
||||
r = re.compile(r'#+\s*Requires: (.*)')
|
||||
x = re.compile(r'#+\s*Excludes: (.*)')
|
||||
c = re.compile(r'#+\s*Category: (.*)')
|
||||
b = re.compile(r'#+\s*DescriptionBegin\s*$')
|
||||
e = re.compile(r'#+\s*DescriptionEnd\s*$')
|
||||
|
||||
modname = desc = pkgs = req = excl = ""
|
||||
modname = desc = pkgs = req = excl = catgy = ""
|
||||
readingDescription = False
|
||||
descLines = []
|
||||
filename = file.split(os.sep)[-1]
|
||||
@ -930,8 +933,12 @@ def processModuleFile(file, bool_docbook):
|
||||
tmp = [s.strip() for s in excl.split("|")]
|
||||
excl = "|".join(tmp)
|
||||
continue
|
||||
res = c.search(line)
|
||||
if res != None:
|
||||
catgy = res.group(1)
|
||||
continue
|
||||
if modname != "":
|
||||
return '"%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, desc, pkgs, req, excl)
|
||||
return '"%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, desc, pkgs, req, excl, catgy)
|
||||
logger.warning("Module file without \DeclareLyXModule line. ")
|
||||
return ""
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#Define character style for dropped capitals.
|
||||
#Hint: try to use math and its font styles for a different shape.
|
||||
#DescriptionEnd
|
||||
#Category: charstyles
|
||||
|
||||
Format 16
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#DescriptionBegin
|
||||
#Defines some character styles for logical markup: noun, emph, strong, and code.
|
||||
#DescriptionEnd
|
||||
#Category: charstyles
|
||||
|
||||
# Author : Martin vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#DescriptionBegin
|
||||
#Allows to use Noweb as a literate programming tool.
|
||||
#DescriptionEnd
|
||||
#Category: literate
|
||||
|
||||
# Suggested style to write your code:
|
||||
# Within same scrap, lines are separated by newlines (Ctrl-Return), use:
|
||||
|
@ -2,6 +2,7 @@
|
||||
#DescriptionBegin
|
||||
#Allows to use the statistical language S/R as a literate programming tool.
|
||||
#DescriptionEnd
|
||||
#Category: literate
|
||||
|
||||
# Within the chunk, lines are separated by newlines (Ctrl-Return)!
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#forms.
|
||||
#DescriptionEnd
|
||||
#Requires: theorems-ams
|
||||
#Category: theorems
|
||||
|
||||
# Original Author : David L. Johnson <dlj0@lehigh.edu>
|
||||
# Probably broken by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
@ -6,6 +6,7 @@
|
||||
#changed by loading one of the Theorems (By ...) modules.
|
||||
#DescriptionEnd
|
||||
#Excludes: theorems-std | theorems-starred
|
||||
#Category: theorems
|
||||
|
||||
# Original Author : David L. Johnson <dlj0@lehigh.edu>
|
||||
# Probably broken by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
@ -5,6 +5,7 @@
|
||||
#DescriptionEnd
|
||||
#Requires: theorems-std | theorems-ams
|
||||
#Excludes: theorems-sec
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#DescriptionEnd
|
||||
#Requires: theorems-std | theorems-ams
|
||||
#Excludes: theorems-chap
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#the extended AMS machinery.
|
||||
#DescriptionEnd
|
||||
#Excludes: theorems-std | theorems-ams
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#changed by loading one of the Theorems (Ordered By ...) modules.
|
||||
#DescriptionEnd
|
||||
#Excludes: theorems-ams | theorems-starred
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -35,9 +35,10 @@ ModuleList moduleList;
|
||||
|
||||
LyXModule::LyXModule(string const & n, string const & i,
|
||||
string const & d, vector<string> const & p,
|
||||
vector<string> const & r, vector<string> const & e):
|
||||
name(n), id(i), description(d),
|
||||
packageList(p), requiredModules(r), excludedModules(e),
|
||||
vector<string> const & r, vector<string> const & e,
|
||||
string const & c):
|
||||
name(n), id(i), description(d), packageList(p),
|
||||
requiredModules(r), excludedModules(e), category_(c),
|
||||
checked(false)
|
||||
{
|
||||
filename = id + ".module";
|
||||
@ -189,9 +190,13 @@ bool ModuleList::read()
|
||||
str = split(str, p, '|');
|
||||
exc.push_back(p);
|
||||
}
|
||||
if (!lex.next())
|
||||
break;
|
||||
string const catgy = lex.getString();
|
||||
LYXERR(Debug::TCLASS, "Category: " << catgy);
|
||||
// This code is run when we have
|
||||
// modName, fname, desc, pkgs, req, and exc
|
||||
addLayoutModule(modName, fname, desc, pkgs, req, exc);
|
||||
// modName, fname, desc, pkgs, req, exc, and catgy
|
||||
addLayoutModule(modName, fname, desc, pkgs, req, exc, catgy);
|
||||
} // end switch
|
||||
} //end while
|
||||
|
||||
@ -206,9 +211,9 @@ bool ModuleList::read()
|
||||
void ModuleList::addLayoutModule(string const & moduleName,
|
||||
string const & filename, string const & description,
|
||||
vector<string> const & pkgs, vector<string> const & req,
|
||||
vector<string> const & exc)
|
||||
vector<string> const & exc, string const & catgy)
|
||||
{
|
||||
LyXModule lm(moduleName, filename, description, pkgs, req, exc);
|
||||
LyXModule lm(moduleName, filename, description, pkgs, req, exc, catgy);
|
||||
modlist_.push_back(lm);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
namespace lyx {
|
||||
|
||||
/**
|
||||
* This struct represents a particular LyX "module", which is a like a layout
|
||||
* This class represents a particular LyX "module", which is a like a layout
|
||||
* file, except that it does not stand alone. In that sense, it is more like
|
||||
* a LaTeX package, where a layout file corresponds to a LaTeX class. Or, in
|
||||
* LyX's own terms, a module is more like an included file that can be used
|
||||
@ -37,9 +37,11 @@ namespace lyx {
|
||||
* #DescriptionEnd
|
||||
* #Requires: theorems-std | theorems-ams
|
||||
* #Excludes: theorems-chap
|
||||
* #Category: theorems
|
||||
* The description is used in the gui to give information to the user. The
|
||||
* Requires and Excludes lines are read by the configuration script and
|
||||
* written to a file lyxmodules.lst in the user configuration directory.
|
||||
* Requires, Excludes, and Categofy lines are read by the configuration script
|
||||
* and written to a file lyxmodules.lst in the user configuration directory.
|
||||
* That file is then read on startup to populate the ModuleList, below.
|
||||
*
|
||||
* Modules can also be "provided" or "excluded" by document classes, using
|
||||
* the ProvidesModule and ExcludesModule tags.
|
||||
@ -51,7 +53,8 @@ public:
|
||||
LyXModule(std::string const & n, std::string const & i,
|
||||
std::string const & d, std::vector<std::string> const & p,
|
||||
std::vector<std::string> const & r,
|
||||
std::vector<std::string> const & e);
|
||||
std::vector<std::string> const & e,
|
||||
std::string const & c);
|
||||
/// whether the required packages are available
|
||||
bool isAvailable();
|
||||
///
|
||||
@ -71,6 +74,8 @@ public:
|
||||
/// Modules this one excludes: the list should be treated disjunctively
|
||||
std::vector<std::string> const & getExcludedModules() const
|
||||
{ return excludedModules; }
|
||||
///
|
||||
std::string category() const { return category_; }
|
||||
/// \return true if the module is compatible with this one, i.e.,
|
||||
/// it does not exclude us and we do not exclude it.
|
||||
/// this will also return true if modName is unknown and we do not
|
||||
@ -95,6 +100,8 @@ private:
|
||||
/// Modules this one excludes: none of these
|
||||
std::vector<std::string> excludedModules;
|
||||
///
|
||||
std::string category_;
|
||||
///
|
||||
bool checked;
|
||||
///
|
||||
bool available;
|
||||
@ -133,7 +140,8 @@ private:
|
||||
/// add a module to the list
|
||||
void addLayoutModule(std::string const &, std::string const &,
|
||||
std::string const &, std::vector<std::string> const &,
|
||||
std::vector<std::string> const &, std::vector<std::string> const &);
|
||||
std::vector<std::string> const &, std::vector<std::string> const &,
|
||||
std::string const &);
|
||||
///
|
||||
std::vector<LyXModule> modlist_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user