SF.net SVN: geany-plugins:[1093] trunk/geanylatex/src/bibtex.c

frlan at users.sourceforge.net frlan at xxxxx
Thu Dec 31 02:17:38 UTC 2009


Revision: 1093
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1093&view=rev
Author:   frlan
Date:     2009-12-31 02:17:37 +0000 (Thu, 31 Dec 2009)

Log Message:
-----------
Use also plugin API v166's editor_get_eol_char() also for bibTeX entries

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

Modified: trunk/geanylatex/src/bibtex.c
===================================================================
--- trunk/geanylatex/src/bibtex.c	2009-12-31 02:16:33 UTC (rev 1092)
+++ trunk/geanylatex/src/bibtex.c	2009-12-31 02:17:37 UTC (rev 1093)
@@ -134,11 +134,23 @@
 	gint i;
 	GString *output = NULL;
 	gchar *tmp = NULL;
-
+	GeanyDocument *doc = NULL;
+	const gchar *eol;
+	
+	doc = document_get_current();
+	if (doc != NULL)
+	{
+		eol = editor_get_eol_char(doc->editor);
+	}
+	else
+	{
+		eol = "\n";
+	}
 	/* Adding the doctype to entry */
 	output = g_string_new("@");
 	g_string_append(output, glatex_label_types[doctype]);
-	g_string_append(output, "{ \n");
+	g_string_append(output, "{");
+	g_string_append(output, eol);
 
 	/* Adding the keywords and values to entry */
 	for (i = 0; i < GLATEX_BIBTEX_N_ENTRIES; i++)
@@ -150,7 +162,8 @@
 			if (utils_str_equal(g_ptr_array_index (entry, i), "\0"))
 			{
 				g_string_append(output, glatex_label_entry_keywords[i]);
-				g_string_append(output," = {},\n");
+				g_string_append(output," = {}");
+				g_string_append(output, eol);
 			}
 			/* ... or has some real value inside. */
 			else
@@ -158,12 +171,14 @@
 				g_string_append(output, glatex_label_entry_keywords[i]);
 				g_string_append(output, " = {");
 				g_string_append(output, g_ptr_array_index(entry, i));
-				g_string_append(output, "},\n");
+				g_string_append(output, "}");
+				g_string_append(output, eol);
 			}
 		}
 	}
 
-	g_string_append(output, "}\n");
+	g_string_append(output, "}");
+	g_string_append(output, eol);
 	tmp = g_string_free(output, FALSE);
 	glatex_insert_string(tmp, FALSE);
 	g_free(tmp);


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