From: Danilo M. Date: Thu, 9 Oct 2025 08:32:49 +0000 (+0200) Subject: First Commit. X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=f5469f255bfb931b3b8c6b251b4a6b423ad85509;p=latex-reports.git First Commit. --- f5469f255bfb931b3b8c6b251b4a6b423ad85509 diff --git a/README.md b/README.md new file mode 100644 index 0000000..d2cfd59 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# Reports templating system + +This is the templating system I use to generate my reports. + +It's a (heavy) work in progress as I am still learning latex. + +it consists of a bash script that I can use to create a new markdown file for my reports and then I can use the same script to run pandoc on the markdown and output a pdf. + +## Requirements + +latex and pandoc installed. Texlive is part of slackware and the extras and pandoc packages can be obtained from [slackbuilds.org](https://slackbuilds.org). + +On my slackware64-current I have: + +- texlive-2024.240409-x86_64-4 +- texlive-extra-2024.240409-x86_64-1_SBo +- pandoc-bin-3.8-x86_64-1_SBo + +## Install + +this is the directory structure I use: + +- ~/bin + - **makereport** (the bash script) +- ~/.local/share/pandoc/templates + - **reports.latex** (the latex template) + - **reports.theme** (the color theme for the code highlighting) +- ~/Documents/reports/template/ + - **template.md** (the empty markdown template) +- ~/Pictures + - signature.png (optional signature image) + +## How to + +```bash +makereport -t > "new report.md" +``` + +This will generate the markdown with the template. + +```bash +makereport -o "new report.pdf" "new report.md" +``` + +This command will generate the pdf document. + +## Inspiration + +This script is based on the reports script by Valerio Casalino aka 5amu on github. *Grazie mille Valerio* 🫶🏻 + +## Mantainer + + * [danix](https://danix.xyz) - it's just me, really... + +## LICENSE + +makerepo © 2025 by danix is licensed under CC BY-NC 4.0. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ \ No newline at end of file diff --git a/makereport b/makereport new file mode 100755 index 0000000..b7b84e1 --- /dev/null +++ b/makereport @@ -0,0 +1,63 @@ +#!/bin/sh + +SCRIPTPATH="$(readlink -f "$0")" +SCRIPTDIR="$(dirname "$SCRIPTPATH")/" +TEMPLATE=${TEMPLATE:-~/Documents/reports/template/template.md} +SCRIPTNAME="${SCRIPTPATH##*/}" +TODAY=$(date +%d-%m-%4Y) +VIEWPDF=${VIEWPDF:-/usr/bin/firefox} + +usage() +{ + echo "Usage: ${SCRIPTNAME} [-h|-t] [-o outfile.pdf] " + echo + echo " Positional: , markdown report (input)" + echo + echo " -h|--help display this message and exit" + echo " -t|--template print out the template" + echo " -o|--output output file to be written (default: report.pdf)" + echo + echo " EXAMPLES" + echo " # Save the markdown template to a file" + echo " ${SCRIPTNAME} -t > template.md" + echo " # After editing the template with your vulnerabilities" + echo " # launch ${SCRIPTNAME} directly on it" + echo " ${SCRIPTNAME} -o 2022-09-google.pdf template.md" + echo +} + +if ! command -v pandoc pdflatex >/dev/null; then + echo "You need to install pandoc and pdflatex" +fi + +while [ "$#" -ne 0 ]; do case "$1" in + -h|--help) + usage + exit + ;; + -t|--template) + cat "${TEMPLATE}" + exit + ;; + -o|--output) + shift + export OUTFILE="$1" + ;; + *) + INPUTFILE="$1" +esac; shift; done + +if [ -z "$INPUTFILE" ]; then + echo "No input file provided" + exit 1 +fi + +pandoc --pdf-engine=xelatex \ + --highlight-style=/home/danix/.local/share/pandoc/templates/reports.theme \ + --template reports \ + --variable fontsize=16pt \ + --variable linestretch=1.5 \ + --variable geometry=a4paper \ + -i "${INPUTFILE}" -o "${OUTFILE:-~/Documents/reports/report_$TODAY.pdf}" +# once the file is exported we can preview it in the browser or in a file viewer +# $VIEWPDF $OUTFILE diff --git a/reports.latex b/reports.latex new file mode 100644 index 0000000..4c665c4 --- /dev/null +++ b/reports.latex @@ -0,0 +1,411 @@ +% Options for packages loaded elsewhere +\PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref} +\PassOptionsToPackage{hyphens}{url} +\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor} + +\documentclass[a4paper,12pt]{article} + +% Material color palette +\usepackage{xcolor} +% https://www.materialpalette.com/orange/deep-purple +\definecolor{DarkPrimaryColor}{HTML}{F57C00} % #F57C00 +\definecolor{AccentColor}{HTML}{7C4DFF} % #7C4DFF +\definecolor{LightPrimaryColor}{HTML}{FFE0B2} % #FFE0B2 +\definecolor{PrimaryText}{HTML}{212121} % #212121 +\definecolor{PrimaryColor}{HTML}{FF9800} % #FF9800 +\definecolor{SecondaryText}{HTML}{757575} % #757575 +\definecolor{Text}{HTML}{212121} % #212121 +\definecolor{Divider}{HTML}{BDBDBD} % #BDBDBD + +\usepackage{fontawesome5} +\usepackage[hmargin={2cm,2cm},vmargin={4cm,3cm},headsep=2cm]{geometry} +\usepackage[page,toc]{appendix} % Properly display appendices in TOC + +\usepackage{tcolorbox} +\newtcolorbox{info-box}{colback=cyan!5!white,arc=0pt,outer arc=0pt,colframe=cyan!60!black} +\newtcolorbox{warning-box}{colback=orange!5!white,arc=0pt,outer arc=0pt,colframe=orange!80!black} +\newtcolorbox{error-box}{colback=red!5!white,arc=0pt,outer arc=0pt,colframe=red!75!black} + +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{amssymb,amsmath} +\usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript +% use microtype if available +\IfFileExists{microtype.sty}{\usepackage{microtype}}{} +% use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[utf8]{inputenc} + \usepackage{ucs} +$if(euro)$ + \usepackage{eurosym} +$endif$ +\else % if luatex or xelatex + \usepackage{fontspec} + \ifxetex + \usepackage{xltxtra,xunicode} + \fi + \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} + \setromanfont{Roboto} + \newcommand{\euro}{€} +$if(mainfont)$ + \setmainfont{$mainfont$} +$endif$ +$if(sansfont)$ + \setsansfont{$sansfont$} +$endif$ +$if(monofont)$ + \setmonofont{$monofont$} +$endif$ +$if(mathfont)$ + \setmathfont{$mathfont$} +$endif$ +\fi +\usepackage{textcomp} + +\usepackage{lastpage} + +$if(zero-width-non-joiner)$ +%% Support for zero-width non-joiner characters. +\makeatletter +\def\zerowidthnonjoiner{ + % Prevent ligatures and adjust kerning, but still support hyphenating. + \texorpdfstring{ + \textormath{\nobreak\discretionary{-}{}{\kern.03em} + \ifvmode\else\nobreak\hskip\z@skip\fi}{} + }{} +} +\makeatother +\DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner} +%% End of ZWNJ support +$endif$ + +% define inline code styling +\definecolor{bgcolor}{HTML}{BAC2DE} +\let\oldtexttt\texttt + +\renewcommand{\texttt}[1]{ + \colorbox{bgcolor}{\oldtexttt{#1}} +} + +% Use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +\IfFileExists{microtype.sty}{% use microtype if available + \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype} + \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts +}{} +$if(indent)$ +$else$ +\makeatletter +\@ifundefined{KOMAClassName}{% if non-KOMA class + \IfFileExists{parskip.sty}{ + \usepackage{parskip} + }{% else + \setlength{\parindent}{0pt} + \setlength{\parskip}{6pt plus 2pt minus 1pt}} +}{% if KOMA class + \KOMAoptions{parskip=half}} +\makeatother +$endif$ +$if(verbatim-in-note)$ +\usepackage{fancyvrb} +$endif$ + + +$if(lhs)$ +\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} +$endif$ + +$if(highlighting-macros)$ +$highlighting-macros$ +$endif$ + +$if(tables)$ +\usepackage{longtable,booktabs,array} +$if(multirow)$ +\usepackage{multirow} +$endif$ +\usepackage{calc} % for calculating minipage widths +% Correct order of tables after \paragraph or \subparagraph +\usepackage{etoolbox} +\makeatletter +\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{} +\makeatother +% Allow footnotes in longtable head/foot +\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}} +\makesavenoteenv{longtable} +$endif$ + + +$if(graphics)$ +\usepackage[export]{adjustbox} +\usepackage{graphicx} +\makeatletter +\newsavebox\pandoc@box +\newcommand*\pandocbounded[1]{% scales image to fit in text height/width + \sbox\pandoc@box{#1} + \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax} + \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box} + \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both + \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box} + \else\usebox{\pandoc@box} + \fi +} +\setkeys{Gin}{width=\textwidth} +%\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} +%\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} +\makeatother +% Scale images if necessary, so that they will not overflow the page +% margins by default, and it is still possible to overwrite the defaults +% using explic$pagestyle$ +$endif$ + +$if(links-as-notes)$ +% Make links footnotes instead of hotlinks: +\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}} +$endif$ + +$if(strikeout)$ +\usepackage[normalem]{ulem} +$endif$ + +\setlength{\emergencystretch}{3em} % prevent overfull lines +\providecommand{\tightlist}{ + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} +$if(numbersections)$ +\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} +$else$ +\setcounter{secnumdepth}{-\maxdimen} % remove section numbering +$endif$ + +$if(block-headings)$ +% Make \paragraph and \subparagraph free-standing +\ifx\paragraph\undefined\else + \let\oldparagraph\paragraph + \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} +\fi +\ifx\subparagraph\undefined\else + \let\oldsubparagraph\subparagraph + \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} +\fi +$endif$ + +$if(pagestyle)$ +\pagestyle{$pagestyle$} +$else$ + +\usepackage{fancyhdr} +\pagestyle{fancy} + +$endif$ +$if(csl-refs)$ +\newlength{\cslhangindent} +\setlength{\cslhangindent}{1.5em} +\newlength{\csllabelwidth} +\setlength{\csllabelwidth}{3em} +\newlength{\cslentryspacingunit} % times entry-spacing +\setlength{\cslentryspacingunit}{\parskip} +\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing + {% don't indent paragraphs + \setlength{\parindent}{0pt} + % turn on hanging indent if param 1 is 1 + \ifodd #1 + \let\oldpar\par + \def\par{\hangindent=\cslhangindent\oldpar} + \fi + % set entry spacing + \setlength{\parskip}{#2\cslentryspacingunit} + } + {} +\usepackage{calc} +\newcommand{\CSLBlock}[1]{#1\hfill\break} +\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}} +\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break} +\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} +$endif$ +$if(lang)$ +\usepackage[bidi=default]{babel} +$if(babel-lang)$ +\babelprovide[main,import]{$babel-lang$} +$endif$ +$for(babel-otherlangs)$ +\babelprovide[import]{$babel-otherlangs$} +$endfor$ +% get rid of language-specific shorthands (see #6817): +\let\LanguageShortHands\languageshorthands +\def\languageshorthands#1{} +$endif$ +$for(header-includes)$ +$header-includes$ +$endfor$ +$if(dir)$ +\TeXXeTstate=1 +\newcommand{\RL}[1]{\beginR #1\endR} +\newcommand{\LR}[1]{\beginL #1\endL} +\newenvironment{RTL}{\beginR}{\endR} +\newenvironment{LTR}{\beginL}{\endL} +$endif$ +$if(natbib)$ +\usepackage[$natbiboptions$]{natbib} +\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} +$endif$ +$if(nocite-ids)$ +\nocite{$for(nocite-ids)$$it$$sep$, $endfor$} +$endif$ +$if(csquotes)$ +\usepackage{csquotes} +$endif$ +\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} +\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available +\urlstyle{same} % disable monospaced font for URLs +$if(verbatim-in-note)$ +\VerbatimFootnotes % allow verbatim text in footnotes +$endif$ + +$if(startdate)$$else$ % get last monday date +\usepackage{datenumber,etoolbox} +\newbool{mondate}\ifnumcomp{\arabic{datedayname}}{=}{1}{\setbool{mondate}{true}}{\setbool{mondate}{false}} + +\newcommand\lastmon{ + \unlessboolexpr{bool {mondate} }{ + \addtocounter{datenumber}{-1} + \setdatebynumber{\arabic{datenumber}} + \ifnumcomp{\arabic{datedayname}}{=}{1}{\setbool{mondate}{true}}{\setbool{mondate}{false}} + } + \datedate\setbool{mondate}{false} +} +$endif$ + +% --------------------------------------------------------------------------------------------------------- +% BEGIN OF VARIABLES +% --------------------------------------------------------------------------------------------------------- +\def\mytitle{$if(title)$$title$$else$Security Testing Report$endif$} +\def\myauthor{$if(author)$$author$$else$Danilo 'danix' Macrì$endif$} +\def\mydate{\today} +\def\defaultmail{danilo.macri@danix.me} +\def\myemail{\href{mailto:$if(email)$$email$}{$email$$else$\defaultmail}{\defaultmail$endif$}} +\def\client{$if(client)$$client$$else$Placeholder$endif$} +\def\activity{$if(activity)$$activity$$else$Placeholder$endif$} +\def\activitytype{$if(activity_type)$$activity_type$$else$Placeholder$endif$} +\def\startdate{$if(startdate)$$startdate$$else$\lastmon$endif$} +\def\engagetime{$if(engagetime)$$engagetime$$else$5$endif$} +\author{{\color{AccentColor} \textbf{\myauthor} - \textbf{\myemail}}} +\title{\vspace{-2cm}\Huge {\color{DarkPrimaryColor}\textbf{\mytitle}}\\{\color{PrimaryText}\textbf{\client} - \textbf{\activity}\\\textbf{\activitytype}}} +\date{{\color{PrimaryText}\textbf{\mydate}}} +\date{{\color{PrimaryText}\textbf{Scan started on \startdate}} - \color{PrimaryColor}\textbf{duration (days): \engagetime}} +% --------------------------------------------------------------------------------------------------------- +% END OF VARIABLES +% --------------------------------------------------------------------------------------------------------- + +% --------------------------------------------------------------------------------------------------------- +% BEGIN OF LINK SETUP +% --------------------------------------------------------------------------------------------------------- +\hypersetup{ + pdftitle={\mytitle}, + pdfauthor={\myauthor}, + pdfkeywords={\mytitle, \myauthor, \activity}, + colorlinks=true, + linkcolor={AccentColor}, + urlcolor={AccentColor}, +} +% --------------------------------------------------------------------------------------------------------- +% END OF LINK SETUP +% --------------------------------------------------------------------------------------------------------- + +% --------------------------------------------------------------------------------------------------------- +% BEGIN OF HEADER AND FOOTER SETUP +% --------------------------------------------------------------------------------------------------------- +\fancyhead{} +\lfoot{CLASSIFICATION: { \color{AccentColor}$if(classification)$\textbf{$classification$}$else$\textbf{CONFIDENTIAL}$endif$}} +\lhead{{\color{AccentColor} $if(callout)$$callout$$else$\faHouseUser\space \href{https://danix.xyz/}{danix.xyz} $endif$}} +\rfoot{\thepage\ / \pageref{LastPage}} +\cfoot{} +\rhead{{\color{AccentColor} \faEnvelopeOpen\space {{\myemail}}}} +\renewcommand{\footrulewidth}{0.4pt}\setlength{\headheight}{20pt} +% --------------------------------------------------------------------------------------------------------- +% END OF HEADER AND FOOTER SETUP +% --------------------------------------------------------------------------------------------------------- + + +\usepackage{fvextra} +\definecolor{bg}{HTML}{8E8E8E} +\DefineVerbatimEnvironment{Highlighting}{Verbatim}{ + breaklines = true, + fontsize = \footnotesize, + frame = single, + rulecolor = bg, + commandchars = \\\{\}, +} + + +\begin{document} +% --------------------------------------------------------------------------------------------------------- +% BEGIN OF TITLE PAGE +% --------------------------------------------------------------------------------------------------------- +{ +\maketitle\thispagestyle{empty} +\hypersetup{pdfborder=0 0 0}\setcounter{page}{0} +} +% --------------------------------------------------------------------------------------------------------- +% END OF TITLE PAGE +% --------------------------------------------------------------------------------------------------------- + +%------------------------------------------------------------------------------------------------------- +% BEGIN OF TABLE OF CONTENTS +%------------------------------------------------------------------------------------------------------- +\setcounter{tocdepth}{3}{\hypersetup{hidelinks}\tableofcontents} +\clearpage +%------------------------------------------------------------------------------------------------------- +% END OF TABLE OF CONTENTS +%------------------------------------------------------------------------------------------------------- + +%------------------------------------------------------------------------------------------------------- +% BEGIN OF MAIN CONTENT +%------------------------------------------------------------------------------------------------------- +$body$ +% Signature image +\begin{figure}[h!] + \includegraphics[width=0.6\textwidth]{/home/danix/Pictures/signature.png} +\end{figure} +%------------------------------------------------------------------------------------------------------- +% END OF MAIN CONTENT +%------------------------------------------------------------------------------------------------------- + +%------------------------------------------------------------------------------------------------------- +% BEGIN OF LEGAL +%------------------------------------------------------------------------------------------------------- +$if(legal)$ +\pagebreak +\begin{appendices} +\section{Document Legal Data} + +\subsection*{Proprietary \& Legal Notice} + This document is the property of {\myauthor}; the contents herein are the intellectual property + and copyright of {\myauthor}. Disclosure of this document and its contents herein does not + grant or construe any transfer or other rights in relation to {\myauthor} intellectual property. + +\subsection*{Classification} + This document and information included must be considered "CONFIDENTIAL" between {\myauthor} and + {\client} and cannot be shared to any Third Party, neither copied in any format, without previous + agreement with {\myauthor}. + +\subsection*{Disclaimer} + {\myauthor} expressly disclaims any liability, which may arise in any manner and to any party through + publication of this document. Any party acting for or failing to act because of this document + assumes full responsibility for any use made of the information contained herein. This publication + does not constitute an endorsement of the product or products described. + +\subsection*{Copyright} + All trademarks or registered trademarks either mentioned or implied are respected. \newline + {\client} and {\myauthor}. All Rights Reserved. + +\end{appendices} +\pagebreak +$endif$ % legal +%------------------------------------------------------------------------------------------------------- +% END OF LEGAL +%------------------------------------------------------------------------------------------------------- + + +\clearpage\end{document} diff --git a/reports.theme b/reports.theme new file mode 100644 index 0000000..49934e4 --- /dev/null +++ b/reports.theme @@ -0,0 +1,240 @@ +{ + "metadata": { + "name": "catpuccin mocha", + "author": "danix ", + "license": "Unlicense", + "revision": 1 + }, + "Comment": "https://catppuccin.com/palette/ Mocha", + "Base colors": "tc = Text, bg = Surface 1, ln = Lavender", + "text-color": "#cdd6f4", + "background-color": "#45475a", + "line-number-color": "#b4befe", + "line-number-background-color": null, + "text-styles": { + "Alert": { + "Comment": "Red", + "text-color": "#f38ba8", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Annotation": { + "Comment": "Blue", + "text-color": "#89b4fa", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Attribute": { + "Comment": "Blue", + "text-color": "#89b4fa", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BaseN": { + "Comment": "Sapphire", + "text-color": "#74c7ec", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "BuiltIn": { + "Comment": "Peach", + "text-color": "#fab387", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Char": { + "Comment": "Lavender", + "text-color": "#b4befe", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Comment": { + "Comment": "Subtext 1", + "text-color": "#bac2de", + "background-color": null, + "bold": false, + "italic": true, + "underline": false + }, + "CommentVar": { + "Comment": "Subtext 1", + "text-color": "#bac2de", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Constant": { + "Comment": "Yellow", + "text-color": "#f9e2af", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "ControlFlow": { + "Comment": "Mauve", + "text-color": "#cba6f7", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "DataType": { + "Comment": "Lavender", + "text-color": "#b4befe", + "bold": false, + "italic": false, + "underline": false + }, + "DecVal": { + "Comment": "Teal", + "text-color": "#94e2d5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Documentation": { + "text-color": "#ba2121", + "background-color": null, + "bold": false, + "italic": true, + "underline": false + }, + "Error": { + "text-color": "#ff0000", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Extension": { + "Comment": "Sky", + "text-color": "#89dceb", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Float": { + "Comment": "Teal", + "text-color": "#94e2d5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Function": { + "Comment": "Teal", + "text-color": "#94e2d5", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Import": { + "text-color": "#008000", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Information": { + "text-color": "#60a0b0", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + }, + "Keyword": { + "Comment": "Blue", + "text-color": "#89b4fa", + "background-color": null, + "bold": true, + "italic": false, + "underline": false + }, + "Operator": { + "Comment": "Text", + "text-color": "#cdd6f4", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Other": { + "Comment": "Sky", + "text-color": "#89dceb", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Preprocessor": { + "text-color": "#bc7a00", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialChar": { + "text-color": "#4070a0", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "SpecialString": { + "text-color": "#bb6688", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "String": { + "Comment": "Green", + "text-color": "#a6e3a1", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Variable": { + "Comment": "Maroon", + "text-color": "#eba0ac", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "VerbatimString": { + "Comment": "Green", + "text-color": "#a6e3a1", + "background-color": null, + "bold": false, + "italic": false, + "underline": false + }, + "Warning": { + "Comment": "Red", + "text-color": "#f38ba8", + "background-color": null, + "bold": true, + "italic": true, + "underline": false + } + } +} diff --git a/warn-info_sections.lua b/warn-info_sections.lua new file mode 100644 index 0000000..40abcc3 --- /dev/null +++ b/warn-info_sections.lua @@ -0,0 +1,23 @@ +function Heading(lines, meta) + local warningPattern = "%>% [!WARNING]" + local infoPattern = "%>% [NOTE]" + for i, line in ipairs(lines) do + if line:match(warningPattern) then + local warning = {} + for j = 2, #lines do + table.insert(warning, lines[j]) + end + table.insert(meta.warning, {text = warning, color = "red"}) + elseif line:match(infoPattern) then + local info = {} + for j = 2, #lines do + table.insert(info, lines[j]) + end + table.insert(meta.info, {text = info, color = "blue"}) + end + end +end + +return { + Heading = Heading, +} \ No newline at end of file