Commit 99160cd3 authored by Atsuhito Kohda's avatar Atsuhito Kohda

Imported Upstream version 0.5~svn1007

parent 33d48ed7
Unless noted otherwise, all files in this directory and are released under the
following terms:
Copyright (C) 2011-2012 Charlie Sharpsteen
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
......@@ -4,9 +4,9 @@
# FONTCONFIG_FOUND - system has Fontconfig
# FONTCONFIG_INCLUDE_DIR - the Fontconfig include directory
# FONTCONFIG_LIBRARIES - Link these to use Fontconfig
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# Redistribution and use of this file is allowed according to the terms of the
# MIT license. For details see the file COPYING-CMAKE-MODULES.
if ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARIES )
......
......@@ -4,9 +4,9 @@
# HUNSPELL_FOUND - system has Hunspell
# HUNSPELL_INCLUDE_DIR - the Hunspell include directory
# HUNSPELL_LIBRARIES - Link these to use Hunspell
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# Redistribution and use of this file is allowed according to the terms of the
# MIT license. For details see the file COPYING-CMAKE-MODULES.
if ( HUNSPELL_INCLUDE_DIR AND HUNSPELL_LIBRARIES )
......@@ -31,7 +31,7 @@ FIND_PATH(HUNSPELL_INCLUDE_DIR NAMES hunspell.h
PATH_SUFFIXES hunspell
)
FIND_LIBRARY(HUNSPELL_LIBRARIES NAMES hunspell hunspell-1.2 hunspell-1.3 ${HUNSPELL_PKG_LIBRARIES}
FIND_LIBRARY(HUNSPELL_LIBRARIES NAMES hunspell-1.3 hunspell-1.2 hunspell ${HUNSPELL_PKG_LIBRARIES}
PATHS
/usr/local
/usr
......
......@@ -11,9 +11,8 @@
#
# Note: the Poppler-cpp include directory is currently not needed by TeXworks
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# Redistribution and use of this file is allowed according to the terms of the
# MIT license. For details see the file COPYING-CMAKE-MODULES.
if ( POPPLER_LIBRARIES )
# in cache already
......
......@@ -40,17 +40,18 @@ IF ( ${CMAKE_INSTALL_PREFIX} MATCHES .*/_CPack_Packages/.* )
# Download and install TeXworks manual
# ------------------------------------
IF ( NOT EXISTS ${PROJECT_SOURCE_DIR}/TeXworks-manual-html-r814.zip )
IF ( NOT EXISTS ${PROJECT_SOURCE_DIR}/TeXworks-manual-html-r959.zip )
MESSAGE(STATUS "Downloading TeXworks HTML manual")
FILE(DOWNLOAD "http://texworks.googlecode.com/files/TeXworks-manual-html-r814.zip"
${PROJECT_SOURCE_DIR}/TeXworks-manual-html-r814.zip
EXPECTED_MD5 2894969a6ac4bba31953264e04553717
FILE(DOWNLOAD
"http://texworks.googlecode.com/files/TeXworks-manual-html-r959.zip"
${PROJECT_SOURCE_DIR}/TeXworks-manual-html-r959.zip
EXPECTED_MD5 2071e3c2fc6b6fdb57bca0484abdd35a
SHOW_PROGRESS
)
ENDIF ()
IF ( NOT EXISTS ${PROJECT_SOURCE_DIR}/TeXworks-manual )
EXECUTE_PROCESS(COMMAND unzip ${PROJECT_SOURCE_DIR}/TeXworks-manual-html-r814.zip
EXECUTE_PROCESS(COMMAND unzip ${PROJECT_SOURCE_DIR}/TeXworks-manual-html-r959.zip
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
ENDIF ()
......@@ -79,7 +80,7 @@ IF ( ${CMAKE_INSTALL_PREFIX} MATCHES .*/_CPack_Packages/.* )
# Gather all TeXworks Plugin libraries.
FILE(GLOB TeXworks_PLUGINS
${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents/PlugIns/*${CMAKE_SHARED_LIBRARY_SUFFIX})
${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents/PlugIns/*${CMAKE_SHARED_MODULE_SUFFIX})
# If `BU_CHMOD_BUNDLE_ITEMS` is not set, `install_name_tool` will fail to
# re-write some loader paths due to insufficiant permissions.
......
......@@ -26,10 +26,10 @@ class PopplerData < Formula
end
class Poppler < Formula
url 'http://poppler.freedesktop.org/poppler-0.18.1.tar.gz'
url 'http://poppler.freedesktop.org/poppler-0.18.4.tar.gz'
homepage 'http://poppler.freedesktop.org'
md5 'd30e883a27423c936ef338ce1d967e2d'
version '0.18.1-texworks'
md5 '12658f3308597e57f3faff538cc73baf'
version '0.18.4-texworks'
depends_on 'pkg-config' => :build
depends_on 'qt'
......
......@@ -234,6 +234,11 @@ SET(TeXworks_PLUGIN_DIR lib)
# On OS X, the plugins should live inside the application bundle.
IF ( APPLE )
SET(TeXworks_PLUGIN_DIR ${PROJECT_NAME}.app/Contents/PlugIns)
# Plugins are build as shared libraries that contain undefined symbols.
# Pass `-undefined dynamic_lookup` so that the Apple linker does not
# freak out about this.
SET(CMAKE_MODULE_LINKER_FLAGS
"${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS} -undefined dynamic_lookup")
ENDIF ()
......
Release 0.4.4 (TL'12) [April 2012]
* Fix crash caused by Qt when adding lines at the beginning of a document
* Fix search/replace for multi-line strings
* Work around layout issues which cause lines to disappear
* Fix building with BSD make
* Fix block selection of last paragraph
* Fix overwrite of "Find all occurrences" option
* Improve "Unable to execute..." error dialog
* Rename "Show/Hide Output Panel" to "Show/Hide Console Output" in the menu
and the preferences dialog
* Remove subject and add instructions to body of the "email to mailinglist"
* Bring the window running TeX to the top at the beginning of typesetting to
ensure that the console output is visible
* Allow symlinks and display only folders in "path for programs" in the
preferences dialog
* Add "Clear Recent Files" to "Open Recent" menu
* Add an autocompletion entry to the preferences dialog
* Add Lua(La)TeX to the default tools (and drop LaTeXmk by default)
* Add an option to open log files
* Add CMake support (experimental)
* Update SyncTeX to version 1.17
* Update URLs to http://www.tug.org/texworks/
* Some enhancements to functions available to scripting
* Avoid showing an empty message box for script results
* Resolve symlinks when looking for scripts
* Expose the scripts' titles, authors, filenames, etc. to scripting
* Update/improve scripts: open pdf in default viewer, derive spellchecking
language from babel package, log parser
Release 0.4.3 (TL'11) [June 2011]
* Fix bug in autocompletion that could cause data loss
......
......@@ -29,13 +29,13 @@ Mailing list: http://tug.org/mailman/listinfo/texworks
License
=======
TeXworks is copyright (C) 2007-2011 by Jonathan Kew and Stefan Löffler.
Distributed under the terms of the GNU General Public License, version 2 or (at
your option) any later version.
TeXworks is copyright (C) 2007-2012 by Jonathan Kew, Stefan Löffler, and Charlie
Sharpsteen. Distributed under the terms of the GNU General Public License,
version 2 or (at your option) any later version.
See the file COPYING for details.
The SyncTeX code is copyright (c) 2008-2011 by Jérôme Laurens; see
synctex_parser.c for license details.
src/synctex_parser.c for license details.
Building TeXworks
......
......@@ -51,7 +51,7 @@
<key>CFBundleIconFile</key>
<string>TeXworks.icns</string>
<key>CFBundleGetInfoString</key>
<string>TeXworks version @VER@ (r.@REV@)&#xA;(C) 2007-2011 Jonathan Kew, Stefan L&#xF6;ffler&#xA;Released under GPL (v2.0 or later)</string>
<string>TeXworks version @VER@ (r.@REV@)&#xA;(C) 2007-2012 Jonathan Kew, Stefan L&#xF6;ffler, Charlie Sharpsteen&#xA;Released under GPL (v2.0 or later)</string>
<key>CFBundleExecutable</key>
<string>TeXworks</string>
<key>CFBundleIdentifier</key>
......
# This is part of TeXworks, an environment for working with TeX documents
# Copyright (C) 2007-2011 Jonathan Kew, Stefan Löffler
# Copyright (C) 2007-2012 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen
#
# 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
......@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# For links to further information, or to contact the author,
# For links to further information, or to contact the authors,
# see <http://www.tug.org/texworks/>.
TEMPLATE = app
......@@ -25,7 +25,8 @@ SUBDIRS += plugins-src/TWLuaPlugin
SUBDIRS += plugins-src/TWPythonPlugin
MOC_DIR = ./moc
OBJECTS_DIR = ./obj
# NOTE: BSD make fails if OBJECTS_DIR = ./obj (or rather if a directory obj exists at all; see issue 76)
OBJECTS_DIR = ./objs
UI_DIR = ./ui
RCC_DIR = ./rcc
......
......@@ -22,6 +22,12 @@ fi
appendPath()
{
NEWPATH="$1"
# Don't append common system directories here (they are added elsewhere)
# to ensure that they are always at the end of the list
if [ "$NEWPATH" = "/usr/bin" -o "$NEWPATH" = "/usr/local/bin" ]; then
echo "$NEWPATH ignored"
return
fi
case "$BINPATHS" in
*:"$NEWPATH":*) echo $NEWPATH already present;;
*) # note that BINPATHS already ends with colon
......@@ -68,6 +74,7 @@ case $PLATFORM in
*) OS=`echo $PLATFORM | sed 's/.*-//'`
esac
appendPath "/usr/local/texlive/2012/bin/$ARCH-$OS"
appendPath "/usr/local/texlive/2011/bin/$ARCH-$OS"
appendPath "/usr/local/texlive/2010/bin/$ARCH-$OS"
appendPath "/usr/local/texlive/2009/bin/$ARCH-$OS"
......@@ -89,8 +96,7 @@ done
# (3) append default paths that we should always check
appendPath "/usr/local/bin"
appendPath "/usr/bin"
BINPATHS="$BINPATHS/usr/local/bin:/usr/bin"
# strip leading and trailing colons from the list
BINPATHS=`echo $BINPATHS | sed 's/^://;s/:$//'`
......
......@@ -66,10 +66,10 @@ development: \%http://code.google.com/p/texworks/
If you find a bug, please report it at \%http://code.google.com/p/texworks/issues/list
.SH AUTHORS
Jonathan Kew, Stefan Löffler, and others
Jonathan Kew, Stefan Löffler, Charlie Sharpsteen, and others
.SH COPYRIGHT
Copyright (C) 2007-2011 Jonathan Kew, Stefan Löffler
Copyright (C) 2007-2012 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen
License GPLv2+: GNU GPL (version 2 or later) <http://gnu.org/licenses/gpl.html>
......
......@@ -15,7 +15,7 @@ LINK_DIRECTORIES(${QT_LIBRARY_DIR})
# alternative._
QT4_WRAP_CPP(LUA_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWLuaPlugin.h)
ADD_LIBRARY(TWLuaPlugin SHARED
ADD_LIBRARY(TWLuaPlugin MODULE
TWLuaPlugin.cpp
${TeXworks_SCRIPT_API}
${LUA_PLUGIN_MOC}
......
/*
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2011 Jonathan Kew, Stefan Löffler
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the author,
see <http://www.tug.org/texworks/>.
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2012 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the authors,
see <http://www.tug.org/texworks/>.
*/
#include "TWLuaPlugin.h"
......
/*
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2011 Jonathan Kew, Stefan Löffler
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the author,
see <http://www.tug.org/texworks/>.
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2012 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the authors,
see <http://www.tug.org/texworks/>.
*/
#ifndef TW_LUA_PLUGIN_H
......
......@@ -24,7 +24,7 @@ CONFIG += plugin
INCLUDEPATH += ../../src/
MOC_DIR = ./moc
OBJECTS_DIR = ./obj
OBJECTS_DIR = ./objs
TARGET = TWLuaPlugin
......
......@@ -15,7 +15,7 @@ LINK_DIRECTORIES(${QT_LIBRARY_DIR})
# alternative._
QT4_WRAP_CPP(PYTHON_PLUGIN_MOC ${TeXworks_SCRIPT_API_H} TWPythonPlugin.h)
ADD_LIBRARY(TWPythonPlugin SHARED
ADD_LIBRARY(TWPythonPlugin MODULE
TWPythonPlugin.cpp
${TeXworks_SCRIPT_API}
${PYTHON_PLUGIN_MOC}
......
/*
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2011 Jonathan Kew, Stefan Löffler
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the author,
see <http://www.tug.org/texworks/>.
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2012 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the authors,
see <http://www.tug.org/texworks/>.
*/
#include "TWPythonPlugin.h"
......
/*
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2011 Jonathan Kew, Stefan Löffler
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the author,
see <http://www.tug.org/texworks/>.
This is part of TeXworks, an environment for working with TeX documents
Copyright (C) 2007-2012 Jonathan Kew, Stefan Löffler, Charlie Sharpsteen
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 2 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, see <http://www.gnu.org/licenses/>.
For links to further information, or to contact the authors,
see <http://www.tug.org/texworks/>.
*/
#ifndef TW_PYTHON_PLUGIN_H
......
......@@ -24,7 +24,7 @@ CONFIG += plugin
INCLUDEPATH += ../../src/
MOC_DIR = ./moc
OBJECTS_DIR = ./obj
OBJECTS_DIR = ./objs
TARGET = TWPythonPlugin
......
......@@ -22,7 +22,7 @@ BEGIN
VALUE "FileDescription", "TeXworks editor & previewer"
VALUE "FileVersion", TEXWORKS_VERSION ".r" SVN_REVISION_STR
VALUE "InternalName", "TeXworks"
VALUE "LegalCopyright", "Copyright (C) 2007-2011 Jonathan Kew, Stefan Lffler"
VALUE "LegalCopyright", "Copyright (C) 2007-2012 Jonathan Kew, Stefan Lffler, Charlie Sharpsteen"
VALUE "OriginalFilename", "TeXworks.exe"
VALUE "ProductName", "TeXworks"
VALUE "ProductVersion", "TeXworks " TEXWORKS_VERSION
......
......@@ -11,7 +11,7 @@
<file>resfiles/configuration/tag-patterns.txt</file>
<file>resfiles/configuration/texworks-config.txt</file>
<file>resfiles/scripts/Hooks/babelLanguage.js</file>
<file>resfiles/scripts/Hooks/latexErrors.js</file>
<file>resfiles/scripts/Hooks/logParser.js</file>
<file>resfiles/scripts/LaTeX styles/toggleBold.js</file>
<file>resfiles/scripts/LaTeX styles/toggleEmph.js</file>
<file>resfiles/scripts/launchPdf.js</file>
......
// TeXworksScript
// Title: Babel language
// Description: Looks for a Babel line to set the spell-check language
// Author: Jonathan Kew
// Version: 0.3
// Date: 2010-01-09
// Author: Jonathan Kew & Stefan Löffler
// Version: 0.3.1
// Date: 2012-03-20
// Script-Type: hook
// Hook: LoadFile
babelRE = new RegExp("\\\\usepackage\\[(?:.+,)*([^,]+)\\]\\{babel\\}");
var spellcheckModlineRE = new RegExp("% *!TEX +spellcheck *=", "i");
var babelRE = new RegExp("^[^%]*\\\\usepackage\\[(?:.+,)*([^,]+)\\]\\{babel\\}");
spellingDict = new Array();
var spellingDict = new Array();
// extend or customize this list as needed
spellingDict.czech = "cs_CZ";
......@@ -37,27 +38,63 @@ spellingDict.slovak = "sk_SK";
spellingDict.slovene = "sl_SL";
spellingDict.swedish = "sv_SV";
// get list of available dictionairies to avoid overriding the default spell
// checking language by "None" in case we tried to set the language to something
// for which no dict exists.
var dicts = TW.getDictionaryList();
function startsWith(haystack, needle)
{
if (needle.length > haystack.length)
return false;
return haystack.substr(0, needle.length) === needle
}
function trySetSpellcheckLanguage(lang)
{
// See if we have any entry for this in our list
if (spellingDict[lang] === undefined)
return false;
// map the babel code to an ISO language code
lang = spellingDict[lang];
// If we have a matching dict, set it
if (dicts[lang] !== undefined) {
TW.target.setSpellcheckLanguage(lang);
TW.result = "Set spell-check language to " + lang;
return true;
}
// Otherwise, see if we have a specialized dict (e.g., de_DE_frami when de_DE
// is requested).
for (d in dicts) {
if (startsWith(d, lang)) {
TW.target.setSpellcheckLanguage(d);
TW.result = "Set spell-check language to " + d;
return true;
}
}
return false;
}
// get the text from the document window
txt = TW.target.text;
lines = txt.split('\n');
var txt = TW.target.text;
var lines = txt.split('\n');
// look for a babel line...
for (i = 0; i < lines.length; ++i) {
line = lines[i];
matched = babelRE.exec(line);
if (matched) {
lang = matched[1];
if (spellingDict[lang]) {
TW.target.setSpellcheckLanguage(spellingDict[lang]);
TW.result = "Set spell-check language to " + spellingDict[lang];
}
var line = lines[i];
// If we have a "%!TeX spellcheck" modline, we don't override it (after all,
// the user has probably put it there for a reason)
if (spellcheckModlineRE.test(line))
break;
var matched = babelRE.exec(line);
if (matched) {
if (trySetSpellcheckLanguage(matched[1]))
break;
}
// ...but give up at the end of the preamble
if (line.match("\\\\begin\\{document\\}")) {
if (line.match("\\\\begin\\{document\\}"))
break;
}
if (line.match("\\\\starttext")) { // oops, seems to be ConTeXt!
if (line.match("\\\\starttext")) // oops, seems to be ConTeXt!
break;
}
}
undefined;
// TeXworksScript
// Title: LaTeX errors
// Description: Looks for errors in the LaTeX terminal output
// Author: Jonathan Kew & Stefan Löffler
// Version: 0.4
// Date: 2010-11-02
// Script-Type: hook
// Hook: AfterTypeset
// This is just a simple proof-of-concept; it will often get filenames wrong, for example.
// Switching the engines to use the FILE:LINE-style error messages could help a lot.
parenRE = new RegExp("[()]");
// Should catch filenames of the following forms:
// * ./abc, "./abc"
// * /abc, "/abc"
// * .\abc, ".\abc"
// * C:\abc, "C:\abc"
// * \\server\abc, "\\server\abc"
// Caveats: filenames with escaped " or space in the filename don't work (correctly)
newFileRE = new RegExp("^\\(\"?((?:\\./|/|.\\\\|[a-zA-Z]:\\\\|\\\\\\\\[^\\\" )]+\\\\)[^\" )]+)");
lineNumRE = new RegExp("^l\\.(\\d+)");
badLineRE = new RegExp("^(?:Over|Under)full \\\\hbox.*at lines (\\d+)");
warnLineRE = new RegExp("^(?:LaTeX|Package (?:.*)) Warning: .*");
warnLineNumRE = new RegExp("on input line (\\d+).");
errors = [];
warnings = [];
infos = [];
function trim (zeichenkette) {
return zeichenkette.replace (/^\s+/, '').replace (/\s+$/, '');
}
// get the text from the standard console output
txt = TW.target.consoleOutput;
lines = txt.split('\n');
curFile = undefined;
filenames = [];
extraParens = 0;
for (i = 0; i < lines.length; ++i) {
line = lines[i];
// check for error messages
if (line.match("^! ")) {
var error = [];
// record the current input file
error[0] = curFile;
// record the error message itself
error[2] = line;
// look ahead for the line number and record that
error[1] = 0;
while (++i < lines.length) {
line = lines[i];
if(trim(line) == '') break;
matched = lineNumRE.exec(line);
if (matched)
error[1] = matched[1];
error[2] += "\n" + line;
}
errors.push(error);
continue;
}
// check for over- or underfull lines
matched = badLineRE.exec(line);
if (matched) {
var error = [];
error[0] = curFile;
error[1] = matched[1];
error[2] = line;
infos.push(error);
continue;
}
// check for other warnings
matched = warnLineRE.exec(line);
if (matched) {
var error = [];
error[0] = curFile;
error[1] = "?";
error[2] = line;
while (++i < lines.length) {
line = lines[i];
if(line == '') break;