Skip to content

Commit

Permalink
Build files use for PDF crestion
Browse files Browse the repository at this point in the history
Build files use for PDF crestion
  • Loading branch information
darkoperator authored Jul 16, 2020
1 parent 5a28b91 commit 5ed21e1
Show file tree
Hide file tree
Showing 10 changed files with 3,136 additions and 0 deletions.
2,389 changes: 2,389 additions & 0 deletions Build/Sysmon.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Build/bullet_style.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
% https://stackoverflow.com/questions/22156999/how-to-change-the-style-of-bullets-in-pandoc-markdown

\usepackage{enumitem}
\usepackage{amsfonts}

\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\circ$}
\setlist[itemize,3]{label=$\star$}

%% \setlist[itemize,2]{label=$\diamond$}
%% \setlist[itemize,1]{label=$\star$}
%% \setlist[itemize,1]{label=$\bullet$}
%% \setlist[itemize,1]{label=$\checkmark$}

10 changes: 10 additions & 0 deletions Build/chapter_break.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%% Adds pagebreak between chapters
% from comments of accepted answer
% https://superuser.com/questions/601469/getting-chapters-to-start-on-a-new-page-in-a-pandoc-generated-pdf
\usepackage{sectsty}
\sectionfont{\clearpage}

% accepted answer gave error
%\usepackage{titlesec}
%\newcommand{\sectionbreak}{\clearpage}

13 changes: 13 additions & 0 deletions Build/inline_code.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%% https://stackoverflow.com/questions/40975004/pandoc-latex-change-backtick-highlight
\usepackage{fancyvrb,newverbs,xcolor}

%\definecolor{Light}{gray}{.90}
%% https://martin-thoma.com/colors-in-latex/
%% https://en.wikibooks.org/wiki/LaTeX/Colors
\definecolor{Light}{HTML}{F4F4F4}

\let\oldtexttt\texttt
\renewcommand{\texttt}[1]{
\colorbox{Light}{\oldtexttt{#1}}
}

113 changes: 113 additions & 0 deletions Build/listings-setup.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
\lstset{
basicstyle=\ttfamily,
numbers=left,
numberstyle=\footnotesize,
stepnumber=1,
numbersep=5pt,
backgroundcolor=\color[RGB]{248,248,248},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
escapeinside={\%*}{*)},
linewidth=\textwidth,
basewidth=0.5em,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
}

\definecolor{maroon}{rgb}{0.5,0,0}
\definecolor{darkgreen}{rgb}{0,0.5,0}

\lstdefinelanguage{XML}
{
basicstyle=\ttfamily,
morestring=[s]{"}{"},
morecomment=[s]{?}{?},
morecomment=[s]{!--}{--},
commentstyle=\color{darkgreen},
moredelim=[s][\color{black}]{>}{<},
moredelim=[s][\color{red}]{\ }{=},
stringstyle=\color{blue},
identifierstyle=\color{maroon}
}

\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{ltgray}{rgb}{0.5,0.5,0.5}

\usepackage{listings}
\lstset{%
backgroundcolor=\color{white},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{dkgreen},
deletekeywords={...},
escapeinside={\%*}{*)},
extendedchars=true,
frame=single,
keepspaces=true,
keywordstyle=\color{blue},
language=SQL,
morekeywords={*,modify,MODIFY,...},
numbers=left,
numbersep=15pt,
numberstyle=\tiny,
rulecolor=\color{ltgray},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
tabsize=4,
title=\lstname
}

