koppor / jabref

Collection of simple for JabRef issues. Please submit PRs to https://github.com/jabRef/jabref/.
https://github.com/jabRef/jabref/
MIT License
8 stars 13 forks source link

Unified LaTeX to NNN-converter #145

Open oscargus opened 8 years ago

oscargus commented 8 years ago

(Previously #1198)

Refs #201 (final bullet):

One may write a single LaTeX to {HTML, Unicode, OOPreFormatter, XML, RTF}-converter, but it requires a bit of thinking. Still, quite a bit of the code is very similar (to the extent that code duplication tools detects it).

Rough approach:

The generic method needs a Map<String, String>, which contain mappings for the LaTeX symbols, see https://github.com/JabRef/jabref/blob/master/src/main/java/net/sf/jabref/logic/util/strings/RtfCharMap.java for an example (the HTML and Unicode ones are larger and automatically generated from https://github.com/JabRef/jabref/blob/master/src/main/java/net/sf/jabref/logic/util/strings/HTMLUnicodeConversionMaps.java ) These maps are readily available, except for XML where the format of the first string must be modified a bit (similar to the generation of the HTML and Unicode maps).

Also, a method returning formatting commands, see getHTMLTag in https://github.com/JabRef/jabref/blob/master/src/main/java/net/sf/jabref/logic/layout/format/HTMLChars.java must be provided. Ideally, there should be a getFormattingStart method and a getFormattingEnd method to make it generic.

koppor commented 7 years ago

Refs https://github.com/JabRef/jabref/pull/1215

We are now using latex2unicode as library. Maybe, that library can be extended for a generic conversion?