Repository navigation
strip newlines from PostScript DSC comment metadata - #32501
Priyank-gouda678 wants to merge 1 commit into
Conversation
|
Hello. Please review our policy on AI and fill out the AI Disclosure with the specifics of your AI use. Thank you! |
|
Updated the AI Disclosure section in the description: I used AI to write the code. |
Specifics of your AI use? |
|
I'm marking this PR as Autoclose. My impression is that both the code and PR summary is AI-generated and violates our policy on AI. If this is not the case, please let me or another maintainer know. |
|
⏰ This pull request might be automatically closed in two weeks from now. Thank you for your contribution to Matplotlib and for the effort you have put into this PR. This pull request does not yet meet the quality and clarity standards needed for an effective review. Project maintainers have limited time for code reviews, and our goal is to prioritize well-prepared contributions to keep Matplotlib maintainable. Matplotlib maintainers cannot provide one-to-one guidance on this PR. However, if you ask focused, well-researched questions, a community member may be willing to help. 💬 To increase the chance of a productive review:
As the author, you are responsible for driving this PR, which entails doing necessary background research as well as presenting its context and your thought process. If you are a new contributor, or do not know how to fulfill these requirements, we recommend that you familiarize yourself with Matplotlib's development conventions or engage with the community via our Discourse or one of our meetings before submitting code. If you substantially improve this PR within two weeks, leave a comment and a team member may remove the |
PR summary
The PostScript/EPS backend writes DSC header comments as
%%Key: valuelines inFigureCanvasPS._print_ps. TheCreatorvalue comes fromsavefig(metadata=...)andTitlefrom the output filename, and neither had CR/LF removed. A newline in such a value ends the%%comment early and leaves the remainder as its own line in the document prolog, where a PostScript interpreter (including the gs/ps2pdf distiller Matplotlib runs over its own output) treats it as code rather than a comment. The PDF and SVG backends already strip or escape the equivalent metadata; this brings PS into line by collapsing CR/LF in each DSC comment value to a space, so valid single-line values are written unchanged.Repro on current main:
Before, the header carries a bare
systemdict /showpage get execline between%%Creator:and%%CreationDate:; after, it stays on the%%Creator:line.AI Disclosure
I used AI to write the code.
PR quality check