/usr/share/perl5/LaTeXML/Package/url.sty.ltxml is in latexml 0.8.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | # -*- mode: Perl -*-
# /=====================================================================\ #
# | url | #
# | Implementation for LaTeXML | #
# |=====================================================================| #
# | Part of LaTeXML: | #
# | Public domain software, produced as part of work done by the | #
# | United States Government & not subject to copyright in the US. | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov> #_# | #
# | http://dlmf.nist.gov/LaTeXML/ (o o) | #
# \=========================================================ooo==U==ooo=/ #
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;
AssignValue(BASE_URL => '');
# Ignorable stuff, since we're not doing linebreaks.
DefMacro('\UrlBreaks', '');
DefMacro('\UrlBigBreaks', '');
DefMacro('\UrlNoBreaks', '');
DefMacro('\UrlOrds', '');
DefMacro('\UrlSpecials', '');
# Font style definitions.
DefMacro('\urlstyle{}', '\expandafter\protect\csname url@#1style\endcsname');
DefMacro('\url@ttstyle', '\def\UrlFont{\ttfamily}');
DefMacro('\url@rmstyle', '\def\UrlFont{\rmfamily}');
DefMacro('\url@sfstyle', '\def\UrlFont{\sffamily}');
DefMacro('\url@samestyle', '');
DefMacro('\UrlFont', '\ttfamily');
# Bracketting.
Let('\UrlLeft', '\@empty');
Let('\UrlRight', '\@empty');
# \DeclareUrlCommand\cmd{settings}
# Have this expand into \@Url w/ the declared cmd as arg, so it gets reflected in XML.
DefMacro('\DeclareUrlCommand{}{}', '\def#1{\begingroup #2\@Url#1}');
# This is an extended version of \Url that takes an extra token as 1st arg.
# That token is the cs that invoked it, so that it can be reflected in the generated XML,
# as well as used to generate the reversion.
# In any case, we read the verbatim arg, and build a Whatsit for @@Url
DefMacro('\@Url Token', sub {
my ($gullet, $cmd) = @_;
my $mouth = $gullet->getMouth;
my ($open, $close, $url);
$open = $gullet->readToken;
StartSemiverbatim();
if ($open->equals(T_BEGIN)) {
$open = T_OTHER('{'); $close = T_OTHER('}');
$url = $gullet->readBalanced; }
else {
$close = $open = T_OTHER($open->getString);
$url = $mouth->readTokens($close); }
EndSemiverbatim();
my @toks = map { T_OTHER(ToString($_)) } $url->unlist;
(Invocation(T_CS('\@@Url'),
T_OTHER(ToString($cmd)), Tokens($open), Tokens($close),
Tokens(@toks),
Tokens(T_CS('\UrlFont'), T_CS('\UrlLeft'), @toks, T_CS('\UrlRight')))->unlist,
T_CS('\endgroup')); });
# Define \Url, in case its used; won't be represented as nicely
DefMacro('\Url', sub {
my ($gullet) = @_;
$gullet->unread(T_OTHER('\Url'));
(T_CS('\@Url')); });
# \@@Url cmd {open}{close}{url}{formattedurl}
DefConstructor('\@@Url Undigested {}{} Semiverbatim {}',
"<ltx:ref href='#href' class='#class'>#5</ltx:ref>",
properties => sub { (href => CleanURL(LookupValue('BASE_URL') . ToString($_[4])),
class => sub { my $c = ToString($_[1]); $c =~ s/^\\//; 'ltx_' . $c; }); },
reversion => '#1#2#4#3');
# These are the expansions of \DeclareUrlCommand
DefMacro('\path', '\begingroup\urlstyle{tt}\@Url\path');
DefMacro('\url', '\begingroup\@Url\url');
# \urldef{newcmd}\cmd{arg}
# Kinda tricky, since we need to get the expansion of \cmd as the value of \newcmd
# Along with the annoying \endgroup that must balance the one always preceding \Url!
DefPrimitive('\urldef{}', sub {
my ($stomach, $cmd) = @_;
my $gullet = $stomach->getGullet;
my @expansion = $stomach->digestNextBody(T_CS('\endgroup'));
DefPrimitiveI($cmd, undef, sub { @expansion; });
(); });
1;
|