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

LaTeX writer: figure label #2637

Merged
merged 1 commit into from
Mar 19, 2016
Merged

LaTeX writer: figure label #2637

merged 1 commit into from
Mar 19, 2016

Conversation

mb21
Copy link
Collaborator

@mb21 mb21 commented Jan 10, 2016

No description provided.

@tomduck
Copy link

tomduck commented Jan 10, 2016

Hi there. I'm the author of the pandoc-fignos filter. I think that this is going to cause a bit of a problem for me. Pandoc-fignos reads figure attributes and injects a LaTeX \label{} into the json abstract syntax tree when the LaTeX format is being used. With your new patch, I will need to stop doing that beginning with pandoc 1.17 (I presume). A way for filters to detect the pandoc version is going to be needed if backward-compatibility is to be maintained. Thanks.

@jgm
Copy link
Owner

jgm commented Jan 10, 2016

Text.Pandoc.pandocVersion will give you the version.

However, this requires pandoc, not just pandoc-types.
It would be good to export a version from pandoc-types, too.

+++ Thomas J. Duck [Jan 10 16 07:40 ]:

Hi there. I'm the author of the [1]pandoc-fignos filter. I think that
this is going to cause a bit of a problem for me. Pandoc-fignos reads
figure attributes and injects a LaTeX \label{} into the abstract syntax
tree when the LaTeX format is being used. With your new patch, I should
stop doing that. Is there any way to detect the pandoc version in a
filter so that I can adjust to this new behavior? Thanks.


Reply to this email directly or [2]view it on GitHub.

References

  1. https://github.com/tomduck/pandoc-fignos
  2. LaTeX writer: figure label #2637 (comment)

@tomduck
Copy link

tomduck commented Jan 10, 2016

Thanks, @jgm. My filter is written in python, so I don't think that I have access to Text.Pandoc.pandocVersion.

@jgm
Copy link
Owner

jgm commented Jan 10, 2016

+++ Thomas J. Duck [Jan 10 16 13:55 ]:

Thanks, [1]@jgm. My filter is written in python, so I don't think that
I have access to Text.Pandoc.pandocVersion.

If you're consuming json produced by the pandoc on your
system, then you can just have your python script shell out
to 'pandoc --version' and get the version this way.

@tomduck
Copy link

tomduck commented Jan 11, 2016

On Jan 10, 2016, at 7:51 PM, John MacFarlane notifications@github.com wrote:

+++ Thomas J. Duck [Jan 10 16 13:55 ]:

Thanks, [1]@jgm. My filter is written in python, so I don't think that
I have access to Text.Pandoc.pandocVersion.

If you're consuming json produced by the pandoc on your
system, then you can just have your python script shell out
to 'pandoc --version' and get the version this way.

This might not work if one has multiple pandoc versions on the same machine. For example, I have /usr/local/bin/pandoc-1.5.2, /usr/local/bin/pandoc-1.6-1 and more, all for compatibility testing. Passing version information along in the JSON would be more reliable.

@mb21
Copy link
Collaborator Author

mb21 commented Feb 17, 2016

@jgm can this be merged or is this waiting for #2640?

@jgm
Copy link
Owner

jgm commented Feb 17, 2016

Not sure what is best. I haven't had much time to
review PRs lately, sadly.

+++ Mauro Bieg [Feb 17 16 03:57 ]:

[1]@jgm can this be merged or is this waiting for [2]#2640?


Reply to this email directly or [3]view it on GitHub.

References

  1. https://github.com/jgm
  2. Include pandoc version in json abstract syntax tree #2640
  3. LaTeX writer: figure label #2637 (comment)

@jgm
Copy link
Owner

jgm commented Mar 19, 2016

@tomduck is this really a problem? Can't pandoc-fignos simply change the attribute identifier to "" after it injects the label? And then, even with pandoc 1.17 (assuming this is merged), you won't get an extra label. mb21's code only has an effect (as far as I can see) if the attribute identifier is non-null.

jgm added a commit that referenced this pull request Mar 19, 2016
@jgm jgm merged commit 3af753d into jgm:master Mar 19, 2016
@mb21 mb21 deleted the latex-figure-label branch March 19, 2016 22:47
@tomduck
Copy link

tomduck commented Mar 20, 2016

@jgm Yes, I could do that. But I think it would be better if filters let pandoc do the processing wherever possible.

In this case pandoc-fignos provides functionality that I expect pandoc is going to gradually replace. It turns out this replacement is not happening all at once — see mb21’s patch. If there was a way to detect new behaviours (e.g., by retrieving version information) then pandoc-fignos could stay out of the way where appropriate.

I could use your trick of calling pandoc and asking for the pandoc version, but it seems to me this would be rather fragile. It would likely break for any pandoc fork. Having some mechanism to pass version information along solves this problem.

If it can’t be done, no biggie. But I think that having version information available in the json representation would be an asset to filter writers.

On Mar 19, 2016, at 5:51 PM, John MacFarlane notifications@github.com wrote:

@tomduck is this really a problem? Can't pandoc-fignos simply change the attribute identifier to "" after it injects the label? And then, even with pandoc 1.17 (assuming this is merged), you won't get an extra label. mb21's code only has an effect (as far as I can see) if the attribute identifier is non-null.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

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.

3 participants