Browse Source

Merge branch '0.9'

Conflicts:
	src/pageconverter.cc
Jakob Truelsen 15 years ago
parent
commit
e650a69722
5 changed files with 50 additions and 40 deletions
  1. 4 0
      README
  2. 12 0
      scripts/upload.sh
  3. 1 1
      src/manoutputter.cc
  4. 32 38
      src/pageconverter.cc
  5. 1 1
      wkhtmltopdf.pro

+ 4 - 0
README

@@ -85,6 +85,8 @@ wkhtmltopdf [OPTIONS]... <input file> [More input files] <output file>
 -g, --grayscale                       PDF will be generated in grayscale
 -h, --help                            Display help
     --htmldoc                         Output program html help
+    --ignore-load-errors              Ignore pages that claimes to have
+                                      encountered an error during loading
 -l, --lowquality                      Generates lower quality pdf/ps. Useful to
                                       shrink the result document space
     --manpage                         Output program man page
@@ -225,6 +227,8 @@ arguments respectfully.  In header and footer text string supplied to e.g.
  * [webpage]    Replaced by the URL of the page being printed
  * [section]    Replaced by the name of the current section
  * [subsection] Replaced by the name of the current subsection
+ * [date]       Replaced by the current date in system local format
+ * [time]       Replaced by the current time in system local format
 
 
 As an example specifying --header-right "Page [page] of [toPage]", will result

+ 12 - 0
scripts/upload.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+wget http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py -O googlecode_upload.py
+
+function ul() {
+	source upload.conf
+	python googlecode_upload.py -u "$USER" -w "$PASS" -s "$1" -p "wkhtmltopdf" -l "$2" "$3"
+}
+
+ul "wkhtmltopdf-$1 Source" "Type-Source,OpSys-All,Featured" "release-$1/wkhtmltopdf-$1.tar.bz2"
+ul "wkhtmltopdf-$1 Linux Static Binary (i368)" "Type-Executable,OpSys-Linux,Featured" "release-$1/wkhtmltopdf-$1-static-i386.tar.bz2"
+ul "wkhtmltopdf-$1 Linux Static Binary (amd64)" "Type-Executable,OpSys-Linux,Featured" "release-$1/wkhtmltopdf-$1-static-amd64.tar.bz2"
+ul "wkhtmltopdf-$1 Windows Installer (i368)" "Type-Installer,OpSys-Windows,Featured" "release-$1/wkhtmltopdf-$1-installer.exe"

+ 1 - 1
src/manoutputter.cc

@@ -97,7 +97,7 @@ public:
 		for(QVector<QString>::const_iterator i = h->argn.constBegin(); i != h->argn.constEnd(); ++i)
 			fprintf(fd," \\fI<%s>\\fR", S(*i));
 		
-		fprintf(fd, "\n%s\n",S(h->desc));
+		fprintf(fd, "\n%s\n", S(QString(h->desc).replace("-", "\\-")));
 	}
 	
 	void endSwitch() {

+ 32 - 38
src/pageconverter.cc

@@ -1,4 +1,4 @@
-//-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*-
+
 // This file is part of wkhtmltopdf.
 //
 // wkhtmltopdf is free software: you can redistribute it and/or modify
@@ -190,41 +190,6 @@ void PageConverterPrivate::fail() {
 	qApp->exit(0); // quit qt's event handling
 }
 
-
-void PageConverterPrivate::findLinks(QWebFrame * frame, QVector<QPair<QWebElement, QString> > & local, QVector<QPair<QWebElement, QString> > & external) {
-	bool ulocal=true, uexternal=true;
-	if (PageObject::webPageToObject.contains(frame->page())) {
-		ulocal = PageObject::webPageToObject[frame->page()]->settings.useLocalLinks;
-		uexternal  = PageObject::webPageToObject[frame->page()]->settings.useExternalLinks;
-	}
-	if (!ulocal && !uexternal) return;
-	foreach (const QWebElement & elm, frame->findAllElements("a")) {
-		QUrl href=QUrl(elm.attribute("href"));
-		if (href.isEmpty()) continue;
-		href=frame->url().resolved(href);
-		if (urlToPageObj.contains(href.toString(QUrl::RemoveFragment))) {
-			if (ulocal) {
-				PageObject * p = urlToPageObj[href.toString(QUrl::RemoveFragment)];
-				QWebElement e;
-				if (!href.hasFragment()) 
-					e = p->page->mainFrame()->findFirstElement("body");
-				else {
-					e = p->page->mainFrame()->findFirstElement("a[name=\""+href.fragment()+"\"]");
-					if(e.isNull()) 
-						e = p->page->mainFrame()->findFirstElement("*[id=\""+href.fragment()+"\"]");
-				}
-				if (e.isNull())
-					qDebug() << "Unable to find target for local link " << href; 
-				else {
-					p->anchors[href.toString()] = e;
-					local.push_back( qMakePair(elm, href.toString()) );
-				}
-			}
-		} else if (uexternal)
-			external.push_back( qMakePair(elm, href.toString() ) );
-	}
-}
-
 /*!
  * Prepares printing out the document to the pdf file
  */
@@ -389,8 +354,37 @@ void PageConverterPrivate::preparePrint(bool ok) {
 }
 
 #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__
-void PageConverterPrivate::fillParms(QHash<QString, QString> & parms, int page, const settings::Page & ps) {
-	outline->fillHeaderFooterParms(page, parms, ps);
+void PageConverterPrivate::findLinks(QWebFrame * frame, QVector<QPair<QWebElement, QString> > & local, QVector<QPair<QWebElement, QString> > & external) {
+	if (!settings.useLocalLinks && !settings.useExternalLinks) return;
+	foreach (const QWebElement & elm, frame->findAllElements("a")) {
+		QUrl href=QUrl(elm.attribute("href"));
+		if (href.isEmpty()) continue;
+		href=frame->url().resolved(href);
+		if (urlToDoc.contains(href.toString(QUrl::RemoveFragment))) {
+			if (settings.useLocalLinks) {
+				int t = urlToDoc[href.toString(QUrl::RemoveFragment)];
+				QWebElement e;
+				if (!href.hasFragment()) 
+					e = pages[t]->mainFrame()->findFirstElement("body");
+				else {
+					e = pages[t]->mainFrame()->findFirstElement("a[name=\""+href.fragment()+"\"]");
+					if(e.isNull()) 
+						e = pages[t]->mainFrame()->findFirstElement("*[id=\""+href.fragment()+"\"]");
+				}
+				if (e.isNull())
+					qDebug() << "Unable to find target for local link " << href; 
+				else {
+					anchors[t][href.toString()] = e;
+					local.push_back( qMakePair(elm, href.toString()) );
+				}
+			}
+		} else if (settings.useExternalLinks)
+			external.push_back( qMakePair(elm, href.toString() ) );
+	}
+}
+
+void PageConverterPrivate::fillParms(QHash<QString, QString> & parms, int page) {
+	outline->fillHeaderFooterParms(page, parms);
 	QDateTime t(QDateTime::currentDateTime());
 	parms["time"] = t.time().toString(Qt::SystemLocaleShortDate);
 	parms["date"] = t.date().toString(Qt::SystemLocaleShortDate);

+ 1 - 1
wkhtmltopdf.pro

@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with wkhtmltopdf.  If not, see <http:#www.gnu.org/licenses/>.
 
-DEFINES += MAJOR_VERSION=0 MINOR_VERSION=9 PATCH_VERSION=6 BUILD=""
+DEFINES += MAJOR_VERSION=0 MINOR_VERSION=9 PATCH_VERSION=9 BUILD=""
 
 TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl
 PRL  = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl