AddTexCommands() публичный статический Метод

public static AddTexCommands ( string comment ) : string
comment string
Результат string
Пример #1
0
        public override string ToTexCode()
        {
            List <string> lines = new List <string> ();

            lines.Add(@"\subsubsection{Enumeration " + name + @"}");
            lines.Add(@"\paragraph{Beschreibung:}\mbox{}\newline\newline");
            foreach (string cmt in Comments.GetComments(commentsKey))
            {
                lines.Add(Packages.AddTexCommands(cmt));
            }
            lines.Add("\n");
            lines.Add(@"\paragraph{Eigenschaften:}\mbox{} \newline\newline");
            foreach (string _literal in values)
            {
                string literal = _literal;
                if (literal.Contains("="))
                {
                    string[] p = literal.Split(new char[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries);
                    literal = @"\ptype{" + p [0] + @"} \keyword{ = } \varname{" + p [1] + @"}";
                }
                else
                {
                    literal = @"\ptype{" + literal + "}";
                }
                lines.Add(@"\textbf{" + literal + @"}\newline\newline");
                foreach (string cmt in Comments.GetComments(Comments.Key(name, _literal)))
                {
                    lines.Add(cmt);
                }
                lines.Add(@"~\\\\");
            }
            return(string.Join("\n", lines));
        }
Пример #2
0
        public override string ToTexCode()
        {
            List <string> lines = new List <string> ();
            string        uml   = Publicity.ToCode(@"\keyword{", "} ").Replace("public ", "")
                                  + Virtuality.ToCode(@"\keyword{", "} ")
                                  + (IsContructor ? "" : @"\ptype{" + returntype + @"} ")
                                  + @"\varname{" + name.ToTexCode() + "} (";

            for (int i = 0; i < parameters.Length; ++i)
            {
                string[] parts = parameters [i].Split(new char[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
                if (i > 0)
                {
                    uml += ", ";
                }
                if (parts.Length == 1)
                {
                    uml += @"\ptype{" + parts [0] + @"}";
                }
                else if (parts.Length > 1)
                {
                    uml += @"\ptype{" + parts [0] + @"} \varname{" + parts [1].ToTexCode() + "}";
                }
            }
            uml += ")";
            // lines.Add (@"\item[" + uml + @"] \item[]");
            lines.Add(@"\textbf{" + uml + @"}\newline\newline");
            foreach (string _cmt in Comments.GetComments(commentsKey))
            {
                string cmt = _cmt;
                if (cmt.StartsWith("[") && cmt.EndsWith("]") && cmt.Contains("="))
                {
                    continue;
                }
                for (int i = 0; i < parameters.Length; ++i)
                {
                    string[] parts = parameters [i].Split(new char[] { ' ' }, 2, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length > 1)
                    {
                        cmt = cmt.Replace(parts [1], @"\param{" + parts [1] + @"}");
                    }
                }
                cmt = Packages.AddTexCommands(cmt);
                lines.Add(cmt);
            }
            return(string.Join("\n", lines));
        }
Пример #3
0
        public override string ToTexCode()
        {
            List <string> lines = new List <string> ();
            string        uml   = Publicity.ToCode(@"\keyword{", "} ").Replace("public ", "")
                                  + Virtuality.ToCode(@"\keyword{", "} ").Replace("public ", "")
                                  + @"\ptype{" + type + @"} \varname{" + name + "}";

            //lines.Add (@"\item[" + uml + @"] \item[]");
            lines.Add(@"{\textbf{" + uml + @"}\newline\newline");
            foreach (string cmt in Comments.GetComments(commentsKey))
            {
                if (cmt.StartsWith("[") && cmt.EndsWith("]") && cmt.Contains("="))
                {
                    continue;
                }
                lines.Add(Packages.AddTexCommands(cmt));
            }
            return(string.Join("\n", lines));
        }
Пример #4
0
        public override string ToTexCode()
        {
            if (Content.Length == 0)
            {
                return("");
            }

            string        typestr = type == ClassType.Interface ? "Schnittstelle" : "Klasse";
            List <string> lines   = new List <string> ();

            lines.Add(@"\subsubsection{" + typestr + @" " + name + @"}\index{" + Packages.GetPackage(name) + "!" + name + @"}\label{" + name + "}");

            // wrapfigure
            //lines.Add (@"\begin{wrapfigure}{R}{9cm}{0}" + "\n" + @"\centering");
            //lines.Add (@"\includegraphics[scale=0.5]{Klassen/" + Name.Clean () + @"}");
            //lines.Add (@"\end{wrapfigure}");

            // in der mitte
            lines.Add(@"\begin{figure}[h!]" + "\n" + @"\centering");
            lines.Add(@"\includegraphics[scale=1]{Klassen/" + Name.Clean() + @"}");
            lines.Add(@"\end{figure}");


            lines.Add(@"\paragraph{Beschreibung:}\mbox{}\newline\newline");
            foreach (string cmt in Comments.GetComments(commentsKey))
            {
                if (cmt.StartsWith("[") && cmt.EndsWith("]") && cmt.Contains("="))
                {
                    continue;
                }

                lines.Add(Packages.AddTexCommands(cmt));
            }
            //lines.Add (@"\setlength{\columnsep}{10pt}%");
            lines.Add("\n");
            IEnumerable <UmlAttribute> attributes  = Content.OfType <UmlAttribute> ();
            IEnumerable <UmlMethod>    contructors = Content.OfType <UmlMethod> ().Where((m) => m.Name == Name);
            IEnumerable <UmlMethod>    methods     = Content.OfType <UmlMethod> ().Where((m) => m.Name != Name);

            if (attributes.Count() > 0)
            {
                lines.Add(@"\paragraph{Eigenschaften:}\mbox{} \newline\newline");
                bool first = true;
                foreach (UmlAttribute obj in attributes)
                {
                    if (!first)
                    {
                        lines.Add(@"~\\\\");
                    }
                    lines.Add(obj.ToTexCode());
                    first = false;
                }
                //lines.Add (@"\end{description}");
            }
            if (contructors.Count() > 0)
            {
                // lines.Add (@"\paragraph{Konstruktoren:}\mbox{} \begin{description} ");
                lines.Add(@"\paragraph{Konstruktoren:}\mbox{} \newline\newline");
                bool first = true;
                foreach (UmlMethod obj in contructors)
                {
                    if (!first)
                    {
                        lines.Add(@"~\\\\");
                    }
                    obj.IsContructor = true;
                    lines.Add(obj.ToTexCode());
                    first = false;
                }
                //lines.Add (@"\end{description}");
            }
            if (methods.Count() > 0)
            {
                // lines.Add (@"\paragraph{Methoden:}\mbox{} \begin{description} ");
                lines.Add(@"\paragraph{Methoden:}\mbox{} \newline\newline");
                bool first = true;
                foreach (UmlMethod obj in methods)
                {
                    if (!first)
                    {
                        lines.Add(@"~\\\\");
                    }
                    lines.Add(obj.ToTexCode());
                    first = false;
                }
                // lines.Add (@"\end{description}");
            }
            return(string.Join("\n", lines).Replace("<", "$<$").Replace(">", "$>$"));
        }