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

Fixed #1264 #1581

Merged
merged 4 commits into from
Jul 15, 2016
Merged

Fixed #1264 #1581

merged 4 commits into from
Jul 15, 2016

Conversation

oscargus
Copy link
Contributor

@oscargus oscargus commented Jul 13, 2016

I finally got around to understand the reasons for #1264 (and parts of #1464). It turned out that commands starting with c was handled in a special way and that {\v{S}} was for unknown reasons used as "line tabulation set".

As a result, not only does JabRef now render \v{S} and \chi correctly, it also renders combining accents, see screen shot.
capture4

  • Change in CHANGELOG.md described
  • Screenshots added (for bigger UI changes)

@oscargus oscargus added bug Confirmed bugs or reports that are very likely to be bugs type: enhancement status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Jul 13, 2016
for (Character character : chars) {
result = result.replace(character.toString(),
HTMLUnicodeConversionMaps.UNICODE_LATEX_CONVERSION_MAP.get(character));
Set<String> strings = HTMLUnicodeConversionMaps.UNICODE_LATEX_CONVERSION_MAP.keySet();
Copy link
Member

Choose a reason for hiding this comment

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

Please find a more speaking variable name as "strings" here and below in the loop
e.g unicode_strings or whatever..

@stefan-kolb
Copy link
Member

@oscargus Do the tests from #1464 pass in your branch?

@oscargus
Copy link
Contributor Author

@stefan-kolb as it was only \chi that was failing, I would expect that, yes. The other two did already work. (Right?)

@stefan-kolb
Copy link
Member

@oscargus It was only the \chi, yes because \c is handled as special character. If my test from the PR pass we can merge my test PR into your branch and then merge your fix 😄

@tobiasdiez
Copy link
Member

In general, I would like tests for this PR.

@stefan-kolb
Copy link
Member

My PR #1464 includes tests for the bug.

@oscargus
Copy link
Contributor Author

@stefan-kolb There is a \chi first at the second row of the screen shot. Turned out all commands starting with c didn't work as c was hardcoded into Globals as an accent, so \chi was interpreted similar to if it had said {\c{h}}i and since \c{h} wasn't listed it was simply removed. Now \c{h} works as well, giving ḩ .

@tobiasdiez: I was considering that. However, the main feature is adding support for accented unicode characters and they are a hassle to type properly... Nor will they make much sense except lots of comments. For example, spot the difference between ä and ä...

@oscargus oscargus force-pushed the latextounicodefix branch from 2a4a045 to 4addbcf Compare July 13, 2016 21:56
@stefan-kolb
Copy link
Member

@oscargus Can you just cherry-pick my commit from the PR and you have your first test 😄
And then just close my PR afterwards 👍

@oscargus
Copy link
Contributor Author

I added some tests now.

@stefan-kolb I'm afraid that is a bit out of my comfort/knowledge zone... My solution would be to almost simultaneously merge both PRs. :-)

@stefan-kolb
Copy link
Member

@oscargus Then just copy my tests and close the PR 😄

@oscargus
Copy link
Contributor Author

@stefan-kolb That should be within grasp. :-)

@@ -54,7 +54,7 @@



public static final String SPECIAL_COMMAND_CHARS = "\"`^~'c=";
public static final String SPECIAL_COMMAND_CHARS = "\"`^~'=.|"; // "\"`^~'c="
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment describing this string?

@simonharrer
Copy link
Contributor

LGTM thanks for the quick solution! :)

@stefan-kolb
Copy link
Member

LGTM 👍

@@ -31,6 +31,7 @@
public class LatexToUnicodeFormatter implements LayoutFormatter, Formatter {

private static final Map<String, String> CHARS = HTMLUnicodeConversionMaps.LATEX_UNICODE_CONVERSION_MAP;
private static final Map<String, String> ACCENTS = HTMLUnicodeConversionMaps.UNICODE_ESCAPED_ACCENTS;
Copy link
Member

Choose a reason for hiding this comment

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

@JabRef/developers Does java copies here the whole map or just point to the original one? If the map is copied, then one should inline CHARS and ACCENTS

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't matter, as this is a kind of constant which gets replaced by the containing value on compile time, directly in the byte code.
In general, java is by value, it copies just the object reference (pointer).
http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value

@tobiasdiez
Copy link
Member

LGTM 👍 just some minor remarks about naming variables and tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants