Package: talqual
talqualTALChameleonstatic site generator.Simple structure: templates + data -> output htmlInstallationInstall from PyPI:pip install talqualDevelopingInstall requirement and launch tests:pip install -r requirements-dev.txt
pytest testsSeleniumLaunch tests with driver option:pytest tests --driver firefoxMaybe you get the error:selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.Then you need to download the latestgeckodriverrelease fromhttps://github.com/mozilla/geckodriver/releases(such asgeckodriver-v0.28.0-linux64.tar.gz) and extract it to the correspongind directory (such as/usr/local/bin/).Usagetalqualtemplates_dirtalqualtemplates_diroutput_html–datadata_dirpython -m talqualtemplates_diroutput_html–datadata_diror from code:from talqual.main import build
build(templates_dir, html_dir, data_dir)FeaturesTemplate elements: Folder, File, TalTemplate/Html, NoView, TalCommand
Data elements: Python objects, Folder, yaml, json, rstDefine adatadirectory. Will be converted to dictionary structure:SubfoldersYaml filesJson filesReestructuredText files (only variables)Define atemplatesdirectoryA folder in thetemplatesis created to thehtmldirectoryA file (pdf, image, css, js, etc.) in thetemplatesis copied to thehtmldirectoryA no view element (file or directory starting by_) in thetemplatesis not created to thehtmldirectoryA TAL template in thetemplatesgets rendered to thehtmldirectoryIt can reference data from thedatadirectory or from python objectsIt can be:a static .html or .htm (with no templating)a simple template .html .htm or .pt (with TAL templating, seeTALsyntax)a template with macros .html .htm or .pt (with TAL and METAL templating, seeMETALsyntax)A TAL Command gets executed and rendered  to thehtmldirectorya template with NAME.tal_repeat_VARIABLE.pt gets repeated bydata[VARIABLE](it must be an iterable such as[ITEM0, ITEM1, ITEM2, …]). Results inNAME.0.html,NAME.1.html,NAME.2.html, etc.a template withtal.tal_repeat_VARIABLE.pt results inITEM0.html,ITEM1.html,ITEM2.html, etc.inside each TAL template the expression${tal_repeat_VARIABLE}can be used. Contains the current index${tal_repeat_VARIABLE.num}andITEM${tal_repeat_VARIABLE.item}.a template with NAME.tal_batch_VARIABLE_PAGESIZE.pt gets rendered by a Batch of PAGESIZE fordata[VARIABLE](it must be an iterable). Results inNAME.html,NAME.2.html,NAME.3.html, etc.a template with NAME.tal_replace_talqual_scripts.js gets rendered to a javascript file NAME.js with the faceted module.a template with NAME.tal_replace_DATA:VARIABLE.js gets rendered to the contents of file indata[DATA][VARIABLE].VARIABLE can be generally expressed asVAR1:VAR2:VAR3meaningdata[VAR1][VAR2][VAR3]Inside TAL templates, there is the expressionurl:for computing links relatively to the root. For example:href=”${url: static/a.png}”HTML internal links integrity is checked. In case of broken links, a warning is shown when building.ExtraA template can include the faceted javascript module. See theportfolioexample.A template can include the calendar javascript module. See theportfolioexample.Translation (i18n)See thei18nexample.Install:You need topip install babel-lingua-chameleonorpip install talqual[multilingual]Usage:talqualtemplates_dir(by default locales attemplates_dir/_locales)talqualtemplates_diroutput_html–datadata_dir–localeslocales_dirFeatures:Define a folder in thetemplatesnamedtal_.tal_repeat_LOCALESDefine templates .html .htm or .pt with TAL templating that includes i18n, seeTALi18nsyntax.Define insidedataaLOCALESvariable listing the enabled localizations (l10n). For exemple, adata.yaml:LOCALES:
- ca
- en
- ocDefine thelocales_dir. Recommended withBabel command-line interfaceFirst time:Define thebabel.cfgto extract from TAL templates:[python: **.py]
[lingua-chameleon: **.html]
[lingua-chameleon: **.htm]
[lingua-chameleon: **.pt]mkdir localespybabel extract -F babel.cfg -o locales/mydomain.pot .pybabel init -D mydomain -i locales/mydomain.pot -d locales -l ca(init all languages)pybabel compile -D mydomain -d localesUpdates:pybabel extract -F babel.cfg -o locales/mydomain.pot .pybabel update -D mydomain -i locales/mydomain.pot -d localespybabel compile -D mydomain -d localesLicensetalqualis offered under the GPLv3 license.This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.CHANGES0.0.4 (2023-4-16)Fix parsing empty folders0.0.3 (2023-4-15)Add data structure: template structure + data structure = output htmlAdd TAL templating i18n featuresAdd context variabletal_repeatwhen repeating commandsAdd url: expression for TAL templatesManage static Files with hard links.0.0.2 (2020-4-7)Add faceted select featuresAdd faceted+batch combination0.0.1 (2020-2-2)Initial release.Template structure + yaml data file = output html structure