[tex4ht-commits] [SCM] tex4ht updated: r1547 - trunk/lit

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Mon Aug 19 16:07:03 CEST 2024


Author: michal_h21
Date: 2024-08-19 14:07:03 +0000 (Mon, 19 Aug 2024)
New Revision: 1547

Modified:
   trunk/lit/ChangeLog
   trunk/lit/mktex4ht-cnf.tex
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-html4.tex
Log:
Added Moderncv support

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2024-08-13 19:30:20 UTC (rev 1546)
+++ trunk/lit/ChangeLog	2024-08-19 14:07:03 UTC (rev 1547)
@@ -1,3 +1,10 @@
+2024-08-19  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (moderncv.4ht),
+	* tex4ht-html4.tex (html4.4ht): added support for the Moderncv
+	package.
+	https://tex.stackexchange.com/q/721180/2891
+
 2024-08-13  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-4ht.tex (amsfonts.4ht): fixed support for \mathbb and

Modified: trunk/lit/mktex4ht-cnf.tex
===================================================================
--- trunk/lit/mktex4ht-cnf.tex	2024-08-13 19:30:20 UTC (rev 1546)
+++ trunk/lit/mktex4ht-cnf.tex	2024-08-19 14:07:03 UTC (rev 1547)
@@ -238,6 +238,7 @@
 \AddFile{9}{europecv}
 \AddFile{9}{resume}
 \AddFile{9}{curve}
+\AddFile{9}{moderncv}
 \AddFile{9}{vowel}
 \AddFile{9}{enumitem}
 \AddFile{9}{esperanto}

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2024-08-13 19:30:20 UTC (rev 1546)
+++ trunk/lit/tex4ht-4ht.tex	2024-08-19 14:07:03 UTC (rev 1547)
@@ -30147,6 +30147,173 @@
 >>>
 
 %%%%%%%%%%%%%%%%%%%%%%%%%
