Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for all natbib and BibLaTeX citation commands #183

Merged
merged 1 commit into from
Sep 23, 2018

Conversation

soraxas
Copy link
Contributor

@soraxas soraxas commented May 8, 2018

Modified the Regex for citation syntax, now it is able to capture all natbib commands and biblatex commands for citations.

natbib commands list
from https://gking.harvard.edu/files/natnotes2.pdf
biblatex commands list
from http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf

Citations commands that wasn't capturing before includes:

%==========================================================%
%|                     Natbib Commands                    |%
%==========================================================%
\citenum{foo_bar}
\citetext{foo_bar}

%==========================================================%
%|                    BibLaTeX Commands                    |%
%==========================================================%
% Standard Commands
\Parencite{foo_bar}
\footcitetext{foo_bar}

% Style-specific Commands
\smartcite{foo_bar}
\Smartcite{foo_bar}
\supercite{foo_bar}

% Qualified Citation Lists

\Parencites{foo_bar}
\footcitetexts{foo_bar}
\smartcites{foo_bar}
\Smartcites{foo_bar}
\Textcite{aabide}
\supercites{aabide}

% Style-independent Commands
\Autocite{foo_bar}
\Autocite*{foo_bar}
\Autocites{foo_bar}
\citedate{foo_bar}
\citedate*{foo_bar}
\citeurl{foo_bar}
\parentext{foo_bar}
\brackettext{foo_bar}

