diff options
author | Karl Berry <karl@freefriends.org> | 2009-01-25 16:13:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-01-25 16:13:25 +0000 |
commit | 3062f54d06ccad7035b82b56fd5476dcac02c505 (patch) | |
tree | 922a67ac0a967a5975bcc69750746913352907b9 /Master/texmf-dist/tex | |
parent | aa11c46b08336e3b16a46b7b7099b45bc4757478 (diff) |
breakurl 1.30 (23jan09)
git-svn-id: svn://tug.org/texlive/trunk@11968 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/breakurl/breakurl.sty | 93 |
1 files changed, 56 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/latex/breakurl/breakurl.sty b/Master/texmf-dist/tex/latex/breakurl/breakurl.sty index 994b069c0e7..0bf5b06e8fe 100644 --- a/Master/texmf-dist/tex/latex/breakurl/breakurl.sty +++ b/Master/texmf-dist/tex/latex/breakurl/breakurl.sty @@ -29,7 +29,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{breakurl} - [2008/07/15 v1.23 Breakable hyperref URLs] + [2009/01/24 v1.30 Breakable hyperref URLs] \RequirePackage{xkeyval} @@ -66,37 +66,35 @@ \newtoks\burl@toks -\def\burl@charlist{} -\def\burl@addtocharlist#1{% - \expandafter\gdef\expandafter\burl@charlist\expandafter{% - \burl@charlist #1}% -} +\let\burl@charlistbefore\empty +\let\burl@charlistafter\empty + +\def\burl@addtocharlistbefore{\g@addto@macro\burl@charlistbefore} +\def\burl@addtocharlistafter{\g@addto@macro\burl@charlistafter} \bgroup -\catcode`\&=12\relax -\hyper@normalise\burl@addtocharlist{:/.?#&_,;!} + \catcode`\&=12\relax + \hyper@normalise\burl@addtocharlistbefore{%} + \hyper@normalise\burl@addtocharlistafter{:/.?#&_,;!} \egroup -\def\burl@growmif#1{% - \expandafter\def\expandafter\burl@mif\expandafter{% - \burl@mif\def\burl@ttt{#1}\ifx\burl@ttt\@nextchar\@burl@breakabletrue\else - }% +\def\burl@growmif#1#2{% + \g@addto@macro\burl@mif{\def\burl@ttt{#1}\ifx\burl@ttt\@nextchar#2\else}% } \def\burl@growmfi{% - \expandafter\def\expandafter\burl@mfi\expandafter{\burl@mfi\fi}% -} -\def\burl@melse{% - \if@burl@breakable\burl@flush\linebreak[0]\@burl@breakablefalse\fi - \expandafter\expandafter\expandafter\burl@toks - \expandafter\expandafter\expandafter{% - \expandafter\the\expandafter\burl@toks\@nextchar}% + \g@addto@macro\burl@mfi{\fi}% } \def\burl@defifstructure{% - \def\burl@mif{}% - \def\burl@mfi{}% + \let\burl@mif\empty + \let\burl@mfi\empty \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% - \burl@charlist\do{% - \expandafter\burl@growmif\@nextchar + \burl@charlistbefore\do{% + \expandafter\burl@growmif\@nextchar\@burl@breakbeforetrue + \burl@growmfi + }% + \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% + \burl@charlistafter\do{% + \expandafter\burl@growmif\@nextchar\@burl@breakaftertrue \burl@growmfi }% } @@ -120,9 +118,12 @@ } \DeclareOptionX{preserveurlmacro}{\@preserveurlmacrotrue} -\DeclareOptionX{hyphenbreaks}{\bgroup - \catcode`\&=12\relax\hyper@normalise\burl@addtocharlist{-}% - \egroup} +\DeclareOptionX{hyphenbreaks}{% + \bgroup + \catcode`\&=12\relax + \hyper@normalise\burl@addtocharlistafter{-}% + \egroup +} \DeclareOptionX{vertfit}[local]{\burl@setvertfit{#1}} \ProcessOptionsX\relax @@ -177,7 +178,9 @@ \hyper@normalise\burl@alt } -\newif\if@burl@breakable +\newif\if@burl@breakbefore +\newif\if@burl@breakafter +\newif\if@burl@prevbreakafter \bgroup \catcode`\&=12\relax @@ -198,20 +201,36 @@ \gdef\burl@doit{% \burl@toks{}% - \let\burl@UrlRight=\UrlRight - \let\UrlRight=\empty + \let\burl@UrlRight\UrlRight + \let\UrlRight\empty + \@burl@prevbreakafterfalse \@ifundefined{@urlcolor}{\Hy@colorlink\@linkcolor}{\Hy@colorlink\@urlcolor}% - \@burl@breakablefalse \expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=% \burl@urltext\do{% - \expandafter\burl@mif\expandafter\burl@melse\burl@mfi - \if@burl@breakable - \expandafter\expandafter\expandafter\burl@toks - \expandafter\expandafter\expandafter{% - \expandafter\the\expandafter\burl@toks\@nextchar}% + \if@burl@breakafter\@burl@prevbreakaftertrue + \else\@burl@prevbreakafterfalse\fi + \@burl@breakbeforefalse + \@burl@breakafterfalse + \expandafter\burl@mif\burl@mfi + \if@burl@breakbefore + % Breakable if the current char is in the `can break before' list + \burl@flush\linebreak[0]% + \else + \if@burl@prevbreakafter + \if@burl@breakafter\else + % Breakable if the current char is not in any of the `can break' + % lists, but the previous is in the `can break after' list. + % This mechanism accounts for sequences of `break after' characters, + % where a break is allowed only after the last one + \burl@flush\linebreak[0]% + \fi + \fi \fi + \expandafter\expandafter\expandafter\burl@toks + \expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\burl@toks\@nextchar}% }% - \let\UrlRight=\burl@UrlRight + \let\UrlRight\burl@UrlRight \burl@flush \literalps@out{BU.E}% \Hy@endcolorlink @@ -226,7 +245,7 @@ \literalps@out{/BU.L (\burl@url) def}% \hyper@linkurl{\expandafter\Hurl\expandafter{\burl@toks@def}}{\burl@url}% \global\burl@toks{}% - \let\UrlLeft=\empty + \let\UrlLeft\empty }% \if@preserveurlmacro\else\let\url\burl\let\urlalt\burlalt\fi |