pander icon indicating copy to clipboard operation
pander copied to clipboard

add parameter to set (pass on) the hyphenation language

Open salim-b opened this issue 8 years ago • 3 comments

Since I'm mostly writing stuff in German and the hyphenation function which pander uses under the hood already supports a bunch of languages including German, I'd like to have an option to change the current hard-coded value of 'en.us'.

The relevant code seems to be this line of helpers.R: https://github.com/Rapporter/pander/blob/32e0f75ef359225a27aba3641fbe4fa84a5dc6d5/R/helpers.R#L404

If I'm right, we just need to be able to set hyph.pattern directly in pandoc.table (and maybe other relevant pander functions, I don't know) and pass that argument on to koRpus::hyphen(). Of course, 'en.us' could still be the default.

According to the package documentation the following languages are currently supported out of the box:

  • "de" — German (new spelling, since 1996)
  • "de.old" — German (old spelling, 1901–1996)
  • "en" — English (UK)
  • "en.us" — English (US)
  • "es" — Spanish
  • "fr" — French
  • "it" — Italian
  • "ru" — Russian

So a lot of non-english speaking people would benefit of this addition 🙂 What do you think?

salim-b avatar Oct 14 '17 01:10 salim-b

Sure, we should parametrize the language for koRpus and maybe it will be useful at some other parts of pander as well (eg decimal mark defaults in the future, but let's not turn this into something complicated).

I think we should add a new field in panderOptions -- I won't be able to actively work on this in the near future, but would be happy to review and merge a related PR

daroczig avatar Oct 14 '17 22:10 daroczig

I won't be able to actively work on this in the near future, but would be happy to review and merge a related PR

Ok, I see. Actually I'd like to contribute, but haven't developed R packages before. So I'd need some time to get started (and get familiar with pander's internals). At the moment I won't have time for this either, but hopefully that might change towards the end of the year... 😬

salim-b avatar Oct 14 '17 23:10 salim-b

FTR it seems that hyphenation is being moved out of koRpus to its own package at https://cran.r-project.org/web/packages/sylly, so this maybe we should address that as well as part of this idea

daroczig avatar Oct 23 '17 10:10 daroczig