citation-style-language / csl-editor

cslEditorLib - A HTML 5 library for searching and editing CSL styles
http://editor.citationstyles.org
MIT License
187 stars 34 forks source link

Saving styles where the label contains diacritics (Umlaute) #174

Closed zuphilip closed 8 years ago

zuphilip commented 10 years ago

Every time I save a style where the label contains diacritics (Umlaute in my case) a prompt will show up asking me to change the id. I am following the rules of the style requirements and it would be nice if point 2 (diacritics) could be implemented in the csl-editor accordingly.

Moreover, the "language should also be mentioned in the style title, unless the language is English" see point 7. But the language information will not be part of the id. For example I have here a style with the name "Zeitschrift für Theologie und Kirche (German)" and id http://www.zotero.org/styles/zeitschrift-fur-theologie-und-kirche.

zuphilip commented 9 years ago

This seems a good starting point to look for such replacements: https://github.com/citation-style-language/utilities/blob/master/generate_dependent_styles/generate_styles_from_data.rb#L205 --> https://github.com/citation-style-language/journals/blob/master/generate_styles.rb#L12

zuphilip commented 8 years ago

The code in the csl-editor is here: https://github.com/citation-style-language/csl-editor/blob/0ac45c9ebe97ab1f475f8e537ed7a6d12dfb8b1a/src/cslStyles.js#L73 :

            .replace(/[àáäâ]|ã|á|à /g, "a")
            .replace(/[èéëê]|é|è/g, "e")
            .replace(/[ìíïî]/g, "i")
            .replace(/[òóöô]/g, "o")
            .replace(/[ùúüû]/g, "u")

Actually, the Umlauts should already been replaced with the base form of the character. This works for French accent and I don't understand why it does not already work for the German Umlauts. Any ideas? CC @adam3smith @jmiba

The second thing, to delete the content of the (last) bracket, could be implemented in the csl-editor as well and this should be easy to do.

rmzelle commented 8 years ago

@zuphilip, you could verify that you're typing the same umlaut character as in the replacement list (e.g. http://unicodelookup.com/#ü/1).

zuphilip commented 8 years ago

It may just be an encoding problem of this file. Everybody can try this out: 1) Go to https://github.com/citation-style-language/csl-editor/blob/master/src/cslStyles.js 2) Click on edit, but don't change anything 3) Preview the changes

Spoiler: That is the result:

csl-editor-encoding

(I try to prepare a PR to fix this.)

adam3smith commented 8 years ago

Fixed in https://github.com/citation-style-language/csl-editor/issues/195

zuphilip commented 8 years ago

Great! Thank you!