Skip to content

Also record labels as metadata for longtables, when requested in lxRDFa#862

Merged
brucemiller merged 1 commit intobrucemiller:masterfrom
dginev:more-rdfa-labels
Aug 24, 2017
Merged

Also record labels as metadata for longtables, when requested in lxRDFa#862
brucemiller merged 1 commit intobrucemiller:masterfrom
dginev:more-rdfa-labels

Conversation

@dginev
Copy link
Copy Markdown
Collaborator

@dginev dginev commented Aug 4, 2017

This PR is a follow-up to #596 and I would appreciate a quick review & merge, if possible.

It turns out that my generic recording of \label as metadata did not extend to packages redefining it, such as longtable.

The problem there is that longtable redefines (via Let) the \label macro on each environment start, which makes it impossible to maintain the RDFa hook I introduced globally in the preamble. However, I can hook into the lower level \@longtable@label macro, and it all works great again!

Example test being:

\documentclass{article}
\usepackage{longtable}
\usepackage[labels]{lxRDFa}
\begin{document}

\begin{longtable}[]{@{}lccc@{}}
1 & 2 & 3 & 4 \\

\caption{\label{table:long} caption}
\end{longtable}

I should be able to refer to Table \ref{table:long}.

\end{document}

with the expected snippet of metadata produced:

<figcaption class="ltx_caption" property="dcterms:alternative" content="table:long">

Tested locally and all works well.

@brucemiller
Copy link
Copy Markdown
Owner

Hmm... I guess the original option "labels" was a patch from you, and I accepted it? But...

It kinda seems the wrong way to go; since we'd conceivably need to mung every package that plays around with \label. Shouldn't it be more correct to use Tag (or something similar) to check for any labels attributes, and add RDF when appropriate?

@dginev
Copy link
Copy Markdown
Collaborator Author

dginev commented Aug 8, 2017

But then I would need to add that rule to all heading-like tags? Or attach it to * which would hurt performance badly.

I double-checked the bindings, i think this is the only case one needs to make a special exception. All other table packages, such as tabularx or tabulary keep using the standard label.

Happy to backtrack when it becomes unmanageable (which I hope will never happen)?

@brucemiller
Copy link
Copy Markdown
Owner

Have you actually tried whether it really hurts performance? I'd bet it's not as bas as you think (but might be).

@dginev
Copy link
Copy Markdown
Collaborator Author

dginev commented Aug 23, 2017

I mean I have a perfectly safe 3-line PR that does everything one needs with no issue...

@dginev
Copy link
Copy Markdown
Collaborator Author

dginev commented Aug 24, 2017

Maybe a compromise - if we merge here as-is, I promise to rework this using Tag the next time I find a missing label macro that isn't supported.

@brucemiller
Copy link
Copy Markdown
Owner

brucemiller commented Aug 24, 2017 via email

@dginev
Copy link
Copy Markdown
Collaborator Author

dginev commented Aug 24, 2017

XS? I love XS! I'm sure it will work out in the end :) Thanks for merging 👍

@brucemiller
Copy link
Copy Markdown
Owner

OK, I'm convinced!

@brucemiller brucemiller reopened this Aug 24, 2017
@brucemiller brucemiller merged commit 93421a3 into brucemiller:master Aug 24, 2017
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