summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-05-18 20:21:44 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2011-05-18 20:21:44 +0000
commite71eaa026ac3384e0e25e3cae94a54be4fe69223 (patch)
tree44eaf7ef2af6da9e2d4f4599e391a29bf66f0c4e /Master
parent0d6f6d802fc805abf007cdde14f242de7450c587 (diff)
texdoc 0.80
git-svn-id: svn://tug.org/texlive/trunk@22522 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf/doc/man/man1/texdoc.12
-rw-r--r--Master/texmf/doc/man/man1/texdoc.man1.pdfbin5361 -> 5355 bytes
-rw-r--r--Master/texmf/doc/texdoc/News25
-rw-r--r--Master/texmf/doc/texdoc/texdoc.pdfbin178196 -> 170889 bytes
-rw-r--r--Master/texmf/doc/texdoc/texdoc.tex203
-rw-r--r--Master/texmf/scripts/texdoc/alias.tlu34
-rw-r--r--Master/texmf/scripts/texdoc/config.tlu16
-rw-r--r--Master/texmf/scripts/texdoc/constants.tlu3
-rw-r--r--Master/texmf/scripts/texdoc/score.tlu38
-rw-r--r--Master/texmf/scripts/texdoc/search.tlu3
-rw-r--r--Master/texmf/scripts/texdoc/view.tlu3
-rw-r--r--Master/texmf/texdoc/texdoc.cnf3
12 files changed, 250 insertions, 80 deletions
diff --git a/Master/texmf/doc/man/man1/texdoc.1 b/Master/texmf/doc/man/man1/texdoc.1
index 728c80b9248..be0577db1bb 100644
--- a/Master/texmf/doc/man/man1/texdoc.1
+++ b/Master/texmf/doc/man/man1/texdoc.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.39.2.
-.TH TEXDOC "1" "April 2011" "texdoc 0.72" "User Commands"
+.TH TEXDOC "1" "May 2011" "texdoc 0.80" "User Commands"
.SH NAME
texdoc \- find & view documentation in TeX Live
.SH SYNOPSIS
diff --git a/Master/texmf/doc/man/man1/texdoc.man1.pdf b/Master/texmf/doc/man/man1/texdoc.man1.pdf
index 8a2c3b74b29..0cc41a0c19e 100644
--- a/Master/texmf/doc/man/man1/texdoc.man1.pdf
+++ b/Master/texmf/doc/man/man1/texdoc.man1.pdf
Binary files differ
diff --git a/Master/texmf/doc/texdoc/News b/Master/texmf/doc/texdoc/News
index c154cf0f7bb..eed70d3aedb 100644
--- a/Master/texmf/doc/texdoc/News
+++ b/Master/texmf/doc/texdoc/News
@@ -1,3 +1,26 @@
+Version 0.80
+============
+
+New 'lang' configuration option (defaults on system locale): now <name>-de.pdf
+wins over <name>.pdf if German is preferred. Patch kindly provided by Philipp
+Stephani. Also works with aliases (eg koma-de = scrguide wins over koma =
+scrguien).
+
+Document the previously undocumented options from 0.72-tl2010.
+
+Accept htm as a valid extension, synonym for html. Emit less warnings about
+viewers.
+
+Version 0.72 as in TeX Live 2010
+--------------------------------
+
+New (undocumented) settings (bad)basenme_list, parallel to (bad)ext_list.
+
+New (undocumented) setting item suffix_list for known documentation suffixes,
+previously hardcoded.
+
+New (undocumented) option --just-view for use by front-end programs.
+
Version 0.72
------------
@@ -11,7 +34,7 @@ Fix bug introduced in 0.70: some results were duplicated on windows. (Reported
by Uwe Siart.)
Version 0.70
-------------
+============
Use information from the TeX Live package database (some of it coming from the
CTAN catalogue) to improve search results. Display some of this information.
diff --git a/Master/texmf/doc/texdoc/texdoc.pdf b/Master/texmf/doc/texdoc/texdoc.pdf
index 052115c36a0..869e4461ca8 100644
--- a/Master/texmf/doc/texdoc/texdoc.pdf
+++ b/Master/texmf/doc/texdoc/texdoc.pdf
Binary files differ
diff --git a/Master/texmf/doc/texdoc/texdoc.tex b/Master/texmf/doc/texdoc/texdoc.tex
index 6e4389432a4..016f964b38b 100644
--- a/Master/texmf/doc/texdoc/texdoc.tex
+++ b/Master/texmf/doc/texdoc/texdoc.tex
@@ -163,19 +163,19 @@
\subtitle{Find \& view documentation in \TeX\ Live}
\author{\url{http://tug.org/texdoc/}\\
Manuel Pégourié-Gonnard}
-\date{v0.70 2010-02-28}
+\date{v0.80 2011-05-18}
\begin{document}
\VerbatimFootnotes
\maketitle
-\section{Quick guide}
+\section{Quick guide (2 pages only)}
\subsection{Basics}
Open a command line\footnote{On windows, use ``Execute'' from the Start menu
- and type ©cmd©. On Mac OS X, use the ``terminal'' icon on Mac OS X. If you
+ and type ©cmd©. On Mac OS X, use the ``terminal'' icon. If you
are using another flavour of Unix, you probably know what to do.} and type
©texdoc «name»©: the documentation of the ©«name»© package will pop up. Of
course, replace ©«name»© with the actual name of the package you want to learn
@@ -187,11 +187,11 @@ see all documentation related to a package or use a different viewer.
\subsection{Modes}\label{ss-modes}
-\texdoc has different modes that determine how results will be handled. The
-default mode, called ``view'' mode, is to open the first (supposedly the best)
-result in a viewer. It is rather handy when you know what you want to read,
-and want to access it quickly. On the other hand, there may be other relevant
-documents for the given ©«name»©, which are ignored in view mode.
+\texdoc has different modes that determine how results will be handled. In the
+default, ``view'' mode, it opens the first (supposedly the best) result in a
+viewer. It is rather handy when you know what you want to read, and want to
+access it quickly. On the other hand, there may be other relevant documents
+for the given ©«name»©, which are ignored in view mode.
The so-called ``list mode'' makes \texdoc list all relevant documentation and
ask you which one you want to view. It is useful when there a other
@@ -201,44 +201,47 @@ There is also a ``mixed'' mode, intended to combine the best of view mode and
list mode: if there is only one relevant result, then \texdoc opens it in a
viewer, else it offers you a menu.
-Usually, \texdoc shows you only results it considers relevant. If there are no
+Usually, \texdoc shows only the results it considers relevant. If there are no
``good'' results, it falls back to less relevant results. You can force
-\texdoc to show you also ``bad'' results even when there are good ones by
+it to show you also ``bad'' results even when there are good ones by
using the ``showall'' mode. (This implies using a menu rather than starting a
viewer.)
-You can select the mode with command-line options: use
-©texdoc «option» «name»© with
-one of the following options: ©-w© or ©--view© for view mode, ©-m© or
-©--mixed© for mixed mode, ©-l© or ©--list© for list mode, ©-s© or ©--showall©
-for showall mode.
+You can select the mode with command-line options: use
+©texdoc «option» «name»© with one of the following options: ©-w© or ©--view©
+for view mode, ©-m© or ©--mixed© for mixed mode, ©-l© or ©--list© for list
+mode, ©-s© or ©--showall© for showall mode.
If you always (or mostly) use the same mode, it is probably easier to
select it in a configuration file than to always use the command-line
-option. For this, see the next section.
+option.
\subsection{Configuration files}\label{ss-quick-file}
-\texdoc use various configuration files, which you can see using the ©-f© or
+\texdoc uses various configuration files, which you can see using the ©-f© or
©--files© options. The entry marked with a star ©(*)©
is the file you should use for your personal preferences as a user; you may
need to create it (and the parents directories).
In order to select you favorite mode, just insert a line ©mode = «yourmode»©
-in this files, where ©«yourmode»© is one of ©view©, ©mixed©, ©list© or
+in this file, where ©«yourmode»© is one of ©view©, ©mixed©, ©list© or
©showall©.
+You can also set your favorite language with ©lang = «2-letter code»© here,
+though it is usually detected automatically.
+
The configuration files can be used to tweak \texdoc in many ways, the most
useful of which is probably the selection of the viewers for various types of
-documents, explained in the next section.
+documents.
\subsection{Viewers}
\texdoc's mechanism for choosing a viewer varies according to your platform.
-On Windows and MacOS, it uses your file associations like when you
-double-click files in the Explorer or the Finder (except for the text viewer,
-which is always a pager). On Unix, it tries to find a viewer in the path from
-a list of ``known' viewers.
+On Windows, OS X or Unix with KDE, Gnome or XFCE, it uses your file
+associations like when you double-click files in the Explorer, the Finder or
+your default file manager (except for the text viewer, which is always a
+pager). Otherwise, it tries to find a viewer in the path from a list of
+``known'' viewers.
You may want to select a different viewer for some kind of file. This is
achieved by the various ©viewer_«ext»© configuration options, where ©«ext»© is
@@ -249,13 +252,12 @@ name of the file to view.
\subsection{Conclusion}
-We have now covered the most common needs. The next part explains
-how \texdoc proceeds to find the best results.
-The default configuration file tries hard to set appropriate values so that
-you have a good out-of-the-box experience, but you may want to understand the
-underlying mechanisms and adapt them to your needs. The final part is a full
-reference for configuration options, including points omitted in the present
-part.
+We have now covered the most common needs. The next part explains how \texdoc
+proceeds to find and sort results. The default configuration file tries hard
+to set appropriate values so that you have a good out-of-the-box experience,
+but you may want to understand the underlying mechanisms and adapt them to
+your needs. The final part is a full reference for configuration options,
+including points omitted in the present part.
Your feedback is very welcome of the \tdml. Feel free to post comments, bug
reports, suggestions for improvements (inc. new aliases), even without
@@ -271,9 +273,11 @@ When you type ©texdoc «keyword»©, texdoc browses the trees containing
documentation (given by the \href{http://www.tug.org/kpathsea/} {kpathsea}
variable ©TEXDOCS©), lists all files containing ©«keyword»© in their name
(including the directory name) and give them a score based on some simple
-heuristics. For example, a file named ©«keyword».pdf©, will get a high score,
-©«keyword»-doc© will be preferred over ©«keyword»whatever©, files in a
-directory named exactly ©«keyword»© get a bonus, etc.
+heuristics. For example, a file named ©«keyword».pdf©, is good,
+©«keyword»-«lang».pdf© will score higher if your favorite language
+©«lang»© is detected or configured, ©«keyword»-doc© will be preferred over
+©«keyword»whatever©, files in a directory named exactly ©«keyword»© get a
+bonus, etc.
There is also some filtering based on extensions: only files with known
extensions are listed, and some extensions get a lesser score. Also, there is
@@ -294,31 +298,38 @@ However, this model works only if the documentation for ©«keyword»© has
©«keyword»© in its name, which is not always true. The documentation of the
memoir class is in ©memman.pdf©, for example, but it will be found anyway
since it is in a directory named memoir. But there are more complicated cases:
-the documentation for mathptmx is in ©psnfss2e.pdf©, which is quite more
-complicated to guess.\footnote{But not totally impossible: using the \TeX\
- Live database, texdoc can know which documentation files are associated with
- a given ©.sty© file. Here, it could guess that the documentation is either
- ©psfonts.pdf© of ©psnfss2e.pdf©. This will probably be done in a future
- version.}
-
-Here comes the notion of \emph{alias}: in the default configuration file,
-mathptmx is aliased to psnfss2e, so that when you type ©texdoc mathptmx©,
-texdoc knows it has to look also for psnfss2e. Note that texdoc will also look
-for the original name, and that a name can be aliased to more than one new
-name (this is new in texdoc 0.60).
+the documentation for mathptmx is in ©psnfss2e.pdf©; how can \texdoc guess
+that? It looks for ©mathptmx.sty© in the \texlive package database and finds
+it in the ©psnfss© package, and then adds the documentation files for this
+package to the results. There are two PDF files: ©psfonts.pdf© and
+©psnfss2e.pdf©, but only the second has a comment from the CTAN
+catalogue\footnote{\url{http://texcatalogue.sarovar.org/} --- most relevant
+ information from the catalogue is included in the \texlive package
+ database.} so it is considered better.
+
+However, sometimes even this doesn't work. For example, suppose you're looking
+for documentation about the standard ©article© \LaTeX\ class. Unfortunately,
+the only file name ©article.pdf© is completely unrelated and the name of the
+real file, ©classes.pdf©, is hard to guess (there are plenty of other
+documentation files in the base ©latex© package). Here comes the notion of
+\emph{alias}: in the default configuration file, article is aliased to
+classes, so that when you type ©texdoc article©, texdoc knows it has to look
+also for classes. Note that texdoc will also look for the original name, and
+that a name can be aliased to more than one new name (since version 0.60).
\medskip
-We will soon see how you can configure this, but let's give a few definitions
-about how a file can match keyword first (all matching is case-insensitive):
+We will soon see how you can configure this, but let's start with a few
+definitions about how a file can match keyword (all matching is
+case-insensitive):
\begin{enumerate}
\item The keyword is a substring of the file name.
\item The keyword is a ``subword'' of the file name; words are defined as a
sequence of alphanumeric characters delimited by punctuation characters
(there is no space in file names in \TeX\ Live) and a subword is a
substring both ends of which are a word boundary.
- \item The keyword can match ``exactly'' the file name: that is, the file
- name is the keyword plus an extension.
+ \item The keyword matches ``exactly'' the file name: that is, the file
+ name is the keyword, possibly plus an extension.
\end{enumerate}
\subsection{Alias directives}\label{ss-alias}
@@ -333,17 +344,17 @@ You can define your own aliases in \texdoc's configuration files
insert\footnote{Actually, you don't need to do this, the default configuration
file already includes this directive.}
\begin{htcode}
- alias mathptmx = psnfss2e
+ alias article = classes
\end{htcode}
-in order to alias mathptmx to psnfss2e. Precisely, it means that files
-matching exactly psnfss2e will be added to the result list when you look for
-mathptmx, and get a score of 10 (default score for alias results). This is
+in order to alias article to classes. Precisely, it means that files
+matching exactly classes be added to the result list when you look for
+article, and get a score of 10 (default score for alias results). This is
greater than the results of heuristic scoring: it means that results found via
aliases will always rank before results associated to the original keyword.
If you want the results associated to a particular alias to have a custom
score instead of the default 10, you can use the optional argument to the
-alias directive. This can be usefull if you associate many aliases to
+alias directive. This can be useful if you associate many aliases to
a keyword and want one of them to show up first.
You can have a look at the configuration file provided (the last shown by
@@ -359,6 +370,11 @@ from begin applied for a particular keyword by saying ©stopalias «keyword»© in
your personal configuration file. It will keep the aliases defined before
this directive (if any) and prevent all further aliasing on this keyword.
+Additionally, starting from version 0.80, aliases for ©«keyword»-«lang»©,
+where ©«lang»© is your preferred language's 2-letter code (as detected or
+configured, see the ©lang© option) are also used for ©«keyword»© and get a
+©+1© score upgrade.
+
\subsection{Score directives}\label{ss-score}
\begin{htcode}
@@ -397,13 +413,13 @@ a negative score, so wil not be displayed unless ``showall'' mode is active.
range of heuristic scoring, etc.) may change in a future version of texdoc.
Scoring is quite new and may need some adjustments. So, don't be surprised if
you need to adapt your scoring directives after a future update of texdoc.
-This warning will disappear at some point.
+This warning should disappear at some point.
-\subsection{File extensions}
+\subsection{File extensions and base names}
The allowed file extensions are defined by the configuration item ©ext_list©
-(default: pdf, html, txt, ps, dvi, no extension). You can configure it with
-a line ©ext_list = «your, list»© in a configuration file. Be aware
+(default: pdf, html, htm, txt, ps, dvi, no extension). You can configure it
+with ©ext_list = «your, list»© in a configuration file. Be aware
that it will completely override the default list, not add to it. An empty
string in the list means files without extension (no dot in the name), while a
star means any extension.
@@ -413,6 +429,11 @@ extension is ``bad'' according to this list will get a lesser score (currently
0). This only affect heuristic scoring (results found from the original
keyword, not from aliases).
+Similarly, there are ©basename_list© and ©badbasename_list© parameters: a file
+is selected only if its extension is in ©ext_list© or its base name in
+©basename_list©. This is for ©readme.«stuff»© files where ©«stuff»© doesn't
+mean anything about the file type.
+
\clearpage
\section{Full reference}
@@ -507,6 +528,17 @@ Set ©verbosity_level© to maximum, see~\ref{cf-verbosity_level}.
Set ©debug_list©, see~\ref{cf-debug_list}. If not list is given, activates all
available debug items.
+\begin{cmdsubsub}{--just-view}{cl-just-view}
+ --just-view
+\end{cmdsubsub}
+
+This is a very special switch: when it is used, texdoc accepts only one
+argument which must be the a file name with full path (absolute or relative to
+current directory) and starts a viewer for this file according to its usual
+viewer rules. Absolutely no search is done. It is unlikely you'll want to use
+this option directly; it may however be useful when texdoc is used as a
+back-end by other programs (such as texdoctk).
+
\subsection{Environment variables}\label{ss-envvar}
They all correspond to some ©viewer_«ext»© setting, and the reader is referred
@@ -525,6 +557,9 @@ the first column: this wins over every other name.
\end{tabular}
\end{center}
+Also, on Unix systems, locale-related variables such as ©LANG© and ©LC_ALL©
+are used for the default value of ©lang©.
+
\subsection{Configuration items}\label{ss-conf}
\subsubsection{Structure of configuration files}\label{sss-sonf-struct}
@@ -590,7 +625,7 @@ Turn on or off aliasing. Default is on.
Set the list of recognised extensions to ©«list»©. Default is
\begin{htcode}
- pdf, html, txt, dvi, ps,
+ pdf, html, htm, txt, dvi, ps,
\end{htcode}
This list is used to filter and sort the results that have the same
score(with the default value: pdf first, etc). Two special values are
@@ -605,7 +640,7 @@ recognised:
There is a very special case: if the searched ©«name»© has ©.sty© extension,
\texdoc enters a special search mode for ©.sty© files (not located in the same
-place as real documentation files) for this ©«name»©, indepandantly of the
+place as real documentation files) for this ©«name»©, independently of the
current value of ©ext_list© and ©mode©. In an ideal world, this wouldn't be
necessary since every sty file would have a proper documentation in pdf, html
or plain text, but\dots
@@ -615,17 +650,55 @@ value set. Defaults are defined corresponding to the default ©ext_list©, but
you can add values if you want. For example, if you want \texdoc to be able
to find man pages and display them with the ©man© command, you can use
\begin{htcode}
- ext_list = pdf, html, 1, 5, txt, dvi, ps,
+ ext_list = pdf, html, htm, 1, 5, txt, dvi, ps,
viewer_1 = man
viewer_5 = man
\end{htcode}
+As a special case, if the extension is ©sty©, then the ©txt© viewer is used;
+similarly, if it is ©htm© the ©html© viewer is used. Otherwise, the ©txt©
+viewer is used and a warning is issued.
+
\begin{cmdsubsub}{badext_list}{cf-badext_list}
badext_list = «list»
\end{cmdsubsub}
Set the list of ``bad'' extensions to ©«list»©. Default is ``©txt,©''. Files
-with those extensions get a heuristic score of 0.
+with those extensions get a malus of ©1© on their heurisitc score if it was
+previously positive.
+
+\begin{cmdsubsub}{basename_list}{cf-basename_list}
+ basename_list = «list»
+\end{cmdsubsub}
+
+Set the list of allowed base names. Default is ©readme©.
+
+\begin{cmdsubsub}{badbasename_list}{cf-badbasename_list}
+ badbasename_list = «list»
+\end{cmdsubsub}
+
+Set the list of ``bad'' base names to ©«list»©. Default is ©readme©. Files
+with those names get a malus of ©1© on their heurisitc score if it was
+previously positive.
+
+\begin{cmdsubsub}{suffix_list}{cf-suffix_list}
+ suffix_list = «list»
+\end{cmdsubsub}
+
+Set the list of know documentation suffixes to ©«list»©. Default is
+\begin{Verbatim}
+ doc, -doc, _doc, .doc, /doc, manual, /manual, -manual, userguide,
+ /user_guide, -guide, -user, -man, notes
+ \end{Verbatim}
+When searching for ©«keyword»©, results (found directly with ©«keyword»© as
+opposed to aliases) are scored in this order (from worse to best):
+\begin{enumerate}
+ \item Substring match for ©«keyword»©.
+ \item Substring match for ©«keyword»«suffix»© for a listed ©«suffix»©.
+ \item Exact match for ©«keyword»«suffix»© for a listed ©«suffix»©.
+ \item Exact match for ©«keyword»©.
+\end{enumerate}
+(Adjustements may be done later based on other informations and settings.)
\begin{cmdsubsub}{viewer_*}{cf-viewer_*}
viewer_«ext» = «cmd»
@@ -637,6 +710,12 @@ In ©«cmd»©, ©%s© can be used as a placeholder for the file name, which is
otherwise inserted at the end of the command. The command can be a arbitrary
shell construct.
+\begin{cmdsubsub}{lang}{cf-lang}
+ lang = «2-letter code»
+\end{cmdsubsub}
+
+Set you preferred language. Defaults to your system's locale.
+
\begin{cmdsubsub}{verbosity_level}{cf-verbosity_level}
verbosity_level = «n»
\end{cmdsubsub}
diff --git a/Master/texmf/scripts/texdoc/alias.tlu b/Master/texmf/scripts/texdoc/alias.tlu
index f364fa90f76..a99a8b51058 100644
--- a/Master/texmf/scripts/texdoc/alias.tlu
+++ b/Master/texmf/scripts/texdoc/alias.tlu
@@ -13,14 +13,20 @@ load_env(L, {
--[[ structure of the alias table
-alias = { name1 = aliasentry1, ... }
+alias = {
+ name1 = { <true or nill> stop, <aliasentry> aliasentry1, ... },
+ ...
+}
+stop == true means further alias directives should be ignored
aliasentry = {
- name = <string> pattern to be matched,
- score = <number or nil> associated score (may be nil),
- original = <true or nil> is this the original keyword?,
+ name = <string> pattern to be matched,
+ score = <number or nil> associated score,
+ original = <true or nil> is this the original keyword?,
+ locale = <true or nil> is this entry found via config.lang?
}
score == nil means to use the default score (defined in score.tlu)
+
--]]
-- alias is local to this file
@@ -57,12 +63,28 @@ end
-- get patterns for a name
function get_patterns(name, no_alias)
local n = string.lower(name)
+ -- get normal aliases
+ local res
if config.mode ~= 'regex' and config.alias_switch
and not no_alias and alias[n] then
- return alias[n]
+ res = alias[n]
else
- return { make_alias(name, false) }
+ res = { make_alias(name, false) }
+ end
+ -- check for language-specific aliases
+ local lang = config.lang and alias[n .. '-' .. config.lang]
+ if lang then
+ for _, entry in ipairs(lang) do
+ if not entry.original then
+ table.insert(res, {
+ name = entry.name,
+ score = entry.score,
+ locale = true,
+ })
+ end
+ end
end
+ return res
end
-- interpret a confline as an alias setting or return false
diff --git a/Master/texmf/scripts/texdoc/config.tlu b/Master/texmf/scripts/texdoc/config.tlu
index a83b7855308..fd37ba66be7 100644
--- a/Master/texmf/scripts/texdoc/config.tlu
+++ b/Master/texmf/scripts/texdoc/config.tlu
@@ -122,6 +122,8 @@ function context_to_string(context)
return 'from command line option "'..context.name..'"'
elseif context.src == 'env' then
return 'from environment variable "'..context.name..'"'
+ elseif context.src == 'loc' then
+ return 'from operating system locale'
elseif context.src == 'file' then
return 'in file "'..context.file..'" on line '..context.line
elseif context.src == 'def' then
@@ -373,6 +375,19 @@ end
end -- scope of config_files
+---------------------- config from locale settings -------------------------
+
+function setup_config_from_locale()
+ local current = os.setlocale(nil, "all")
+ os.setlocale("", "all")
+ local native = os.setlocale(nil, "time")
+ os.setlocale(current, "all")
+ local lang = string.match(native, "^[a-z][a-z]")
+ if lang then
+ set_config_element("lang", lang, {src="loc"})
+ end
+end
+
---------------------- options from built-in defaults ----------------------
-- for default viewer on general Unix, we have a list; the following two
@@ -551,6 +566,7 @@ function setup_config_and_alias(arg)
setup_config_from_cl(arg)
setup_config_from_env()
setup_config_from_files()
+ setup_config_from_locale()
setup_config_from_defaults()
-- regex mode is deprecated
if config.mode == 'regex' then
diff --git a/Master/texmf/scripts/texdoc/constants.tlu b/Master/texmf/scripts/texdoc/constants.tlu
index 9e2b5ff4e55..a8c107034cc 100644
--- a/Master/texmf/scripts/texdoc/constants.tlu
+++ b/Master/texmf/scripts/texdoc/constants.tlu
@@ -15,7 +15,7 @@ load_env(L, {
-- progname and version
fullname = arg[0]
progname = 'texdoc'
-version = '0.72'
+version = '0.80'
-- make sure to update setup_config_from_cl() accordingly
-- and set a default value in setup_config_from_defaults() if relevant
@@ -76,6 +76,7 @@ known_options = {
'unzip_.*',
'zipext_list',
'max_lines',
+ 'lang',
}
error_msg = [[
diff --git a/Master/texmf/scripts/texdoc/score.tlu b/Master/texmf/scripts/texdoc/score.tlu
index b655f62e57f..75022e41288 100644
--- a/Master/texmf/scripts/texdoc/score.tlu
+++ b/Master/texmf/scripts/texdoc/score.tlu
@@ -61,6 +61,7 @@ function set_score(df, original_kw)
if config.mode == 'regex' then df.score = 0 return end
-- scoring is case-insenstitive (patterns are already lowercased)
local name = string.lower(df.shortname)
+ deb_print('score', '----------')
deb_print('score', 'Start scoring '..df.realpath)
deb_print('score', 'Name used: '..name)
-- get score from patterns
@@ -71,16 +72,26 @@ function set_score(df, original_kw)
if pat.original then
s = df.tree > -1 and heuristic_score(name, p) or 1
elseif is_exact(name, p) then
- s = pat.score or 10 -- default alias score
+ local bonus, msg = 0, ''
+ if pat.locale then
+ bonus, msg = 5, ', (language-based)'
+ end
+ s = (pat.score or 10) + bonus -- default alias score is 10
deb_print('score', string.format(
- "Matching alias '%s', score: %g", pat.name, s))
+ "Matching alias '%s', score: %g%s", pat.name, s, msg))
end
if s > score then score = s end
end
deb_print('score', 'Max pattern score: '..tostring(score))
-- get score from tlp associations
- if score == -10 and df.tlptodoc then score = -2 end
- if score == -10 and df.runtodoc then score = -6 end
+ if score == -10 and df.tlptodoc then
+ score = -2
+ deb_print('score', 'New score: -2 from package name association')
+ end
+ if score == -10 and df.runtodoc then
+ score = -6
+ deb_print('score', 'New score: -6 from sty/cls association')
+ end
-- bonus for metadata
if df.details then
if string.find(string.lower(df.details), 'readme') then
@@ -88,6 +99,7 @@ function set_score(df, original_kw)
else
score = score + 2.5
end
+ deb_print('score', string.format('New score: %g from metadata', score))
end
-- adjust from keyword-specific tables
if df.tree > -1 and spec_adjscore[original_kw] then
@@ -127,7 +139,9 @@ function heuristic_score(file, pat)
end
local slash = not not string.find(pat, '/', 1, true)
-- look for exact or subword match
- if is_exact(file, pat) then
+ if is_exact_locale(file, pat) then
+ upscore(5, 'exact match with correct locale')
+ elseif is_exact(file, pat) then
upscore(4, 'exact match')
elseif is_subword(file, pat) then
upscore(1, 'subword match')
@@ -176,6 +190,20 @@ function is_exact(file, pat)
return false
end
+-- says if file is an exact match for pat and the current locale
+function is_exact_locale(file, pat)
+ if string.match(pat, '%-%l%l%l?$') then
+ -- don't match if the pattern appears to include a language code
+ return false
+ end
+ local lang = config.lang
+ if lang then
+ return is_exact(file, pat .. '-' .. lang)
+ or is_exact(file, lang .. '-' .. pat)
+ end
+ return false
+end
+
-- say if pat is a "subword" of str
function is_subword(str, pat)
local i, j = string.find(str, pat, 1, true)
diff --git a/Master/texmf/scripts/texdoc/search.tlu b/Master/texmf/scripts/texdoc/search.tlu
index 4e19513d1ca..11203fd97c5 100644
--- a/Master/texmf/scripts/texdoc/search.tlu
+++ b/Master/texmf/scripts/texdoc/search.tlu
@@ -480,7 +480,8 @@ function get_tlpinfo_from_tlpdb(filename)
else
local file = string.match(line, '^ ([^ ]*)')
local meta = string.match(line, '^ [^ ]* (.+)')
- if check_ext(file) then
+ local basename = string.match(file, '([^/]*)$')
+ if check_ext(basename) then
-- we've got a docfile here, add it
table.insert(tlp_doclist[curr_tlp], file)
if meta then
diff --git a/Master/texmf/scripts/texdoc/view.tlu b/Master/texmf/scripts/texdoc/view.tlu
index e2676ba367b..218cbfff6bf 100644
--- a/Master/texmf/scripts/texdoc/view.tlu
+++ b/Master/texmf/scripts/texdoc/view.tlu
@@ -62,10 +62,11 @@ function view_file (filename)
viewer_replacement = '"'..w32_path(filename)..'"'
end
-- files without extension are assumed to be text
- local viewext = string.match(filename,'.*%.([^/]*)$') or 'txt'
+ local viewext = filename:match('.*%.([^/]*)$'):lower() or 'txt'
-- special case : sty files use txt viewer
if viewext == 'sty' then viewext = 'txt' end
-- FIXME: hardcoding such cases this way is not very clean
+ if viewext == 'texlive' then viewext = 'txt' end
if viewext == 'htm' then viewext = 'html' end
if not config['viewer_'..viewext] then
err_print('warning',
diff --git a/Master/texmf/texdoc/texdoc.cnf b/Master/texmf/texdoc/texdoc.cnf
index bdc254ccc1a..531d608633a 100644
--- a/Master/texmf/texdoc/texdoc.cnf
+++ b/Master/texmf/texdoc/texdoc.cnf
@@ -197,7 +197,7 @@ alias faq = newfaq
alias latex = latex-doc-ptr
# various lshort translations
-adjscore(lshort) /lshort-english/ = +3 # original
+adjscore(lshort) /lshort-english/ = +0.5 # original
alias lshort-de = l2kurz # german
alias lshort-pl = lshort-polish/lshort2e # polish
alias lshort-pt = ptlshort # portuguese
@@ -432,7 +432,6 @@ alias(4.1) texilikecover = texilikecover.sty
alias(4.1) thrmappendix = thrmappendix.sty
alias(4.1) topcapt = topcapt.sty
alias(4.1) vrbexin = vrbexin.sty
-alias(4.1) wrapfig = wrapfig.sty
# Final hack