浏览代码

Some more doc

Jakob Truelsen 16 年之前
父节点
当前提交
7e0d233910
共有 4 个文件被更改,包括 42 次插入29 次删除
  1. 1 0
      src/commandlineparser.cc
  2. 20 5
      src/manoutputter.cc
  3. 9 21
      src/textoutputter.cc
  4. 12 3
      wkhtmltopdf.pro

+ 1 - 0
src/commandlineparser.cc

@@ -75,6 +75,7 @@ void CommandLineParserPrivate::manpage(FILE * fd) const {
 #else
 #else
 	outputNotPatched(o,true);
 	outputNotPatched(o,true);
 #endif
 #endif
+	outputArgsFromStdin(o);
  	outputPageBreakDoc(o);
  	outputPageBreakDoc(o);
  	outputContact(o);
  	outputContact(o);
  	outputAuthors(o);
  	outputAuthors(o);

+ 20 - 5
src/manoutputter.cc

@@ -14,12 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // You should have received a copy of the GNU General Public License
 // along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
 // along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
 #include "commandlineparser_p.hh"
 #include "commandlineparser_p.hh"
-
+#include <QStringList>
 #define S(x) ((x).toLocal8Bit().constData())
 #define S(x) ((x).toLocal8Bit().constData())
 
 
 class ManOutputter: public Outputter {
 class ManOutputter: public Outputter {
 private:
 private:
 	FILE * fd;
 	FILE * fd;
+	int order;
 public:
 public:
 	ManOutputter(FILE * _): fd(_) {
 	ManOutputter(FILE * _): fd(_) {
 		fprintf(fd,".TH WKHTMLTOPDF 1 \"2009 February 23\"\n\n");
 		fprintf(fd,".TH WKHTMLTOPDF 1 \"2009 February 23\"\n\n");
@@ -57,16 +58,30 @@ public:
 	}
 	}
 
 
 	void verbatim(const QString & t) {
 	void verbatim(const QString & t) {
-		fprintf(fd, "%s", S(t));
+		QStringList l = t.split('\n');
+		while ( l.back() == "") l.pop_back();
+		foreach(const QString & line, l)
+			fprintf(fd, "  %s\n", S(line));
+		fprintf(fd, "\n");
 	}
 	}
 	
 	
 	void beginSwitch() {
 	void beginSwitch() {
 		fprintf(fd, ".PD 0\n");
 		fprintf(fd, ".PD 0\n");
 	}
 	}
 
 
-	void beginList(bool ordered) {}
-	void endList() {}
-	void listItem(const QString & s) {}
+	void beginList(bool ordered) {
+		order=(ordered?1:-1);
+	}
+
+	void endList() {
+		fprintf(fd, "\n");
+	}
+	
+	void listItem(const QString & s) {
+		if (order < 0) fprintf(fd, " * ");
+		else fprintf(fd, "%3d ", order++);
+		fprintf(fd,"%s\n",S(s));
+	}
 	
 	
 	void cswitch(const ArgHandler * h, bool) {
 	void cswitch(const ArgHandler * h, bool) {
 		fprintf(fd, ".TP\n");
 		fprintf(fd, ".TP\n");

+ 9 - 21
src/textoutputter.cc

@@ -106,29 +106,17 @@ public:
 	}
 	}
 
 
 	void beginList(bool ordered) {
 	void beginList(bool ordered) {
-		order=ordered:1?-1;
+		order=ordered?1:-1;
+	}
+	void endList() {
+		fprintf(fd,"\n");
+	}
+	void listItem(const QString & s) {
+		if (order < 0) fprintf(fd, " * ");
+		else fprintf(fd, "%3d ", order++);
+		fprintf(fd,"%s\n",S(s));
 	}
 	}
-	void endList() {}
-	void listItem(const QString & s) {}
-	
-// 	void beginList(bool ordered) {
-// 		this->ordered = ordered;
-// 		order = 1;
-// 	}
-	
-// 	void endList() {
-// 		printf("\n");
-// 	}
 	
 	
-// 	void listItem(QString & t) {
-// 		if(ordered) {
-// 			fprintf(fd, "%2d: ",order);
-// 			++order;
-// 		} else 
-// 			fprintf(fd, " * ");
-// 		fprintf(fd,"%s\N", doc?t.toUtf8().constData():t.toLocal8Bit().constData());
-// 	}
-
 	void beginSwitch() {}
 	void beginSwitch() {}
 
 
 	void cswitch(const ArgHandler * h, bool doc) {
 	void cswitch(const ArgHandler * h, bool doc) {

+ 12 - 3
wkhtmltopdf.pro

@@ -33,12 +33,20 @@ DEPENDPATH += . src
 INCLUDEPATH += . src
 INCLUDEPATH += . src
 
 
 MOC_DIR = build
 MOC_DIR = build
+OBJECTS_DIR = build
+UI_DIR = build
+
+readme.target=README
+readme.commands=./wkhtmltopdf --readme > README
+readme.depends=wkhtmltopdf
+
+QMAKE_EXTRA_UNIX_TARGETS += readme
 
 
 unix {
 unix {
     man.target=wkhtmltopdf.1.gz
     man.target=wkhtmltopdf.1.gz
-    man.commands=m4 wkhtmltopdf.man.m4 | gzip > $@
-    man.depends=wkhtmltopdf wkhtmltopdf.man.m4 
-    
+    man.commands=./wkhtmltopdf --manpage | gzip > $@
+    man.depends=wkhtmltopdf
+
     manins.target=manins
     manins.target=manins
     manins.depends=man
     manins.depends=man
     manins.files=wkhtmltopdf.1.gz
     manins.files=wkhtmltopdf.1.gz
@@ -48,6 +56,7 @@ unix {
     INSTALLS += manins
     INSTALLS += manins
 }
 }
 
 
+
 win32 {
 win32 {
     CONFIG += console
     CONFIG += console
 }
 }