diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:45:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:45:13 +0000 |
commit | 92a15e15b276458e10aa05016bf472e8c6dd3eb0 (patch) | |
tree | af0343097e5f497167cefa16ed45c03475b98c37 /Master/texmf-dist/tex/context/base/spec-tst.tex | |
parent | df014cf02a62504f6b3e7a4398fb1e093b84f114 (diff) |
context
git-svn-id: svn://tug.org/texlive/trunk@608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/spec-tst.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/spec-tst.tex | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/spec-tst.tex b/Master/texmf-dist/tex/context/base/spec-tst.tex new file mode 100644 index 00000000000..e30eea2fec2 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/spec-tst.tex @@ -0,0 +1,151 @@ +%D \module +%D [ file=spec-tst, +%D version=2002.12.08, +%D title=\CONTEXT\ \PDF\ Macros, +%D subtitle=Special Test Macro +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\ifcase \pdfoutput \endinput \fi + +\unprotect + +%D The conversions comes down to (for the sake fo speed the +%D implementation combines steps): +%D +%D \startitemize +%D \item we expand the \UTF\ sequences into \type {\unicodechar}'s +%D \item spaces become character 255's (so that they are not +%D gobbled in argument fetching +%D \item normal \ASCII\ chars are unchanged +%D \item \par's and alike are converted to \type {\unicodechar}'s +%D \stopitemize +%D +%D This happens by expansion; next we convert the resulting +%D sequence by interpreting the stream. + +\long\def\sanitizePDFuniencoding#1\to#2% + {\enablePDFunicrlf + \let\unicodechar\relax % prevent further expansion + \retainlccodes\lccode32=255 % slooow + \lowercasestring\PDFunicodetrigger#1\to#2% + \edef#2{\expandafter\doPDFuni#2\empty\empty}} % slooow + +%D Handling of empty lines: + +\bgroup +\catcode`\^^M=\@@active +\gdef\enablePDFunicrlf% + {\def\\{\unicodechar{13}}% + \def\par{\\\\}% + \catcode`\^^M=\@@active% + \let^^M=\\} +\egroup + +%D Conversion to 16 bit \UNICODE: + +\def\PDFunicodechar#1% + {\@EA\lchexnumbers\@EA{\number\utfdiv{#1}}% + \@EA\lchexnumbers\@EA{\number\utfmod{#1}}} + +\def\PDFunicodetrigger + {\unicodechar{65279}} + +%D The postprocessor: + +\def\doPDFuni#1% + {\ifx#1\relax + \@EA\dodoPDFuni + \else\ifx#1\empty + % quit + \else + \@EAEAEA\nodoPDFuni + \fi\fi#1} + +\def\nodoPDFuni#1% + {\PDFunicodechar{\ifnum`#1=255 32\else`#1\fi}\doPDFuni} + +\def\dodoPDFuni#1#2% + {\PDFunicodechar{#2}\doPDFuni} + +\def\sanitizePDFencoding + {\doifelse\currentregime{utf}% + {\PDFunicodetrue\sanitizePDFuniencoding}\sanitizePDFdocencoding} + +% pdftex specific + +\def\doPDFinsertbookmark#1#2#3#4#5% level sublevels text page open=1 + {\bgroup + \sanitizePDFencoding#3\to\bookmarktext % uses scratchcounter + \stripstring\bookmarktext + \doPDFbookmark level #1 n #2 text {\bookmarktext} page {#4} open #5 + \egroup} + +\def\doPDFbookmark level #1 n #2 text #3 page #4 open #5% + {\doPDFgetpagereference{#4}\PDFobjectreference + \pdfoutline + user {<</S /GoTo /D [\PDFobjectreference\space\PDFpageviewwrd]>>}% + \ifcase#2 \else count \ifcase#5-\fi#2 \fi + {\ifPDFunicode<#3>\else#3\fi}} + +\def\doPDFsetupidentity#1#2#3#4#5#6% + {\bgroup + \enablePDFdocencoding + \sanitizePDFencoding#1\to\idtitle \stripstring\idtitle + \sanitizePDFencoding#2\to\idsubject\stripstring\idsubject + \sanitizePDFencoding#3\to\idauthor \stripstring\idauthor + \sanitizePDFencoding#4\to\idcreator\stripstring\idcreator + \sanitizePDFencoding#6\to\idkeyword\stripstring\idkeyword + \expanded{\doPDFaddtoinfo + {/Title \ifPDFunicode<\idtitle >\else(\idtitle )\fi + /Subject \ifPDFunicode<\idsubject>\else(\idsubject)\fi + /Author \ifPDFunicode<\idauthor >\else(\idauthor )\fi + /Creator \ifPDFunicode<\idcreator>\else(\idcreator)\fi + /ModDate (#4) + /ID (\jobname.#5) % needed for pdf/x + /Keywords \ifPDFunicode<\idkeyword>\else(\idkeyword)\fi}}% + \egroup} + +\protect + +\doifnotmode{demo}{\endinput} + +% \input spec-tst.tex + +\mainlanguage[vn] +\enableregime[utf] +\usetypescript[all][computer-modern][t5] + +\setupinteraction + [state=start, + title={Thử tiếng Việt}, + author={Tác Văn Giả}, + keyword={Thử tiếng Việt}] + +\placebookmarks[chapter,section,subsection] + +\starttext + +\placelist[chapter,section,subsection][alternative=c] + +\chapter{Thử tiếng Việt} + +\section {Mục thứ nhất} +\subsection{Mục nhỏ thứ nhất} Thử tiếng Việt +\subsection{Mục nhỏ thứ hai} Thử tiếng Việt + +\section {Mục thứ hai} +\subsection{Mục nhỏ thứ nhất} Thử tiếng Việt +\subsection{Mục nhỏ thứ hai} Thử tiếng Việt + +\section {Mục thứ ba} +\subsection{Mục nhỏ thứ nhất} Thử tiếng Việt +\subsection{Mục nhỏ thứ hai} Thử tiếng Việt + +\stoptext + |