hi,

by the way, the attached patch add StandardTemplate support to 0.3.8 
version...

a++
diff -ruN kdissert-0.3.8-old/debian/rules kdissert-0.3.8/debian/rules
--- kdissert-0.3.8-old/debian/rules	2005-04-22 23:27:57.000000000 +0200
+++ kdissert-0.3.8/debian/rules	2005-04-22 23:27:57.000000000 +0200
@@ -13,6 +13,7 @@
 
 common-build-arch:: build-stamp debian/kdissert.xpm debian/kdissert-16.xpm
 build-stamp:
+	( cd src/templates; uudecode kdissstx.tar.gz.uu )
 	$(SCONS) configure prefix=$(DEB_DESTDIR)/usr
 	$(SCONS)
 	perl -pi -e "s#$(DEB_DESTDIR)##" `find . -name *.la`
@@ -31,7 +32,7 @@
 
 
 clean::
-	rm -f build-stamp
+	rm -f build-stamp src/templates/kdissstx.tar.gz
 	-test -f kde.cache.py && $(SCONS) --clean
 	rm -f debian/kdissert.xpm debian/kdissert-16.xpm
 	rm -f generic.pyc kde.pyc generic.cache.py kde.cache.py
diff -ruN kdissert-0.3.8-old/src/templates/kdissstx.cpp kdissert-0.3.8/src/templates/kdissstx.cpp
--- kdissert-0.3.8-old/src/templates/kdissstx.cpp	1970-01-01 01:00:00.000000000 +0100
+++ kdissert-0.3.8/src/templates/kdissstx.cpp	2005-04-23 01:08:06.000000000 +0200
@@ -0,0 +1,157 @@
+/***************************************************************************
+ *   Copyright (C) 2005 praKsys                                            *
+ *   [EMAIL PROTECTED]                                                   *
+ *                                                                         *
+ *   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, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include <qdir.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qmap.h>
+#include <qpixmap.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+#include <ktempdir.h>
+#include <kgenericfactory.h>
+
+#include "settings.h"
+#include "datastruct/aux.h"
+#include "datastruct/DItem.h"
+#include "datastruct/DDataControl.h"
+#include "datastruct/DDataItem.h"
+
+#include "kdissstx.h"
+
+K_EXPORT_COMPONENT_FACTORY(libkdissstx, kdissstxFactory) 
+	QObject *kdissstxFactory::createObject(QObject *, const char *, const char *, const QStringList &) { return new kdissstx; }
+
+const QString kdissstx::identifikation()
+{
+	return "kdissstx";
+}
+
+const QString kdissstx::fullName()
+{
+	return "StructuredText";
+}
+
+const QString kdissstx::group()
+{
+	return "Plain Text";
+}
+
+const QString kdissstx::description()
+{
+	return i18n("This template generates a StructuredText document for use in Plone. The pictures will be included in the directory created.");
+}
+
+const QString kdissstx::quickstart()
+{
+	return i18n("Go into the directory created and view main.txt with a text editor (eg: Kate)\n");
+}
+
+static const QString indent_string = "\n          ";
+QString indent(const QString &str, int level)
+{
+	QStringList strings( QStringList::split( "\n", str ) );
+	QStringList::Iterator i;
+
+	for ( i = strings.begin(); i != strings.end(); ++i )
+	{
+	     *i = indent_string.left( level ) + (*i).simplifyWhiteSpace() + "\n";
+	}
+	return strings.join("");
+}
+
+void outputPixParagraph(DDataItem* item, QTextStream & s, int level)
+{
+	if (item->m_pix.isNull())
+		return;
+	s << indent("</p><div align=\"center\"><img src=\"pics/" + item->m_picfilename +
+		    "\" alt=\""  + item->m_piccaption + "\" /></div><p>", level)<<"\n";
+}
+
+void kdissstx::outputLinks(DDataItem* item, QTextStream & s, int level)
+{
+	for (unsigned int i=0; i<item->m_urllist.count(); i++)
+	{
+		if (!item->m_urllist[i].m_caption.length())
+			s <<indent( item->m_urllist[i].m_url, level)<<"\n";
+		else
+                        s << indent( "\"" + item->m_urllist[i].m_caption + "\":" + item->m_urllist[i].m_url,
+				     level)<<"\n";
+	}
+}
+
+void kdissstx::outputComment(DDataItem* item, QTextStream & s, int level)
+{
+        if (item->m_comment.length()) {
+                s<<indent("::", level)<<"\n";
+                s<<indent(item->m_comment, level + 1)<<"\n";
+	}
+}
+
+void kdissstx::writeItem(DDataItem* item, QTextStream & s, int level)
+{
+	DGenerator::writeItem(item, s, level);
+
+        // print the abstract
+	//s<<i18n("add a space after the:", "Abstract: ")<<wipeTags(item->m_text)<<"\n\n\n";
+	s<<indent( item->m_summary, level );
+	s<<indent( wipeTags(item->m_text), level + 1 );
+	outputPixParagraph(item, s, level + 1 );
+	outputComment(item, s, level + 1 );
+	outputLinks(item, s, level + 1 );
+
+	// write recursively the rest of the tree
+	for (int i = 0; i<item->countChildren(); i++ )
+	{
+		writeItem( (DDataItem*) m_data->Item( item->childNum(i) ), s, level + 1 );
+	}
+}
+
+bool kdissstx::writeMaindoc(DDataItem *root, const QString & path)
+{
+	QFile textfile(path+"/main.txt");
+	if (!textfile.open(IO_WriteOnly | IO_Append) )
+	{
+		kdWarning()<<"could not open ascii file for append :-/"<<endl;
+		return false;
+	}
+
+	QTextStream u(&textfile);
+	if (Settings::templatesUTF8())
+	{
+		u.setEncoding(QTextStream::UnicodeUTF8);
+	}
+
+	// u<<i18n("add a space after the:", "Title: ")<<root->m_summary<<"\n";
+	// u<<i18n("add a space after the:", "Author: ")<<m_data->m_fname<<" "<<m_data->m_sname<<"\n";
+
+	// now the central part, with text, pictures, etc ..
+	writeItem(root, u, 0);
+
+	// close the file 
+	textfile.close();
+
+	notifyDocGenerated( path+"/main.txt" );
+	
+	return true;
+}
+
+#include "kdissstx.moc"
diff -ruN kdissert-0.3.8-old/src/templates/kdissstx.h kdissert-0.3.8/src/templates/kdissstx.h
--- kdissert-0.3.8-old/src/templates/kdissstx.h	1970-01-01 01:00:00.000000000 +0100
+++ kdissert-0.3.8/src/templates/kdissstx.h	2005-04-22 23:27:57.000000000 +0200
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *   Copyright (C) 2005 praKsys                                            *
+ *   [EMAIL PROTECTED]                                                   *
+ *                                                                         *
+ *   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, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _KDISSSTX_H
+#define _KDISSSTX_H
+
+#include <qstringlist.h>
+#include <qobject.h>
+#include <klibloader.h>
+#include "DGenerator.h"
+
+class kdissstxFactory : KLibFactory { Q_OBJECT public: QObject *createObject(QObject *, const char *, const char *, const QStringList & = QStringList()); };
+
+class DDataItem;
+class kdissstx : public DGenerator
+{
+    public:
+	~kdissstx() {}
+
+	const QString identifikation();
+	const QString fullName();
+	const QString group();
+	const QString description();
+	const QString quickstart();
+
+    protected:
+	bool writeMaindoc(DDataItem*, const QString &);
+	void writeItem(DDataItem* item, QTextStream & s, int level);
+	void outputLinks(DDataItem* item, QTextStream & s, int level);
+	void outputComment(DDataItem* item, QTextStream & s, int level);
+
+};
+
+#endif // _KDISSSTX_H
+
diff -ruN kdissert-0.3.8-old/src/templates/kdissstx.tar.gz.uu kdissert-0.3.8/src/templates/kdissstx.tar.gz.uu
--- kdissert-0.3.8-old/src/templates/kdissstx.tar.gz.uu	1970-01-01 01:00:00.000000000 +0100
+++ kdissert-0.3.8/src/templates/kdissstx.tar.gz.uu	2005-04-22 23:27:57.000000000 +0200
@@ -0,0 +1,5 @@
+begin-base64 644 kdissstx.tar.gz
+H4sIALf8aEIAA+3OMQqDQBCF4ak9xZ5A3qy6nmcDAQVNoRvI8U1I0qYQNM3/
+NcPAK/45j7e6PIodSC6ltjVJ3nf+uvL3/xHNFZvofYqdnntvkizoyKiv+1ry
+EoJdpjz83l2X9Yygc1XVvwsAAAAAAAAAAAAAAAAAAHtsuXnsaQAoAAA=
+====
diff -ruN kdissert-0.3.8-old/src/templates/SConscript kdissert-0.3.8/src/templates/SConscript
--- kdissert-0.3.8-old/src/templates/SConscript	2005-03-23 17:45:35.000000000 +0100
+++ kdissert-0.3.8/src/templates/SConscript	2005-04-22 23:27:57.000000000 +0200
@@ -12,7 +12,8 @@
 'kdissprosperslides',
 'kdissbeamerslides',
 'kdisspdflatexbook',
-'kdisspdflatexarticle'
+'kdisspdflatexarticle',
+'kdissstx'
 ]
 
 ## use the myenvironment set in SConstruct

Reply via email to