% Special Commands
\volcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Volcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\volcites[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Volcites[hprenotei]{hvolumei}[hpagei]{foo_bar}
\pvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Pvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\pvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Pvolcites[hprenotei]{hvolumei}
\fvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\ftvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\fvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Fvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\svolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Svolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\svolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Svolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\tvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Tvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\tvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Tvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\avolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Avolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\avolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Avolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\notecite{foo_bar}
\Notecite{foo_bar}
\pnotecite{foo_bar}
\Pnotecite{foo_bar}
\fnotecite{foo_bar}

% Low-level Commands
\citename{foo_bar}[hformati]{hname listi}
\citelist{foo_bar}[hformati]{hliteral listi}
\citefield{foo_bar}[hformati]{hfieldi}

all natbib commands and biblatex commands for citations.

*natbib commands list
    from https://gking.harvard.edu/files/natnotes2.pdf
*biblatex commands list
    from http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/biblatex/
                doc/biblatex.pdf

Citations commands that wasn't capturing before includes:

%==========================================================%
%|                     Natbib Commands                    |%
%==========================================================%
\citenum{foo_bar}
\citetext{foo_bar}

%==========================================================%
%|                    BibLaTeX Commands                    |%
%==========================================================%
% Standard Commands
\Parencite{foo_bar}
\footcitetext{foo_bar}

% Style-specific Commands
\smartcite{foo_bar}
\Smartcite{foo_bar}
\supercite{foo_bar}

% Qualified Citation Lists

\Parencites{foo_bar}
\footcitetexts{foo_bar}
\smartcites{foo_bar}
\Smartcites{foo_bar}
\Textcite{aabide}
\supercites{aabide}

% Style-independent Commands
\Autocite{foo_bar}
\Autocite*{foo_bar}
\Autocites{foo_bar}
\citedate{foo_bar}
\citedate*{foo_bar}
\citeurl{foo_bar}
\parentext{foo_bar}
\brackettext{foo_bar}

% Special Commands
\volcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Volcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\volcites[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Volcites[hprenotei]{hvolumei}[hpagei]{foo_bar}
\pvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Pvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\pvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Pvolcites[hprenotei]{hvolumei}
\fvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\ftvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\fvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Fvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\svolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Svolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\svolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Svolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\tvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Tvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\tvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Tvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\avolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Avolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\avolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\Avolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}
          [hpagei]{foo_bar}
\notecite{foo_bar}
\Notecite{foo_bar}
\pnotecite{foo_bar}
\Pnotecite{foo_bar}
\fnotecite{foo_bar}

% Low-level Commands
\citename{foo_bar}[hformati]{hname listi}
\citelist{foo_bar}[hformati]{hliteral listi}
\citefield{foo_bar}[hformati]{hfieldi}
@soraxas soraxas changed the title Modified the Regex for citation syntax, now it is able to capture Added support for all natbib and BibLaTeX citation commands May 8, 2018
@soraxas
Copy link
Contributor Author

soraxas commented May 8, 2018

The full list of citations commands used to validate the syntax highlighting:

%==========================================================%
%|                                                        |%
%|                     Natbib Commands                    |%
%|                                                        |%
%==========================================================%

\citet{foo_bar}
\citep{foo_bar}
\citealt{foo_bar}
\citealt*{foo_bar}
\citealp{foo_bar}
\citealp*{foo_bar}

\citenum{foo_bar}
\citetext{foo_bar}

\citeauthor{foo_bar}
\citeauthor*{foo_bar}
\citeyear{foo_bar}
\citeyearpar{foo_bar}

\Citet{foo_bar}
\Citep{foo_bar}
\Citealt{foo_bar}
\Citealp{foo_bar}
\Citeauthor{foo_bar}


%==========================================================%
%|                                                         |%
%|                    BibLaTeX Commands                    |%
%|                                                         |%
%==========================================================%

%----------------------------------------------------------%
%                    Standard Commands                     %
%----------------------------------------------------------%
\cite{foo_bar}
\Cite{foo_bar}

\parencite{foo_bar}
\Parencite{foo_bar}

\footcite{foo_bar}
\footcitetext{foo_bar}

%----------------------------------------------------------%
%                 Style-specific Commands                  %
%----------------------------------------------------------%
\smartcite{foo_bar}
\Smartcite{foo_bar}

\cite*{foo_bar}

\parencite*{foo_bar}

\supercite{foo_bar}

%----------------------------------------------------------%
%                 Qualified Citation Lists                 %
%----------------------------------------------------------%
\cites{foo_bar}
\Cites{foo_bar}

\parencites{foo_bar}
\Parencites{foo_bar}

\footcites{foo_bar}
\footcitetexts{foo_bar}

\smartcites{foo_bar}
\Smartcites{foo_bar}

\textcite{foo_bar}
\Textcite{aabide}

\supercites{aabide}

%----------------------------------------------------------%
%                Style-independent Commands                %
%----------------------------------------------------------%
\autocite{foo_bar}
\Autocite{foo_bar}

\autocite*{foo_bar}
\Autocite*{foo_bar}

\autocites{foo_bar}
\Autocites{foo_bar}

\citeauthor{foo_bar}
\citeauthor*{foo_bar}
\Citeauthor{foo_bar}
\Citeauthor*{foo_bar}

\citetitle{foo_bar}
\citetitle*{foo_bar}

\citeyear{foo_bar}
\citeyear*{foo_bar}

\citedate{foo_bar}
\citedate*{foo_bar}

\citeurl{foo_bar}

\parentext{foo_bar}

\brackettext{foo_bar}

%----------------------------------------------------------%
%                     Special Commands                     %
%----------------------------------------------------------%
\nocite{foo_bar}
\nocite{*}

\fullcite{foo_bar}

\footfullcite{foo_bar}

\volcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Volcite[hprenotei]{hvolumei}[hpagei]{foo_bar}

\volcites[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Volcites[hprenotei]{hvolumei}[hpagei]{foo_bar}

\pvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Pvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}

\pvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Pvolcites[hprenotei]{hvolumei}

\fvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\ftvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}

\fvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Fvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}

\svolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Svolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}

\svolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Svolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}

\tvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Tvolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}

\tvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Tvolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}

\avolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Avolcite[hprenotei]{hvolumei}[hpagei]{foo_bar}

\avolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}
\Avolcites[hprenotei]{hvolumei}[hpagei]{foo_bar}[hprenotei]{hvolumei}[hpagei]{foo_bar}

\notecite{foo_bar}
\Notecite{foo_bar}

\pnotecite{foo_bar}
\Pnotecite{foo_bar}

\fnotecite{foo_bar}

%----------------------------------------------------------%
%                    Low-level Commands                    %
%----------------------------------------------------------%
\citename{foo_bar}[hformati]{hname listi}

\citelist{foo_bar}[hformati]{hliteral listi}

\citefield{foo_bar}[hformati]{hfieldi}

@Aerijo
Copy link
Collaborator

Aerijo commented Sep 23, 2018

Can't see anything wrong with it. The lenient [ANP]* at the end was there originally.

@Aerijo Aerijo merged commit afeda09 into area:master Sep 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants