Skip to content

Commit

Permalink
perf: disable print when detect toks empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Kin committed Aug 5, 2024
1 parent 5337872 commit 3b435c5
Showing 1 changed file with 48 additions and 26 deletions.
74 changes: 48 additions & 26 deletions public_resources/doc.cls
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
% 文类版本设定
% -----------------------------------------------
\NeedsTeXFormat{LaTeX2e} % 该文类所需的 Tex 系统版本。
\ProvidesClass{doc}[2023/07/20 v2.1.6 General Document Template] % 该文类的名称、发布日期、版本序号等。(date 的写法格式为 YYYY/MM/DD,其中月和日不能写成一位。否则编译会报两个错误 Missing = inserted for \ifnum. 和 Missing number, treated as zero.)
\ProvidesClass{doc}[2024/08/05 v2.1.7 General Document Template] % 该文类的名称、发布日期、版本序号等。(date 的写法格式为 YYYY/MM/DD,其中月和日不能写成一位。否则编译会报两个错误 Missing = inserted for \ifnum. 和 Missing number, treated as zero.)

% -----------------------------------------------
% 文类新选项设定
Expand Down Expand Up @@ -124,11 +124,19 @@
\ifLightDoc
\relax
\else
\begin{tabular}{rl}
Author's Email: & \hspace{-0.8em} \href{mailto:\the\AuthorEmail}{\color{black} \the\AuthorEmail} \\
Author's Blog: & \hspace{-0.8em} \href{\the\AuthorBlog}{\color{black} \the\AuthorBlog} \\
Author's Blog Mirror: & \hspace{-0.8em} \href{\the\AuthorBlogMirror}{\color{black} \the\AuthorBlogMirror} \\
\end{tabular}
\DetectToksEmpty\AuthorBlogMirror
\ifToksEmpty
\begin{tabular}{rl}
Author's Email: & \hspace{-0.8em} \href{mailto:\the\AuthorEmail}{\color{black} \the\AuthorEmail} \\
Author's Blog: & \hspace{-0.8em} \href{\the\AuthorBlog}{\color{black} \the\AuthorBlog} \\
\end{tabular}
\else
\begin{tabular}{rl}
Author's Email: & \hspace{-0.8em} \href{mailto:\the\AuthorEmail}{\color{black} \the\AuthorEmail} \\
Author's Blog: & \hspace{-0.8em} \href{\the\AuthorBlog}{\color{black} \the\AuthorBlog} \\
Author's Blog Mirror: & \hspace{-0.8em} \href{\the\AuthorBlogMirror}{\color{black} \the\AuthorBlogMirror} \\
\end{tabular}
\fi
\fi

\DetectToksEmpty\LinkBlogPost
Expand All @@ -137,12 +145,6 @@
\else
\LinkBlogPostText{\href{\the\LinkBlogPost}{\color{black} 点击跳转}}
\fi
\DetectToksEmpty\LinkBlogPostMirror
\ifToksEmpty
\LinkBlogPostMirrorText{链接暂空}
\else
\LinkBlogPostMirrorText{\href{\the\LinkBlogPostMirror}{\color{black} 点击跳转}}
\fi
\DetectToksEmpty\LinkPDF
\ifToksEmpty
\LinkPDFText{链接暂空}
Expand Down Expand Up @@ -187,13 +189,23 @@
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\end{tabular}
\else
\begin{tabular}{rl}
博文链接: & \the\LinkBlogPostText \\
博文镜像链接: & \the\LinkBlogPostMirrorText \\
离线文档PDF链接: & \the\LinkPDFText \\
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\the\LinkVideoTextLeft & \the\LinkVideoTextRight \\
\end{tabular}
\DetectToksEmpty\LinkBlogPostMirror
\ifToksEmpty
\begin{tabular}{rl}
博文链接: & \the\LinkBlogPostText \\
离线文档PDF链接: & \the\LinkPDFText \\
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\the\LinkVideoTextLeft & \the\LinkVideoTextRight \\
\end{tabular}
\else
\begin{tabular}{rl}
博文链接: & \the\LinkBlogPostText \\
博文镜像链接: & \href{\the\LinkBlogPostMirror}{\color{black} 点击跳转} \\
离线文档PDF链接: & \the\LinkPDFText \\
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\the\LinkVideoTextLeft & \the\LinkVideoTextRight \\
\end{tabular}
\fi
\fi
\else
\tikz[thick]{\draw (0,0) -- (10.5,0);}
Expand All @@ -205,13 +217,23 @@
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\end{tabular}
\else
\begin{tabular}{rl}
博文链接: & \the\LinkBlogPostText \\
博文镜像链接: & \the\LinkBlogPostMirrorText \\
离线文档PDF链接: & \the\LinkPDFText \\
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\the\LinkVideoTextLeft & \the\LinkVideoTextRight \\
\end{tabular}
\DetectToksEmpty\LinkBlogPostMirror
\ifToksEmpty
\begin{tabular}{rl}
博文链接: & \the\LinkBlogPostText \\
离线文档PDF链接: & \the\LinkPDFText \\
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\the\LinkVideoTextLeft & \the\LinkVideoTextRight \\
\end{tabular}
\else
\begin{tabular}{rl}
博文链接: & \the\LinkBlogPostText \\
博文镜像链接: & \href{\the\LinkBlogPostMirror}{\color{black} 点击跳转} \\
离线文档PDF链接: & \the\LinkPDFText \\
文档LaTeX源码链接: & \the\LinkLaTeXText \\
\the\LinkVideoTextLeft & \the\LinkVideoTextRight \\
\end{tabular}
\fi
\fi
\fi
\end{center}
Expand Down

0 comments on commit 3b435c5

Please sign in to comment.