\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{dlaresume}[2017/01/21 DLA Resume Class]

\RequirePackage{ifthen}
\RequirePackage{xkeyval}

%\DeclareOptionX*{\PassOptionsToClass{\CurrentOption}}
\ProcessOptionsX*

% much of this was borrowed from Mako's work: git://projects.mako.cc/bmh-cv

% include data on fonts
\LoadClass{article}

\RequirePackage{fontspec}

\setmainfont[Ligatures=TeX]{FreeSerif}
\setsansfont{FreeSans}
\setmonofont{FreeMono}

\RequirePackage{lastpage}
\PassOptionsToPackage{letterpaper,margin=1in,left=1in,ignoreall=true}{geometry}
\RequirePackage{geometry}
\RequirePackage{url}
\RequirePackage{fancyhdr}
\PassOptionsToPackage{final}{graphicx}
\RequirePackage{graphicx}
\PassOptionsToPackage{labelfont=bf,font=sl}{caption}
\RequirePackage{caption}
\RequirePackage{multirow}
\PassOptionsToPackage{usenames,dvipsnames}{color}
\RequirePackage{color}
\PassOptionsToPackage{x11names,svgnames,table}{xcolor}
\RequirePackage{xcolor}
\RequirePackage{hyperref}
\PassOptionsToPackage{nomargin,inline}{fixme}
\RequirePackage{fixme}
\PassOptionsToPackage{capitalize}{cleveref}
\RequirePackage{cleveref}
\PassOptionsToPackage{backend=biber,hyperref=true,style=numeric-comp}{biblatex}
\RequirePackage{biblatex}
\addbibresource{references.bib}

\hypersetup{colorlinks=true, linkcolor=Black, citecolor=Black, filecolor=Black,
    urlcolor=Black, unicode=true}
\urlstyle{same}
% customize the titles so that they appear in the right margin
\RequirePackage{titlesec}

%\AtBeginDocument{
\setlength{\marginparwidth}{0in}
\setlength{\titlewidth}{0in}
% set the default indent to nothing
\setlength{\parindent}{0em}
%}
\makeatletter
% \newif\if@aftersec
% \newcommand\setsubskip{%
%     \global\@aftersectrue
%     \everypar{%
%         \global\@aftersecfalse
%         \if@noskipsec
%             \global\@noskipsecfalse
%             \clubpenalty\@M
%             \hskip-\parindent
%             \begingroup
%                 \@svsechd\unskip{\hspace{\@tempskipb}}%
%             \endgroup
%         \else
%             \clubpenalty\@clubpenalty\everypar{}%
%         \fi}}

% \newcommand\subskip{%
%   \if@aftersec
%      \removelastskip%         EDIT 2
%      \vspace{-\baselineskip}% EDIT 2 ??????????????
%   \else
%      \removelastskip%
%      \vspace{0.5em}
%   \fi
%   \global\@aftersecfalse}
\makeatother

\definecolor{date}{HTML}{666666} 
\definecolor{primary}{HTML}{0b0b0b} 
\definecolor{headings}{HTML}{1A1A1A}
\definecolor{subheadings}{HTML}{3A3A3A}

\titleformat{\section}{%
\color{headings}\fontsize{16pt}{20pt}\selectfont%
 \raggedright\scshape}{}{0pt}{}
\titlespacing*{\section}{0pt}{0ex}{0cm}
\titleformat{\subsection}{%
\color{subheadings}\fontsize{14pt}{18pt}\selectfont%
 \raggedright \scshape}{}{0pt}{}
\titlespacing*{\subsection}{0pt}{0ex}{0ex}

\def\myauthor{Don Armstrong}
\def\mytitle{Resume}
\def\mycopyright{\myauthor}
\def\myaddress{}
\def\myemail{don@donarmstrong.com}
\def\myweb{http://www.donarmstrong.com/}
\def\myphone{+1 714-813-8531}

% create a special cvlist environment to format the items
\newenvironment{cvlist}{
\begin{list}{-}{\leftmargin=0em \itemindent=1.0em}
  \setlength{\itemsep}{0pt}
  \setlength{\parskip}{0em}
  \setlength{\parsep}{1em}
  \setlength{\parindent}{0em}}%
{\vspace{1em}
\end{list}}

\renewenvironment{itemize}{\begin{cvlist}}{\end{cvlist}}
\newcounter{cvlistenumcounter}

\newenvironment{cvlistenum}{
\begin{list}{\arabic{cvlistenumcounter}. }{\usecounter{cvlistenumcounter}\leftmargin=3.0em \itemindent=-3.0em}
  \setlength{\itemsep}{0pt}
  \setlength{\parskip}{0em}
  \setlength{\parsep}{1em}
  \setlength{\parindent}{0em}}%
{\vspace{1em}
\end{list}}

\renewenvironment{enumerate}{\begin{cvlistenum}}{\end{cvlistenum}}
% no title
\renewcommand{\maketitle}{}

% Page layout
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhead{}
\fancyfoot{}
\makeatletter
 \fancyfoot[C]{{\scriptsize \@title \ of \@author \ -- Page \thepage\ of\ \pageref{LastPage}}}
\makeatother