xmlresume2x 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ChangeLog +318 -0
- data/README +57 -0
- data/Rakefile +275 -0
- data/TODO +37 -0
- data/VERSION +1 -0
- data/bin/xmlresume2x +57 -0
- data/data/xmlresume2x/common/common.cfg +154 -0
- data/data/xmlresume2x/format/latex-europecv.cfg +453 -0
- data/data/xmlresume2x/format/xhtml.cfg +413 -0
- data/data/xmlresume2x/lang/de.cfg +72 -0
- data/data/xmlresume2x/lang/en.cfg +72 -0
- data/data/xmlresume2x/lang/fr.cfg +73 -0
- data/doc/src/default.css +137 -0
- data/doc/src/default.template +33 -0
- data/doc/src/download.fragment +40 -0
- data/doc/src/examples.fragment +24 -0
- data/doc/src/features.fragment +9 -0
- data/doc/src/index.fragment +29 -0
- data/doc/src/manual.fragment +135 -0
- data/doc/src/metainfo.backing +37 -0
- data/install.rb +24 -0
- data/lib/xmlresume2x/converter.rb +86 -0
- data/lib/xmlresume2x/processor.rb +135 -0
- data/lib/xmlresume2x/wrapper.rb +113 -0
- data/lib/xmlresume2x/xmlmarkup.rb +104 -0
- data/setup.rb +1331 -0
- metadata +73 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
# Configuration for the resume converter -*- ruby -*-
|
2
|
+
# Language file
|
3
|
+
|
4
|
+
keyword(
|
5
|
+
# general keywords
|
6
|
+
:Resume => 'Résumé',
|
7
|
+
:Of => 'of',
|
8
|
+
:In => 'in',
|
9
|
+
:And => 'and',
|
10
|
+
:AdditionalInformation => 'Additional Information',
|
11
|
+
:Phone => 'Phone',
|
12
|
+
:Phone_Home => 'Home Phone',
|
13
|
+
:Phone_Work => 'Work Phone',
|
14
|
+
:Phone_Mobile => 'Mobile Phone',
|
15
|
+
:Fax => 'Fax',
|
16
|
+
:Fax_Home => 'Home Fax',
|
17
|
+
:Fax_Work => 'Work Fax',
|
18
|
+
:Pager => 'Pager',
|
19
|
+
:IM_Aim => 'AIM',
|
20
|
+
:IM_Icq => 'ICQ',
|
21
|
+
:IM_Irc => 'IRC',
|
22
|
+
:IM_Jabber => 'Jabber',
|
23
|
+
:IM_Msn => 'MSN Messenger',
|
24
|
+
:IM_Yahoo => 'Yahoo! Messenger',
|
25
|
+
:Email => 'Email',
|
26
|
+
:Url => 'URL',
|
27
|
+
:Projects => 'Projects',
|
28
|
+
:Dates => 'Dates',
|
29
|
+
:LastModified => 'Last modified',
|
30
|
+
:Present => 'Present',
|
31
|
+
|
32
|
+
# for job history
|
33
|
+
:History_Title => 'Work Experience',
|
34
|
+
:History_Employer => 'Name and address of employer',
|
35
|
+
:History_Occupation => 'Occupation or position held',
|
36
|
+
:History_MainActivities => 'Main activities and responsibilities',
|
37
|
+
:History_Achievements => 'Achievements',
|
38
|
+
|
39
|
+
# for education
|
40
|
+
:Education_Title => 'Education And Training',
|
41
|
+
:Education_Organization => 'Name and type of organization providing education and training',
|
42
|
+
:Education_Level => 'Title of qualification awarded',
|
43
|
+
:Education_MajorStudies => 'Major Studies',
|
44
|
+
:Education_MinorStudies => 'Minor Studies',
|
45
|
+
:Education_Minor => 'minor',
|
46
|
+
:Education_Minors => 'minors',
|
47
|
+
:Education_Gpa => 'Grade Point Average (GPA)',
|
48
|
+
:Education_Gpa_Overall => 'Overall',
|
49
|
+
:Education_Gpa_Major => 'Major',
|
50
|
+
:Education_Gpa_Outof => 'out of',
|
51
|
+
:Education_Subjects => 'Subjects',
|
52
|
+
|
53
|
+
# for skills
|
54
|
+
:Skills_Title => 'Skills',
|
55
|
+
|
56
|
+
# for publications
|
57
|
+
:Publications_Title => 'Publications',
|
58
|
+
:Publications_In => 'in',
|
59
|
+
|
60
|
+
# for interests
|
61
|
+
:Interests_Title => 'Interests',
|
62
|
+
|
63
|
+
# for security clearances
|
64
|
+
:SecurityClearances_Title => 'Security Clearances',
|
65
|
+
|
66
|
+
# for awards
|
67
|
+
:Awards_Title => 'Awards',
|
68
|
+
|
69
|
+
# for referees
|
70
|
+
:Referees_Title => 'References'
|
71
|
+
|
72
|
+
)
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Configuration for the resume converter -*- ruby -*-
|
2
|
+
# Language file
|
3
|
+
# Thanks to Eva Langthaler for helping me with the translations
|
4
|
+
|
5
|
+
keyword(
|
6
|
+
# general keywords
|
7
|
+
:Resume => 'Curriculum Vitae',
|
8
|
+
:Of => 'de',
|
9
|
+
:In => 'en',
|
10
|
+
:And => 'et',
|
11
|
+
:AdditionalInformation => 'Informations Supplémentaires',
|
12
|
+
:Phone => 'Téléphone',
|
13
|
+
:Phone_Home => 'Téléphone privé',
|
14
|
+
:Phone_Work => 'Téléphone au travail',
|
15
|
+
:Phone_Mobile => 'Téléphone GSM',
|
16
|
+
:Fax => 'Télécopie',
|
17
|
+
:Fax_Home => 'Télécopie privé',
|
18
|
+
:Fax_Work => 'Télécopie au travail',
|
19
|
+
:Pager => 'Pager',
|
20
|
+
:IM_Aim => 'AIM',
|
21
|
+
:IM_Icq => 'ICQ',
|
22
|
+
:IM_Irc => 'IRC',
|
23
|
+
:IM_Jabber => 'Jabber',
|
24
|
+
:IM_Msn => 'MSN Messenger',
|
25
|
+
:IM_Yahoo => 'Yahoo! Messenger',
|
26
|
+
:Email => 'Courrier électronique',
|
27
|
+
:Url => 'URL',
|
28
|
+
:Projects => 'Projets',
|
29
|
+
:Dates => 'Dates',
|
30
|
+
:LastModified => 'Dernier modification',
|
31
|
+
:Present => 'Présent',
|
32
|
+
|
33
|
+
# for job history
|
34
|
+
:History_Title => 'Expérience Professionnelle',
|
35
|
+
:History_Employer => 'Nom et adresse de l''employeur',
|
36
|
+
:History_Occupation => 'Fonction ou poste occupé',
|
37
|
+
:History_MainActivities => 'Principales activités et responsabilités',
|
38
|
+
:History_Achievements => 'Réalisations',
|
39
|
+
|
40
|
+
# for education
|
41
|
+
:Education_Title => 'Education et Formation',
|
42
|
+
:Education_Organization => 'Nom et type de l''établissement disposant l''enseignement ou la formation',
|
43
|
+
:Education_Level => 'Intitulé du certificat ou diplôme délivré',
|
44
|
+
:Education_MajorStudies => 'Matières principales',
|
45
|
+
:Education_MinorStudies => 'Matières secondaires',
|
46
|
+
:Education_Minor => 'Matière secondaire',
|
47
|
+
:Education_Minors => 'Matières secondaires',
|
48
|
+
:Education_Gpa => 'Terme moyen des notes',
|
49
|
+
:Education_Gpa_Overall => 'Terme moyen des toutes les notes',
|
50
|
+
:Education_Gpa_Major => 'Terme moyen des notes des matières principales',
|
51
|
+
:Education_Gpa_Outof => 'de',
|
52
|
+
:Education_Subjects => 'Matières',
|
53
|
+
|
54
|
+
# for skills
|
55
|
+
:Skills_Title => 'Capacité',
|
56
|
+
|
57
|
+
# for publications
|
58
|
+
:Publications_Title => 'Publications',
|
59
|
+
:Publications_In => 'Dans',
|
60
|
+
|
61
|
+
# for interests
|
62
|
+
:Interests_Title => 'Intérêts',
|
63
|
+
|
64
|
+
# for security clearances
|
65
|
+
:SecurityClearances_Title => 'Compétence de sécurité',
|
66
|
+
|
67
|
+
# for awards
|
68
|
+
:Awards_Title => 'Distinctions',
|
69
|
+
|
70
|
+
# for referees
|
71
|
+
:Referees_Title => 'Références'
|
72
|
+
|
73
|
+
)
|
data/doc/src/default.css
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
html {
|
2
|
+
margin: 0px 5%;
|
3
|
+
background-color: #eee;
|
4
|
+
}
|
5
|
+
|
6
|
+
body {
|
7
|
+
margin: 0px;
|
8
|
+
padding: 0px;
|
9
|
+
background-color: #fff;
|
10
|
+
font-size: 12px;
|
11
|
+
font-family: Verdana, Arial, Helvetica;
|
12
|
+
}
|
13
|
+
|
14
|
+
/* General layout of the page */
|
15
|
+
|
16
|
+
#header, #footer {
|
17
|
+
width: 100%;
|
18
|
+
background-color: #58b;
|
19
|
+
color: #fff;
|
20
|
+
}
|
21
|
+
|
22
|
+
#menu {
|
23
|
+
float: left;
|
24
|
+
width: 230px;
|
25
|
+
padding: 20px 0px 0px 20px;
|
26
|
+
border: 3px solid #58b;
|
27
|
+
}
|
28
|
+
|
29
|
+
#body {
|
30
|
+
margin-left: 250px;
|
31
|
+
padding: 20px;
|
32
|
+
}
|
33
|
+
|
34
|
+
#footer {
|
35
|
+
clear: both;
|
36
|
+
padding: 5px 0px;
|
37
|
+
text-align: center;
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
/* styling the header */
|
42
|
+
|
43
|
+
#headerbar {
|
44
|
+
width: 100%;
|
45
|
+
font-size: 90%;
|
46
|
+
}
|
47
|
+
|
48
|
+
span#navbar, span#languages {
|
49
|
+
padding: 3px;
|
50
|
+
width: 45%;
|
51
|
+
}
|
52
|
+
|
53
|
+
span#navbar {
|
54
|
+
float: left;
|
55
|
+
text-align: left;
|
56
|
+
}
|
57
|
+
|
58
|
+
span#languages {
|
59
|
+
float: right;
|
60
|
+
text-align: right;
|
61
|
+
}
|
62
|
+
|
63
|
+
div#header h1, h2 {
|
64
|
+
margin: 0px;
|
65
|
+
padding: 15px 50px 0px;
|
66
|
+
|
67
|
+
font-size: 300%;
|
68
|
+
font-style: italic;
|
69
|
+
font-weight: normal;
|
70
|
+
}
|
71
|
+
|
72
|
+
div#header h2 {
|
73
|
+
padding-top: 0px;
|
74
|
+
padding-bottom: 15px;
|
75
|
+
font-size: 100%;
|
76
|
+
}
|
77
|
+
|
78
|
+
/* styling the menu */
|
79
|
+
|
80
|
+
#menu a {
|
81
|
+
text-decoration: none;
|
82
|
+
color: #b55;
|
83
|
+
font-weight: bold;
|
84
|
+
font-size: 130%;
|
85
|
+
}
|
86
|
+
|
87
|
+
#menu a:hover {
|
88
|
+
text-decoration: underline;
|
89
|
+
}
|
90
|
+
|
91
|
+
#menu .webgen-menuitem-selected {
|
92
|
+
border-left: 3px solid #58b;
|
93
|
+
}
|
94
|
+
|
95
|
+
#menu .webgen-submenu {
|
96
|
+
}
|
97
|
+
|
98
|
+
#menu ul {
|
99
|
+
list-style-type: none;
|
100
|
+
padding: 0px;
|
101
|
+
margin-left: 10px;
|
102
|
+
}
|
103
|
+
|
104
|
+
#menu li > ul {
|
105
|
+
font-size: 95%;
|
106
|
+
}
|
107
|
+
|
108
|
+
#menu li {
|
109
|
+
margin: 0.0em 0px;
|
110
|
+
padding: 2px 0px;
|
111
|
+
padding-left: 5px;
|
112
|
+
border-left: 3px solid #CCCCCC;
|
113
|
+
}
|
114
|
+
|
115
|
+
/* styling the content */
|
116
|
+
|
117
|
+
div.section {
|
118
|
+
margin-bottom: 30px;
|
119
|
+
}
|
120
|
+
|
121
|
+
h2.section_header {
|
122
|
+
padding: 0px;
|
123
|
+
border-bottom: 3px double #8b5;
|
124
|
+
|
125
|
+
letter-spacing: 0.2em;
|
126
|
+
font-size: 150%;
|
127
|
+
font-weight: bold;
|
128
|
+
color: #8b5;
|
129
|
+
}
|
130
|
+
|
131
|
+
pre.webgen-file {
|
132
|
+
padding-left: 10px;
|
133
|
+
margin: 0px 10px;
|
134
|
+
border-left: 3px solid #8b5;
|
135
|
+
}
|
136
|
+
|
137
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>XMLResume2x: {title: }</title>
|
7
|
+
<link href="{relocatable: default.css}" rel="stylesheet" />
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="header">
|
11
|
+
<h1>{title: }</h1>
|
12
|
+
<h2>xmlresume2x: converts an xml resume to various output formats</h2>
|
13
|
+
<div id="headerbar">
|
14
|
+
<span id="navbar">{navbar: }</span>
|
15
|
+
<span id="languages">{lang: }</span>
|
16
|
+
<div style="clear: both; border-top: 1px solid #58b"></div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div id="menu">
|
21
|
+
{menu: }
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div id="body">
|
25
|
+
{content: }
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div id="footer">
|
29
|
+
generated with <em><b><a href="http://webgen.rubyforge.org">webgen</a></b></em> on <b>{date: }</b>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
</body>
|
33
|
+
</html>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<div class="section">
|
2
|
+
<h2 class="section_header">Download</h2>
|
3
|
+
<p>The newest version of xmlresume2x can be downloaded from Rubyforge.</p>
|
4
|
+
<p>Homepage: <a href="http://xmlresume2x.rubyforge.org">xmlresume2x.rubyforge.org</a><br />
|
5
|
+
Download: <a href="http://rubyforge.org/frs/?group_id=459">http://rubyforge.org/frs/?group_id=459</a>
|
6
|
+
</p>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="section">
|
10
|
+
<h2 class="section_header">Dependencies</h2>
|
11
|
+
<p>None</p>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="section">
|
15
|
+
<h2 class="section_header">Installation</h2>
|
16
|
+
|
17
|
+
You can use the standard way to install xmlresume2x. Download the package, open up a terminal and
|
18
|
+
change into the package root. Then do the following:
|
19
|
+
<pre>
|
20
|
+
$ ruby setup.rb config
|
21
|
+
$ ruby setup.rb setup
|
22
|
+
$ ruby setup.rb install
|
23
|
+
</pre>
|
24
|
+
|
25
|
+
Or you could use Rake and substitute the above commands with this:
|
26
|
+
<pre>
|
27
|
+
$ rake install
|
28
|
+
</pre>
|
29
|
+
|
30
|
+
Or you could use the RPA way:
|
31
|
+
<pre>
|
32
|
+
$ rpa install xmlresume2x
|
33
|
+
</pre>
|
34
|
+
|
35
|
+
Or you could use the GEM way:
|
36
|
+
<pre>
|
37
|
+
$ gem install xmlresume2x
|
38
|
+
</pre>
|
39
|
+
|
40
|
+
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="section">
|
2
|
+
<h2 class="section_header">Example files</h2>
|
3
|
+
<p>Here are the results when xmlresume2x is used for converting the two example résumés provided by
|
4
|
+
xmlresume.sf.net</p>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="section">
|
8
|
+
<h2 class="section_header">Example1</h2>
|
9
|
+
<ul>
|
10
|
+
<li><a href="examples/example1.xml">XML source</a></li>
|
11
|
+
<li><a href="examples/example1.pdf">PDF version</a></li>
|
12
|
+
<li><a href="examples/example1.html">HTML version (without stylesheet)</a></li>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="section">
|
17
|
+
<h2 class="section_header">Example2</h2>
|
18
|
+
<ul>
|
19
|
+
<li><a href="examples/example2.xml">XML source</a></li>
|
20
|
+
<li><a href="examples/example2.pdf">PDF version</a></li>
|
21
|
+
<li><a href="examples/example2.html">HTML version (without stylesheet)</a></li>
|
22
|
+
</ul>
|
23
|
+
|
24
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="section">
|
2
|
+
<h2 class="section_header">Feature list</h2>
|
3
|
+
<ul>
|
4
|
+
<li>Uses the XML standard for résumés provided by <a href="http://xmlresume.sf.net">xmlresume.sf.net</a></li>
|
5
|
+
<li>Configuration files are pure Ruby - unleash the power!</li>
|
6
|
+
<li>Publish your résumé in PDF (using a good looking LaTeX template) or HTML!</li>
|
7
|
+
<li>Easily extendable</li>
|
8
|
+
</ul>
|
9
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<div class="section">
|
2
|
+
<h2 class="section_header">Welcome</h2>
|
3
|
+
<p>... to the homepage of <i><b>xmlresume2x</b></i>, a converter for xml resumes.</p>
|
4
|
+
<p>Have a look around the site!</p>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="section">
|
8
|
+
<h2 class="section_header">Description</h2>
|
9
|
+
<p>The <a href="http://xmlresume.sourceforge.net">"XML Résumé Library"</a> provides a way for storing
|
10
|
+
one's résumé data in a consistent way. The XML résumé can be transformed to various output formats,
|
11
|
+
including text, HTML and PDF by utilizing XSLT.</p>
|
12
|
+
|
13
|
+
<p>I came across the <a href="http://www.cedefop.eu.int/transparency/cv.asp">European Curriculum
|
14
|
+
Vitae</a> format which provides a standard for CVs in Europe. Nicola Vitacolonna has used this
|
15
|
+
information to provide a LaTeX class - <a
|
16
|
+
href="http://www.ctan.org/tex-archive/help/Catalogue/entries/europecv.html">europecv</a> - which
|
17
|
+
(nearly) conforms to this standard. As the XML Résumé Library does not have a converter for this, I
|
18
|
+
wrote this program to convert an XML résumé to a LaTeX file which uses the europecv class.</p>
|
19
|
+
|
20
|
+
<p>During the development process I realized that it would be useful to add support for other output
|
21
|
+
formats. Therefore I changed the conversion process to use configuration files so that this program
|
22
|
+
can be used to transform a résumé to any output format.</p>
|
23
|
+
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="section">
|
27
|
+
<h2 class="section_header">And so ...</h2>
|
28
|
+
<p>... have fun!</p>
|
29
|
+
</div>
|
@@ -0,0 +1,135 @@
|
|
1
|
+
<p align="center" style="font-size: Large; font-weight: bold">This manual is for version {includeFile: ../../VERSION} of xmlresume2x!</p>
|
2
|
+
|
3
|
+
<div class="section">
|
4
|
+
<h2 class="section_header">How To Use xmlresume2x?</h2>
|
5
|
+
<p>xmlresume2x is a CLI application, ie. you can only use it from the command line. You need to
|
6
|
+
specify the XML resume file which you want to convert, the output format and the language, like this:</p>
|
7
|
+
<pre>
|
8
|
+
xmlresume2x -f latex-europecv -l en myresume.xml
|
9
|
+
</pre>
|
10
|
+
<p>The former converts the resume <code>myresume.xml</code> into a LaTeX file which uses the
|
11
|
+
latex-europecv class. Have a look at the help screen for other available options.</p>
|
12
|
+
|
13
|
+
<p>If you are not satisfied with the way some things are transformed or named, you can specify your
|
14
|
+
own configuration file. This allows you to override the default transformation settings.</p>
|
15
|
+
<p>The resume files have to conform to XML resume >=1.5.1, must not use deprecated elements and have
|
16
|
+
to use the element <code><resume></code> as root element!</p>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="section">
|
20
|
+
<h2 class="section_header">How It Works</h2>
|
21
|
+
<p>The application itself is rather simple, the power lies in the configuration files. There are two
|
22
|
+
types of configuration files, for formats and for languages. A format file is the equivalent to an
|
23
|
+
XSL file: it defines how the XML file is translated. A language file contains phrases in a specific
|
24
|
+
language which are then used in the format files.</p>
|
25
|
+
|
26
|
+
<p>When xmlresume2x is started, the given format and language files are read and the input file is
|
27
|
+
translated accordingly.</p>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="section">
|
31
|
+
<h2 class="section_header">Currently Available Formats And Languages</h2>
|
32
|
+
<dl>
|
33
|
+
<dt>Formats</dt>
|
34
|
+
<dd>latex-europecv (for producing PDF and other formats supported by LaTeX), xhtml</dd>
|
35
|
+
|
36
|
+
<dt>Languages</dt>
|
37
|
+
<dd>English (en), German (de), French (fr)</dd>
|
38
|
+
</dl>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="section">
|
43
|
+
<h2 class="section_header">Configuration Files</h2>
|
44
|
+
<p>The configuration files are pure Ruby files, so you can use the full power of Ruby!</p>
|
45
|
+
|
46
|
+
<p>Basically, all you do in a configuration file is:</p>
|
47
|
+
<ol>
|
48
|
+
<li>Define processors for specific XML elements</li>
|
49
|
+
<li>Define keywords for a specific language</li>
|
50
|
+
</ol>
|
51
|
+
<p>Normally, these two actions are separated from each other and put into different files: one or
|
52
|
+
more format files and one or more language files. This separation does not have to occur, as
|
53
|
+
processors and keywords can be defined in any configuration file. However, this separation makes it
|
54
|
+
easier to combine languages and formats.</p>
|
55
|
+
|
56
|
+
<p>The configuration files are normally located in the <code>/usr/share/xmlresume2x</code>
|
57
|
+
directory. Format files should go into the sub directory <code>format</code> and language files in
|
58
|
+
the sub directory <code>lang</code>.</p>
|
59
|
+
|
60
|
+
|
61
|
+
<h3>List of available commands</h3>
|
62
|
+
<p>This is a list of additional commands that can and should be used in configuration files (<a
|
63
|
+
href="rdoc/classes/XMLResume2x/ResumeProcessor.html">here</a> is a description of them):</p>
|
64
|
+
<ul>
|
65
|
+
<li>add_processor</li>
|
66
|
+
<li>processor</li>
|
67
|
+
<li>call_processor</li>
|
68
|
+
<li>keyword</li>
|
69
|
+
<li>get_value</li>
|
70
|
+
<li>get_children_value</li>
|
71
|
+
<li>load_config</li>
|
72
|
+
</ul>
|
73
|
+
|
74
|
+
<h3>Processors</h3>
|
75
|
+
|
76
|
+
<p>Processors are the heart of the transformation process. You can create an unlimited number of
|
77
|
+
processors which can be assigned to specific XML elements. Each processor defines how an XML element
|
78
|
+
should be transformed (the XSL equivalent would be <code>xsl:template</code>). Let's take a look at
|
79
|
+
an example:</p>
|
80
|
+
<pre>
|
81
|
+
processor 'contact' => 'ContactProcessor' do |contact|
|
82
|
+
str = ''
|
83
|
+
str << contact.phone.collect {|phone| "#{phone_location(phone._location)}: #{phone}" }.join( NEWLINE ) if contact.phone
|
84
|
+
str << NEWLINE + contact.fax.collect {|fax| "#{fax_location(fax._location)}: #{fax}" }.join( NEWLINE ) if contact.fax
|
85
|
+
str << NEWLINE + contact.pager.collect {|pager| "#{keyword(:Pager)}: #{pager}" }.join( NEWLINE ) if contact.pager
|
86
|
+
str << NEWLINE + contact.email.collect {|email| "#{keyword(:Email)}: \\url{#{email}}" }.join( NEWLINE ) if contact.email
|
87
|
+
str << NEWLINE + contact.url.collect {|url| "#{keyword(:Url)}: \\url{#{url}}" }.join( NEWLINE ) if contact.url
|
88
|
+
str << NEWLINE + contact.instantMessage.collect {|im| "#{im_service(im._service)}: #{im}" }.join( NEWLINE ) if contact.instantMessage
|
89
|
+
str
|
90
|
+
end
|
91
|
+
</pre>
|
92
|
+
<p>This defines a processor <code>ContactProcessor</code> which is assigned to the element
|
93
|
+
<code>contact</code>. All the format files shipped with xmlresume2x use a convention for the
|
94
|
+
processor names: <code><capitalized element name>Processor</code> (useful when overriding a
|
95
|
+
processor with a user defined one). The first parameter is always the element which should be
|
96
|
+
transformed (there is an optional second parameter for passing options). The associated block
|
97
|
+
defines how the <code>contact</code> is transformed.</p>
|
98
|
+
|
99
|
+
<p>REXML is used for reading in the XML resume. Two wrapper classes are used to simplify the use of
|
100
|
+
the XML elements: ElementWrapper wraps a single REXML::Element objecct and ElementWrapperList wraps
|
101
|
+
a bunch of them. Using these wrappers, you can do the following:</p>
|
102
|
+
<ul>
|
103
|
+
<li>Access the first <code>phone</code> subelement from contact: <code>contact.phone</code></li>
|
104
|
+
<li>Join all phones: <code>contact.phone.join(', ')</code></li>
|
105
|
+
<li>Access the attribute <code>location</code> of the first <code>phone</code> subelement: <code>contact.phone._location</code></li>
|
106
|
+
</ul>
|
107
|
+
|
108
|
+
<p>So, subelements of an element are accessed by using the name of the subelement as method name. If
|
109
|
+
there is more than one subelement of the same type, you can use the bracket notation to access the
|
110
|
+
others: <code>contact.phone[1]</code>. Attributes of an element are accessed by prepending an
|
111
|
+
underscore to the attribute name and using that as method name.</p>
|
112
|
+
|
113
|
+
<h3>Keywords</h3>
|
114
|
+
|
115
|
+
<p>Not all words in the result document are directly taken from the XML resume file. Some words,
|
116
|
+
e.g. headers like <code>Additional Information</code>, are inserted to make reading easier.
|
117
|
+
Naturally, these words are not the same in every language and therefore they have to be defined
|
118
|
+
somewhere.</p>
|
119
|
+
|
120
|
+
<p>These keywords are normally defined in the language files. These files are Ruby source files too
|
121
|
+
and contain statements like this:</p>
|
122
|
+
<pre>
|
123
|
+
keyword(
|
124
|
+
# general keywords
|
125
|
+
:Resume => 'Resume',
|
126
|
+
:Of => 'of',
|
127
|
+
:AdditionalInformation => 'Additional Information',
|
128
|
+
)
|
129
|
+
</pre>
|
130
|
+
<p>The <code>keyword</code> function takes a Hash as argument to define new keywords or overwrite
|
131
|
+
already defined ones. The key has to be a Symbol and the value has to be a String in UTF8 format. Any
|
132
|
+
keyword can be defined this way and later, in a configuration file, used by calling the
|
133
|
+
<code>keyword</code> function with a Symbol as argument.</p>
|
134
|
+
|
135
|
+
</div>
|