Skip to content

Commit

Permalink
add orcidlink binding
Browse files Browse the repository at this point in the history
  • Loading branch information
xworld21 committed Aug 17, 2024
1 parent d4232c0 commit 56c77a0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ lib/LaTeXML/resources/CSS/ltx-article.css
lib/LaTeXML/resources/CSS/ltx-book.css
lib/LaTeXML/resources/CSS/ltx-cv.css
lib/LaTeXML/resources/CSS/ltx-listings.css
lib/LaTeXML/resources/CSS/ltx-orcidlink.css
lib/LaTeXML/resources/CSS/ltx-report.css
lib/LaTeXML/resources/CSS/ltx-svjour.css
lib/LaTeXML/resources/CSS/ltx-ulem.css
Expand Down Expand Up @@ -648,6 +649,7 @@ lib/LaTeXML/Package/nomencl.sty.ltxml
lib/LaTeXML/Package/nopageno.sty.ltxml
lib/LaTeXML/Package/ntheorem.sty.ltxml
lib/LaTeXML/Package/numprint.sty.ltxml
lib/LaTeXML/Package/orcidlink.sty.ltxml
lib/LaTeXML/Package/ot4.fontmap.ltxml
lib/LaTeXML/Package/overpic.sty.ltxml
lib/LaTeXML/Package/palatino.sty.ltxml
Expand Down
41 changes: 41 additions & 0 deletions lib/LaTeXML/Package/orcidlink.sty.ltxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- mode: Perl -*-
# /=====================================================================\ #
# | paralist | #
# | 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;
use LaTeXML::Common::Error;

InputDefinitions('orcidlink', type => 'sty', noltxml => 1);

# add ltx_orcidlogo class to adjust logo height in CSS
RequireResource('ltx-orcidlink.css');
DefConstructor('\lx@orcidlink@addclass{}', '#1', afterConstruct => sub {
my ($document, $whatsit) = @_;
my $context = $document->getElement;
if (my $pic = $document->findnode('.//ltx:picture', $context)) {
$document->addClass($pic, 'ltx_orcidlogo'); } });

# intercept core macro (\orcidlogo in newer versions)
my $orcidmacro = LookupDefinition(T_CS('\orcidlogo')) ? '\orcidlogo' : '\orcidlink';
Let('\lx@orcidmacro', $orcidmacro);

# if \fontcharht is still not implemented, fall back to hardcoded value
if (LookupDefinition(T_CS('\fontcharht'))) {
DefMacro("$orcidmacro\{}", '\lx@orcidlink@addclass{\lx@orcidmacro{#1}}'); }
else {
DefMacro("$orcidmacro\{}", '\let\lx@fontcharht@orig\fontcharht\def\fontcharht#2{12pt}' .
'\lx@orcidlink@addclass{\lx@orcidmacro{#1}}' .
'\let\fontchar\lx@fontcharht@orig'); }

1;
4 changes: 4 additions & 0 deletions lib/LaTeXML/resources/CSS/ltx-orcidlink.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.ltx_orcidlogo {
height: 1em; /* fallback for very old browsers */
height: 1cap;
width: auto; }

0 comments on commit 56c77a0

Please sign in to comment.