Debian Codegraph @

texmf-dist/tex/latex/lwarp/lwarp-common-multimedia.sty

raw
1 %%
2 %% This is file `lwarp-common-multimedia.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% lwarp.dtx (with options: `common-multimedia')
8 %% This is a generated file.
9 %% Copyright 2016-2026 Brian Dunn
10 %%
11 %% This work may be distributed and/or modified under the
12 %% conditions of the LaTeX Project Public License, either version 1.3
13 %% of this license or (at your option) any later version.
14 %% The latest version of this license is in
15 %% http://www.latex-project.org/lppl.txt
16 %% and version 1.3 or later is part of all distributions of LaTeX
17 %% version 2005/12/01 or later.
18
19 \ProvidesPackage{lwarp-common-multimedia}[2019/04/22]
20 \RequirePackage{xkeyval}
21
22 \define@key{LWR@multimedia}{width}{\setlength{\LWR@multimedia@width}{#1}}
23 \define@key{LWR@multimedia}{height}{\setlength{\LWR@multimedia@height}{#1}}
24 \define@key{LWR@multimedia}{totalheight}{\setlength{\LWR@multimedia@height}{#1}}
25 \newlength{\LWR@multimedia@width}
26 \newlength{\LWR@multimedia@height}
27 \newlength{\LWR@multimedia@maxdimension}
28 \newcommand*{\LWR@multimedia@printsize}{%
29 \setlength{\LWR@multimedia@maxdimension}{%
30 \maxof%
31 {\linewidth}%
32 {\maxof{\LWR@multimedia@width}{\LWR@multimedia@height}}%
33 }%
34 \setlength{\LWR@multimedia@maxdimension}{1.1\LWR@multimedia@maxdimension}%
35 \ifdimgreater{\LWR@multimedia@width}{0pt}{%
36 width:%
37 \LWR@printpercentlength%
38 {\LWR@multimedia@width}%
39 {\LWR@multimedia@maxdimension}vmin ; % space
40 }{}%
41 \ifdimgreater{\LWR@multimedia@height}{0pt}{%
42 height:%
43 \LWR@printpercentlength%
44 {\LWR@multimedia@height}%
45 {\LWR@multimedia@maxdimension}vmin ; % space
46 }{}%
47 }
48 \newcommand*{\LWR@multimedia@fileAV}[4]{%
49 \IfFileExists{#2}{% also sets \@filef@und
50 \StrSubstitute[100]{\@filef@und}{"}{}[\LWR@parsedfilename]%
51 \ifstrequal{#3}{audio}{%
52 \begin{BlockClass}{AVviewport}
53 }{%
54 \begin{BlockClass}[\LWR@multimedia@printsize\ margin:auto]{AVviewport}
55 }
56 \LWR@stoppars
57 \LWR@htmltag{%
58 #3\ % space
59 \ifstrequal{#3}{audio}{}{%
60 width=\textquotedbl{}100\%\textquotedbl\ % space
61 height=\textquotedbl{}100\%\textquotedbl\ % space
62 }%
63 controls%
64 }\LWR@orignewline
65 \LWR@htmltag{%
66 source % space
67 src=\textquotedbl%
68 \LWR@parsedfilename\unskip\textquotedbl\ % space
69 type=\textquotedbl{}#4\textquotedbl}
70 \LWR@startpars
71 \LWR@href{\LWR@parsedfilename}{#1}
72 \LWR@stoppars
73 \LWR@htmltag{/#3}\LWR@orignewline
74 \end{BlockClass}
75 }{%
76 \PackageError{lwarp-common-multimedia}
77 {File '#2' not found}
78 {Perhaps an incorrect path?}
79 }%
80 }
81 \newcommand*{\LWR@multimedia@httpAV}[4]{%
82 \ifstrequal{#3}{audio}{%
83 \begin{BlockClass}{AVviewport}
84 }{%
85 \begin{BlockClass}[\LWR@multimedia@printsize\ margin:auto]{AVviewport}
86 }
87 \LWR@stoppars
88 \LWR@htmltag{%
89 #3\ % space
90 \ifstrequal{#3}{audio}{}{%
91 width=\textquotedbl{}100\%\textquotedbl\ % space
92 height=\textquotedbl{}100\%\textquotedbl\ controls%
93 }%
94 }\LWR@orignewline
95 \LWR@htmltag{%
96 source % space
97 src=\textquotedbl#2\textquotedbl\ % space
98 type=\textquotedbl#4\textquotedbl}
99 \LWR@startpars
100 \LWR@href{#2}{#1}
101 \LWR@stoppars
102 \LWR@htmltag{/#3}\LWR@orignewline
103 \end{BlockClass}
104 }
105 \newcommand*{\LWR@multimedia@AV}[4]{%
106 \IfBeginWith{#2}{http}%
107 {\LWR@multimedia@httpAV{#1}{#2}{#3}{#4}}%
108 {%
109 \IfBeginWith{#2}{HTTP}%
110 {\LWR@multimedia@httpAV{#1}{#2}{#3}{#4}}%
111 {\LWR@multimedia@fileAV{#1}{#2}{#3}{#4}}%
112 }%
113 }
114 \newcommand*{\LWR@multimedia@embed}[3]{%
115 \begin{BlockClass}[width:100\%]{AVviewport}%
116 \LWR@stoppars
117 \LWR@htmltag{%
118 embed % space
119 \ifblank{#3}{}{type=\textquotedbl#3\textquotedbl\ }%
120 style=\textquotedbl\LWR@multimedia@printsize\ margin:auto\textquotedbl\ % space
121 src=\textquotedbl#2\textquotedbl\ % space
122 }%
123 \LWR@startpars
124 \end{BlockClass}
125 }
126 \newcommand*{\LWR@multimedia@percenterror}{%
127 \PackageError{lwarp-media9}
128 {%
129 Do not use a percent comment between\MessageBreak
130 \protect\includemedia\space arguments%
131 }
132 {%
133 Percent is changed to a regular character\MessageBreak
134 to allow its use inside a URL.%
135 }
136 }
137 \newcommand*{\LWR@multimediab}[3][]{%
138 \if#1\@percentchar\LWR@multimedia@percenterror\fi%
139 \if#2\@percentchar\LWR@multimedia@percenterror\fi%
140 \if#3\@percentchar\LWR@multimedia@percenterror\fi%
141 \LWR@stoppars%
142 \setlength{\LWR@multimedia@width}{0pt}%
143 \setlength{\LWR@multimedia@height}{0pt}%
144 \setkeys*{LWR@multimedia}{#1}%
145 \IfEndWith{#3}{.mp4}{\LWR@multimedia@AV{#2}{#3}{video}{video/mp4}}{%
146 \IfEndWith{#3}{.MP4}{\LWR@multimedia@AV{#2}{#3}{video}{video/mp4}}{%
147 \IfEndWith{#3}{.mp3}{\LWR@multimedia@AV{#2}{#3}{audio}{audio/mpeg}}{%
148 \IfEndWith{#3}{.MP3}{\LWR@multimedia@AV{#2}{#3}{audio}{audio/mpeg}}{%
149 \IfBeginWith{#3}{http}{\LWR@multimedia@embed{#2}{#3}{}}{%
150 \IfBeginWith{#3}{HTTP}{\LWR@multimedia@embed{#2}{#3}{}}{%
151 \IfBeginWith{#3}{ftp}{\LWR@multimedia@embed{#2}{#3}{}}{%
152 \IfBeginWith{#3}{FTP}{\LWR@multimedia@embed{#2}{#3}{}}{%
153 \LWR@href{#3}{#2}% unknown format
154 }}}}}}}}%
155 \LWR@startpars%
156 \endgroup%
157 }
158 \newrobustcmd*{\LWR@multimedia}{%
159 \begingroup%
160 \LWR@linkmediacatcodes%
161 \LWR@multimediab%
162 }
163 \endinput
164 %%
165 %% End of file `lwarp-common-multimedia.sty'.