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

felixfontein commented Jan 18, 2015

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

Kwpolska commented Jan 18, 2015

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())):

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Jan 18, 2015

Member
    for k in natsort.natsorted(list(data.keys()), alg=natsort.ns.F | natsort.ns.IC):
@felixfontein
Copy link
Contributor Author

felixfontein commented Jan 18, 2015

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

felixfontein commented Jan 18, 2015

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
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/appveyor Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci The Travis CI build passed
Details
@Kwpolska Kwpolska deleted the fix-meta-order branch Jan 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.