getpelican / pelican-plugins

Collection of plugins for the Pelican static site generator
Other
1.39k stars 856 forks source link

[org_python_reader] TRANSLATION property is not respected #1382

Open szebenyib opened 1 year ago

szebenyib commented 1 year ago

If one creates a translated post (no i18n_subsites or other spec plugins) then it should respect the TRANSLATION property and not create two separate posts.

Stepst to reproduce: Have this in your pelicanconf.py:

PLUGINS = ['org_python_reader']
ORGMODE = {
    'code_highlight': True
}

Have these two posts, test_en.org:

#+TITLE: TitleEn
#+DATE: 2023-01-27
#+CATEGORY: CategoryEn
#+AUTHOR: AuthorEn
#+PROPERTY: LANGUAGE en
#+PROPERTY: SUMMARY English summary
#+PROPERTY: SLUG slug1
#+PROPERTY: MODIFIED [2023-01-27 p]
#+PROPERTY: TAGS tag1en, tag2en
#+PROPERTY: KEYWORDS kw1en, kw2en

English content
#+TITLE: TitleHu
#+DATE: 2023-01-27
#+CATEGORY: CategoryHu
#+AUTHOR: AuthorHu
#+PROPERTY: LANGUAGE hu
#+PROPERTY: SUMMARY Hungarian summary
#+PROPERTY: SLUG slug1
#+PROPERTY: MODIFIED [2023-01-27 p]
#+PROPERTY: TAGS tag1hu, tag2hu
#+PROPERTY: KEYWORDS kw1hu, kw2hu
#+PROPERTY: TRANSLATION true

HU content

Observe that the generation does create two separate posts.

Now if one were to use in pelicanconf.py this instead of the above (so another solution to convert org into posts):

PLUGINS = ['org_reader']
ORG_READER_EMACS_LOCATION = '/usr/bin/emacs'

Then the two org files produce a translated post nicely.