\lstdefinelanguage{powershell}{
morekeywords={Add-Content,Add-PSSnapin,Clear-Content,%
Clear-History,Clear-Host,Clear-Item,%
Clear-ItemProperty,Clear-Variable,%
Compare-Object,Connect-PSSession,ConvertFrom-String,%
Convert-Path,Copy-Item,Copy-ItemProperty,%
Disable-PSBreakpoint,Disconnect-PSSession,%
Enable-PSBreakpoint,Enter-PSSession,Exit-PSSession,%
Export-Alias,Export-Csv,Export-PSSession,ForEach-Object,%
Format-Custom,Format-Hex,Format-List,Format-Table,%
Format-Wide,Get-Alias,Get-ChildItem,Get-Clipboard,%
Get-Command,Get-ComputerInfo,Get-Content,Get-History,%
Get-Item,Get-ItemProperty,Get-ItemPropertyValue,Get-Job,%
Get-Location,Get-Member,Get-Module,Get-Process,%
Get-PSBreakpoint,Get-PSCallStack,Get-PSDrive,Get-PSSession,%
Get-PSSnapin,Get-Service,Get-TimeZone,Get-Unique,Get-Variable,%
Get-WmiObject,Group-Object,help,Import-Alias,Import-Csv,%
Import-Module,Import-PSSession,Invoke-Command,Invoke-Expression,%
Invoke-History,Invoke-Item,Invoke-RestMethod,Invoke-WebRequest,%
Invoke-WmiMethod,Measure-Object,mkdir,Move-Item,Move-ItemProperty,%
New-object,New-Alias,New-Item,New-Module,New-PSDrive,New-PSSession,%
New-PSSessionConfigurationFile,New-Variable,Out-GridView,%
Out-Host,Out-Printer,Pop-Location,powershell_ise.exe,%
Push-Location,Receive-Job,Receive-PSSession,Remove-Item,%
Remove-ItemProperty,Remove-Job,Remove-Module,Remove-PSBreakpoint,%
Remove-PSDrive,Remove-PSSession,Remove-PSSnapin,Remove-Variable,%
Remove-WmiObject,Rename-Item,Rename-ItemProperty,Resolve-Path,%
Resume-Job,Select-Object,Select-String,Set-Alias,Set-Clipboard,%
Set-Content,Set-Item,Set-ItemProperty,Set-Location,%
Set-PSBreakpoint,Set-TimeZone,Set-Variable,Set-WmiInstance,%
Show-Command,Sort-Object,Start-Job,Start-Process,Start-Service,%
Start-Sleep,Stop-Job,Stop-Process,Stop-Service,Suspend-Job,%
Tee-Object,Trace-Command,Wait-Job,Where-Object,Write-Output%
},
morekeywords={Do,Else,For,ForEach,Function,If,In,Until,While},
alsodigit={-},
sensitive=false,
morecomment=[l]{\#},
morecomment=[n]{<\#}{\#>},
morestring=[b]{"},
morestring=[b]{'},
morestring=[s]{@'}{'@},
morestring=[s]{@"}{"@}
}

34 changes: 34 additions & 0 deletions Build/md2pdf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Script based on https://learnbyexample.github.io/tutorial/ebook-generation/customizing-pandoc/
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")

pandoc "$tfl" \
-f gfm \
--toc \
--listings \
--include-in-header ${SCRIPTPATH}/Build/chapter_break.tex \
--include-in-header ${SCRIPTPATH}/Build/inline_code.tex \
--include-in-header ${SCRIPTPATH}/Build/bullet_style.tex \
--include-in-header ${SCRIPTPATH}/Build/pdf_properties.tex \
--include-in-header ${SCRIPTPATH}/Build/listings-setup.tex \
--highlight-style ${SCRIPTPATH}/Build/pygments.theme \
-V toc-title='Table of contents' \
-V linkcolor:blue \
-V geometry:a4paper \
-V geometry:margin=2cm \
-V mainfont="DejaVu Serif" \
-V monofont="DejaVu Sans Mono" \
--pdf-engine=xelatex \
-o temp.tex

fn="${2%.*}"

perl -0777 -pe 's/begin\{document\}\n\n\K(.*?^\}$)(.+?)\n/$2\n\\thispagestyle{empty}\n\n$1\n/ms' temp.tex > ${fn}.tex

xelatex ${SCRIPTPATH}/${fn}.tex &> /dev/null
xelatex ${SCRIPTPATH}/${fn}.tex &> /dev/null

rm temp.tex "$fn".{tex,toc,aux,log}


13 changes: 13 additions & 0 deletions Build/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Sysmon Missing Manual"
author: "Carlos Perez"
rights: "TrustedSec LLC, Creative Commons Non-Commercial Share Alike 4.0"
language: "en-US"
subtitle: Open Source Sysinternals Sysmon Community Guide
date: 28.01.2020
publisher: TrustedSec Inc.
ibooks:
version: 1.0
stylesheet: pandoc.css
cover-image: media/cover.png
---
Loading

0 comments on commit 5ed21e1

Please sign in to comment.