Skip to content
Snippets Groups Projects
sn-mathphys.bst 62.2 KiB
Newer Older
theochap's avatar
theochap committed
            "cnm" markup.xml write$ }
          { temp.str i "{ll{ }}" format.name$ % last names space seperated. 
            "snm" markup.xml write$ }
        if$

        "fnm" markup.xml write$ 
      
        "</au>" write$ newline$
        i #1 + 'i :=
      }
      while$      
      "  </aug>" write$ newline$
    }
  if$
}


%%
 % markup.xml.pub
 %
 % Takes 4 args (school address publisher tag)
 % prints concatenation 
 % returns nothing
%% 
FUNCTION {markup.xml.pub}
{
  't :=    % Tag
  "" 'v := % Publisher 
  "" 'l := % Address
  "" 'f := % School
  "" 's := % Answer
  duplicate$ missing$ 'pop$ { 'v := } if$
  duplicate$ missing$ 'pop$ { 'l := } if$
  duplicate$ missing$ 'pop$ { 'f := } if$
  "" f = not     % school not empty
    { f 's := }   % return school as publisher 
    {             % else 
      "" v = "" l = and % address and pub empty 
        'skip$
        {
          "" l = 
            { v 's := }         % return pub
            { "" v =
                { l 's := }         % return add
                { l ": " * v * 's := }  % return add : pub
              if$
            }
          if$
        }
      if$
    }
  if$
  s t markup.xml output.xml
}

%%
 % xml.phd
 %
 % Takes nothing
 % Returns type (phd/msc) of empty string
%%
FUNCTION {xml.phd}
{   
    "phdthesis" type$ =
    "mastersthesis" type$ = or
    { "phdthesis" type$ =
        { "PhD thesis" }
        { "Master's thesis" }
      if$
    }
    { type } % usually empty
  if$ 
}

% markup.xml.edition
%
% edition is a numeric value. ie "2"
% if format 2nd 1st etc.. strip letters.
%
FUNCTION {markup.xml.edition}
{ pop$ pop$  %clear stack
  edition strip.letters duplicate$ "" = 
      { pop$ edition } 
      'skip$ 
  if$
  "edition"   markup.xml  output.xml
}


FUNCTION{begin.bmcxmlcomment}{
    newline$ 
    "\newcommand{\BMCxmlcomment}[1]{}" write$ newline$
    newline$ 
    "\BMCxmlcomment{" write$ newline$ 
    newline$ "<refgrp>" write$ newline$
}

FUNCTION{end.bmcxmlcomment}{ 
    newline$ 
    "</refgrp>" write$ newline$
    "} % end of \BMCxmlcomment" write$ newline$
}

FUNCTION {export.xml}{ 
  newline$
  global.counter #1 + 'global.counter :=
  "<bibl id=" quote$ * "B" * global.counter int.to.str$ * quote$ * ">" * 
  write$ newline$
%  title "\&" "&amp" replace "title" markup.xml.title     
  title         "title"     markup.xml.title     
  author        "aug"       markup.xml.names % org. and inst. here
  howpublished missing$ 
    { booktitle missing$ 
      { journal missing$
          { xml.phd } % <type> Phd/Msc 
          {journal}
        if$
      } {booktitle}
    if$
    } { howpublished }
  if$           "source"    markup.xml output.xml
  school 
  address  
  publisher     "publisher" markup.xml.pub
  editor        "editor"    markup.xml output.xml
  edition       "edition"   markup.xml.edition     
  series        "p"         markup.xml 
                "title"     markup.xml 
                "series"    markup.xml output.xml    
  chapter       "p"         markup.xml 
                "title"     markup.xml 
                "section"   markup.xml output.xml    
  % month       % ignore
  year          "pubdate"   markup.xml output.xml    
  
  note missing$ 
      { volume  "volume"    markup.xml output.xml    
        number  "issue"     markup.xml output.xml    
        pages               markup.xml.pages    
        url     "url"       markup.xml output.xml }
      { note "l" change.case$ "in press" = 
          { "  <inpress />" write$ newline$ }
          { volume  "volume"    markup.xml output.xml    
            number  "issue"     markup.xml output.xml    
            pages               markup.xml.pages    
            url     "url"       markup.xml output.xml 
            note    "note"      markup.xml output.xml 
          }   
        if$ 
      }
  if$
  "</bibl>" write$ newline$
} 

%%EXECUTE {begin.bmcxmlcomment}
%%ITERATE {export.xml}
%%EXECUTE {end.bmcxmlcomment}