mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Make module categories (almost) great again
The category tag was rarely used and thus not very useful. This adds categorization to most modules (the rest will follow) and uses the \DeclareCategory tag we use in layouts rather than the extra syntax we used in modules. Categories are now added to the po files and translated. Note that this is work in progress: the current categories are still subject to change. The ultimate goal of this is to sort the modules in the GUI by category as we do with layouts, examples and templates (and add a filter to search for specific modules) As it is now (with the many modules we accumulated), the module selector is not really usable anymore. If you don't happen to know how exactly a module is named, selecting a module is really a PITA.
This commit is contained in:
parent
990f1eca4a
commit
b5af05b4a7
@ -1517,7 +1517,7 @@ def processModuleFile(file, filename, bool_docbook):
|
||||
remods = re.compile(b'\s*#\s*\\\\DeclareLyXModule\s*(?:\[([^]]*?)\])?{(.*)}')
|
||||
rereqs = re.compile(b'\s*#+\s*Requires: (.*)')
|
||||
reexcs = re.compile(b'\s*#+\s*Excludes: (.*)')
|
||||
recaty = re.compile(b'\s*#+\s*Category: (.*)')
|
||||
recaty = re.compile(b'\\s*#\\s*\\\\DeclareCategory{(.*)}\\s*$')
|
||||
redbeg = re.compile(b'\s*#+\s*DescriptionBegin\s*$')
|
||||
redend = re.compile(b'\s*#+\s*DescriptionEnd\s*$')
|
||||
|
||||
|
@ -8545,12 +8545,39 @@ A module must begin with a line like the following:
|
||||
\begin_layout LyX-Code
|
||||
#
|
||||
\backslash
|
||||
DeclareLyXModule[endnotes.sty]{Endnotes}
|
||||
DeclareLyXModule[endnotes.sty]{Endnotes}
|
||||
\change_inserted -712698321 1554395911
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout LyX-Code
|
||||
|
||||
\change_inserted -712698321 1554395924
|
||||
|
||||
\size small
|
||||
#
|
||||
\backslash
|
||||
DeclareCategory{Foot- and Endnotes}
|
||||
\change_deleted -712698321 1554395911
|
||||
|
||||
\size default
|
||||
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
The mandatory argument, in curly brackets, is the name of the module, as
|
||||
it should appear in
|
||||
The mandatory argument
|
||||
\change_inserted -712698321 1554395956
|
||||
of
|
||||
\family typewriter
|
||||
|
||||
\backslash
|
||||
DeclareLyXModule
|
||||
\change_unchanged
|
||||
|
||||
\family default
|
||||
, in curly brackets, is the name of the module, as it should appear in
|
||||
\begin_inset Flex Noun
|
||||
status collapsed
|
||||
|
||||
@ -8598,10 +8625,28 @@ to
|
||||
\end_inset
|
||||
|
||||
'.
|
||||
|
||||
\change_inserted -712698321 1554396133
|
||||
The
|
||||
\family typewriter
|
||||
|
||||
\backslash
|
||||
DeclareCategory
|
||||
\family default
|
||||
declaration is not strictly mandatory, but you should add it, since it
|
||||
is helpful to find the module.
|
||||
Please have a look at the existing module categories and if appropriate,
|
||||
use one of those.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
The module declaration should then be followed by lines like the following:
|
||||
The module
|
||||
\change_inserted -712698321 1554395988
|
||||
and category
|
||||
\change_unchanged
|
||||
declaration should then be followed by lines like the following:
|
||||
\begin_inset Foot
|
||||
status collapsed
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Title and Preamble Hacks}
|
||||
#\DeclareCategory{Fixes and Hacks}
|
||||
#DescriptionBegin
|
||||
#Provides two new styles:
|
||||
#1. An 'In Preamble' style that puts whatever is entered into it into the preamble.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[algorithm2e.sty]{Algorithm2e}
|
||||
#\DeclareCategory{Floats}
|
||||
#DescriptionBegin
|
||||
# Use the algorithm2e package for algorithm floats rather
|
||||
# than LyX's home-brewed algorithm floats. Use the Algorithm
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[braille.sty]{Braille}
|
||||
#\DeclareCategory{Accessibility}
|
||||
#DescriptionBegin
|
||||
#Defines an environment to typeset Braille.
|
||||
#For more details see Braille.lyx in examples.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[endnotes.sty]{Endnote}
|
||||
#\DeclareLyXModule[endnotes.sty]{Endnotes}
|
||||
#\DeclareCategory{Foot- and Endnotes}
|
||||
#DescriptionBegin
|
||||
#Adds an endnote inset, in addition to footnotes. You will need to add
|
||||
#\theendnotes in TeX-code where you want the endnotes to appear.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[enumitem.sty]{Customisable Lists (enumitem)}
|
||||
#\DeclareCategory{List Enhancements}
|
||||
#DescriptionBegin
|
||||
# Controls the layout of enumerate, itemize, description, and list/labeling.
|
||||
# See section Customized Lists of the User's Guide for a detailed description.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Number Equations by Section}
|
||||
#\DeclareCategory{Maths}
|
||||
#DescriptionBegin
|
||||
#Resets the equation number at section start and prepends
|
||||
#the section number to the equation number, as in '(2.1)'.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Fix cm}
|
||||
#\DeclareCategory{Fixes and Hacks}
|
||||
#DescriptionBegin
|
||||
#Fix-cm improves the appearance of Computer Modern fonts and makes them
|
||||
#available with arbitrary sizes. For details see the documentation
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Fix LaTeX}
|
||||
#\DeclareLyXModule{Fix LaTeX (Obsolete)}
|
||||
#\DeclareCategory{Fixes and Hacks}
|
||||
#DescriptionBegin
|
||||
#Loads the LaTeX package fixltx2e which contains some bug fixes for LaTeX.
|
||||
#Those fixes were not part of older LaTeX kernels because of backward compatibility.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[fixme.sty]{FiXme}
|
||||
#\DeclareCategory{Annotations}
|
||||
#DescriptionBegin
|
||||
#Provides 'FiXme' (marginal) annotations for document revision purposes.
|
||||
#A list of annotations can be produced by using the 'List of FIXMEs' paragraph style.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[endnotes.sty]{Foot to End}
|
||||
#\DeclareCategory{Foot- and Endnotes}
|
||||
#DescriptionBegin
|
||||
#Sets all footnotes as endnotes. You will need to add \theendnotes
|
||||
#in TeX-code where you want the endnotes to appear.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{GraphicBoxes}
|
||||
#\DeclareCategory{Boxes}
|
||||
#DescriptionBegin
|
||||
#Boxes to scale and rotate its contents
|
||||
#DescriptionEnd
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Hanging}
|
||||
#\DeclareCategory{Paragraph Styles}
|
||||
#DescriptionBegin
|
||||
#Adds an environment for hanging paragraphs.
|
||||
#Hanging paragraph is a paragraph in which the first line is set to the left margin, but all subsequent lines are indented.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Initials}
|
||||
#\DeclareCategory{Paragraph Styles}
|
||||
#DescriptionBegin
|
||||
#Define a style for paragraphs with an initial.
|
||||
#See the EmbeddedObjects manual for a detailed description.
|
||||
|
@ -1,9 +1,9 @@
|
||||
#\DeclareLyXModule[knitr->latex]{Rnw (knitr)}
|
||||
#\DeclareCategory{Literate Programming}
|
||||
#DescriptionBegin
|
||||
#Uses the knitr package in R for dynamic report generation. This R package has to be installed for this module to work: install.packages('knitr'). Note it depends on R >= 2.14.1.
|
||||
#For more info see http://yihui.name/knitr
|
||||
#DescriptionEnd
|
||||
#Category: literate
|
||||
#Excludes: lilypond | sweave
|
||||
|
||||
Format 72
|
||||
|
@ -1,8 +1,8 @@
|
||||
#\DeclareLyXModule{Logical Markup}
|
||||
#\DeclareCategory{Text Markup}
|
||||
#DescriptionBegin
|
||||
#Defines some character styles for logical markup: noun, emph, strong, and code.
|
||||
#DescriptionEnd
|
||||
#Category: charstyles
|
||||
|
||||
# Author : Martin vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Minimalistic}
|
||||
#\DeclareCategory{Fixes and Hacks}
|
||||
#DescriptionBegin
|
||||
# Redefines several insets (Index, Branch, URL) as being Minimalistic.
|
||||
#DescriptionEnd
|
||||
|
@ -1,8 +1,8 @@
|
||||
#\DeclareLyXModule[literate->latex,noweb.sty]{Noweb}
|
||||
#\DeclareCategory{Literate Programming}
|
||||
#DescriptionBegin
|
||||
#Allows to use Noweb as a literate programming tool.
|
||||
#DescriptionEnd
|
||||
#Category: literate
|
||||
|
||||
Format 72
|
||||
Input litinsets.inc
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[paralist.sty]{Paragraph Lists (paralist)}
|
||||
#\DeclareCategory{List Enhancements}
|
||||
#DescriptionBegin
|
||||
# The package paralist provides some new list environments.
|
||||
# Itemized and enumerated lists can be typeset within paragraphs, as
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[datetime.sty,fmtcount.sty]{PDF Comments}
|
||||
#\DeclareCategory{Annotations}
|
||||
#DescriptionBegin
|
||||
#Provides various kinds of annotations for the PDF output. The module uses
|
||||
#the pdfcomment package. Please consult the LyX example file PDF-comment.lyx
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{PDF Form}
|
||||
#\DeclareCategory{Annotations}
|
||||
#DescriptionBegin
|
||||
#Provides fields and buttons for PDF forms. The module uses
|
||||
#the LaTeX package hyperref. Please consult the LyX example file PDF-form.lyx
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[sectionbox.sty]{Section Boxes}
|
||||
#\DeclareCategory{Boxes}
|
||||
#DescriptionBegin
|
||||
#Defines Boxes with section header. Mainly intended for
|
||||
#the SciPoster class.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[shapepar.sty]{Custom Paragraph Shapes}
|
||||
#\DeclareCategory{Paragraph Styles}
|
||||
#DescriptionBegin
|
||||
#Provides several paragraph shapes as well as commands to define custom
|
||||
#shapes. For a description see LyX's Additional
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[soul.sty]{Hyphenatable Text Markup (Soul)}
|
||||
#\DeclareCategory{Text Markup}
|
||||
#DescriptionBegin
|
||||
#Defines text styles to highlight, space-out, strike-through,
|
||||
#underline and capitalize/small-cap text by means of the soul package.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Subequations}
|
||||
#\DeclareCategory{Maths}
|
||||
#DescriptionBegin
|
||||
#Provide a straightforward way to segregate subequations in LyX. See the subequations.lyx example file.
|
||||
#DescriptionEnd
|
||||
|
@ -1,9 +1,9 @@
|
||||
#\DeclareLyXModule[sweave->latex,fancyvrb.sty]{Sweave}
|
||||
#\DeclareCategory{Literate Programming}
|
||||
#DescriptionBegin
|
||||
#Allows to use the statistical language S/R as a literate programming tool via the Sweave() function.
|
||||
#For more info see the LyX example file sweave.lyx.
|
||||
#DescriptionEnd
|
||||
#Category: literate
|
||||
#Excludes: lilypond
|
||||
|
||||
Format 72
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[tcolorbox.sty,environ.sty,etoolbox.sty,pgf.sty]{Fancy Colored Boxes}
|
||||
#\DeclareCategory{Boxes}
|
||||
#DescriptionBegin
|
||||
#Adds custom insets that support colored boxes via the tcolorbox package.
|
||||
#See the tcolorbox documentation for details.
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (AMS, Numbered by Type within Chapters)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines theorem environments and the proof environment using the extended
|
||||
#AMS machinery. Both numbered and unnumbered types are provided. Contrary to the
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (AMS-Extended, Numbered by Type)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines some additional theorem environments for use with the
|
||||
#AMS theorems packages. Includes Criterion, Algorithm, Axiom,
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (AMS-Extended, Numbered by Type within Chapters)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines some additional theorem environments for use with the
|
||||
#AMS theorems packages. Includes Criterion, Algorithm, Axiom,
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (AMS-Extended)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines some additional theorem environments for use with the
|
||||
#AMS theorems packages. Includes Criterion, Algorithm, Axiom,
|
||||
@ -7,7 +8,6 @@
|
||||
#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>
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (AMS)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines theorem environments and the proof environment using the extended
|
||||
#AMS machinery. Both numbered and unnumbered types are provided. By default,
|
||||
@ -6,7 +7,6 @@
|
||||
#changed by loading one of the 'Theorems (Numbered 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>
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (Numbered by Type)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines some theorem environments for use with non-AMS classes. Contrary to the
|
||||
#plain Theorem module, the different theorem types provided here each have a separate
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (Numbered by Type within Chapters)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines some theorem environments for use with non-AMS classes. Contrary to the
|
||||
#plain Theorem module, the different theorem types provided here each have a separate
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Theorems (Numbered by Chapter)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Numbers theorems and the like by chapter (i.e., the counter is reset at
|
||||
#each chapter start). Use this module only with document classes that provide a chapter
|
||||
@ -6,7 +7,6 @@
|
||||
#DescriptionEnd
|
||||
#Requires: theorems-std | theorems-ams
|
||||
#Excludes: theorems-sec
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#% Do not delete the line below; configure depends on this
|
||||
#\DeclareLyXModule{Named Theorems}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
# Facilitates the use of named theorems. The name of the theorem
|
||||
# goes into the 'Additional Theorem Text' argument.
|
||||
|
@ -1,11 +1,11 @@
|
||||
#\DeclareLyXModule{Theorems (Numbered by Section)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Numbers theorems and the like by section (i.e., the counter is reset at
|
||||
#each section start).
|
||||
#DescriptionEnd
|
||||
#Requires: theorems-std | theorems-ams
|
||||
#Excludes: theorems-chap
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#\DeclareLyXModule{Theorems (Unnumbered)}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines only unnumbered theorem environments, and the proof environment, using
|
||||
#the extended AMS machinery.
|
||||
#DescriptionEnd
|
||||
#Excludes: theorems-std | theorems-ams
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#\DeclareLyXModule{Theorems}
|
||||
#\DeclareCategory{Theorems}
|
||||
#DescriptionBegin
|
||||
#Defines some theorem environments for use with non-AMS classes. By default,
|
||||
#the theorems are numbered consecutively throughout the document. This can be
|
||||
#changed by loading one of the 'Theorems (Numbered by ...)' modules.
|
||||
#DescriptionEnd
|
||||
#Excludes: theorems-ams | theorems-starred
|
||||
#Category: theorems
|
||||
|
||||
# Author: Richard Heck <rgheck@comcast.net>
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule[todonotes.sty]{TODO Notes}
|
||||
#\DeclareCategory{Annotations}
|
||||
#DescriptionBegin
|
||||
#Provides custom insets to insert TODO items in your document
|
||||
#(using the todonotes package). In order to generate a 'List of TODOs',
|
||||
|
@ -1,4 +1,5 @@
|
||||
#\DeclareLyXModule{Variable-width Minipages}
|
||||
#\DeclareCategory{Boxes}
|
||||
#DescriptionBegin
|
||||
# Adds a 'Minipage (Var. Width)' inset using the varwidth LaTeX package.
|
||||
# The varwidth package provides a variable-width minipage, whose resulting
|
||||
|
@ -31,12 +31,12 @@ namespace lyx {
|
||||
* The requires and excludes are given in comments within the module file,
|
||||
* which must begin roughly so:
|
||||
* #\DeclareLyXModule{Theorems (By Section)}
|
||||
* #\DeclateCategory{Theorems}
|
||||
* #DescriptionBegin
|
||||
* #Numbers theorems and the like by section.
|
||||
* #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, Excludes, and Category lines are read by the configuration script
|
||||
* and written to a file lyxmodules.lst in the user configuration directory.
|
||||
|
@ -2902,7 +2902,8 @@ void GuiDocument::updateModuleInfo()
|
||||
if (!cat.empty()) {
|
||||
if (!desc.empty())
|
||||
desc += "\n";
|
||||
desc += bformat(_("Category: %1$s."), cat);
|
||||
desc += bformat(_("Category: %1$s."),
|
||||
translateIfPossible(cat));
|
||||
}
|
||||
|
||||
vector<string> pkglist = getPackageList(modName);
|
||||
|
Loading…
Reference in New Issue
Block a user