SF.net SVN: geany-plugins:[323] trunk/geanylatex/src

frlan at users.sourceforge.net frlan at xxxxx
Wed Dec 3 21:13:58 UTC 2008


Revision: 323
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=323&view=rev
Author:   frlan
Date:     2008-12-03 21:13:57 +0000 (Wed, 03 Dec 2008)

Log Message:
-----------
GeanyLaTeX: Added a special template for letters

Modified Paths:
--------------
    trunk/geanylatex/src/geanylatex.c
    trunk/geanylatex/src/geanylatex.h

Modified: trunk/geanylatex/src/geanylatex.c
===================================================================
--- trunk/geanylatex/src/geanylatex.c	2008-12-03 21:13:30 UTC (rev 322)
+++ trunk/geanylatex/src/geanylatex.c	2008-12-03 21:13:57 UTC (rev 323)
@@ -677,7 +677,10 @@
 			}
 		}
 
-		code = g_string_new(TEMPLATE_LATEX);
+		if (documentclass_int == 3)
+			code = g_string_new(TEMPLATE_LATEX_LETTER);
+		else
+			code = g_string_new(TEMPLATE_LATEX);
 
 		if (classoptions != NULL)
 		{
@@ -698,11 +701,27 @@
 		{
 			if (author[0] != '\0')
 			{
-				author = g_strconcat("\\author{", author, "}\n", NULL);
+				if (documentclass_int == 3)
+			  	{
+			  		author = g_strconcat("\\signature{", author, "}\n", NULL);
+				}
+			  	else
+				{
+					author = g_strconcat("\\author{", author, "}\n", NULL);
+				}
+
 				p_utils->string_replace_all(code, "{AUTHOR}", author);
 			}
 			else
-				p_utils->string_replace_all(code, "{AUTHOR}", "\% \\author{}\n");
+				if (documentclass_int == 3)
+				{
+					p_utils->string_replace_all(code, "{AUTHOR}", "\% \\signature{}\n");
+				}
+				else
+				{
+					p_utils->string_replace_all(code, "{AUTHOR}", "\% \\author{}\n");
+				}
+
 			g_free(author);
 		}
 		if (date != NULL)
@@ -720,11 +739,27 @@
 		{
 			if (title[0] != '\0')
 			{
-				title = g_strconcat("\\title{", title, "}\n", NULL);
+				if (documentclass_int == 3)
+				{
+					title = g_strconcat("\\subject{", title, "}\n", NULL);
+				}
+				else
+				{
+					title = g_strconcat("\\title{", title, "}\n", NULL);
+				}
+
 				p_utils->string_replace_all(code, "{TITLE}", title);
 			}
 			else
-				p_utils->string_replace_all(code, "{TITLE}", "\% \\title{} \n");
+				if (documentclass_int == 3)
+				{
+					p_utils->string_replace_all(code, "{TITLE}", "\% \\subject{} \n");
+				}
+				else
+				{
+					p_utils->string_replace_all(code, "{TITLE}", "\% \\title{} \n");
+				}
+
 			g_free(title);
 		}
 		output = g_string_free(code, FALSE);

Modified: trunk/geanylatex/src/geanylatex.h
===================================================================
--- trunk/geanylatex/src/geanylatex.h	2008-12-03 21:13:30 UTC (rev 322)
+++ trunk/geanylatex/src/geanylatex.h	2008-12-03 21:13:57 UTC (rev 323)
@@ -66,6 +66,19 @@
 \n\
 \\end{document}\n"
 
+#define TEMPLATE_LATEX_LETTER "\
+\\documentclass[{CLASSOPTION}]{{DOCUMENTCLASS}}\n\
+{ENCODING}\
+\\stdaddress{}\n\
+\\place{}\n\
+{DATE}\
+{TITLE}\
+{AUTHOR}\
+\\begin{document}\n\
+\\begin{letter}{}\n\
+\\opening{}\n\
+\\end{document}\n"
+
 #define create_sub_menu(base_menu, menu, item, title) \
 		(menu) = gtk_menu_new(); \
 		(item) = gtk_menu_item_new_with_mnemonic((title)); \


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list