summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/spec-tst.mkii
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
committerTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
commit8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 (patch)
tree3cd9bbdd599bc4d1ac0409e167fee2136e4c0ec9 /Master/texmf-dist/tex/context/base/spec-tst.mkii
parent850fc99b7cd3ae7a20065531fe866ff7bae642ec (diff)
this is context 2009.08.19 17:10
git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/spec-tst.mkii')
-rw-r--r--Master/texmf-dist/tex/context/base/spec-tst.mkii152
1 files changed, 152 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/spec-tst.mkii b/Master/texmf-dist/tex/context/base/spec-tst.mkii
new file mode 100644
index 00000000000..bdd8a29b221
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/spec-tst.mkii
@@ -0,0 +1,152 @@
+%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 of 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
+ \simplifycommands % added due to Dohyun Kim
+ \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{#1}{#2}{\bookmarktext}{#4}{#5}%
+ \egroup}
+
+\def\doPDFbookmark#1#2#3#4#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
+