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

Fixing order for other metadata. #1589

Merged
merged 2 commits into from Jan 18, 2015
Merged

Fixing order for other metadata. #1589

merged 2 commits into from Jan 18, 2015

Conversation

felixfontein
Copy link
Contributor

This PR fixes the order of metadata written via utils.write_metadata(). Currently, a 'random' order (induced by the dict used) is taken.

I'm currently working on a small tag management plugin, which needs to read and write metadata. I want to avoid that every time the tags are modified, other metadata ends up in a new random order.

@felixfontein felixfontein added this to the v7.3.1 milestone Jan 18, 2015
@Kwpolska
Copy link
Member

small tag management plugin

Are you aware of http://plugins.getnikola.com/#tags ?

@@ -1241,8 +1242,8 @@ def write_metadata(data):
pass

# Leftover metadata (user-specified/non-default).
for k, v in data.items():
meta.append(f.format(k, v))
for k in natsort.natsorted(list(data.keys())):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    for k in natsort.natsorted(list(data.keys()), alg=natsort.ns.F | natsort.ns.IC):

@felixfontein
Copy link
Contributor Author

No, I wasn't aware of that plugin. Looks like that does most of what I wanted to do :)

(I originally started writing my plugin to have something nice to get a list of all tags with number of use; I only later got the idea to add tag rename/... support. Well, no need to work that out, then.)

@felixfontein
Copy link
Contributor Author

Ok, added your suggestion. Using the additional natsorted arguments doesn't matter here too much, but it's nice to have anyway.

Kwpolska added a commit that referenced this pull request Jan 18, 2015
Fixing order for other metadata.
@Kwpolska Kwpolska merged commit 2b34513 into master Jan 18, 2015
@Kwpolska Kwpolska deleted the fix-meta-order branch January 19, 2015 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants