LaTeXML

 view release on metacpan or  search on metacpan

lib/LaTeXML/Package/listings.sty.ltxml  view on Meta::CPAN

sub lstClassProperty {
  my ($classname, $property) = @_;
  my $class = $classname && LookupValue('LST_CLASSES')->{$classname};
  return ($class && ($$class{$property}
      ? $$class{$property}
      : lstClassProperty($$class{class}, $property))); }

DefConstructor('\@lst@startline{}', "<ltx:listingline xml:id='#id'>#1",
  properties => sub { RefStepID('lstnumber'); });
DefConstructor('\@lst@endline',      "</ltx:listingline>");
DefConstructor('\@lst@linenumber{}', "<ltx:tags><ltx:tag>#1</ltx:tag></ltx:tags>");

DefMacro('\lstnumbertyperefname', 'line');

DefConstructor('\@lst@visible@space', "\x{2423}");

sub lstDoNumber {
  my ($isempty) = @_;
  if ((LookupValue('LISTINGS_NEEDS_NUMBER')
      || ((($LaTeXML::linenum - 1) % lstGetNumber('stepnumber')) == 0))
    && (lstGetBoolean('numberblanklines') || !$isempty)) {
    AssignValue('LISTINGS_NEEDS_NUMBER' => 0);
    return Invocation(T_CS('\lx@make@tags'), T_OTHER('lstnumber')); }
  else {
    return Invocation(T_CS('\@lst@linenumber'), Tokens()); } }

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Configuration
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Initialize the various parameters...

RawTeX(<<'EoTeX');
\lstset{
 alsoletter={abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@$\_},
 alsodigit={0123456789},
 alsoother={!"#\%&'()*+,-./:;<=>?[\\]^\{|\}~},
 float=tbp,floatplacement=tbp,aboveskip=\medskipamount,belowskip=\medskipamount,
 lineskip=0pt,boxpos=c,
 print=true,firstline=1,lastline=9999999,showlines=false,emptylines=9999999,gobble=0,
 style={},language={},printpod=false,usekeywordsintag=true,tagstyle={},
 markfirstintag=false,makemacrouse=true,
 basicstyle={},identifierstyle={},commentstyle=\itshape,stringstyle={},
 keywordstyle=\bfseries,classoffset=0,
 emph={},delim={},
 extendedchars=false,inputencoding={},upquote=false,tabsize=8,showtabs=false,
 tabs={},showspaces=false,showstringspaces=true,formfeed=\bigbreak,
 numbers=none,stepnumber=1,numberfirstline=false,numberstyle={},numbersep=10pt,
 numberblanklines=true,firstnumber=auto,name={},
 title={},caption={},label={},nolol=false,
 captionpos=t,abovecaptionskip=\smallskipamount,belowcaptionskip=\smallskipamount,
 linewidth=\linewidth,xleftmargin=0pt,xrightmargin=0pt,resetmargins=false,breaklines=false,
 prebreak={},postbreak={},breakindent=20pt,breakautoindent=true,
 frame=none,frameround=ffff,framesep=3pt,rulesep=2pt,framerule=0.4pt,
 framexleftmargin=0pt,framexrightmargin=0pt,framextopmargin=0pt,framexbottommargin=0pt,
 backgroundcolor={},rulecolor={},fillcolor={},rulesepcolor={},
 frameshape={},
 index={},indexstyle=\lstindexmacro,
 columns=[c]fixed,flexiblecolumns=false,keepspaces=false,basewidth={0.6em,0.45em},
 fontadjust=false,texcl=false,mathescape=false,escapechar={},escapeinside={},
 escapebegin={},escapeend={},
 fancyvrb=false,fvcmdparams=\overlay1,morefvcmdparams={},
 ndkeywordstyle=keywordstyle,texcsstyle=keywordstyle,directivestyle=keywordstyle
}
EoTeX

#======================================================================
# Finally, we want to load the definitions from the configurations...
# Actually, we should just load .cfg
# and the extra files should be loaded as needed, but...
sub lstLoadConfiguration {
  InputDefinitions("listings", type => 'cfg');
  AssignValue(LST_LANGUAGE_FILES => [lstSplit(Digest(T_CS('\lstlanguagefiles')))], 'global');

  # Now, if you want to read in all definitions immediately, you could do this (on preload)
  # otherwise, they'll be read in whenever missing languages are used.
  if (LookupValue('InitialPreloads')) {
    while (my $file = ShiftValue('LST_LANGUAGE_FILES')) {
      InputDefinitions($file, noerror => 1); } }
  return; }

lstLoadConfiguration();

# Also allow some internal macros which get used from sibling bindings e.g. cleveref
DefMacro('\lst@UseHook{}',        '\csname\@lst hk@#1\endcsname');
DefMacro('\lst@AddToHook{}{}',    '');                               # ignore
DefMacro('\lst@AddToHookExe{}{}', '');                               # ignore
DefMacro('\lst@AddTo {}{}',
  '\expandafter\gdef\expandafter#1\expandafter{#1#2}',
  long => 1);
DefMacro('\@lst', 'lst');
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1;



( run in 3.801 seconds using v1.01-cache-2.11-cpan-f56aa216473 )