Created
June 28, 2014 04:03
-
-
Save dohyunkim/c45f25e6c7402545e315 to your computer and use it in GitHub Desktop.
xxruby, a variant of ruby command for Korean document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \begingroup\expandafter\expandafter\expandafter\endgroup | |
| \expandafter\ifx\csname ProvidesPackage\endcsname\relax\else | |
| \ProvidesPackage{xxruby}[2014/05/20 v0.1 consecutive ruby annotations] | |
| \fi | |
| \ifdefined\directlua\else | |
| \ifdefined\ruby\else | |
| \usepackage{ruby} | |
| \def\rubysep{-1.25ex} | |
| \def\rubysize{0.6} | |
| \fi\fi | |
| \protected\def\XXruby#1#2{\def\BaseSTR{#1}\def\RubySTR{#2}\XXrubyXX} | |
| \def\XXrubyXX{% | |
| \ifx\empty\BaseSTR\else | |
| \expandafter\getBaseCHAR\BaseSTR\end | |
| \expandafter\getRubyCHAR\RubySTR\end | |
| \ifdefined\directlua\else\hskip\z@ plus .0625em minus .0625ex\fi | |
| \ruby\BaseCHAR\RubyCHAR | |
| \expandafter\XXrubyXX | |
| \fi | |
| } | |
| \ifx가가% | |
| \def\getBaseCHAR#1#2\end{\def\BaseCHAR{#1}\def\BaseSTR{#2}} | |
| \def\getRubyCHAR#1#2\end{\def\RubyCHAR{#1}\def\RubySTR{#2}} | |
| \else | |
| \def\getBaseCHAR#1#2\end{% | |
| \count@`#1\relax | |
| \ifnum\count@<"80 \getBaseCHARx #1#2\end \else | |
| \ifnum\count@<"E0 \getBaseCHARxx #1#2\end \else | |
| \ifnum\count@<"F0 \getBaseCHARxxx #1#2\end \else | |
| \ifnum\count@<"F5 \getBaseCHARxxxx#1#2\end \else | |
| \errmessage{Package xxruby Error: | |
| Invalid UTF-8 charcter on input line \the\inputlineno.}% | |
| \fi\fi\fi\fi | |
| } | |
| \def\getBaseCHARx #1#2\end {\def\BaseCHAR{#1}\def\BaseSTR{#2}} | |
| \def\getBaseCHARxx #1#2#3\end {\def\BaseCHAR{#1#2}\def\BaseSTR{#3}} | |
| \def\getBaseCHARxxx #1#2#3#4\end {\def\BaseCHAR{#1#2#3}\def\BaseSTR{#4}} | |
| \def\getBaseCHARxxxx#1#2#3#4#5\end{\def\BaseCHAR{#1#2#3#4}\def\BaseSTR{#5}} | |
| \def\getRubyCHAR#1#2\end{% | |
| \count@`#1\relax | |
| \ifnum\count@<"80 \getRubyCHARx #1#2\end \else | |
| \ifnum\count@<"E0 \getRubyCHARxx #1#2\end \else | |
| \ifnum\count@<"F0 \getRubyCHARxxx #1#2\end \else | |
| \ifnum\count@<"F5 \getRubyCHARxxxx#1#2\end \else | |
| \errmessage{Package xxruby Error: | |
| Invalid UTF-8 charcter on input line \the\inputlineno.}% | |
| \fi\fi\fi\fi | |
| } | |
| \def\getRubyCHARx #1#2\end {\def\RubyCHAR{#1}\def\RubySTR{#2}} | |
| \def\getRubyCHARxx #1#2#3\end {\def\RubyCHAR{#1#2}\def\RubySTR{#3}} | |
| \def\getRubyCHARxxx #1#2#3#4\end {\def\RubyCHAR{#1#2#3}\def\RubySTR{#4}} | |
| \def\getRubyCHARxxxx#1#2#3#4#5\end{\def\RubyCHAR{#1#2#3#4}\def\RubySTR{#5}} | |
| \fi | |
| \endinput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment