From: Matteo Nastasi (mop) Date: Sat, 8 Dec 2007 16:12:09 +0000 (+0000) Subject: first commit X-Git-Tag: v0.1.3~9 X-Git-Url: https://mop.ddnsfree.com/gitweb/?p=populate.git;a=commitdiff_plain;h=b315c0ece595dde913e7c69a48a8198eeba1254d first commit --- b315c0ece595dde913e7c69a48a8198eeba1254d diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..eb31c39 --- /dev/null +++ b/README.txt @@ -0,0 +1,77 @@ + +PREAMBLE + + The program is uncomplete (but work) + The program is more a Bash exercize then a application + +GOAL + Create a template system to produce multi-format/multi-language documents from a single + content file. + As test the template system is used to produce a curriculum vitae. + +IDEA + The basic idea behind this program is the possibility to have three type of files: + - an infrastructural template (one for each format) + - a user-independent multi-language content template file + - a user-dependent multi-language content file + and combine them to produce all the output matrix [ formats X languages ] using a single file + as content description with all the languages inside. + +USAGE + - copy cv_exa_mple.data to cv__.data + - edit it to describe your curriculum + - run ./populate.sh cv__ + - at the end you will find + cv__.tex + cv___eng.tex + cv__.htm + cv___eng.htm + +SUPPORTED FILE FORMATS + Currently html and latex are supported. + +SUPPORTED LANGUAGES + populate.sh havn't limitation but the europecv module (included in the texlive-latex-extra package) + have some language limitation. + +CHAR-SET SUPPORT + UTF-8 is the only supported charset. + +FILE FORMAT + Simple tag + Definition: "#T_#" + Description: Each simple tag will be substitute by the content of T_ variable for the main + language and of T__ for the others languages; if the T__ + is not defined the program fault-back to the T_ var. + + Row block + Definition: "##T_:start## ... ##T_:stop##" + Description: Each block will be replaced by N occurences of itself with valorized tags (see below + for the policy to define N) + + Indexed row tag + Definition: (start of a block) ... "#T__X#" ... (stop of a block) + Description: Each indexed row tag is substitute with the T___1 variable in the first line, + with the T___2 variable in the second and so on. + The number of blocks row (N) is defined by the index of the variable associated with + the first indexed row tag in the alphabetical order (in the group of index row tags + of the current block). + + Simple row tag + Definition: (start of a block) ... "#T_#" ... (stop of a block) + Description: Each simple row tag is substitute with the T__ variable for each line + of the block. + + Recursive tag + Definition: ..[#T_[#T_]]#T_#[#[#]].. + Description: If a tag substitution produce a new tag this tag will be substitute with the relate var value. + Recursive tags can be found in or out blocks. + + +REQUIREMENTS + + Packages: + latex + pdflatex + texlive-latex-extra + diff --git a/cv_exa_mple.data b/cv_exa_mple.data new file mode 100644 index 0000000..55e858d --- /dev/null +++ b/cv_exa_mple.data @@ -0,0 +1,161 @@ +T_LASTNAME="qui-il-cognome" +T_LASTNAME_ENG="here-the-lastname" +T_FIRSTNAME="qui-il-nome" +T_FIRSTNAME_ENG="here-the-lastname" + +T_ADDRESS="qui l'indirizzo" +T_ADDRESS_ENG="here the address" + +T_EMAIL="qui/here l'email" + +T_NATION="qui la nazionalità" +T_NATION_ENG="here the nationality" + +T_BIRTH="qui la data di nascita" +T_BIRTH_ENG="here the birth day" + +T_GENDER="qui il sesso" +T_GENDER_ENG="here the gender" + +# "Autorizzo il trattamento dei miei dati personali ai sensi del D.lgs. 196 del 30 giugno 2003." +T_AUTHMGR="qui l'autorizzazione al trattamento dei dati personali" +T_AUTHMGR_ENG="here the authorization to treat your data" + +# --- Work Experiences --- + +# only htm +T_FUNC_CUR="qui la posizione correntemente occupata" +T_FUNC_CUR_ENG="here the current role covered" + +T_ESPROF_DATE_1="qui l'intervallo di tempo (da - a) dell'ultimo impiego" +T_ESPROF_DATE_1_ENG="here the time interval of the last job" + +T_ESPROF_FUNC_1="qui la posizione occupata nell'ultimo impiego" +T_ESPROF_FUNC_1_ENG="here the role covered in the last job" + +T_ESPROF_ROLE_1="qui la descrizione del lavoro svolto nell'ultimo impiego" +T_ESPROF_ROLE_1_ENG="here the description of the last job" + +T_ESPROF_COMP_1="qui nome e indirizzo dell'azienda dell'ultimo lavoro" +T_ESPROF_COMP_1_ENG="here name and address of the last job" + +T_ESPROF_TYCO_1="tipo di azienda dell'ultimo impiego" +T_ESPROF_TYCO_1_ENG="type of the company of the last job" + +# ------------------------ +T_ESPROF_DATE_2="qui l'intervallo di tempo (da - a) del penultimo impiego" +T_ESPROF_DATE_2_ENG="here the time interval of the penultimate job" + +T_ESPROF_FUNC_2="qui la posizione occupata nel penultimo impiego" +T_ESPROF_FUNC_2_ENG="here the role covered in the penultimate job" + +T_ESPROF_ROLE_2="qui la descrizione del lavoro svolto nel penultimo impiego" +T_ESPROF_ROLE_2_ENG="here the description of the penultimate job" + +T_ESPROF_COMP_2="qui nome e indirizzo dell'azienda del penultimo lavoro" +T_ESPROF_COMP_2_ENG="here the name and address of the penultimate job" + +T_ESPROF_TYCO_2="qui tipo di azienda del penultimo impiego" +T_ESPROF_TYCO_2_ENG="here the type of the company of the penultimate job" +# ----------------------------- +# +# ... until the first job +# +# ----------------------------- + +# +# uncompleted schools +# +T_SCHSHORT_DATE_1="qui l'intervallo di tempo (da - a) dell'ultima scuola frequentata" +T_SCHSHORT_DATE_1_ENG="here the time interval of the last school attended" + +T_SCHSHORT_MATS_1="qui le materie più importanti" +T_SCHSHORT_MATS_1_ENG="here the most significant subjects" + +T_SCHSHORT_SCHO_1="qui il nome della scuola" +T_SCHSHORT_SCHO_1_ENG="here the name of the school" + +# +# completed schools +# +T_SCHLONG_DATE_1="qui l'intervallo di tempo (da - a) dell'ultima scuola frequentata" +T_SCHLONG_DATE_1_ENG="here the time interval of the last school attended" + +T_SCHLONG_CERT_1="qualifica conseguita" +T_SCHLONG_CERT_1_ENG="grade achieved" + +T_SCHLONG_MATS_1="qui le materie più importanti" +T_SCHLONG_MATS_1_ENG="here the most significant subjects" + +T_SCHLONG_SCHO_1="qui il nome della scuola" +T_SCHLONG_SCHO_1_ENG="here the name of the school" + +T_SCHLONG_LEVL_1="qui il livello di classificazione" +T_SCHLONG_LEVL_1_ENG="here the classification level" + +# ----------------------------- +# +# ... until the first school +# +# ----------------------------- + +# ------------------------ +T_MOTHTON="qui la madrelingua" +T_MOTHTON_ENG="here the mothertongue" + +T_LANGARR_LANG_1="qui la prima lingua straniera" +T_LANGARR_LANG_1_ENG="here the first foreign language" + +# --- qui le valutazioni per la prima lingua straniera +T_LANGARR_VAL_A_1="B_TWO" +T_LANGARR_VAL_B_1="B_TWO" +T_LANGARR_VAL_C_1="B_ONE" +T_LANGARR_VAL_D_1="B_ONE" +T_LANGARR_VAL_E_1="B_ONE" +# ------------------------------- +# +# ... until the last language +# +# ------------------------------- + + +T_CAPREL="qui le capacità relazionali" +T_CAPREL_ENG="here the social compentences" + +T_CAPORG="qui le competenze organizzative" +T_CAPORG_ENG="here the organizational competences" + +T_CAPTEC="qui le competenze tecniche" +T_CAPTEC_ENG="here the technological competences" + +T_CAPINF="qui le competenze informatiche" +T_CAPINF_ENG="here the computer competences" + +T_CAPART="qui le competenze artistiche" +T_CAPART_ENG="here the artistic competences" + +T_CAPOTH="qui altre competenze" +T_CAPOTH_ENG="here other competences" + +T_LICENCE="qui le patenti di guida" + +T_LICENCE_ENG="here the licence(s)" + +T_PUBLIC_PUB_1="qui l'ultima pubblicazione" +T_PUBLIC_PUB_1_ENG="here the last publication" + +T_PUBLIC_PUB_2="qui la penultima pubblicazione" +T_PUBLIC_PUB_2_ENG="here the penultimate publication" + +# ----------------------------------- +# +# ... until the first publication +# +# ----------------------------------- + + +T_PERSINT="qui gli interessi personali" +T_PERSINT_ENG="here the personal interests" + + + diff --git a/cv_template.data b/cv_template.data new file mode 100644 index 0000000..80a9f53 --- /dev/null +++ b/cv_template.data @@ -0,0 +1,168 @@ +T_LANGUAGE="italian" +T_LANGUAGE_ENG="english" + +T_PERS_INFO_TIT="Informazioni personali" +T_PERS_INFO_TIT_ENG="Personal information" + +T_NAME_TIT="Cognome/i Nome/i" +T_NAME_TIT_ENG="Surname(s)/First name(s)" + +T_ADDRESS_TIT="Indirizzo/i" +T_ADDRESS_TIT_ENG="Address(es)" + +T_TEL_TIT="Telefono/i" +T_TEL_TIT_ENG="Telephone(s)" + +T_EMAIL_TIT="Email" + +T_NATION_TIT="Nazionalità" +T_NATION_TIT_ENG="Nazionality(-ies)" + +T_BIRTH_TIT="Data di nascita" +T_BIRTH_TIT_ENG="Date of birth" + +T_GENDER_TIT="Sesso" +T_GENDER_TIT_ENG="Gender" + + + +T_ESPROF_TIT="Esperienza professionale" +T_ESPROF_TIT_ENG="Work experience" + +T_ESPROF_DATE_TIT="Date" +T_ESPROF_DATE_TIT_ENG="Dates" + +T_ESPROF_FUNC_TIT="Funzione o posto occupato" +T_ESPROF_FUNC_TIT_ENG="Occupation or position held" + +T_ESPROF_ROLE_TIT="Principali mansioni e responsabilità" +T_ESPROF_ROLE_TIT_ENG="Main activities and responsabilites" + +T_ESPROF_COMP_TIT="Nome e indirizzo del datore di lavoro" +T_ESPROF_COMP_TIT_ENG="Name and address of employer" + +T_ESPROF_TYCO_TIT="Tipo o settore d'attività" +T_ESPROF_TYCO_TIT_ENG="Type of business or sector" + + + +T_SCHOOL_TIT="Istruzione e formazione" +T_SCHOOL_TIT_ENG="Education and training" + + + +T_SCHSHORT_DATE_TIT="Date" +T_SCHSHORT_DATE_TIT_ENG="Dates" + +T_SCHSHORT_MATS_TIT="Principali materie" +T_SCHSHORT_MATS_TIT_ENG="Principal subjects/Occupational skills covered" + +T_SCHSHORT_SCHO_TIT="Nome e tipo d'istituto" +T_SCHSHORT_SCHO_TIT_ENG="Name and type of organization providing education and training" + + + +T_SCHLONG_DATE_TIT="Date" +T_SCHLONG_DATE_TIT_ENG="Dates" + +T_SCHLONG_CERT_TIT="Certificato o diploma ottenuto" +T_SCHLONG_CERT_TIT_ENG="Title of qualification awarded" + +T_SCHLONG_MATS_TIT="Principali materie" +T_SCHLONG_MATS_TIT_ENG="Principal subjects/Occupational skills covered" + +T_SCHLONG_SCHO_TIT="Nome e tipo d'istituto" +T_SCHLONG_SCHO_TIT_ENG="Name and type of organization providing education and training" + +T_SCHLONG_LEVL_TIT="Livello nella classificazione nazionale" +T_SCHLONG_LEVL_TIT_ENG="Level in national or international classification" + + + +T_PROFESS_TIT="Capacità e competenze professionali" +T_PROFESS_TIT_ENG="Professional skills and competences" + +T_MOTHTON_TIT="Madrelingua/e" +T_MOTHTON_TIT_ENG="Mother tongue(s)" + +T_LANG_TIT="Lingua" +T_LANG_TIT_ENG="Language" + +T_LANGARR_BASE_USER="Utente base" +T_LANGARR_BASE_USER_ENG="Basic user" + +T_LANGARR_AUTO_USER="Utente autonomo" +T_LANGARR_AUTO_USER_ENG="Independent user" + +T_LANGARR_PROF_USER="Utente avanzato" +T_LANGARR_PROF_USER_ENG="Proficient user" + +T_LANGARR_A_ONE="
A1#T_BASE_USER#
AOne" +T_LANGARR_A_TWO="
A2#T_BASE_USER#
ATwo" + +T_LANGARR_B_ONE="
B1#T_AUTO_USER#
BOne" +T_LANGARR_B_TWO="
B2#T_AUTO_USER#
BTwo" + +T_LANGARR_C_ONE="
C1#T_PROF_USER#
COne" +T_LANGARR_C_TWO="
C2#T_PROF_USER#
CTwo" + + +T_LANG_NOTE="Livello del Quadro europeo comune di riferimento (QECR)" +T_LANG_NOTE_ENG="Common European Framework of Reference (CEF) level" + +T_LANG_SELFEVAL="Autovalutazione" +T_LANG_SELFEVAL_ENG="Self-assessment" + +T_LANG_EULEVEL="Livello europeo" +T_LANG_EULEVEL_ENG="European level" + +T_LANG_COMP="Comprensione" +T_LANG_COMP_ENG="Understanding" + +T_LANG_SPEAK="Parlato" +T_LANG_SPEAK_ENG="Speaking" + +T_LANG_WRI="Scritto" +T_LANG_WRI_ENG="Writing" + +T_LANG_EAR="Ascolto" +T_LANG_EAR_ENG="Listening" + +T_LANG_READ="Lettura" +T_LANG_READ_ENG="Reading" + +T_LANG_INTER="Interazione" +T_LANG_INTER_ENG="Spoken Interaction" + +T_LANG_PROD="Produzione orale" +T_LANG_PROD_ENG="Spoken Production" + +T_CAPREL_TIT="Capacità e competenze relazionali" +T_CAPREL_TIT_ENG="Social skills and competences" + +T_CAPORG_TIT="Capacità e competenze organizzative" +T_CAPORG_TIT_ENG="Organizational skills and competences" + +T_CAPTEC_TIT="Capacità e competenze tecniche" +T_CAPTEC_TIT_ENG="Technical skills and competences" + +T_CAPINF_TIT="Capacità e competenze informatiche" +T_CAPINF_TIT_ENG="Computer skills and competences" + +T_CAPART_TIT="Capacità e competenze artistiche" +T_CAPART_TIT_ENG="Artistic skills and competences" + +T_CAPOTH_TIT="Altre capacità e competenze" +T_CAPOTH_TIT_ENG="Other skills and competences" + +T_LICENCE_TIT="Patente/i" +T_LICENCE_TIT_ENG="Driving licence(s)" + +T_OTHER_INFO_TIT="Ulteriori informazioni" +T_OTHER_INFO_TIT_ENG="Additional information" + +T_PUBLIC_TIT="Pubblicazioni" +T_PUBLIC_TIT_ENG="Publications" + +T_PERSINT_TIT="Interessi personali" +T_PERSINT_TIT_ENG="Personal interests" diff --git a/cv_template.htm b/cv_template.htm new file mode 100644 index 0000000..b2ae2f9 --- /dev/null +++ b/cv_template.htm @@ -0,0 +1,356 @@ + + + + + + + + + + + +#T_LASTNAME#,#T_FIRSTNAME# - #T_FUNC_CUR# - Curriculum Vitae + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +##T_ESPROF:start## + + + + + + + +##T_ESPROF:end## + + + + +##T_SCHSHORT:start## + + + + + +##T_SCHSHORT:end## +##T_SCHLONG:start## + + + + + + +##T_SCHLONG:end## + + + + + + + + + +##T_LANGARR:start## + + +##T_LANGARR:end## + + + + + + + + + + + + + + + + +

Curriculum Vitæ
Europass
#T_PERS_INFO_TIT#
#T_NAME_TIT##T_LASTNAME# #T_FIRSTNAME#
#T_ADDRESS_TIT##T_ADDRESS#
#T_TEL_TIT##T_TEL#
#T_EMAIL_TIT##T_EMAIL#
#T_NATION_TIT##T_NATION#
#T_BIRTH_TIT##T_BIRTH#
#T_GENDER_TIT##T_GENDER#
#T_ESPROF_TIT#
#T_DATE_TIT##T_DATE_X#
#T_FUNC_TIT##T_FUNC_X#
#T_ROLE_TIT##T_ROLE_X#
#T_COMP_TIT##T_COMP_X#
#T_TYCO_TIT##T_TYCO_X#

#T_SCHOOL_TIT#
#T_DATE_TIT##T_DATE_X#
#T_MATS_TIT##T_MATS_X#
#T_SCHO_TIT##T_SCHO_X#

#T_DATE_TIT##T_DATE_X#
#T_CERT_TIT##T_CERT_X#
#T_MATS_TIT##T_MATS_X#
#T_SCHO_TIT##T_SCHO_X#
#T_LEVL_TIT##T_LEVL_X#
#T_PROFESS_TIT#
#T_MOTHTON_TIT##T_MOTHTON#
#T_LANG_TIT#
#T_LANG_SELFEVAL#
#T_LANG_EULEVEL#(*)
+ + + +
#T_LANG_COMP##T_LANG_SPEAK##T_LANG_WRI#
#T_LANG_EAR##T_LANG_READ##T_LANG_INTER##T_LANG_PROD#
+ +
#T_LANG_X# + + +#T_#T_VAL_A_X## +#T_#T_VAL_B_X## +#T_#T_VAL_C_X## +#T_#T_VAL_D_X## +#T_#T_VAL_E_X## + + +
+ +
(*)#T_LANG_NOTE#
#T_CAPREL_TIT##T_CAPREL#
#T_CAPORG_TIT##T_CAPORG#
#T_CAPTEC_TIT##T_CAPTEC#
#T_CAPINF_TIT##T_CAPINF#
#T_CAPART_TIT##T_CAPART#
#T_CAPOTH_TIT##T_CAPOTH#
#T_LICENCE_TIT##T_LICENCE#
#T_OTHER_INFO_TIT# +#T_PUBLIC_TIT#
+##T_PUBLIC:start## +#T_PUB_X# +
+
+##T_PUBLIC:end## +#T_PERSINT_TIT#
+#T_PERSINT# + + +
+ + \ No newline at end of file diff --git a/cv_template.tex b/cv_template.tex new file mode 100644 index 0000000..10ebaf8 --- /dev/null +++ b/cv_template.tex @@ -0,0 +1,143 @@ +\documentclass[helvetica,narrow,openbib,#T_LANGUAGE#,nologo,flagCMYK]{europecv} +\usepackage[T1]{fontenc} +\usepackage[a4paper,top=1.27cm,left=1cm,right=1cm,bottom=2cm]{geometry} +\usepackage{ifpdf} +\usepackage{bibentry} +\usepackage[#T_LANGUAGE#]{babel} +\usepackage{url} + +\ifpdf + \usepackage[pdftex]{graphicx} +\else + \usepackage{graphicx} +\fi +\renewcommand{\ttdefault}{phv} % Uses Helvetica instead of fixed width font + +\ecvlastname{#T_LASTNAME#} +\ecvfirstname{#T_FIRSTNAME#} +\ecvaddress{#T_ADDRESS#} +% \ecvtelephone{#TEL_NUMBERS#} +\ecvemail{\url{#T_EMAIL#}} +\ecvnationality{#T_NATION#} +\ecvdateofbirth{#T_BIRTH#} +\ecvgender{#T_GENDER#} +%\ecvpicture[width=2cm]{mypicture} + +\def\ecv@kern{\kern2pt} + +\renewcommand*\ecvtitle{\tabularnewline[1pt] %& \tabularnewline[5pt] +\Large\textbf{C\ecv@kern u\ecv@kern r\ecv@kern r\ecv@kern +i\ecv@kern c\ecv@kern u\ecv@kern l\ecv@kern u\ecv@kern m \ecv@kern V\ecv@kern +i\ecv@kern t\ecv@kern a\ecv@kern e}\\ +\Large\textbf{E\ecv@kern u\ecv@kern +r\ecv@kern o\ecv@kern p\ecv@kern a\ecv@kern s\ecv@kern s}\tabularnewline[1pt]} + + +\begin{document} +\selectlanguage{#T_LANGUAGE#} + +\ecvfootnote{#T_AUTHMGR#} +%\ecvfootnote{Per ulteriori informazioni: \url{http://europass.cedefop.eu.int}\\ +%\textcopyright~European Communities, 2003.} + +\begin{europecv} + + +\ecvpersonalinfo[20pt] + +% \ecvitem{\large\textbf{Impiego ricercato/ Settore di competenza}}{\large\textbf{Facoltativo}} + +\ecvsection{#T_ESPROF_TIT#} + +%\ecvitem{Date}{} +%\ecvitem{Funzione o posto occupato}{} +%\ecvitem{Principali mansioni e responsabilit\`a}{} +%\ecvitem{Nome e indirizzo del datore di lavoro}{} +%\ecvitem{Tipo o settore d'attivit\`a}{} + +##T_ESPROF:start## +\ecvitem{#T_DATE_TIT#}{#T_DATE_X#} +\ecvitem{#T_FUNC_TIT#}{#T_FUNC_X#} +\ecvitem{#T_ROLE_TIT#}{#T_ROLE_X#} +\ecvitem{#T_COMP_TIT#}{#T_COMP_X#} +\ecvitem{#T_TYCO_TIT#}{#T_TYCO_X#} +\\ +##T_ESPROF:end## + +\ecvsection{#T_SCHOOL_TIT#} + +%\ecvitem{Date}{Iniziare con le informazioni pi\'u recenti ed elencare separatamente ciascun corso frequentato con successo. Facoltativo.} +%\ecvitem{Certificato o diploma ottenuto}{\ldots} +%\ecvitem{Principali materie/Competenze professionali apprese}{\ldots} +%\ecvitem{Nome e tipo d'istituto di istruzione o formazione}{\ldots} +%\ecvitem{Livello nella classificazione nazionale o internazionale\footnote{Se pertinente.}}{\ldots} + + +##T_SCHSHORT:start## +\ecvitem{#T_DATE_TIT#}{#T_DATE_X#} +\ecvitem{#T_MATS_TIT#}{#T_MATS_X#} +\ecvitem{#T_SCHO_TIT#}{#T_SCHO_X#} +\\ +##T_SCHSHORT:end## +##T_SCHLONG:start## +\ecvitem{#T_DATE_TIT#}{#T_DATE_X#} +\ecvitem{#T_CERT_TIT#}{#T_CERT_X#} +\ecvitem{#T_MATS_TIT#}{#T_MATS_X#} +\ecvitem{#T_SCHO_TIT#}{#T_SCHO_X#} +\ecvitem{#T_LEVL_TIT#}{#T_LEVL_X#} +##T_SCHLONG:end## + + + +\ecvsection{#T_PROFESS_TIT#} + +\ecvmothertongue[5pt]{#T_MOTHTON#} +\ecvitem{\large #T_LANG_TIT#}{} +\ecvlanguageheader{(*)} +##T_LANGARR:start## +% \ecvlanguage{#T_LANG_X#}{\ecvBTwo}{\ecvBTwo}{\ecvBOne}{\ecvBOne}{\ecvBOne} +\ecvlanguage{#T_LANG_X#}{\ecv#T_#T_VAL_A_X##}{\ecv#T_#T_VAL_B_X##}{\ecv#T_#T_VAL_C_X##}{\ecv#T_#T_VAL_D_X##}{\ecv#T_#T_VAL_E_X##} +##T_LANGARR:end## +\ecvlanguagefooter[10pt]{(*)} + +\ecvitem[10pt]{\large #T_CAPREL_TIT#}{#T_CAPREL#} +\ecvitem[10pt]{\large #T_CAPORG_TIT#}{#T_CAPORG#} +\ecvitem[10pt]{\large #T_CAPTEC_TIT#}{#T_CAPTEC#} + +\ecvitem[10pt]{\large #T_CAPINF_TIT#}{#T_CAPINF#} +\ecvitem[10pt]{\large #T_CAPART_TIT#}{#T_CAPART#} +\ecvitem[10pt]{\large #T_CAPOTH_TIT#}{#T_CAPOTH#} +\ecvitem{\large #T_LICENCE_TIT#}{#T_LICENCE#} + +% per evitare l'orfano +\ecvitem[10pt]{ } + + + +\ecvsection{#T_OTHER_INFO_TIT#} +% \bibliographystyle{plain} +% \nobibliography{cv_matteo_nastasi} +\ecvitem{}{\textbf{#T_PUBLIC_TIT#}} +##T_PUBLIC:start## +\ecvitem[10pt]{}{#T_PUB_X#} +##T_PUBLIC:end## + +%\ecvitem{}{\bibentry{pgsql} + +%Avente come argomento la soluzione del problema della sovrapposizione di intervalli attraverso trigger functions.} +%\ecvitem[10pt]{}{\bibentry{virtual} +% +%} +%\ecvitem[10pt]{}{\bibentry{segre} +% +%} +%\ecvitem[10pt]{}{\bibentry{brisk} +% +%} +\ecvitem{}{\textbf{#T_PERSINT_TIT#}} +\ecvitem{}{#T_PERSINT#} + +% \ecvsection{Allegati} +% \ecvitem{}{Enumerare gli allegati al CV.} +\end{europecv} +\end{document} diff --git a/populate.sh b/populate.sh new file mode 100755 index 0000000..2010bd7 --- /dev/null +++ b/populate.sh @@ -0,0 +1,411 @@ +#!/bin/bash +# set -x + +# +# populate.sh +# +# Copyright (C) 2007 nastasi@alternativeoutput.it +# +# 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 2 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 +# MERCHANTABLILITY 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, write to the Free Software Foundation, Inc, 59 Temple Place - +# Suite 330, Boston, MA 02111-1307, USA. +# + +# +# Description of tag behaviors +# ---------------------------- +# +# | | +# Template Tag | Assoc. Var | Description +# ------------------------+----------------------------+------------------- +# #T_# | $T_ | simple tag +# ##T_:start## | $B_ | block tag begin +# . . . . . | | +# #T_# | $T__ | tag inside a block +# #T__X# | $T___<#> | indexed tag inside a block +# | | (the first in the alphab. order must +# | | exists to enable the entire block) +# . . . . . | | +# ##T_:stop## | | block tag finish +# + +# TODO +# +# Aggiungere la filtratura per tipo di output +# +# loop formati +#+ loop lingue +#+ loop for recursion (general) +#+ get blocchi dal template +#+ sost TAG nei blocchi con le VAR +#+ loop for recursion (for each row of each block) +#+ per ogni set di var per quel blocco (flat o con indice) +#+ fino a quando la prima con indice non e' stringa vuota +#+ fine loop for recursion (for each row of each block) +#+ sostituire i TAG nel template con i blocchi +#+ sostituire i TAG nel template con le VAR +# +#+ produrre il file in output +#+ fine loop for recursion (general) +#+ fine loop lingue +# fine loop formati +# +# + +# GLOBAL VARS +# debug=1 +debug="" +verbose="" +NEWLI="#aCaPo#" + +TMPFILE="/tmp/populate1_$$.tmp" +TMP2FILE="/tmp/populate2_$$.tmp" +TMP3FILE="/tmp/populate3_$$.tmp" +TMP4FILE="/tmp/populate4_$$.tmp" + + +# +# FUNCTIONS +# +function usage() { + echo "Usage: $1 [-v] [-d] [-h] data-file" + echo " -v Verbose enable." + echo " -d Debug enable." + echo " -h This help." + exit 0 +} + +function vars_get() { + # echo "vars_get start" + sed -n 's/\(#T_[A-Z_]\+#\)/\n\1\n/gp' | grep '^#T_' | sort | uniq | sed 's/#\(T_[A-Z_]\+\)#/\1/g' + # echo "vars_get stop" + return 0 +} + +function unsedify() { + + ( + if [ $# -eq 1 ]; then + echo "$1" + else + cat + fi + ) | sed 's/\(["\\\/\$]\)/\\\1/g' + + return 0 +} + +function formatify() { + ( + if [ $# -eq 2 ]; then + echo "$2" + else + cat + fi + ) | ( + if [ "$1" = "tex" ]; then + sed 's/à/\\`a/g;s/è/\\`e/g;s/ì/\\`i/g;s/ò/\\`o/g;s/ù/\\`u/g;s/áéíóú/\\'"'"'a/g; +s/é/\\'"'"'e/g;s/í/\\'"'"'i/g;s/ó/\\'"'"'o/g;s/ú/\\'"'"'u/g;s/°/\$\^\\circ\$/g; +s//\\textit{/g;s//\\textbf{/g;s/<\/[ib]>/}/g;s//URL: \\textit\{/g;s/<\/url>/\}/g; +s/‟/``/g;s/”/'"''"'/g;s///g;s/<\/lang:tex>//g;s/]*>.*<\/lang:[^>]*>//g' + elif [ "$1" = "htm" ]; then + sed "s/${NEWLI}${NEWLI}/
${NEWLI}/g;"'s/\([^<]*\)<\/url>/\1<\/a>/g; +s///g;s/<\/lang:htm>//g;s/]*>.*<\/lang:[^>]*>//g' + fi + ) + + +} + +function debecho() { + if [ -z $debug ]; then + return 0 + fi + echo "debug "$* + return 0 +} + +function populator() { + local tmplname lng frmt + + tmplname="$1" + contname="$2" + lng="$3" + frmt="$4" + + tmplname="${tmplname}.${frmt}" + if [ $lng ]; then + lngsfx="_`echo "$lng" | tr '[:lower:]' '[:upper:]'`" + filesfx="_$lng" + else + lngsfx="" + filesfx="" + fi + + oldifs="$IFS" + IFS=" +" + anotherloop=0 + + # + # Recursion loop, resolve TAG created with a tag substitution, on the entire document. + # + while [ $anotherloop -eq 0 ]; do + debecho "ANOTHERLOOP" + # + # GET BLOCKS + # + + # add normal tag before each block, output to TMPFILE + cat $tmplname | sed 's/^\(##\(T_[A-Z_0-9]\+\):start##\)$/#\2#\n\1/g' > $TMPFILE + + # get all blocks from the template, output to TMP2FILE + cat $TMPFILE | sed -n '/##T_[A-Z_0-9]\+:start##/,/##T_[A-Z_0-9]\+:end##/p' > $TMP2FILE + + # remove blocks from the template, output to TMP3FILE + cat $TMPFILE | sed '/##T_[A-Z_0-9]\+:start##/,/##T_[A-Z_0-9]\+:end##/d' > $TMP3FILE + + # get line number of the start of all blocks + blist="`cat $TMP2FILE | grep -n '^##T_[A-Z_0-9]\+:start##$' | cut -d : -f 1`" + + # for each line number ... + for i in `echo "$blist"`; do + # extracts the current block + block_cur="`cat $TMP2FILE | sed -n $i',/##T_[A-Z_0-9]\+:end##/p'`" + + # extracts the name of the block variable + block_var="`echo "$block_cur" | sed -n "1,1p" | sed 's/^\(##T\(_[A-Z_0-9]\+\):start##\)$/B\2/g'`" + # remove first and last line (block delimiters) and double '\' char, substitute \n with $NEWLI + block_val="`echo "$block_cur" | sed '1d;$d;s/\\\\/\\\\\\\\/g' | sed "s/\$/$NEWLI\\\\\\/g"`" + + # assign the value to the var + read $block_var <<< "$block_val" + + debecho "vv------------------------------" + debecho "BLOCK_VAR: $block_var" + debecho "BLOCK_VAL: ${!block_var}" + debecho "^^------------------------------" + done + + # + # SUBSTITUTE TAG INSIDE EACH BLOCK + # + if [ $debug ]; then + echo "debug blocks: ${!B_*}" + fi + for i in ${!B_*}; do + blk_var="`echo "$i" | sed 's/^B_/T_/g'`" + debecho "Tag_var: $tag_var" + blk_val="" + outindex=1 + for idx in `seq 1 100`; do + debecho "ISFIRST YES" + isfirst="YES" + + blk_src="${!i}" + # + # Recursion loop, resolve TAG created with a tag substitution, for each row of each block. + # + blk_anotherloop=0 + while [ $blk_anotherloop -eq 0 ]; do + debecho "BLK_ANOTHERLOOP $i $idx" + sedargs="" + tlist="`echo "$blk_src" | vars_get`" + debecho "TILIST $tlist" + + for e in $tlist; do + debecho "LOO1" + + tag_var="`echo "$i $e" | sed 's/^B_\([A-Z_]\+\) T_\([A-Z_]\+\)/T_\1_\2/g'`" + echo "$tag_var" | grep -q '_X$' + if [ $? -eq 0 ]; then + # fault back to original language if not defined + for ll in $lngsfx ""; do + tag_ele="`echo "$tag_var" | sed 's/X$//g'`${idx}${ll}" + debecho "tag_ele: $tag_ele" + debecho " BRA3" + declare -p $tag_ele >/dev/null 2>&1 + if [ $? -eq 0 ]; then + break + else + if [ "$isfirst" = "YES" -a -z "$ll" ]; then + outindex=0 + break 4 + fi + if [ -z "$ll" ]; then + echo "WARN: undefined [$tag_ele]" + elif [ "$verbose" ]; then + tag_fback="`echo "$tag_var" | sed 's/X$//g'`${idx}" + echo "WARN: undefined [$tag_ele]; fault back to main [${!tag_fback}]" + fi + fi + if [ -z "$ll" ]; then + debecho " ISFIRST NO" + isfirst="NO" + fi + done + + else + debecho " BRA4" + # faultback to original language if not defined + for ll in $lngsfx ""; do + tag_ele="${tag_var}${ll}" + debecho " tag_ele: $tag_ele" + + declare -p $tag_ele >/dev/null 2>&1 + if [ $? -eq 0 ]; then + break + else + if [ -z "$ll" ]; then + echo "WARN: undefined [$tag_ele]" + elif [ "$verbose" ]; then + echo "WARN: undefined [$tag_ele]; fault back to main [${!tag_var}]" + fi + fi + done + fi + tag_val="`echo "${!tag_ele}" | sed "s/\$/$NEWLI/g" | tr -d '\n' | sed "s/$NEWLI\$//g" \ + | formatify $frmt`" + debecho " tag_val: $tag_val" + + # TAG replacement + tag_val="`unsedify "$tag_val"`" + sedargs="${sedargs}s/#${e}#/$tag_val/g;" + done # for e ... + debecho "----------------------------------" + debecho "$sedargs" + blk_val="${blk_val}`echo "$blk_src" | sed "$sedargs"`" + if [ $? -ne 0 ]; then + echo "$sedargs" > sedargs.txt + exit 111 + fi + + echo "$blk_val" | grep -q '#\{1,2\}T_[A-Za-z_:]\+#\{1,2\}' + if [ $? -eq 0 ]; then + # echo "$blk_val" | grep '#\{1,2\}T_[A-Za-z_:]\+#\{1,2\}' + # echo "POST BLK GREP" + # read + blk_src="$blk_val" + blk_val="" + blk_anotherloop=0 + else + blk_anotherloop=1 + fi + done # while [ $blk_another_loop .... + if [ $outindex -eq 0 ]; then + break + fi + done + + debecho "++++++++++++++++++++++++++++++++++" + debecho "BLK_VAL: $blk_val" + debecho "**********************************" + # read $blk_var <<< "$blk_val" + + # TAG replacement + blk_val="`unsedify "$blk_val" | sed "s/$NEWLI\$//g"`" + debecho "BLK_VAR: $blk_var: $blk_val" + debecho "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + cat $TMP3FILE | sed "s/#${blk_var}#/$blk_val/g" >$TMP4FILE + mv $TMP4FILE $TMP3FILE + done + + # cat, sed to avoid multitag on single line, grep of tags, sort, uniq, sed to remove '#' chars + t_vars="`cat $TMP3FILE | vars_get`" + + for tag_var in $t_vars; do + # echo "TAG_VAR: $tag_var" + for ll in $lngsfx ""; do + tag_ele="${tag_var}${ll}" + declare -p $tag_ele >/dev/null 2>&1 + if [ $? -eq 0 ]; then + break + else + if [ -z "$ll" ]; then + echo "WARN: undefined [$tag_ele]" + elif [ "$verbose" ]; then + echo "WARN: undefined [$tag_ele]; fault back to main [${!tag_var}]" + fi + fi + done + # TAG replacement + tag_val="`echo "${!tag_ele}" | sed "s/\$/$NEWLI/g" | tr -d '\n' | sed "s/$NEWLI\$//g" \ + | formatify $frmt | unsedify`" + + + cat $TMP3FILE | sed "s/#${tag_var}#/$tag_val/g" >$TMP4FILE + mv $TMP4FILE $TMP3FILE + done + + cat $TMP3FILE | grep -q '#\{1,2\}T_[A-Za-z_:]\+#\{1,2\}' + if [ $? -eq 0 ]; then + # cat $TMP3FILE | grep -q '#\{1,2\}T_[A-Za-z_:]\+#\{1,2\}' + # echo POSTGREP + # read + anotherloop=0 + cat $TMP3FILE | sed "s/$NEWLI/\n/g" > $TMP4FILE + tmplname="$TMP4FILE" + else + anotherloop=1 + fi + done # while [ $anotherloop -eq 0 ]; do + cat $TMP3FILE | sed "s/$NEWLI/\n/g" > ${contname}${filesfx}.$frmt + + rm -f $TMPFILE $TMP2FILE $TMP3FILE $TMP4FILE + + IFS="$oldifs" + + return 0 +} + +# +# MAIN +# + +# maybe parametrizable +# tmplname="temptest" +tmplname="cv_template" +while [ $# ]; do + case $1 in + -v) verbose="Y" + ;; + -d) debug="Y" + ;; + -h) usage $0 + ;; + *) break + esac + shift +done +contname="$1" + +rm -f $TMPFILE $TMP2FILE $TMP3FILE $TMP4FILE + +if [ ! -f ${contname}.data ]; then + echo "File ${contname}.data not exists" + exit 1 +fi + +# source the data file from template scope +. ${tmplname}.data + +# source the data file from user scope +. ${contname}.data + +for frmt in tex htm; do + for lng in "" eng; do + echo "Format: $frmt Lang: $lng" + populator "$tmplname" "$contname" "$lng" "$frmt" + done +done + +exit 0