feat(indesign-export): platform + post types settings, en-dash fix#463
Open
miguelpeixe wants to merge 6 commits into
Open
feat(indesign-export): platform + post types settings, en-dash fix#463miguelpeixe wants to merge 6 commits into
miguelpeixe wants to merge 6 commits into
Conversation
Closed
6 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new configuration and fixes for the Newspack InDesign Tagged Text export, integrating platform header selection and exportable post type selection into the Newspack Settings “Print” tab, and correcting dash conversion behavior.
Changes:
- Added site-level settings for InDesign export header platform (
auto/mac/win) and which post types expose export actions. - Fixed en-dash conversion so
–maps to<0x2013>(and em-dash remains<0x2014>). - Added/expanded PHPUnit coverage for platform resolution, post type settings, and Print settings REST API behavior.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/newspack-plugin/tests/unit-tests/indesign-exporter/indesign-exporter.php | Adds unit tests for platform headers, dash conversion, and post type settings logic. |
| plugins/newspack-plugin/tests/unit-tests/indesign-exporter/class-test-print-section.php | New unit tests for Print settings REST read/update behavior and validation. |
| plugins/newspack-plugin/src/wizards/newspack/views/settings/types.d.ts | Extends Print settings TS types to include InDesign platform and post type options. |
| plugins/newspack-plugin/src/wizards/newspack/views/settings/print/index.tsx | Adds UI controls for “Header platform” and “Available post types” under Print settings. |
| plugins/newspack-plugin/includes/wizards/newspack/class-print-section.php | Extends Print settings REST endpoints to read/write the new InDesign settings. |
| plugins/newspack-plugin/includes/optional-modules/indesign-export/class-indesign-converter.php | Selects <ASCII-MAC> vs <ASCII-WIN> header based on option; fixes en-dash mapping. |
| plugins/newspack-plugin/includes/optional-modules/class-indesign-exporter.php | Implements platform resolution (including UA sniffing), post type settings, and gating by enabled types. |
…ps://github.com/Automattic/newspack-workspace into fix/nppm-2813-indesign-export-platform-encoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Fixes two bugs in the InDesign Tagged Text export and adds two site-level settings under Newspack > Settings > Print > Adobe InDesign.
Platform mismatch on macOS. The exporter hardcoded the
<ASCII-WIN>header on every file, which caused InDesign on Mac to render the tagged-text markup literally instead of interpreting it. A new "Header platform" setting controls the header:<ASCII-MAC>/<ASCII-WIN>header.<ASCII-MAC>.<ASCII-WIN>.A
newspack_indesign_export_platformfilter is available for code-level overrides.En-dash silently converted to em-dash. Every en-dash (
–, U+2013) in post content was being rewritten to an em-dash (U+2014). Each dash now maps to its own code point.Choose which post types are exportable. A new "Available post types" setting lets admins pick which post types show the export action on their list screens. The picker lists every public post type with an admin UI (excluding attachments), so plugins that register custom post types — events, classifieds, etc. — can opt in without code. The default stays at
postto preserve current behavior. The existingnewspack_indesign_export_supported_post_typesfilter still runs after the setting and can extend or restrict the result.Closes NPPM-2813.
How to test the changes in this Pull Request:
Header platform
before – after, before — after, before -- after)..txt. With Auto-detect, the first line should be<ASCII-MAC>on macOS or<ASCII-WIN>on Windows. The body should containbefore <0x2013> afterfor the en-dash andbefore <0x2014> afterfor the em-dash and the double-hyphen.<ASCII-MAC>regardless of your OS. Repeat with Windows and confirm<ASCII-WIN>.Available post types
Other information: