From b47d2dedb7926d63f081bbe3fad758575c9dbf5b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 27 May 2013 02:17:53 +0000 Subject: spelling update 5/27 git-svn-id: svn://tug.org/texlive/trunk@30715 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/luatex/spelling/CHANGES | 8 ++ Master/texmf-dist/doc/luatex/spelling/README | 4 +- .../doc/luatex/spelling/spelling-doc.pdf | Bin 127173 -> 128505 bytes .../doc/luatex/spelling/spelling-doc.tex | 85 ++++++++++----------- 4 files changed, 51 insertions(+), 46 deletions(-) (limited to 'Master/texmf-dist/doc/luatex') diff --git a/Master/texmf-dist/doc/luatex/spelling/CHANGES b/Master/texmf-dist/doc/luatex/spelling/CHANGES index 383a64dcb0f..b96745410fb 100644 --- a/Master/texmf-dist/doc/luatex/spelling/CHANGES +++ b/Master/texmf-dist/doc/luatex/spelling/CHANGES @@ -2,6 +2,14 @@ This material is subject to the LaTeX Project Public License. See for the details of that license. +### v0.41 (2013-05-25) + +Fixes: + +* Fixed compatibility issue with LuaTeX 0.70.2 that caused text output + file written to be emtpy. + + ### v0.4 (2013-05-23) New features: diff --git a/Master/texmf-dist/doc/luatex/spelling/README b/Master/texmf-dist/doc/luatex/spelling/README index fa268331678..a5f2ee41583 100644 --- a/Master/texmf-dist/doc/luatex/spelling/README +++ b/Master/texmf-dist/doc/luatex/spelling/README @@ -7,8 +7,8 @@ This material is subject to the LaTeX Project Public License. See Package name: spelling Summary description: support for spell-checking of LuaTeX documents -Version: v0.4 -Date: 2013-05-23 +Version: v0.41 +Date: 2013-05-25 License: [LPPL v1.3c](http://www.latex-project.org/lppl/lppl-1-3c.html) Maintenance status: maintained Current maintainer: Stephan Hennig, diff --git a/Master/texmf-dist/doc/luatex/spelling/spelling-doc.pdf b/Master/texmf-dist/doc/luatex/spelling/spelling-doc.pdf index 442195e87a6..527d70d6acf 100644 Binary files a/Master/texmf-dist/doc/luatex/spelling/spelling-doc.pdf and b/Master/texmf-dist/doc/luatex/spelling/spelling-doc.pdf differ diff --git a/Master/texmf-dist/doc/luatex/spelling/spelling-doc.tex b/Master/texmf-dist/doc/luatex/spelling/spelling-doc.tex index 88b9a74c5c7..79e59b2aec4 100644 --- a/Master/texmf-dist/doc/luatex/spelling/spelling-doc.tex +++ b/Master/texmf-dist/doc/luatex/spelling/spelling-doc.tex @@ -68,7 +68,7 @@ basicstyle=\ttfamily, \newcommand*{\lpie}{\latinphrase{i.\,e.}\xspace} \begin{document} \author{Stephan Hennig\thanks{sh2d@arcor.de}} -\title{\pkg\thanks{This document describes the \pkg\ package v0.4.}} +\title{\pkg\thanks{This document describes the \pkg\ package v0.41.}} \maketitle @@ -261,13 +261,12 @@ stripped string against the Lua string pattern |^%a%a%a$| via function |unicode.utf8.find| from the Selene Unicode library. The latter function is a \acr{utf-8} capable version of Lua's built-in function |string.find|. It returns |nil| (a false value) if there has been no -match and a number (a true value) if there has been a match. The string -|%a| represents a string class matching a single letter. Characters |^| -and |$| are anchors for the beginning and the end of the string in -question. Note, the pattern |%a%a%a| without anchors would match -any string which contains \emph{at least} three letters in a row. More -information about Lua string patterns can be found in the Lua reference -manual% +match and a number (a true value) if there has been a match. The +pattern |%a| represents a character class matching a single letter. +Characters |^| and |$| are anchors for the beginning and the end of the +string in question. Note, pattern |%a%a%a| without anchors would match +any string containing three letters in a row. More information about +Lua string patterns can be found in the Lua reference manual% \footnote{\url{http://www.lua.org/manual/5.2/manual.html\#6.4}}% % , the Selene Unicode library documentation% @@ -286,7 +285,8 @@ end \end{lstlisting} \autoref{lst:mr-double-punctuation} shows a rule matching all ‘words’ -containing double punctuation. +containing double punctuation. Note, how the raw string is examined +instead of the stripped one. \begin{lstlisting}[style=Lua, float, label=lst:mr-double-punctuation, caption={Matching double punctuation.}] function double_punctuation(raw, stripped) @@ -296,11 +296,11 @@ end The rule in \autoref{lst:mr-bibtex-alpha} combines the results of three string searches to match bibliographic references as generated by the -Bib\TeX\ \emph{alpha} style. +Bib\TeX\ style \emph{alpha}. -\begin{lstlisting}[style=Lua, float, label=lst:mr-bibtex-alpha, caption={Matching references generated by the Bib\TeX\ alpha style.}] +\begin{lstlisting}[style=Lua, float, label=lst:mr-bibtex-alpha, caption={Matching references generated by the Bib\TeX\ style \emph{alpha}.}] function bibtex_alpha(raw, stripped) - return unicode.utf8.find(stripped, '^%u%l%l%d%d$') + return unicode.utf8.find(stripped, '^%u%l%l?%d%d$') or unicode.utf8.find(stripped, '^%u%u%u?%u?%d%d$') or unicode.utf8.find(stripped, '^%u%u%u%+%d%d$') end @@ -327,7 +327,7 @@ document via \spellingmatchrules{myproject.rules} \end{lstlisting} -\begin{lstlisting}[style=Lua, float=p, label=lst:mr-module, caption={A module containing two bad and one good match rule.}] +\begin{lstlisting}[style=Lua, float=p, label=lst:mr-module, caption={A Lua module containing two bad and one good match rule.}] -- Module table. local M = {} @@ -336,9 +336,11 @@ local unicode = require('unicode') -- Add short-cut. local Ufind = unicode.utf8.find +-- Local function matching three letter words. local function three_letter_words(raw, stripped) return Ufind(stripped, '^%a%a%a$') end +-- Make this a bad rule. M.bad_rule_three_letter_words = three_letter_words local function double_punctuation(raw, stripped) @@ -347,12 +349,13 @@ end M.bad_rule_double_punctuation = double_punctuation local function bibtex_alpha(raw, stripped) - return Ufind(stripped, '^%u%l%l%d%d$') + return Ufind(stripped, '^%u%l%l?%d%d$') or Ufind(stripped, '^%u%u%u?%u?%d%d$') or Ufind(stripped, '^%u%u%u%+%d%d$') end M.good_rule_bibtex_alpha = bibtex_alpha +-- Export module table. return M \end{lstlisting} @@ -365,36 +368,30 @@ entry in the list of good spellings takes precedence over any user-supplied bad rule. Likewise, any user-supplied good rule takes precedence over an entry in the list of bad spellings. -Some final remarks on match rules: - -\begin{itemize} - -\item It must be stressed that the boolean return value of a match rule - \emph{does not} indicate whether a spelling is bad or good, but - whether a word matches a certain rule or not. Whether it's a bad or a - good spelling, depends on the name of the match rule in the module - table. - -\item When written without care, match rules can easily produce false - positives as well as false negatives. While false positives in bad - rules and false negatives in good rules can easily be spotted due to - the unexpected highlighting of words, the other cases are more - problematic. To avoid all kinds of false results, match rules should - be stated as specific as possible. - -\item Match rules are only called upon the first occurrence of a - spelling in a document. The information, whether a spelling needs to - be highlighted, is stored in a cache table. Subsequent occurrences of - a spelling just need a table look-up to determine highlighting status. - For that reason, it is safe to do relatively expensive operations - within a match rule without affecting compilation time too much. - Nevertheless, match rules should be stated as efficient as possible.% - \footnote{Some Lua performance tips can be found in the book \emph{Lua - Programming Gems} by Figueiredo, Celes and Ierusalimschy - \emph{(eds.)}, 2008, ch.~2. That chapter is also available online - at \url{http://www.lua.org/gems/}.} - -\end{itemize} +\paragraph{Some final remarks on match rules} It must be stressed that +the boolean return value of a match rule \emph{does not} indicate +whether a spelling is bad or good, but whether a word matches a certain +rule or not. Whether it's a bad or a good spelling, depends on the name +of the match rule in the module table. + +Match rules are only called upon the first occurrence of a spelling in a +document. The information, whether a spelling needs to be highlighted, +is stored in a cache table. Subsequent occurrences of a spelling just +need a table look-up to determine highlighting status. For that reason, +it is safe to do relatively expensive operations within a match rule +without affecting compilation time too much. Nevertheless, match rules +should be stated as efficient as possible.% +\footnote{Some Lua performance tips can be found in the book \emph{Lua + Programming Gems} by Figueiredo, Celes and Ierusalimschy + \emph{(eds.)}, 2008, ch.~2. That chapter is also available online at + \url{http://www.lua.org/gems/}.} + +When written without care, match rules can easily produce false +positives as well as false negatives. While false positives in bad +rules and false negatives in good rules can easily be spotted due to the +unexpected highlighting of words, the other cases are more problematic. +To avoid all kinds of false results, match rules should be stated as +specific as possible. \subsection{Highlighting spellling mistakes} -- cgit v1.2.3