diff options
Diffstat (limited to 'support/makeglossariesgui/src/java/Glossaries.java')
-rw-r--r-- | support/makeglossariesgui/src/java/Glossaries.java | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/support/makeglossariesgui/src/java/Glossaries.java b/support/makeglossariesgui/src/java/Glossaries.java index 8d25ca7748..a8a40329c0 100644 --- a/support/makeglossariesgui/src/java/Glossaries.java +++ b/support/makeglossariesgui/src/java/Glossaries.java @@ -1,3 +1,21 @@ +/* + Copyright (C) 2013-2020 Nicola L.C. Talbot + www.dickimaw-books.com + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ package com.dickimawbooks.makeglossariesgui; import java.util.*; @@ -588,6 +606,9 @@ public class Glossaries String build = null; + int makeglossDisabledLine = -1; + int makeglossRestoredLine = -1; + try { reader = new BufferedReader(new InputStreamReader( @@ -599,6 +620,58 @@ public class Glossaries { Matcher m; + if (istName == null && line.startsWith("Package glossaries Info:") && !line.endsWith(".")) + { + String nextLine; + + while ((nextLine = reader.readLine()) != null) + { + line += nextLine; + + if (nextLine.endsWith(".")) + { + break; + } + } + + // Need to determine which option was the last in + // effect but line numbers may refer to different files. + + m = makeglossDisabledPattern.matcher(line); + + if (m.matches()) + { + String lineRef = m.group(1); + + addDiagnosticMessage(invoker.getLabelWithValues( + "diagnostics.makeglossdisabled", lineRef)); + + makeglossDisabledLine = 1; + + if (makeglossRestoredLine > -1) + { + makeglossRestoredLine = 0; + } + } + + m = makeglossRestoredPattern.matcher(line); + + if (m.matches()) + { + String lineRef = m.group(1); + + addDiagnosticMessage(invoker.getLabelWithValues( + "diagnostics.makeglossrestored", lineRef)); + + makeglossRestoredLine = 1; + + if (makeglossDisabledLine > -1) + { + makeglossDisabledLine = 0; + } + } + } + if (latexFormat == null) { m = formatPattern.matcher(line); @@ -971,6 +1044,24 @@ public class Glossaries } } + if (makeglossDisabledLine > -1) + { + if (makeglossRestoredLine == -1) + { + addDiagnosticMessage(invoker.getLabel("diagnostics.restoremakegloss")); + } + else if (makeglossRestoredLine < makeglossDisabledLine) + { + addDiagnosticMessage( + invoker.getLabel("diagnostics.restoremakegloss.cancelled")); + } + else + { + addDiagnosticMessage( + invoker.getLabel("diagnostics.restoremakegloss.late")); + } + } + if (vers == null) { addDiagnosticMessage(invoker.getLabel( @@ -1439,6 +1530,12 @@ public class Glossaries private static final Pattern glsGroupHeadingPattern = Pattern.compile(".*\\\\glsgroupheading\\{(.+?)\\}.*"); + private static final Pattern makeglossDisabledPattern = Pattern.compile( + "Package glossaries Info: \\\\makeglossaries and \\\\makenoidxglossaries have been disabled on input line ([0-9]+)\\."); + + private static final Pattern makeglossRestoredPattern = Pattern.compile( + "Package glossaries Info: \\\\makeglossaries and \\\\makenoidxglossaries have been restored on input line ([0-9]+)\\."); + private Vector<String> problemGroupLabels = new Vector<String>(); private static final String[] fields = |