linebender / linebender/norad

Plist serialization: option to indent first dict element, expand empty elements

Open
#179 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
61
Forks
16
PR merge metrics
No merged PRs in 30d

Description

A rather annoying feature of ufonormalizer is that it

  1. indents the first dict element in a plist, compared to what Apple writes out by default, though it is more consistent when viewed from an XML lens, and
  2. expands empty elements.

Apple serializers, plist and Python's plistlib will write by default:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>lib</key>
	<dict>
		<key>org.unifiedfontobject.normalizer.imageReferences</key>
		<dict/>
	</dict>
</dict>
</plist>

but ufonormalizer will write:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>lib</key>
		<dict>
			<key>org.unifiedfontobject.normalizer.imageReferences</key>
			<dict>
			</dict>
		</dict>
	</dict>
</plist>

Note the <dict></dict> which ufonormalizer will write instead of just <dict/>.

Both are things that should maybe be writer options in plist, but I'm not sure if the author is open to this? We are, after all, doing semantically unnecessary things...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating ufonormalizer's plist serialization path and compare its output with Apple's serializers and Python's plistlib, as shown in the issue. Determine how writer options could control first-dictionary indentation and empty-element expansion; done means the requested output differences are configurable and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.