diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2022-04-13 16:08:14 +0100 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2022-04-13 16:08:14 +0100 |
commit | 5faf5c34d833f8467bce580e1e249f54856042dc (patch) | |
tree | 23961c9b1bf8a30e3ce8abac5918a95cf318e69f | |
parent | c191669089061a5082dba997ca43d1db233c1b72 (diff) | |
download | Smarker-5faf5c34d833f8467bce580e1e249f54856042dc.tar.gz Smarker-5faf5c34d833f8467bce580e1e249f54856042dc.zip |
Mostly finished tex template
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | ExampleSubmission/example.py | 2 | ||||
-rw-r--r-- | examplerun.sh | 2 | ||||
m--------- | python-latex-highlighting | 0 | ||||
-rw-r--r-- | requirements.txt | 1 | ||||
-rw-r--r-- | smarker.conf | 2 | ||||
-rw-r--r-- | templates/tex.jinja2 | 122 |
7 files changed, 110 insertions, 22 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3183235 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "python-latex-highlighting"] + path = python-latex-highlighting + url = git@github.com:olivierverdier/python-latex-highlighting.git diff --git a/ExampleSubmission/example.py b/ExampleSubmission/example.py index 0cf7cd7..07f21d4 100644 --- a/ExampleSubmission/example.py +++ b/ExampleSubmission/example.py @@ -25,7 +25,9 @@ class Application(tk.Tk): """
return "%s %s" % (arg_1, arg_2)
+ # add
def add(self, num1:int, num2:int) -> int:
+ # add
"""Adds two numbers together and returns the output
Args:
diff --git a/examplerun.sh b/examplerun.sh index eac57b8..b78046f 100644 --- a/examplerun.sh +++ b/examplerun.sh @@ -4,5 +4,5 @@ rm 100301654.zip pdflatex 100301654_report.tex rm -v *.log rm -v *.aux -rm -v *.tex +# rm -v *.tex rm -v *_test_report.pdf
\ No newline at end of file diff --git a/python-latex-highlighting b/python-latex-highlighting new file mode 160000 +Subproject a5b8353876512d8d571a3c3be59452995318a17 diff --git a/requirements.txt b/requirements.txt index 5b00312..3831b5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ # sudo apt-get install wkhtmltopdf
+# https://github.com/olivierverdier/python-latex-highlighting
Jinja2==3.0.3
misaka==2.1.1
Pygments==2.10.0
diff --git a/smarker.conf b/smarker.conf index b4a0540..a31e5d7 100644 --- a/smarker.conf +++ b/smarker.conf @@ -5,7 +5,7 @@ user = root passwd = *************
[tex]
-columns = 2
+columns = 1
show_full_docs = True
show_source = True
show_all_regex_occurrences = True
diff --git a/templates/tex.jinja2 b/templates/tex.jinja2 index 998ba37..94deb20 100644 --- a/templates/tex.jinja2 +++ b/templates/tex.jinja2 @@ -2,14 +2,45 @@ \texttt{((( tex_escape(function_name) )))}:
((* if function_contents["present"] *))
- Arguments: \texttt{((( tex_escape(function_contents["arguments"]) )))}
+ \begin{itemize}
+ \item Arguments: \pyth{((( function_contents["arguments"] )))}
+ \item Documentation: ((( len_documentation(function_contents["documentation"]["comments"], function_contents["documentation"]["doc"]) ))) characters long
+ ((* if tex_show_full_docs == "True" *))
+
+ \textbf{Comments:}
+ ((*- if function_contents["documentation"]["comments"] == "None" *))
+ \errortext{No comments present.}
+ ((* else *))
+ \begin{lstlisting}
+((( function_contents["documentation"]["comments"] )))
+ \end{lstlisting}
+ ((* endif *))
+
+ \textbf{Docstring}:
+ ((*- if function_contents["documentation"]["doc"] == "None" *))
+ \errortext{No docstring present.}
+ ((* else *))
+ \begin{lstlisting}
+((( function_contents["documentation"]["doc"] )))
+ \end{lstlisting}
+ ((* endif *))
+ ((* endif *))
+ \item Code: ((( get_source_numlines(function_contents["source_code"]) )))
+ ((* if tex_show_source == "True" *))
+ \begin{python}
+((( function_contents["source_code"] )))
+ \end{python}
+ ((* endif *))
+ \end{itemize}
((* else *))
- \errortext(Function \texttt{((( tex_escape(function_name) )))} not present.)
+ \errortext{((( x ))) \texttt{((( tex_escape(function_name) )))} not present.}
((* endif *))
((* endmacro *))
\documentclass{article}
+\usepackage{python-latex-highlighting/pythonhighlight}
+
\usepackage[margin=1in]{geometry} % margins
\usepackage{multicol} % columns
\usepackage{float} % layout
@@ -30,7 +61,9 @@ breaklines=true \begin{document}
+((* if tex_columns != "1" *))
\begin{multicols}{((( tex_columns )))}
+((* endif *))
\maketitle
\section{Class Tree}
@@ -64,13 +97,14 @@ breaklines=true ((( files_contents["exception"]["traceback"] )))
\end{lstlisting}
((* else *))
- \textbf{Documentation:}
+ \begin{itemize}
+ \item \textbf{Documentation:}
((( len_documentation(files_contents["documentation"]["comments"], files_contents["documentation"]["doc"]) ))) characters long
((* if tex_show_full_docs == "True" *))
- \textbf{Comments:}
- ((* if files_contents["documentation"]["comments"] == "None" *))
+ \item \textbf{Comments:}
+ ((*- if files_contents["documentation"]["comments"] == "None" *))
\errortext{No comments present.}
((* else *))
\begin{lstlisting}
@@ -78,35 +112,39 @@ breaklines=true \end{lstlisting}
((* endif *))
- \textbf{Docstring:}
- ((* if files_contents["documentation"]["doc"] == "None" *))
+ \item \textbf{Docstring:}
+ ((*- if files_contents["documentation"]["doc"] == "None" *))
\errortext{No docstring present.}
((* else *))
\begin{lstlisting}
((( files_contents["documentation"]["doc"] )))
\end{lstlisting}
((* endif *))
+
((* endif *))
+ \end{itemize}
((* if "classes" in files_contents.keys() *))
\subsubsection{Classes}
((* set flat_classes = flatten_struct(files_contents["classes"]) *))
((* for class_name, class_contents in flat_classes.items() *))
+ \begin{itemize}
+
-
- \texttt{((( class_name )))}:
+ \item \texttt{((( class_name )))}:
((* if class_contents["present"] *))
- \textbf{Documentation:}
-
+ \begin{itemize}
+ \item \textbf{Documentation:}
((( len_documentation(class_contents["documentation"]["comments"], class_contents["documentation"]["doc"]) ))) characters long
+
((* if tex_show_full_docs == "True" *))
- \textbf{Comments:}
+ \item \textbf{Comments:}
- ((* if class_contents["documentation"]["comments"] == "None" *))
+ ((* if class_contents["documentation"]["comments"] == "None" -*))
\errortext{No comments present.}
((* else *))
\begin{lstlisting}
@@ -115,9 +153,9 @@ breaklines=true ((* endif *))
- \textbf{Docstring:}
+ \item \textbf{Docstring:}
- ((* if class_contents["documentation"]["doc"] == "None" *))
+ ((* if class_contents["documentation"]["doc"] == "None" -*))
\errortext{No docstring present.}
((* else *))
\begin{lstlisting}
@@ -126,15 +164,16 @@ breaklines=true ((* endif *))
((* if "methods" in class_contents.keys() *))
- \textbf{Methods:}
+ \item \textbf{Methods:}
((* set flat_methods = flatten_struct(class_contents["methods"]) *))
+ \begin{itemize}
((* for method_name, method_contents in flat_methods.items() *))
- ((( expand_function(method_name, method_contents, x = "Method") )))
+ \item ((( expand_function(method_name, method_contents, x = "Method") )))
((* endfor *))
-
+ \end{itemize}
((* endif *))
-
+ \end{itemize}
((* endif *))
((* else *))
@@ -143,12 +182,53 @@ breaklines=true ((* endif *))
-
+ \end{itemize}
((* endfor *))
((* endif *))
+ ((* if "functions" in files_contents.keys() *))
+ \subsubsection{Functions}
+ ((* set flat_functions = flatten_struct(files_contents["functions"]) *))
+ \begin{itemize}
+ ((* for function_name, function_contents in flat_functions.items() *))
+ \item ((( expand_function(function_name, function_contents) )))
+ ((* endfor *))
+ \end{itemize}
+ ((* endif *))
+
+ \subsubsection{Runtime Analysis}
+ ((* set flat_runtime = flatten_struct(files_contents["run"]) *))
+ \begin{itemize}
+ ((* for cmd, runtime_contents in flat_runtime.items() *))
+ \item Command: \texttt{((( tex_escape(cmd) )))}
+ \item Monitor:
+ ((*- if "monitor" in runtime_contents.keys() *))
+ \texttt{((( tex_escape(runtime_contents["monitor"]) )))}
+ ((*- else *))
+ stdout
+ ((*- endif *))
+ \item Regexes:
+ ((* for regex_, results in runtime_contents["regexes"].items() *))
+ \begin{itemize}
+ \item \texttt{((( tex_escape(regex_) )))}:
+ \begin{itemize}
+ \item Found occurrences: ((( len_(results) )))
+ ((* if txt_show_all_regex_occurrences == "True" and len_(results) > 0 *))
+ \item Occurences list:
+ \begin{enumerate}
+ ((* for result in results *))
+ \item \texttt{((( tex_escape(result.replace("\n", "\\n")) )))}
+ ((* endfor *))
+ \end{enumerate}
+ ((* endif *))
+ \end{itemize}
+ \end{itemize}
+ ((*- endfor -*))
+ ((* endfor *))
+ \end{itemize}
+
((* endif *))
((* else *))
\errortext{File is not present.}
@@ -162,6 +242,8 @@ breaklines=true \includepdf[pages={1-},scale=1.0]{((( junit_xml_to_html(test_results["junitxml"], student_no) )))}
((* endif *))
+((* if tex_columns != "1" *))
\end{multicols}
+((* endif *))
\end{document}
\ No newline at end of file |