+\Section{moderncv}
+%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<moderncv.4ht\><<<
+% moderncv.4ht (|version), generated from |jobname.tex
+% Copyright 2024 TeX Users Group
+|<TeX4ht license text|>
+|<moderncv configs|>
+\Hinput{moderncv}
+\endinput
+>>>\AddFile{9}{moderncv}
+
+This is a bit messy. We had to redefine a bunch of commands from various 
+files that Moderncv uses, mostly to prevent compilation errors and to 
+insert some basic formatting.
+
+\<moderncv configs\><<<
+\NewConfigure{section}{2}
+\RenewDocumentCommand\section{sm}{\a:section #2\b:section}
+
+\NewConfigure{subsection}{2}
+\RenewDocumentCommand\subsection{sm}{\a:subsection #2\b:subsection}
+
+
+\NewConfigure{cvitem}{3}
+\renewcommand*{\cvitem}[3][.25em]{
+\a:cvitem  #2\b:cvitem #3\c:cvitem
+}
+
+\NewConfigure{cvdoubleitem}{2}
+\renewcommand*{\cvdoubleitem}[5][.25em]{%
+\a:cvdoubleitem
+\cvitem{#2}{#3}
+\cvitem{#4}{#5}
+\b:cvdoubleitem
+}
+
+\NewConfigure{cvlistitem}{2}
+\renewcommand*{\cvlistitem}[2][.25em]{%
+  \a:cvlistitem\cvitem[#1]{\listitemsymbol}{#2}\b:cvlistitem
+}
+
+\NewConfigure{cvlistdoubleitem}{2}
+\renewcommand*{\cvlistdoubleitem}[3][.25em]{%
+  \a:cvlistdoubleitem%
+  \cvitem[#1]{\listitemsymbol}{#2}%
+  \cvitem[#1]{\listitemsymbol}{#3}%
+  \b:cvlistdoubleitem%
+}
+
+\NewConfigure{cvhead}{2}
+\NewConfigure{cvphoto}{2}
+
+
+\renewcommand*{\makecvhead}{%
+  \a:cvhead 
+  % recompute lengths (in case we are switching from letter to resume, or vice versa)
+  \recomputecvlengths%
+  % optional detailed information (pre-rendering)
+  \@initializebox{\makecvheaddetailsbox}%
+  \if at details%
+    \def\phonesdetails{}%
+    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
+      \protected at edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
+    \def\socialsdetails{}%
+    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
+      \protected at edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
+    \savebox{\makecvheaddetailsbox}{%
+      \addressfont\color{color2}%
+      \if at left\begin{tabular}[b]{@{}r@{}}\fi%
+      \if at right\begin{tabular}[b]{@{}l@{}}\fi%
+        \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
+          \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
+          \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
+        \ifthenelse{\isundefined{\@born}}{}{\makenewline\bornsymbol\@born}%
+        \phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
+        \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
+        \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httpslink{\@homepage}}%
+        \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
+        \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
+      \end{tabular}
+    }\fi%
+  % optional photo (pre-rendering)
+  \@initializebox{\makecvheadpicturebox}%
+  \savebox{\makecvheadpicturebox}{%
+    \ifthenelse{\isundefined{\@photo}}%
+      {}%
+      {%
+        \a:cvphoto\includegraphics[]{\@photo}\b:cvphoto}%
+          }%
+  % name and title (pre-rendering)
+  \@initializelength{\makecvheaddetailswidth}\settowidth{\makecvheaddetailswidth}{\usebox{\makecvheaddetailsbox}}%
+  \@initializelength{\makecvheadpicturewidth}\settowidth{\makecvheadpicturewidth}{\usebox{\makecvheadpicturebox}}%
+  \ifthenelse{\lengthtest{\makecvheadnamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvheadnamewidth=0pt)
+    {\setlength{\makecvheadnamewidth}{\textwidth-\makecvheaddetailswidth-\makecvheadpicturewidth}}%
+    {}%
+  \@initializebox{\makecvheadnamebox}%
+  \savebox{\makecvheadnamebox}{%
+    \begin{minipage}[b]{\makecvheadnamewidth}%
+      \if at left\raggedright\fi%
+      \if at right\raggedleft\fi%
+      \namestyle{\@firstname\ \@lastname}%
+      \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
+    \end{minipage}}%
+  % rendering
+  \if at left%
+    \usebox{\makecvheadnamebox}%
+    \hfill%
+    \llap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
+    \usebox{\makecvheadpicturebox}\fi%
+  \if at right%
+    \usebox{\makecvheadpicturebox}%
+    \rlap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced
+    \hfill%
+    \usebox{\makecvheadnamebox}\fi%
+  \\[2.5em]%
+  % optional quote
+  \ifthenelse{\isundefined{\@quote}}%
+    {}%
+    {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
+  \b:cvhead\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvhead
+
+
+\RenewDocumentCommand\cvskilllegend{s +O{.25em} +O{\skillLegend at defaultLevelOne} +O{\skillLegend at defaultLevelTwo} +O{\skillLegend at defaultLevelThree} +O{\skillLegend at defaultLevelFour} +O{\skillLegend at defaultLevelFive} +m}{%
+\begin{tabular}{l l l l l l}
+                \raggedleft\hintstyle{#8}  & \cvskill{1}\, & \,{\skillLegend at FontSize #3} & \cvskill{3}\, &\,{\skillLegend at FontSize #5 } \\%
+                            %
+                        & \cvskill{2}\, & \,\multirow{2}{\cvskilllegend at leftdescriptorwidth}{{\skillLegend at FontSize #4}} & \cvskill{4}\,  &\,{\skillLegend at FontSize #6 } \\%
+                    %         
+                        &  &   & \cvskill{5}\, &\,{\skillLegend at FontSize #7 }%
+            \end{tabular}%
+}%
+
+
+\NewConfigure{cvskill}{2}
+\def\:tempa#1{\def\:cvskillamount{#1}\a:cvskill\o:cvskill:{#1}\b:cvskill}
+\HLet\cvskill\:tempa
+
+\NewConfigure{cvskillhead}{2}
+\NewConfigure{cvskillentry}{2}
+\RenewDocumentCommand\cvskillhead{O{.25em} +O{\skillMatrix at HeaderDefaultOne} +O{\skillMatrix at HeaderDefaultTwo} +O{\skillMatrix at HeaderDefaultThree} +O{\skillMatrix at HeaderDefaultFour}}{%
+    \begingroup
+    \a:cvskillhead
+        \begin{tabular}{ p{6em}  p{12em} p{4em} p{20em}}%
+            { #2} & { #3} & { #4} & { #5}  
+        \end{tabular}%
+    \b:cvskillhead
+    \endgroup
+    \par\addvspace{#1}
+}
+
+\RenewDocumentCommand\cvskillentry{s +O{.25em} +m +m +m +m +m}{%
+\a:cvskillentry
+\cvitem{#3}{
+    \begin{tabular}{ p{6em}  p{12em} p{4em} p{20em}}
+            \centering \cvskill{#4} &\centering {#5} & \centering {#6} &{\itshape#7}%
+        \end{tabular}}%
+  \b:cvskillentry
+        \par\addvspace{#2}
+}
+
+>>>
+
+%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%
 \Chapter{Small Ones}
 %%%%%%%%%%%%%%%%%%%%%%%%%
 

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2024-08-13 19:30:20 UTC (rev 1546)
+++ trunk/lit/tex4ht-html4.tex	2024-08-19 14:07:03 UTC (rev 1547)
@@ -17806,6 +17806,45 @@
 >>>
 
 %%%%%%%%%%%%%%%%%%
+\section{moderncv}
+%%%%%%%%%%%%%%%%%%
+
+\<configure html4 moderncv\><<<
+\Configure{cvhead}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvhead">}}{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
+\Configure{cvphoto}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvphoto">}}{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
+
+\Configure{section}{\ifvmode\IgnorePar\fi\EndP\HCode{<h2>}}{\HCode{</h2>}}
+\Configure{subsection}{\ifvmode\IgnorePar\fi\EndP\HCode{<h3>}}{\HCode{</h3>}}
+\Configure{cvitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvitem"><span class="cvitemhead">}}{\HCode{</span><span class="cvitembody">}}{\HCode{</span></div>}}
+\Configure{cvdoubleitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvdoubleitem">}}{\HCode{</div>}}
+\Configure{cvlistitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvlistitem">}}{\HCode{</div>}}
+\Configure{cvlistdoubleitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvlistdoubleitem">}}{\HCode{</div>}}
+
+\Configure{cvskillhead}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvskillhead">}}{\HCode{</div>}}
+\Configure{cvskillentry}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvskillentry">}}{\HCode{</div>}}
+
+\Configure{cvskill}{\Picture*[skill level: \:cvskillamount]{}}{\EndPicture}
+
+\Css{.cvskillentry .tabular, .cvskillhead .tabular {margin:0pt;}}
+\Css{.cvskillentry .tabular td:nth-child(1), .cvskillhead .tabular td:nth-child(1){width: 8ch}}
+\Css{.cvskillentry .tabular td:nth-child(2), .cvskillhead .tabular td:nth-child(2){width: 12ch}}
+\Css{.cvskillentry .tabular td:nth-child(3), .cvskillhead .tabular td:nth-child(3){width: 6ch}}
+\Css{.cvskillentry .tabular td:nth-child(4), .cvskillhead .tabular td:nth-child(4){width: 54ch}}
+
+\Css{.cvitemhead{margin-right: 1em;}}
+
+\Css{
+ at media (min-width:94ch) {
+.cvitemhead{
+  margin-left: -14ch;
+  width: 12ch;
+  float: left;
+  text-align: right;
+  }
+}}
+>>>
+
+%%%%%%%%%%%%%%%%%%
 \section{CSS}
 %%%%%%%%%%%%%%%%%%
 



More information about the tex4ht-commits mailing list.