Skip to content

Commit

Permalink
Support for referencing last link with (x)dvipdfmx
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Dec 7, 2020
1 parent 057231c commit 7889284
Show file tree
Hide file tree
Showing 15 changed files with 694 additions and 6 deletions.
4 changes: 4 additions & 0 deletions l3backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ this project uses date-based 'snapshot' version identifiers.

## [Unreleased]

### Added
- Support for referencing last link with `(x)dvipdfmx` (requires an up-to-date
backend)

## [2020-09-24]

### Fixed
Expand Down
29 changes: 29 additions & 0 deletions l3backend/l3backend-basics.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,35 @@
% \end{macro}
%
% \begin{macrocode}
%<@@=sys>
% \end{macrocode}
%
% \begin{macro}{\c__kernel_sys_dvipdfmx_version_int}
% A short excursion into the |sys| module to set up the backend version
% information.
% \begin{macrocode}
\group_begin:
\cs_set:Npn \@@_tmp:w #1 Version ~ #2 ~ #3 \q_stop {#2}
\sys_get_shell:nnNTF { extractbb~--version }
{ \char_set_catcode_space:n { `\ } }
\l_@@_internal_tl
{
\int_const:Nn \c__kernel_sys_dvipdfmx_version_int
{
\exp_after:wN \@@_tmp:w \l_@@_internal_tl
\q_stop
}
}
{ \int_const:Nn \c__kernel_sys_dvipdfmx_version_int { 0 } }
\group_end:
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
%<@@=>
% \end{macrocode}
%
% \begin{macrocode}
%</dvipdfmx|xetex>
% \end{macrocode}
%
Expand Down
29 changes: 25 additions & 4 deletions l3backend/l3backend-pdf.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,13 @@
% \end{macrocode}
% \end{macro}
%
% \begin{variable}{\g_@@_backend_link_int}
% To track annotations which are links.
% \begin{macrocode}
\int_new:N \g_@@_backend_link_int
% \end{macrocode}
% \end{variable}
%
% \begin{macro}
% {\@@_backend_link_begin_goto:nnw, \@@_backend_link_begin_user:nnw}
% \begin{macro}{\@@_backend_link_begin:n}
Expand All @@ -1414,11 +1421,17 @@
{ \@@_backend_link_begin:n { #1 /Subtype /Link /A << /S /GoTo /D ( #2 ) >> } }
\cs_new_protected:Npn \@@_backend_link_begin_user:nnw #1#2
{ \@@_backend_link_begin:n {#1#2} }
\cs_new_protected:Npn \@@_backend_link_begin:n #1
\cs_new_protected:Npx \@@_backend_link_begin:n #1
{
\@@_backend:n
{
bann
bann ~
\int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
{
@pdf.obj
\exp_not:N \int_use:N \exp_not:N \g_@@_backend_object_int
\c_space_tl
}
<<
/Type /Annot
#1
Expand All @@ -1433,9 +1446,17 @@
% \end{macro}
%
% \begin{macro}{\@@_backend_link_last:}
% Data not available.
% Available using the backend mechanism with a suitably-recent
% version.
% \begin{macrocode}
\cs_new:Npn \@@_backend_link_last: { }
\cs_new:Npx \@@_backend_link_last:
{
\int_compare:nNnF \c__kernel_sys_dvipdfmx_version_int < { 20201111 }
{
@pdf.obj
\exp_not:N \int_use:N \exp_not:N \g_@@_backend_link_int
}
}
% \end{macrocode}
% \end{macro}
%
Expand Down
Loading

0 comments on commit 7889284

Please sign in to comment.