[patch] TeX support in FilterSource



Based on the files submitted at bug # (forgotten) here is a patch that
includes support for Tex files into FilterSource.cs

I tested the patch with debian/sid beagle-0.1. and it worked.

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining AT logic DOT at>             Università di Siena
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
MOLESBY (n.)
The kind of family that drives to the seaside and then sits in the car
with all the windows closed, reading the Sunday Express and wearing
sidcups (q.v.)
			--- Douglas Adams, The Meaning of Liff
diff -urN beagle-0.1.1.orig/Filters/FilterSource.cs beagle-0.1.1/Filters/FilterSource.cs
--- beagle-0.1.1.orig/Filters/FilterSource.cs	2005-08-31 21:33:56.000000000 +0200
+++ beagle-0.1.1/Filters/FilterSource.cs	2005-10-19 16:33:00.000000000 +0200
@@ -41,7 +41,8 @@
 			Fortran_Style,
 			Pascal_Style,
 			Lisp_Style,
-			Matlab_Style
+			Matlab_Style,
+			Tex_Style
 		};
 		
 		protected LangType SrcLangType;
diff -urN beagle-0.1.1.orig/Filters/FilterTex.cs beagle-0.1.1/Filters/FilterTex.cs
--- beagle-0.1.1.orig/Filters/FilterTex.cs	1970-01-01 01:00:00.000000000 +0100
+++ beagle-0.1.1/Filters/FilterTex.cs	2005-10-19 16:54:31.000000000 +0200
@@ -0,0 +1,91 @@
+//
+// FilterTex.cs
+//
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+using Beagle.Daemon;
+
+namespace Beagle.Filters {
+
+	public class FilterTex : FilterSource {
+
+        static string  [] strKeyWords  ={"begin","end","addcontentsline","address","addtocontents","addtocounter","addtolength","addvspace",
+					 "Alph","alph","appendix","arabic","author","backslash","begin","bfseries","bibitem",
+					 "bibliography","bibliographystyle","bigskip","caption","cc","cdots","centering",
+					 "chapter","circle","cite","cleardoublepage","clearpage","cline","closing","COLON",
+					 "dashbox","date","ddots","depth","documentclass","dotfill","emph","encl","end",
+					 "enlargethispage","fbox","flushbottom","fnsymbol","fontencoding","fontfamily",
+					 "fontseries","fontshape","fontsize","footnote","footnotemark","footnotesize","footnotetext",
+					 "frac","frame","framebox","framebox","fussy","height","hfill","hline","hrulefill","hspace","Huge",
+					 "huge","hyphenation","include","includeonly","indent","input","item","itshape","kill",
+					 "label","LARGE","Large","large","ldots","lefteqn","line","linebreak","linethickness",
+					 "listoffigures","listoftables","location","makebox","makelabels","maketitle",
+					 "markboth","markright","mathbf","mathcal","mathit","mathnormal","mathrm","mathsf",
+					 "mathtt","mathversion","mbox","mdseries","medskip","multicolumn","multiput","name",
+					 "newcommand","newcounter","newenvironment","newfont","newlength","newline","newpage",
+					 "newsavebox","newtheorem","nocite","nofiles","noindent","nolinebreak","nopagebreak","normalfont",
+					 "normalsize","onecolumn","opening","oval","overbrace","overline","pagebreak","pagenumbering",
+					 "pageref","pagestyle","par","paragraph","parbox","poptabs","ps","pushtabs","put","raggedbottom",
+	   			         "raggedleft","raggedright","raisebox","ref","refstepcounter","rmfamily","Roman","roman","rule",
+ 					 "savebox","sbox","scriptsize","scshape","selectfont","setcounter","setlength","settodepth","settoheight",
+					 "settowidth","sffamily","shortstack","signature","sloppy","slshape","small","smallskip","sqrt","startbreaks",
+					 "stepcounter","stopbreaks","subparagraph","subsection","subsubsection","symbol","tableofcontents","telephone",
+					 "textbf","textit","textmd","textnormal","textrm","textsc","textsf","textsl","texttt","textup","thanks",
+				         "thispagestyle","tiny","title","today","totalheight","ttfamily","twocolumn","typein","typeout","underbrace",
+					 "underline","upshape","usebox","usecounter","usefont","usepackage","value","vdots","vector","verb","vfill",
+					 "vline","vspace","width","","","array","center","description","enumerate","eqnarray","equation","figure",
+					 "flushleft","flushright","itemize","letter","list","lrbox","minipage","picture","quotation","quote","tabbing",
+					 "table","tabular","thebibliography","theorem","titlepage","verbatim","verse"};
+
+	//FIXME: Check if the parser in FilterSource can remove the '\'
+
+						
+			
+		public FilterTex ()
+		{
+			AddSupportedFlavor (FilterFlavor.NewFromMimeType ("text/x-tex"));
+			AddSupportedFlavor (FilterFlavor.NewFromMimeType ("text/x-bibtex"));
+		}
+
+		override protected void DoOpen (FileInfo info)
+		{
+			foreach (string keyword in strKeyWords)
+				KeyWordsHash [keyword] = true;
+			SrcLangType = LangType.Tex_Style;
+		}
+
+		override protected void DoPull ()
+		{
+			string str = TextReader.ReadLine ();
+			if (str == null)
+				Finished ();
+			else
+				ExtractTokens (str);
+		}
+	}
+}
diff -urN beagle-0.1.1.orig/Filters/Makefile.am beagle-0.1.1/Filters/Makefile.am
--- beagle-0.1.1.orig/Filters/Makefile.am	2005-09-15 18:55:15.000000000 +0200
+++ beagle-0.1.1/Filters/Makefile.am	2005-10-19 16:34:25.000000000 +0200
@@ -47,6 +47,7 @@
 	$(srcdir)/FilterJs.cs		\
 	$(srcdir)/FilterLisp.cs		\
 	$(srcdir)/FilterMatlab.cs	\
+	$(srcdir)/FilterTex.cs	\
 	$(srcdir)/FilterScilab.cs	\
 	$(srcdir)/FilterDocbook.cs	\
 	$(srcdir)/FilterMonodoc.cs	\
diff -urN beagle-0.1.1.orig/Filters/Makefile.in beagle-0.1.1/Filters/Makefile.in
--- beagle-0.1.1.orig/Filters/Makefile.in	2005-10-03 22:47:52.000000000 +0200
+++ beagle-0.1.1/Filters/Makefile.in	2005-10-19 16:34:39.000000000 +0200
@@ -393,6 +393,7 @@
 	$(srcdir)/FilterAbiword.cs $(srcdir)/FilterSpreadsheet.cs \
 	$(srcdir)/FilterJs.cs $(srcdir)/FilterLisp.cs \
 	$(srcdir)/FilterMatlab.cs $(srcdir)/FilterScilab.cs \
+	$(srcdir)/FilterTex.cs \
 	$(srcdir)/FilterDocbook.cs $(srcdir)/FilterMonodoc.cs \
 	$(srcdir)/FilterDesktop.cs $(srcdir)/FilterDirectory.cs \
 	$(srcdir)/FilterMail.cs $(srcdir)/FilterMusic.cs \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]