View | Details | Raw Unified | Return to bug 332122 | Differences between
and this patch

Collapse All | Expand All

(-)a/.gitignore (+1 lines)
Lines 1-2 Link Here
1
/org.eclipse*/bin
1
/org.eclipse*/bin
2
/org.eclipse*/target
2
/org.eclipse*/target
3
/org.eclipse*/.DS_Store
(-)a/org.eclipse.mylyn.docs-site/site.xml (-36 / +39 lines)
Lines 1-36 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<site>
2
<site>
3
   <description>
3
   <description>
4
      Mylyn Docs
4
      Mylyn Docs
5
   </description>
5
   </description>
6
   <feature url="features/org.eclipse.mylyn.wikitext_feature_0.0.0.jar" id="org.eclipse.mylyn.wikitext_feature" version="0.0.0">
6
   <feature url="features/org.eclipse.mylyn.wikitext_feature_0.0.0.jar" id="org.eclipse.mylyn.wikitext_feature" version="0.0.0">
7
      <category name="Features"/>
7
      <category name="Features"/>
8
   </feature>
8
   </feature>
9
   <feature url="features/org.eclipse.mylyn.htmltext_0.0.0.jar" id="org.eclipse.mylyn.htmltext" version="0.0.0">
9
   <feature url="features/org.eclipse.mylyn.htmltext_0.0.0.jar" id="org.eclipse.mylyn.htmltext" version="0.0.0">
10
      <category name="Features"/>
10
      <category name="Features"/>
11
   </feature>
11
   </feature>
12
   <feature url="features/org.eclipse.mylyn.docs.sdk_0.0.0.jar" id="org.eclipse.mylyn.docs.sdk" version="0.0.0">
12
   <feature url="features/org.eclipse.mylyn.docs.sdk_0.0.0.jar" id="org.eclipse.mylyn.docs.sdk" version="0.0.0">
13
      <category name="SDK"/>
13
      <category name="SDK"/>
14
   </feature>
14
   </feature>
15
   <feature url="features/org.eclipse.mylyn.wikitext.sdk_0.0.0.jar" id="org.eclipse.mylyn.wikitext.sdk" version="0.0.0">
15
   <feature url="features/org.eclipse.mylyn.wikitext.sdk_0.0.0.jar" id="org.eclipse.mylyn.wikitext.sdk" version="0.0.0">
16
      <category name="SDK"/>
16
      <category name="SDK"/>
17
   </feature>
17
   </feature>
18
   <feature url="features/org.eclipse.mylyn.wikitext.extras_0.0.0.qualifier.jar" id="org.eclipse.mylyn.wikitext.extras" version="0.0.0">
18
   <feature url="features/org.eclipse.mylyn.wikitext.extras_0.0.0.qualifier.jar" id="org.eclipse.mylyn.wikitext.extras" version="0.0.0">
19
	  <category name="Features"/>
19
      <category name="Features"/>
20
   </feature>
20
   </feature>
21
   <category-def name="Features" label="Mylyn Docs Features">
21
   <feature url="features/org.eclipse.mylyn.docs.epub_0.8.0.qualifier.jar" id="org.eclipse.mylyn.docs.epub" version="0.8.0.qualifier">
22
      <description>
22
      <category name="Features"/>
23
         Tools.
23
   </feature>
24
      </description>
24
   <category-def name="Features" label="Mylyn Docs Features">
25
   </category-def>
25
      <description>
26
   <category-def name="Integration" label="Mylyn Docs Integrations">
26
         Tools.
27
      <description>
27
      </description>
28
         Connectors that integrate with ALM systems.
28
   </category-def>
29
      </description>
29
   <category-def name="Integration" label="Mylyn Docs Integrations">
30
   </category-def>
30
      <description>
31
   <category-def name="SDK" label="Mylyn Docs SDK and Framework">
31
         Connectors that integrate with ALM systems.
32
      <description>
32
      </description>
33
         Source code and documentation for integrators.
33
   </category-def>
34
      </description>
34
   <category-def name="SDK" label="Mylyn Docs SDK and Framework">
35
   </category-def>
35
      <description>
36
</site>
36
         Source code and documentation for integrators.
37
      </description>
38
   </category-def>
39
</site>
(-)a/org.eclipse.mylyn.docs.epub-feature/.project (+17 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.mylyn.docs.epub-feature</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.pde.FeatureBuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
	</buildSpec>
14
	<natures>
15
		<nature>org.eclipse.pde.FeatureNature</nature>
16
	</natures>
17
</projectDescription>
(-)a/org.eclipse.mylyn.docs.epub-feature/.settings/org.eclipse.core.resources.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:01 CEST 2011
2
eclipse.preferences.version=1
3
encoding/<project>=UTF-8
(-)a/org.eclipse.mylyn.docs.epub-feature/.settings/org.eclipse.core.runtime.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:01 CEST 2011
2
eclipse.preferences.version=1
3
line.separator=\n
(-)a/org.eclipse.mylyn.docs.epub-feature/build.properties (+4 lines)
Added Link Here
1
bin.includes = feature.xml,\
2
               feature.properties,\
3
               epl-v10.html,\
4
               license.html
(-)a/org.eclipse.mylyn.docs.epub-feature/epl-v10.html (+328 lines)
Added Link Here
1
<html xmlns:o="urn:schemas-microsoft-com:office:office"
2
xmlns:w="urn:schemas-microsoft-com:office:word"
3
xmlns="http://www.w3.org/TR/REC-html40">
4
5
<head>
6
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
7
<meta name=ProgId content=Word.Document>
8
<meta name=Generator content="Microsoft Word 9">
9
<meta name=Originator content="Microsoft Word 9">
10
<link rel=File-List
11
href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
12
<title>Eclipse Public License - Version 1.0</title>
13
<!--[if gte mso 9]><xml>
14
 <o:DocumentProperties>
15
  <o:Revision>2</o:Revision>
16
  <o:TotalTime>3</o:TotalTime>
17
  <o:Created>2004-03-05T23:03:00Z</o:Created>
18
  <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
19
  <o:Pages>4</o:Pages>
20
  <o:Words>1626</o:Words>
21
  <o:Characters>9270</o:Characters>
22
   <o:Lines>77</o:Lines>
23
  <o:Paragraphs>18</o:Paragraphs>
24
  <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
25
  <o:Version>9.4402</o:Version>
26
 </o:DocumentProperties>
27
</xml><![endif]--><!--[if gte mso 9]><xml>
28
 <w:WordDocument>
29
  <w:TrackRevisions/>
30
 </w:WordDocument>
31
</xml><![endif]-->
32
<style>
33
<!--
34
 /* Font Definitions */
35
@font-face
36
	{font-family:Tahoma;
37
	panose-1:2 11 6 4 3 5 4 4 2 4;
38
	mso-font-charset:0;
39
	mso-generic-font-family:swiss;
40
	mso-font-pitch:variable;
41
	mso-font-signature:553679495 -2147483648 8 0 66047 0;}
42
 /* Style Definitions */
43
p.MsoNormal, li.MsoNormal, div.MsoNormal
44
	{mso-style-parent:"";
45
	margin:0in;
46
	margin-bottom:.0001pt;
47
	mso-pagination:widow-orphan;
48
	font-size:12.0pt;
49
	font-family:"Times New Roman";
50
	mso-fareast-font-family:"Times New Roman";}
51
p
52
	{margin-right:0in;
53
	mso-margin-top-alt:auto;
54
	mso-margin-bottom-alt:auto;
55
	margin-left:0in;
56
	mso-pagination:widow-orphan;
57
	font-size:12.0pt;
58
	font-family:"Times New Roman";
59
	mso-fareast-font-family:"Times New Roman";}
60
p.BalloonText, li.BalloonText, div.BalloonText
61
	{mso-style-name:"Balloon Text";
62
	margin:0in;
63
	margin-bottom:.0001pt;
64
	mso-pagination:widow-orphan;
65
	font-size:8.0pt;
66
	font-family:Tahoma;
67
	mso-fareast-font-family:"Times New Roman";}
68
@page Section1
69
	{size:8.5in 11.0in;
70
	margin:1.0in 1.25in 1.0in 1.25in;
71
	mso-header-margin:.5in;
72
	mso-footer-margin:.5in;
73
	mso-paper-source:0;}
74
div.Section1
75
	{page:Section1;}
76
-->
77
</style>
78
</head>
79
80
<body lang=EN-US style='tab-interval:.5in'>
81
82
<div class=Section1>
83
84
<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
85
</p>
86
87
<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
88
THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
89
REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
90
OF THIS AGREEMENT.</span> </p>
91
92
<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
93
94
<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
95
96
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
97
in the case of the initial Contributor, the initial code and documentation
98
distributed under this Agreement, and<br clear=left>
99
b) in the case of each subsequent Contributor:</span></p>
100
101
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
102
changes to the Program, and</span></p>
103
104
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
105
additions to the Program;</span></p>
106
107
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
108
such changes and/or additions to the Program originate from and are distributed
109
by that particular Contributor. A Contribution 'originates' from a Contributor
110
if it was added to the Program by such Contributor itself or anyone acting on
111
such Contributor's behalf. Contributions do not include additions to the
112
Program which: (i) are separate modules of software distributed in conjunction
113
with the Program under their own license agreement, and (ii) are not derivative
114
works of the Program. </span></p>
115
116
<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
117
entity that distributes the Program.</span> </p>
118
119
<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
120
claims licensable by a Contributor which are necessarily infringed by the use
121
or sale of its Contribution alone or when combined with the Program. </span></p>
122
123
<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
124
distributed in accordance with this Agreement.</span> </p>
125
126
<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
127
receives the Program under this Agreement, including all Contributors.</span> </p>
128
129
<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
130
131
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
132
Subject to the terms of this Agreement, each Contributor hereby grants Recipient
133
a non-exclusive, worldwide, royalty-free copyright license to<span
134
style='color:red'> </span>reproduce, prepare derivative works of, publicly
135
display, publicly perform, distribute and sublicense the Contribution of such
136
Contributor, if any, and such derivative works, in source code and object code
137
form.</span></p>
138
139
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
140
Subject to the terms of this Agreement, each Contributor hereby grants
141
Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
142
patent license under Licensed Patents to make, use, sell, offer to sell, import
143
and otherwise transfer the Contribution of such Contributor, if any, in source
144
code and object code form. This patent license shall apply to the combination
145
of the Contribution and the Program if, at the time the Contribution is added
146
by the Contributor, such addition of the Contribution causes such combination
147
to be covered by the Licensed Patents. The patent license shall not apply to
148
any other combinations which include the Contribution. No hardware per se is
149
licensed hereunder. </span></p>
150
151
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
152
Recipient understands that although each Contributor grants the licenses to its
153
Contributions set forth herein, no assurances are provided by any Contributor
154
that the Program does not infringe the patent or other intellectual property
155
rights of any other entity. Each Contributor disclaims any liability to Recipient
156
for claims brought by any other entity based on infringement of intellectual
157
property rights or otherwise. As a condition to exercising the rights and
158
licenses granted hereunder, each Recipient hereby assumes sole responsibility
159
to secure any other intellectual property rights needed, if any. For example,
160
if a third party patent license is required to allow Recipient to distribute
161
the Program, it is Recipient's responsibility to acquire that license before
162
distributing the Program.</span></p>
163
164
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
165
Each Contributor represents that to its knowledge it has sufficient copyright
166
rights in its Contribution, if any, to grant the copyright license set forth in
167
this Agreement. </span></p>
168
169
<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
170
171
<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
172
Program in object code form under its own license agreement, provided that:</span>
173
</p>
174
175
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
176
it complies with the terms and conditions of this Agreement; and</span></p>
177
178
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
179
its license agreement:</span></p>
180
181
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
182
effectively disclaims on behalf of all Contributors all warranties and
183
conditions, express and implied, including warranties or conditions of title
184
and non-infringement, and implied warranties or conditions of merchantability
185
and fitness for a particular purpose; </span></p>
186
187
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
188
effectively excludes on behalf of all Contributors all liability for damages,
189
including direct, indirect, special, incidental and consequential damages, such
190
as lost profits; </span></p>
191
192
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
193
states that any provisions which differ from this Agreement are offered by that
194
Contributor alone and not by any other party; and</span></p>
195
196
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
197
states that source code for the Program is available from such Contributor, and
198
informs licensees how to obtain it in a reasonable manner on or through a
199
medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
200
201
<p><span style='font-size:10.0pt'>When the Program is made available in source
202
code form:</span> </p>
203
204
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
205
it must be made available under this Agreement; and </span></p>
206
207
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
208
copy of this Agreement must be included with each copy of the Program. </span></p>
209
210
<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
211
copyright notices contained within the Program. </span></p>
212
213
<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
214
originator of its Contribution, if any, in a manner that reasonably allows
215
subsequent Recipients to identify the originator of the Contribution. </span></p>
216
217
<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
218
219
<p><span style='font-size:10.0pt'>Commercial distributors of software may
220
accept certain responsibilities with respect to end users, business partners
221
and the like. While this license is intended to facilitate the commercial use
222
of the Program, the Contributor who includes the Program in a commercial
223
product offering should do so in a manner which does not create potential
224
liability for other Contributors. Therefore, if a Contributor includes the
225
Program in a commercial product offering, such Contributor (&quot;Commercial
226
Contributor&quot;) hereby agrees to defend and indemnify every other
227
Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
228
costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
229
legal actions brought by a third party against the Indemnified Contributor to
230
the extent caused by the acts or omissions of such Commercial Contributor in
231
connection with its distribution of the Program in a commercial product
232
offering. The obligations in this section do not apply to any claims or Losses
233
relating to any actual or alleged intellectual property infringement. In order
234
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
235
Contributor in writing of such claim, and b) allow the Commercial Contributor
236
to control, and cooperate with the Commercial Contributor in, the defense and
237
any related settlement negotiations. The Indemnified Contributor may participate
238
in any such claim at its own expense.</span> </p>
239
240
<p><span style='font-size:10.0pt'>For example, a Contributor might include the
241
Program in a commercial product offering, Product X. That Contributor is then a
242
Commercial Contributor. If that Commercial Contributor then makes performance
243
claims, or offers warranties related to Product X, those performance claims and
244
warranties are such Commercial Contributor's responsibility alone. Under this
245
section, the Commercial Contributor would have to defend claims against the
246
other Contributors related to those performance claims and warranties, and if a
247
court requires any other Contributor to pay any damages as a result, the
248
Commercial Contributor must pay those damages.</span> </p>
249
250
<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
251
252
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
253
AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
254
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
255
WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
256
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
257
responsible for determining the appropriateness of using and distributing the
258
Program and assumes all risks associated with its exercise of rights under this
259
Agreement , including but not limited to the risks and costs of program errors,
260
compliance with applicable laws, damage to or loss of data, programs or
261
equipment, and unavailability or interruption of operations. </span></p>
262
263
<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
264
265
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
266
AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
267
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
268
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
269
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
270
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
271
THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
272
THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
273
274
<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
275
276
<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
277
or unenforceable under applicable law, it shall not affect the validity or
278
enforceability of the remainder of the terms of this Agreement, and without
279
further action by the parties hereto, such provision shall be reformed to the
280
minimum extent necessary to make such provision valid and enforceable.</span> </p>
281
282
<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
283
against any entity (including a cross-claim or counterclaim in a lawsuit)
284
alleging that the Program itself (excluding combinations of the Program with
285
other software or hardware) infringes such Recipient's patent(s), then such
286
Recipient's rights granted under Section 2(b) shall terminate as of the date
287
such litigation is filed. </span></p>
288
289
<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
290
shall terminate if it fails to comply with any of the material terms or
291
conditions of this Agreement and does not cure such failure in a reasonable
292
period of time after becoming aware of such noncompliance. If all Recipient's
293
rights under this Agreement terminate, Recipient agrees to cease use and
294
distribution of the Program as soon as reasonably practicable. However,
295
Recipient's obligations under this Agreement and any licenses granted by
296
Recipient relating to the Program shall continue and survive. </span></p>
297
298
<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
299
copies of this Agreement, but in order to avoid inconsistency the Agreement is
300
copyrighted and may only be modified in the following manner. The Agreement
301
Steward reserves the right to publish new versions (including revisions) of
302
this Agreement from time to time. No one other than the Agreement Steward has
303
the right to modify this Agreement. The Eclipse Foundation is the initial
304
Agreement Steward. The Eclipse Foundation may assign the responsibility to
305
serve as the Agreement Steward to a suitable separate entity. Each new version
306
of the Agreement will be given a distinguishing version number. The Program
307
(including Contributions) may always be distributed subject to the version of
308
the Agreement under which it was received. In addition, after a new version of
309
the Agreement is published, Contributor may elect to distribute the Program
310
(including its Contributions) under the new version. Except as expressly stated
311
in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
312
the intellectual property of any Contributor under this Agreement, whether
313
expressly, by implication, estoppel or otherwise. All rights in the Program not
314
expressly granted under this Agreement are reserved.</span> </p>
315
316
<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
317
State of New York and the intellectual property laws of the United States of
318
America. No party to this Agreement will bring a legal action under this
319
Agreement more than one year after the cause of action arose. Each party waives
320
its rights to a jury trial in any resulting litigation.</span> </p>
321
322
<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
323
324
</div>
325
326
</body>
327
328
</html>
(-)a/org.eclipse.mylyn.docs.epub-feature/feature.properties (+138 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2011 Torkild U. Resheim
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
# 
8
# Contributors:
9
#     Torkild U. Resheim - initial API and implementation
10
###############################################################################
11
featureName=Mylyn Docs EPUB Core
12
description=Adds API for reading and writing of EPUB files. Includes user interface for generating EPUBs from wiki markup and Ant task for assembling and writing EPUBs using Apache Ant.
13
providerName=Eclipse Mylyn
14
copyright=Copyright (c) 2011 Torkild U. Resheim. All rights reserved.
15
license=\
16
Eclipse Foundation Software User Agreement\n\
17
February 1, 2011\n\
18
\n\
19
Usage Of Content\n\
20
\n\
21
THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
22
OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
23
USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
24
AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
25
NOTICES INDICATED OR REFERENCED BELOW.  BY USING THE CONTENT, YOU\n\
26
AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
27
AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
28
OR NOTICES INDICATED OR REFERENCED BELOW.  IF YOU DO NOT AGREE TO THE\n\
29
TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
30
OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
31
BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
32
\n\
33
Applicable Licenses\n\
34
\n\
35
Unless otherwise indicated, all Content made available by the\n\
36
Eclipse Foundation is provided to you under the terms and conditions of\n\
37
the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
38
provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
39
For purposes of the EPL, "Program" will mean the Content.\n\
40
\n\
41
Content includes, but is not limited to, source code, object code,\n\
42
documentation and other files maintained in the Eclipse Foundation source code\n\
43
repository ("Repository") in software modules ("Modules") and made available\n\
44
as downloadable archives ("Downloads").\n\
45
\n\
46
       - Content may be structured and packaged into modules to facilitate delivering,\n\
47
         extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
48
         plug-in fragments ("Fragments"), and features ("Features").\n\
49
       - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
50
         in a directory named "plugins".\n\
51
       - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
52
         Each Feature may be packaged as a sub-directory in a directory named "features".\n\
53
         Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
54
         numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
55
       - Features may also include other Features ("Included Features"). Within a Feature, files\n\
56
         named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
57
\n\
58
The terms and conditions governing Plug-ins and Fragments should be\n\
59
contained in files named "about.html" ("Abouts"). The terms and\n\
60
conditions governing Features and Included Features should be contained\n\
61
in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
62
Licenses may be located in any directory of a Download or Module\n\
63
including, but not limited to the following locations:\n\
64
\n\
65
       - The top-level (root) directory\n\
66
       - Plug-in and Fragment directories\n\
67
       - Inside Plug-ins and Fragments packaged as JARs\n\
68
       - Sub-directories of the directory named "src" of certain Plug-ins\n\
69
       - Feature directories\n\
70
\n\
71
Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
72
Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
73
Update License") during the installation process. If the Feature contains\n\
74
Included Features, the Feature Update License should either provide you\n\
75
with the terms and conditions governing the Included Features or inform\n\
76
you where you can locate them. Feature Update Licenses may be found in\n\
77
the "license" property of files named "feature.properties" found within a Feature.\n\
78
Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
79
terms and conditions (or references to such terms and conditions) that\n\
80
govern your use of the associated Content in that directory.\n\
81
\n\
82
THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
83
TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
84
SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
85
\n\
86
       - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
87
       - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
88
       - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
89
       - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
90
       - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
91
       - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
92
\n\
93
IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
94
TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
95
is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
96
govern that particular Content.\n\
97
\n\
98
\n\Use of Provisioning Technology\n\
99
\n\
100
The Eclipse Foundation makes available provisioning software, examples of which include,\n\
101
but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
102
the purpose of allowing users to install software, documentation, information and/or\n\
103
other materials (collectively "Installable Software"). This capability is provided with\n\
104
the intent of allowing such users to install, extend and update Eclipse-based products.\n\
105
Information about packaging Installable Software is available at\n\
106
http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
107
\n\
108
You may use Provisioning Technology to allow other parties to install Installable Software.\n\
109
You shall be responsible for enabling the applicable license agreements relating to the\n\
110
Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
111
in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
112
making it available in accordance with the Specification, you further acknowledge your\n\
113
agreement to, and the acquisition of all necessary rights to permit the following:\n\
114
\n\
115
       1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
116
          the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
117
          extending or updating the functionality of an Eclipse-based product.\n\
118
       2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
119
          Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
120
       3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
121
          govern the use of the Installable Software ("Installable Software Agreement") and such\n\
122
          Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
123
          with the Specification. Such Installable Software Agreement must inform the user of the\n\
124
          terms and conditions that govern the Installable Software and must solicit acceptance by\n\
125
          the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
126
          indication of agreement by the user, the provisioning Technology will complete installation\n\
127
          of the Installable Software.\n\
128
\n\
129
Cryptography\n\
130
\n\
131
Content may contain encryption software. The country in which you are\n\
132
currently may have restrictions on the import, possession, and use,\n\
133
and/or re-export to another country, of encryption software. BEFORE\n\
134
using any encryption software, please check the country's laws,\n\
135
regulations and policies concerning the import, possession, or use, and\n\
136
re-export of encryption software, to see if this is permitted.\n\
137
\n\
138
Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
(-)a/org.eclipse.mylyn.docs.epub-feature/feature.xml (+73 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<feature
3
      id="org.eclipse.mylyn.docs.epub"
4
      label="%featureName"
5
      version="0.8.0.qualifier"
6
      provider-name="%providerName"
7
      plugin="org.eclipse.mylyn">
8
9
   <description>
10
      %description
11
   </description>
12
13
   <copyright>
14
      %copyright
15
   </copyright>
16
17
   <license url="license.html">
18
      %license
19
   </license>
20
21
   <requires>
22
      <import plugin="org.eclipse.emf.ecore.xmi" version="2.5.0" match="compatible"/>
23
      <import plugin="org.eclipse.emf.validation" version="1.4.0" match="compatible"/>
24
      <import plugin="org.eclipse.mylyn.wikitext.core" version="1.4.0" match="compatible"/>
25
      <import plugin="org.eclipse.emf.mapping.ecore2xml" version="2.7.0" match="compatible"/>
26
      <import plugin="org.eclipse.core.runtime" version="3.6.0" match="compatible"/>
27
      <import plugin="org.eclipse.mylyn.docs.epub.core" version="0.8.0" match="compatible"/>
28
      <import plugin="org.eclipse.mylyn.wikitext.ui" version="1.5.0" match="compatible"/>
29
      <import plugin="org.eclipse.mylyn.wikitext.core" version="1.5.0" match="compatible"/>
30
      <import plugin="org.eclipse.core.resources" version="3.6.0" match="compatible"/>
31
      <import plugin="org.eclipse.ui" version="3.6.0" match="compatible"/>
32
      <import plugin="org.eclipse.core.databinding"/>
33
      <import plugin="org.eclipse.core.databinding.beans"/>
34
      <import plugin="org.eclipse.core.databinding.observable"/>
35
      <import plugin="org.eclipse.core.databinding.property"/>
36
      <import plugin="org.eclipse.jface.databinding"/>
37
      <import plugin="com.ibm.icu"/>
38
      <import plugin="org.eclipse.emf" version="2.6.0" match="greaterOrEqual"/>
39
      <import plugin="org.eclipse.emf.ecore" version="2.7.0" match="greaterOrEqual"/>
40
      <import plugin="org.eclipse.emf.databinding"/>
41
      <import plugin="org.eclipse.emf.validation" version="1.4.0" match="greaterOrEqual"/>
42
      <import plugin="org.eclipse.emf.validation.ui" version="1.3.0" match="greaterOrEqual"/>
43
   </requires>
44
45
   <plugin
46
         id="org.eclipse.mylyn.docs.epub.core"
47
         download-size="0"
48
         install-size="0"
49
         version="0.0.0"
50
         unpack="false"/>
51
52
   <plugin
53
         id="org.eclipse.mylyn.docs.epub.help"
54
         download-size="0"
55
         install-size="0"
56
         version="0.0.0"
57
         unpack="false"/>
58
59
   <plugin
60
         id="org.eclipse.mylyn.docs.epub.ui"
61
         download-size="0"
62
         install-size="0"
63
         version="0.0.0"
64
         unpack="false"/>
65
66
   <plugin
67
         id="org.eclipse.mylyn.docs.epub.ant.core"
68
         download-size="0"
69
         install-size="0"
70
         version="0.0.0"
71
         unpack="false"/>
72
73
</feature>
(-)a/org.eclipse.mylyn.docs.epub-feature/license.html (+108 lines)
Added Link Here
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
6
<title>Eclipse Foundation Software User Agreement</title>
7
</head>
8
9
<body lang="EN-US">
10
<h2>Eclipse Foundation Software User Agreement</h2>
11
<p>February 1, 2011</p>
12
13
<h3>Usage Of Content</h3>
14
15
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
16
   (COLLECTIVELY &quot;CONTENT&quot;).  USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
17
   CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW.  BY USING THE CONTENT, YOU AGREE THAT YOUR USE
18
   OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
19
   NOTICES INDICATED OR REFERENCED BELOW.  IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
20
   CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
21
22
<h3>Applicable Licenses</h3>
23
24
<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
25
   (&quot;EPL&quot;).  A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
26
   For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
27
28
<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
29
   repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
30
31
<ul>
32
       <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content.  Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
33
       <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
34
       <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.  Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;.  Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
35
      and/or Fragments associated with that Feature.</li>
36
       <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
37
</ul>
38
39
<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
40
Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;).  Abouts and Feature Licenses may be located in any directory of a Download or Module
41
including, but not limited to the following locations:</p>
42
43
<ul>
44
       <li>The top-level (root) directory</li>
45
       <li>Plug-in and Fragment directories</li>
46
       <li>Inside Plug-ins and Fragments packaged as JARs</li>
47
       <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
48
       <li>Feature directories</li>
49
</ul>
50
51
<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
52
installation process.  If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
53
inform you where you can locate them.  Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
54
Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
55
that directory.</p>
56
57
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.  SOME OF THESE
58
OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
59
60
<ul>
61
       <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
62
       <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
63
       <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
64
       <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
65
       <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
66
       <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
67
</ul>
68
69
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT.  If no About, Feature License, or Feature Update License is provided, please
70
contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
71
72
73
<h3>Use of Provisioning Technology</h3>
74
75
<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
76
   Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
77
   other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
78
   install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
79
       href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
80
   (&quot;Specification&quot;).</p>
81
82
<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
83
   applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
84
   in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
85
   Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
86
87
<ol>
88
       <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
89
       on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
90
       product.</li>
91
       <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
92
       accessed and copied to the Target Machine.</li>
93
       <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
94
       Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
95
       Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
96
       the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
97
       indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
98
</ol>
99
100
<h3>Cryptography</h3>
101
102
<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
103
   another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
104
   possession, or use, and re-export of encryption software, to see if this is permitted.</p>
105
106
<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
107
</body>
108
</html>
(-)a/org.eclipse.mylyn.docs.epub-feature/pom.xml (+14 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
  <modelVersion>4.0.0</modelVersion>
5
  <parent>
6
    <artifactId>org.eclipse.mylyn.docs-parent</artifactId>
7
    <groupId>org.eclipse.mylyn.docs</groupId>
8
    <version>1.6.0-SNAPSHOT</version>
9
  </parent>
10
  <artifactId>org.eclipse.mylyn.docs.epub</artifactId>
11
  <version>0.8.0-SNAPSHOT</version>
12
  <packaging>eclipse-feature</packaging>
13
  <groupId>org.eclipse.mylyn.docs.epub</groupId>
14
</project>
(-)a/org.eclipse.mylyn.docs.epub.ant.core/.classpath (+7 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
(-)a/org.eclipse.mylyn.docs.epub.ant.core/.gitignore (+1 lines)
Added Link Here
1
/lib
(-)a/org.eclipse.mylyn.docs.epub.ant.core/.project (+28 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.mylyn.docs.epub.ant.core</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
(-)a/org.eclipse.mylyn.docs.epub.ant.core/.settings/org.eclipse.core.resources.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:13 CEST 2011
2
eclipse.preferences.version=1
3
encoding/<project>=UTF-8
(-)a/org.eclipse.mylyn.docs.epub.ant.core/.settings/org.eclipse.core.runtime.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:13 CEST 2011
2
eclipse.preferences.version=1
3
line.separator=\n
(-)a/org.eclipse.mylyn.docs.epub.ant.core/.settings/org.eclipse.jdt.core.prefs (+12 lines)
Added Link Here
1
#Thu Sep 22 12:57:56 CEST 2011
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.5
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12
org.eclipse.jdt.core.compiler.source=1.5
(-)a/org.eclipse.mylyn.docs.epub.ant.core/META-INF/MANIFEST.MF (+12 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: EPUB Ant Support
4
Bundle-SymbolicName: org.eclipse.mylyn.docs.epub.ant.core;singleton:=true
5
Bundle-Version: 0.8.0.qualifier
6
Bundle-Vendor: Torkild U. Resheim
7
Bundle-RequiredExecutionEnvironment: J2SE-1.5
8
Export-Package: org.eclipse.mylyn.docs.epub.ant.core;x-internal:=true;uses:="org.eclipse.mylyn.docs.epub,org.apache.tools.ant.types,org.apache.tools.ant"
9
Require-Bundle: org.apache.ant;bundle-version="[1.8.2,2.0.0)",
10
 org.eclipse.mylyn.docs.epub.core;bundle-version="[0.8.0,1.0.0)",
11
 org.eclipse.ant.core;bundle-version="3.2.300"
12
Bundle-ClassPath: .
(-)a/org.eclipse.mylyn.docs.epub.ant.core/build-ant-jar.xml (+57 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
	Copyright (c) 2009 Chris Aniszczyk and others.
4
    All rights reserved. This program and the accompanying materials
5
    are made available under the terms of the Eclipse Public License v1.0
6
    which accompanies this distribution, and is available at
7
    http://www.eclipse.org/legal/epl-v10.html
8
    
9
    Contributors:
10
        Chris Aniszczyk - initial API and implementation
11
        Torkild U. Resheim - Adapted to build EPUB Ant support
12
-->
13
<project name="Build EPUB Ant Support Jar" default="build">
14
15
	<target name="build" description="Cleans, builds and refreshes" depends="clean, lib/epub-ant.jar" />
16
17
	<target name="init" depends="properties">
18
		<property name="temp.folder" location="${basedir}/temp.folder" />
19
		<property name="build.result.folder" location="${basedir}" />
20
		<property name="src.folder" location="${basedir}/src" />
21
	</target>
22
23
	<target name="properties" if="eclipse.running">
24
		<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
25
	</target>
26
27
	<target name="lib/epub-ant.jar" description="Creates the lib/epub-ant.jar" depends="init">
28
		<property name="destdir" value="${temp.folder}/lib/epub-ant.bin" />
29
		<property name="target.platform.path" value="${eclipse.home}" />
30
		<delete dir="${destdir}" />
31
		<mkdir dir="${destdir}" />
32
		<mkdir dir="${build.result.folder}/lib" />
33
		<!-- compile the source code -->
34
		<javac target="1.5" source="1.5" destdir="${destdir}" failonerror="true" verbose="false" debug="on">
35
			<classpath>
36
				<dirset dir="${basedir}/../">
37
					<include name="org.eclipse.mylyn.docs.epub.core/bin" />
38
				</dirset>
39
			</classpath>
40
			<src path="${src.folder}" />
41
		</javac>
42
		<!-- copy the *.class files to the jar location -->
43
		<copy todir="${destdir}" failonerror="true" overwrite="false">
44
			<fileset dir="${src.folder}">
45
				<exclude name="**/*.java" />
46
				<exclude name="**/package.htm*" />
47
			</fileset>
48
		</copy>
49
		<jar destfile="${build.result.folder}/lib/epub-ant.jar" basedir="${destdir}" />
50
		<delete dir="${temp.folder}" />
51
	</target>
52
53
	<target name="clean" description="Deletes previous build remnants" depends="init">
54
		<delete file="${build.result.folder}/lib/epub-ant.jar" />
55
		<delete dir="${temp.folder}" />
56
	</target>
57
</project>
(-)a/org.eclipse.mylyn.docs.epub.ant.core/build.properties (+5 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               plugin.xml,\
5
               lib/
(-)a/org.eclipse.mylyn.docs.epub.ant.core/plugin.xml (+19 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension
5
         point="org.eclipse.ant.core.antTasks">
6
      <antTask
7
            class="org.eclipse.mylyn.docs.epub.ant.core.EpubTask"
8
            library="lib/epub-ant.jar"
9
            name="epub">
10
      </antTask>
11
   </extension>
12
   <extension
13
         point="org.eclipse.ant.core.extraClasspathEntries">
14
      <extraClasspathEntry
15
            library="lib/epub-ant.jar">
16
      </extraClasspathEntry>
17
   </extension>
18
19
</plugin>
(-)a/org.eclipse.mylyn.docs.epub.ant.core/pom.xml (+48 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
  <modelVersion>4.0.0</modelVersion>
5
  <parent>
6
    <artifactId>org.eclipse.mylyn.docs-parent</artifactId>
7
    <groupId>org.eclipse.mylyn.docs</groupId>
8
    <version>1.6.0-SNAPSHOT</version>
9
  </parent>
10
  <artifactId>org.eclipse.mylyn.docs.epub.ant.core</artifactId>
11
  <version>0.8.0-SNAPSHOT</version>
12
  <packaging>eclipse-plugin</packaging>
13
  <build>
14
    <plugins>
15
			<plugin>
16
				<groupId>org.apache.maven.plugins</groupId>
17
				<artifactId>maven-antrun-plugin</artifactId>
18
				<version>1.6</version>
19
				<executions>
20
					<execution>
21
						<phase>package</phase>
22
						<configuration>
23
							<target>
24
								<jar destfile="lib/epub-ant.jar" basedir="target/classes"/>
25
							</target>
26
						</configuration>
27
						<goals>
28
							<goal>run</goal>
29
						</goals>
30
					</execution>
31
				</executions>
32
			</plugin>
33
      <plugin>
34
        <groupId>org.eclipse.tycho</groupId>
35
        <artifactId>tycho-source-plugin</artifactId>
36
      </plugin>
37
      <plugin>
38
        <groupId>org.codehaus.mojo</groupId>
39
        <artifactId>findbugs-maven-plugin</artifactId>
40
      </plugin>
41
      <plugin>
42
        <groupId>org.apache.maven.plugins</groupId>
43
        <artifactId>maven-pmd-plugin</artifactId>
44
      </plugin>
45
    </plugins>
46
  </build>
47
  <groupId>org.eclipse.mylyn.docs.epub</groupId>
48
</project>
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/ContributorType.java (+66 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * 
17
 * @author Torkild U. Resheim
18
 * @ant.type name="contributor" category="epub"
19
 */
20
public class ContributorType {
21
22
	String fileAs;
23
24
	String id;
25
26
	Locale lang;
27
28
	String name;
29
30
	String role;
31
32
	/**
33
	 * @ant.not-required
34
	 */
35
	public void setFileAs(String fileAs) {
36
		this.fileAs = fileAs;
37
	}
38
39
	/**
40
	 * @ant.not-required
41
	 */
42
	public void setId(String id) {
43
		this.id = id;
44
	}
45
46
	/**
47
	 * @ant.not-required the language code
48
	 */
49
	public void setLang(Locale lang) {
50
		this.lang = lang;
51
	}
52
53
	/**
54
	 * @ant.required name of the contributor
55
	 */
56
	public void setName(String name) {
57
		this.name = name;
58
	}
59
60
	/**
61
	 * @ant.not-required
62
	 */
63
	public void setRole(String role) {
64
		this.role = role;
65
	}
66
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/CoverType.java (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
/**
14
 * 
15
 * @author Torkild U. Resheim
16
 * @ant.type name="cover" category="epub"
17
 */
18
public class CoverType {
19
20
	String image;
21
22
	String value;
23
24
	/**
25
	 * @ant.required
26
	 */
27
	public void addText(String value) {
28
		this.value = value;
29
	}
30
31
	/**
32
	 * @ant.required
33
	 */
34
	public void setImage(String image) {
35
		this.image = image;
36
	}
37
38
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/CoverageType.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * 
17
 * @author Torkild U. Resheim
18
 * @ant.type name="coverage" category="epub"
19
 */
20
public class CoverageType {
21
22
	String id;
23
24
	String text;
25
26
	Locale lang;
27
28
	/**
29
	 * @ant.required
30
	 */
31
	public void addText(String text) {
32
		this.text = text;
33
	}
34
35
	/**
36
	 * @ant.not-required
37
	 */
38
	public void setId(String id) {
39
		this.id = id;
40
	}
41
42
	/**
43
	 * @ant.not-required
44
	 */
45
	public void setLang(Locale lang) {
46
		this.lang = lang;
47
	}
48
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/CreatorType.java (+66 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * 
17
 * @author Torkild U. Resheim
18
 * @ant.type name="creator" category="epub"
19
 */
20
public class CreatorType {
21
22
	String fileAs;
23
24
	String id;
25
26
	Locale lang;
27
28
	String name;
29
30
	String role;
31
32
	/**
33
	 * @ant.not-required
34
	 */
35
	public void setFileAs(String fileAs) {
36
		this.fileAs = fileAs;
37
	}
38
39
	/**
40
	 * @ant.not-required
41
	 */
42
	public void setId(String id) {
43
		this.id = id;
44
	}
45
46
	/**
47
	 * @ant.not-required
48
	 */
49
	public void setLang(Locale lang) {
50
		this.lang = lang;
51
	}
52
53
	/**
54
	 * @ant.required
55
	 */
56
	public void setName(String name) {
57
		this.name = name;
58
	}
59
60
	/**
61
	 * @ant.not-required
62
	 */
63
	public void setRole(String role) {
64
		this.role = role;
65
	}
66
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/DateType.java (+47 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
/**
14
 * 
15
 * @author Torkild U. Resheim
16
 * @ant.type name="date" category="epub"
17
 */
18
public class DateType {
19
20
	String date;
21
22
	String event;
23
24
	String id;
25
26
	/**
27
	 * @ant.required
28
	 */
29
	public void setDate(String date) {
30
		this.date = date;
31
	}
32
33
	/**
34
	 * @ant.not-required
35
	 */
36
	public void setEvent(String event) {
37
		this.event = event;
38
	}
39
40
	/**
41
	 * @ant.not-required
42
	 */
43
	public void setId(String id) {
44
		this.id = id;
45
	}
46
47
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/EpubTask.java (+249 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.io.File;
14
import java.util.ArrayList;
15
16
import org.apache.tools.ant.BuildException;
17
import org.apache.tools.ant.DirectoryScanner;
18
import org.apache.tools.ant.Project;
19
import org.apache.tools.ant.Task;
20
import org.eclipse.mylyn.docs.epub.core.EPUB;
21
import org.eclipse.mylyn.docs.epub.core.OPS2Publication;
22
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
23
import org.eclipse.mylyn.docs.epub.opf.Role;
24
import org.eclipse.mylyn.docs.epub.opf.Type;
25
26
/**
27
 * Assemble a new EPUB.
28
 * 
29
 * 
30
 * @author Torkild U. Resheim
31
 * @ant.task name="epub" category="epub"
32
 */
33
public class EpubTask extends Task {
34
35
	private OPSPublication ops = null;
36
37
	private ArrayList<FileSetType> filesets = null;
38
39
	private TocType toc = null;
40
41
	private File workingFolder;
42
43
	private File epubFile;
44
45
	public EpubTask() {
46
		super();
47
		try {
48
		ops = new OPS2Publication();
49
		filesets = new ArrayList<FileSetType>();
50
		} catch (Exception e) {
51
			e.printStackTrace();
52
		}
53
	}
54
55
	public void addConfiguredContributor(ContributorType item) {
56
		if (item.role == null) {
57
			ops.addContributor(item.id, item.lang, item.name, null, item.fileAs);
58
		} else {
59
			ops.addContributor(item.id, item.lang, item.name, Role.get(item.role), item.fileAs);
60
		}
61
	}
62
63
	public void addConfiguredCover(CoverType item) {
64
		ops.setCover(new File(item.image), item.value);
65
	}
66
67
	public void addConfiguredCoverage(CoverageType coverage) {
68
		ops.addCoverage(coverage.id, coverage.lang, coverage.text);
69
	}
70
71
	public void addConfiguredCreator(CreatorType item) {
72
		if (item.role == null) {
73
			ops.addCreator(item.id, item.lang, item.name, null, item.fileAs);
74
		} else {
75
			ops.addCreator(item.id, item.lang, item.name, Role.get(item.role), item.fileAs);
76
		}
77
	}
78
79
	public void addConfiguredDate(DateType item) {
80
		ops.addDate(item.id, item.date, item.event);
81
	}
82
83
	/**
84
	 * The FileSet sub-element is used to add EPUB artifacts that are not a part
85
	 * of the main text. This can be graphical items and styling (CSS).
86
	 * 
87
	 * @param fs
88
	 *            the fileset to add
89
	 */
90
	public void addConfiguredFileSet(FileSetType fs) {
91
		filesets.add(fs);
92
	}
93
94
	public void addConfiguredFormat(FormatType format) {
95
		ops.addFormat(format.id, format.text);
96
	}
97
98
	/**
99
	 * @ant.required
100
	 */
101
	public void addConfiguredIdentifier(IdentifierType identifier) {
102
		ops.addIdentifier(identifier.id, identifier.scheme, identifier.value);
103
	}
104
105
	/**
106
	 * @ant.required
107
	 */
108
	public void addConfiguredItem(ItemType item) {
109
		ops.addItem(item.id, item.lang, item.file, item.dest, item.type, item.spine, item.linear, item.noToc);
110
	}
111
112
	/**
113
	 * @ant.required
114
	 */
115
	public void addConfiguredLanguage(LanguageType language) {
116
		ops.addLanguage(language.id, language.code);
117
	}
118
119
	public void addConfiguredMeta(MetaType item) {
120
		ops.addMeta(item.name, item.content);
121
	}
122
123
	public void addConfiguredPublisher(PublisherType publisher) {
124
		ops.addPublisher(publisher.id, publisher.lang, publisher.text);
125
	}
126
127
	public void addConfiguredReference(ReferenceType reference) {
128
		Type type = Type.get(reference.type);
129
		if (type == null) {
130
			throw new BuildException("Unknown reference type " + reference.type);
131
		}
132
		ops.addReference(reference.href, reference.title, type);
133
	}
134
135
	public void addConfiguredRelation(RelationType relation) {
136
		ops.addRelation(relation.id, relation.lang, relation.text);
137
	}
138
139
	public void addConfiguredRights(RightsType rights) {
140
		ops.addRights(rights.id, rights.lang, rights.text);
141
	}
142
143
	public void addConfiguredSource(SourceType source) {
144
		ops.addSource(source.id, source.lang, source.text);
145
	}
146
147
	public void addConfiguredSubject(SubjectType subject) {
148
		ops.addSubject(subject.id, subject.lang, subject.text);
149
	}
150
151
	/**
152
	 * @ant.required
153
	 */
154
	public void addConfiguredTitle(TitleType title) {
155
		ops.addTitle(title.id, title.lang, title.text);
156
	}
157
158
	public void addConfiguredToc(TocType toc) {
159
		if (this.toc != null) {
160
			throw new BuildException("Only one table of contents (toc) declaration is allowed.");
161
		}
162
		this.toc = toc;
163
	}
164
165
	public void addConfiguredType(org.eclipse.mylyn.docs.epub.ant.core.TypeType type) {
166
		ops.addType(type.id, type.text);
167
	}
168
169
	private void addFilesets() {
170
		for (FileSetType fs : filesets) {
171
			if (fs.getProject() == null) {
172
				log("Deleting fileset with no project specified;" + " assuming executing project", Project.MSG_VERBOSE);
173
				fs = (FileSetType) fs.clone();
174
				fs.setProject(getProject());
175
			}
176
			final File fsDir = fs.getDir();
177
			if (fsDir == null) {
178
				throw new BuildException("File or Resource without directory or file specified");
179
			} else if (!fsDir.isDirectory()) {
180
				throw new BuildException("Directory does not exist:" + fsDir);
181
			}
182
			DirectoryScanner ds = fs.getDirectoryScanner();
183
			String[] includedFiles = ds.getIncludedFiles();
184
			for (int i = 0; i < includedFiles.length; i++) {
185
				String filename = includedFiles[i].replace('\\', '/');
186
				filename = filename.substring(filename.lastIndexOf("/") + 1);
187
				File base = ds.getBasedir();
188
				File found = new File(base, includedFiles[i]);
189
				ops.addItem(null, fs.lang, found, fs.dest, null, false, true, false);
190
			}
191
192
		}
193
194
	}
195
196
	@Override
197
	public void execute() throws BuildException {
198
		validate();
199
		addFilesets();
200
		if (toc != null) {
201
			if (toc.generate) {
202
				ops.setGenerateToc(true);
203
			} else if (toc.file != null) {
204
				ops.setTableOfContents(toc.file);
205
			}
206
		}
207
		try {
208
			EPUB epub = new EPUB();
209
			epub.add(ops);
210
			if (workingFolder == null) {
211
				epub.pack(epubFile);
212
			} else {
213
				epub.pack(epubFile, workingFolder);
214
			}
215
216
		} catch (Exception e) {
217
			throw new BuildException(e);
218
		}
219
	}
220
221
	/**
222
	 * @ant.not-required Automatically add referenced resources.
223
	 */
224
	public void setIncludeReferenced(boolean automatic) {
225
		ops.setIncludeReferencedResources(automatic);
226
	}
227
228
	/**
229
	 * 
230
	 * 
231
	 * @param file
232
	 *            path to the generated EPUB file.
233
	 */
234
	public void setFile(File file) {
235
		this.epubFile = file;
236
	}
237
238
	public void setIdentifierId(String identifierId) {
239
		ops.setIdentifierId(identifierId);
240
	}
241
242
	public void setWorkingFolder(File workingFolder) {
243
		this.workingFolder = workingFolder;
244
	}
245
246
	private void validate() {
247
	}
248
249
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/FileSetType.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * @author Torkild U. Resheim
17
 * @ant.type name="epubfileset" category="epub"
18
 */
19
public class FileSetType extends org.apache.tools.ant.types.FileSet {
20
21
	String dest;
22
23
	Locale lang;
24
25
	public FileSetType() {
26
27
	}
28
29
	public void setLocale(Locale lang) {
30
		this.lang = lang;
31
	}
32
33
	public void setDest(String dest) {
34
		this.dest = dest;
35
	}
36
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/FormatType.java (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
/**
14
 * @author Torkild U. Resheim
15
 * @ant.type name="format" category="epub"
16
 */
17
public class FormatType {
18
19
	String id;
20
21
	String text;
22
23
	/**
24
	 * @ant.required
25
	 */
26
	public void addText(String text) {
27
		this.text = text;
28
	}
29
30
	/**
31
	 * @ant.not-required
32
	 */
33
	public void setId(String id) {
34
		this.id = id;
35
	}
36
37
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/IdentifierType.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.docs.epub.ant.core;
13
14
/**
15
 * @author Torkild U. Resheim
16
 * @ant.type name="identifier" category="epub"
17
 */
18
public class IdentifierType {
19
20
	String id;
21
22
	String scheme;
23
24
	String value;
25
26
	/**
27
	 * @ant.required
28
	 */
29
	public void addText(String value) {
30
		this.value = value;
31
	}
32
33
	/**
34
	 * @ant.required
35
	 */
36
	public void setId(String id) {
37
		this.id = id;
38
	}
39
40
	/**
41
	 * @ant.required
42
	 */
43
	public void setScheme(String scheme) {
44
		this.scheme = scheme;
45
	}
46
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/ItemType.java (+103 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.io.File;
14
import java.util.Locale;
15
16
/**
17
 * @author Torkild U. Resheim
18
 * @ant.type name="item" category="epub"
19
 */
20
public class ItemType {
21
22
	String dest;
23
24
	File file;
25
26
	String id;
27
28
	Locale lang;
29
30
	/** Default is that items are in reading order */
31
	public boolean linear = true;
32
33
	boolean noToc = false;
34
35
	String page;
36
37
	/** Default is to add the item to the spine */
38
	boolean spine = true;
39
40
	String type;
41
42
	/**
43
	 * @ant.not-required
44
	 */
45
	public void setDest(String dest) {
46
		this.dest = dest;
47
	}
48
49
	/**
50
	 * A file on the local file system.
51
	 * 
52
	 * @param file
53
	 * @ant.required
54
	 */
55
	public void setFile(File file) {
56
		this.file = file;
57
	}
58
59
	/**
60
	 * @ant.not-required
61
	 */
62
	public void setId(String id) {
63
		this.id = id;
64
	}
65
66
	public void setLang(Locale lang) {
67
		this.lang = lang;
68
	}
69
70
	public void setLinear(boolean linear) {
71
		this.linear = linear;
72
	}
73
74
	/**
75
	 * @ant.not-required
76
	 */
77
	public void setNoToc(boolean toc) {
78
		this.noToc = toc;
79
	}
80
81
	/**
82
	 * A page on the wiki.
83
	 * 
84
	 * @param page
85
	 */
86
	public void setPage(String page) {
87
		this.page = page;
88
	}
89
90
	/**
91
	 * @ant.not-required
92
	 */
93
	public void setSpine(boolean spine) {
94
		this.spine = spine;
95
	}
96
97
	/**
98
	 * @ant.not-required
99
	 */
100
	public void setType(String type) {
101
		this.type = type;
102
	}
103
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/LanguageType.java (+32 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
/**
14
 * @author Torkild U. Resheim
15
 * @ant.type name="language" category="epub"
16
 */
17
public class LanguageType {
18
	String code;
19
20
	String id;
21
22
	public void setId(String id) {
23
		this.id = id;
24
	}
25
26
	/**
27
	 * @ant.required
28
	 */
29
	public void setCode(String code) {
30
		this.code = code;
31
	}
32
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/MetaType.java (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
/**
14
 * @author Torkild U. Resheim
15
 * @ant.type name="meta" category="epub"
16
 */
17
public class MetaType {
18
19
	String name;
20
21
	String content;
22
23
	/**
24
	 * @ant.required
25
	 */
26
	public void setName(String name) {
27
		this.name = name;
28
	}
29
30
	/**
31
	 * @ant.required
32
	 */
33
	public void setContent(String content) {
34
		this.content = content;
35
	}
36
37
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/PublisherType.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * @author Torkild U. Resheim
17
 * @ant.type name="publisher" category="epub"
18
 */
19
public class PublisherType {
20
21
	String id;
22
23
	Locale lang;
24
25
	String text;
26
27
	/**
28
	 * @ant.required
29
	 */
30
	public void addText(String text) {
31
		this.text = text;
32
	}
33
34
	/**
35
	 * @ant.not-required
36
	 */
37
	public void setId(String id) {
38
		this.id = id;
39
	}
40
41
	/**
42
	 * @ant.not-required
43
	 */
44
	public void setLang(Locale lang) {
45
		this.lang = lang;
46
	}
47
48
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/ReferenceType.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
/**
14
 * @author Torkild U. Resheim
15
 * @ant.type name="reference" category="epub"
16
 */
17
public class ReferenceType {
18
19
	String href;
20
21
	String title;
22
23
	String type;
24
25
	/**
26
	 * @ant.required
27
	 */
28
	public void setHref(String href) {
29
		this.href = href;
30
	}
31
32
	/**
33
	 * @ant.required
34
	 */
35
	public void setTitle(String title) {
36
		this.title = title;
37
	}
38
39
	/**
40
	 * @ant.required
41
	 */
42
	public void setType(String type) {
43
		this.type = type;
44
	}
45
46
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/RelationType.java (+47 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * @author Torkild U. Resheim
17
 * @ant.type name="relation" category="epub"
18
 */
19
public class RelationType {
20
21
	String id;
22
23
	Locale lang;
24
25
	String text;
26
27
	/**
28
	 * @ant.required
29
	 */
30
	public void addText(String text) {
31
		this.text = text;
32
	}
33
34
	/**
35
	 * @ant.not-required
36
	 */
37
	public void setId(String id) {
38
		this.id = id;
39
	}
40
41
	/**
42
	 * @ant.not-required
43
	 */
44
	public void setLang(Locale lang) {
45
		this.lang = lang;
46
	}
47
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/RightsType.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * @author Torkild U. Resheim
17
 * @ant.type name="rights" category="epub"
18
 */
19
public class RightsType {
20
21
	String id;
22
23
	Locale lang;
24
25
	String text;
26
27
	/**
28
	 * @ant.required
29
	 */
30
	public void addText(String text) {
31
		this.text = text;
32
	}
33
34
	/**
35
	 * @ant.not-required
36
	 */
37
	public void setId(String id) {
38
		this.id = id;
39
	}
40
41
	/**
42
	 * @ant.not-required
43
	 */
44
	public void setLang(Locale lang) {
45
		this.lang = lang;
46
	}
47
48
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/SourceType.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * @author Torkild U. Resheim
17
 * @ant.type name="source" category="epub"
18
 */
19
public class SourceType {
20
21
	String id;
22
23
	Locale lang;
24
25
	String text;
26
27
	/**
28
	 * @ant.required
29
	 */
30
	public void addText(String text) {
31
		this.text = text;
32
	}
33
34
	/**
35
	 * @ant.not-required
36
	 */
37
	public void setId(String id) {
38
		this.id = id;
39
	}
40
41
	/**
42
	 * @ant.not-required
43
	 */
44
	public void setLang(Locale lang) {
45
		this.lang = lang;
46
	}
47
48
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/SubjectType.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * @author Torkild U. Resheim
17
 * @ant.type name="subject" category="epub"
18
 */
19
public class SubjectType {
20
21
	String id;
22
23
	Locale lang;
24
25
	String text;
26
27
	/**
28
	 * @ant.required
29
	 */
30
	public void addText(String text) {
31
		this.text = text;
32
	}
33
34
	/**
35
	 * @ant.not-required
36
	 */
37
	public void setId(String id) {
38
		this.id = id;
39
	}
40
41
	/**
42
	 * @ant.not-required
43
	 */
44
	public void setLang(Locale lang) {
45
		this.lang = lang;
46
	}
47
48
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/TitleType.java (+45 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.util.Locale;
14
15
/**
16
 * @author Torkild U. Resheim
17
 * @ant.type name="title" category="epub"
18
 */
19
public class TitleType {
20
21
	String text;
22
23
	Locale lang;
24
25
	String id;
26
27
	public void setId(String id) {
28
		this.id = id;
29
	}
30
31
	/**
32
	 * @ant.required
33
	 */
34
	public void addText(String text) {
35
		this.text = text;
36
	}
37
38
	/**
39
	 * @ant.not-required
40
	 */
41
	public void setLang(Locale lang) {
42
		this.lang = lang;
43
	}
44
45
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/TocType.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
import java.io.File;
14
15
/**
16
 * Represents a table of contents element in the {@link EpubTask}. One should
17
 * specify either a path to a NCX file or whether or not to generate the NCX.
18
 * 
19
 * @author Torkild U. Resheim
20
 * @ant.type name="toc" category="epub"
21
 */
22
public class TocType {
23
24
	File file;
25
26
	boolean generate;
27
28
	/**
29
	 * @ant.not-required
30
	 */
31
	public void setFile(File file) {
32
		this.file = file;
33
	}
34
35
	/**
36
	 * @ant.not-required
37
	 */
38
	public void setGenerate(boolean generate) {
39
		this.generate = generate;
40
	}
41
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/TypeType.java (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.ant.core;
12
13
/**
14
 * @author Torkild U. Resheim
15
 * @ant.type name="type" category="epub"
16
 */
17
public class TypeType {
18
19
	String id;
20
21
	String text;
22
23
	/**
24
	 * @ant.required
25
	 */
26
	public void addText(String text) {
27
		this.text = text;
28
	}
29
30
	/**
31
	 * @ant.not-required
32
	 */
33
	public void setId(String id) {
34
		this.id = id;
35
	}
36
37
}
(-)a/org.eclipse.mylyn.docs.epub.ant.core/src/org/eclipse/mylyn/docs/epub/ant/core/tasks.xml (+4 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<antlib>
3
	<taskdef name="epub" classname="org.eclipse.mylyn.docs.epub.ant.core.EpubTask" />
4
</antlib>
(-)a/org.eclipse.mylyn.docs.epub.core/.classpath (+8 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src-gen"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
5
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
6
	<classpathentry kind="src" path="src"/>
7
	<classpathentry kind="output" path="bin"/>
8
</classpath>
(-)a/org.eclipse.mylyn.docs.epub.core/.gitignore (+2 lines)
Added Link Here
1
/bin
2
/target
(-)a/org.eclipse.mylyn.docs.epub.core/.project (+28 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.mylyn.docs.epub.core</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
(-)a/org.eclipse.mylyn.docs.epub.core/.settings/org.eclipse.core.resources.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:22 CEST 2011
2
eclipse.preferences.version=1
3
encoding/<project>=UTF-8
(-)a/org.eclipse.mylyn.docs.epub.core/.settings/org.eclipse.core.runtime.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:22 CEST 2011
2
eclipse.preferences.version=1
3
line.separator=\n
(-)a/org.eclipse.mylyn.docs.epub.core/.settings/org.eclipse.jdt.core.prefs (+12 lines)
Added Link Here
1
#Sun May 01 15:29:11 CEST 2011
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.5
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12
org.eclipse.jdt.core.compiler.source=1.5
(-)a/org.eclipse.mylyn.docs.epub.core/META-INF/MANIFEST.MF (+73 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: EPUB Core
4
Bundle-SymbolicName: org.eclipse.mylyn.docs.epub.core;singleton:=true
5
Bundle-Version: 0.8.0.qualifier
6
Bundle-Vendor: Torkild U. Resheim
7
Bundle-RequiredExecutionEnvironment: J2SE-1.5
8
Require-Bundle: org.eclipse.emf.ecore.xmi;bundle-version="[2.5.0,3.0.0)",
9
 org.eclipse.emf.validation;bundle-version="[1.4.0,2.0.0)",
10
 org.eclipse.mylyn.wikitext.core;bundle-version="[1.4.0,2.0.0)",
11
 org.eclipse.emf.mapping.ecore2xml;bundle-version="[2.7.0,3.0.0)"
12
Export-Package: org.eclipse.mylyn.docs.epub.core;uses:="org.eclipse.mylyn.docs.epub.dc,org.eclipse.mylyn.docs.epub.opf,org.eclipse.mylyn.docs.epub.ncx",
13
 org.eclipse.mylyn.docs.epub.core.wikitext,
14
 org.eclipse.mylyn.docs.epub.dc;uses:="org.eclipse.emf.ecore.util,org.eclipse.emf.ecore,org.eclipse.mylyn.docs.epub.opf",
15
 org.eclipse.mylyn.docs.epub.dc.impl;
16
  uses:="org.eclipse.emf.ecore.util,
17
   org.eclipse.emf.ecore,
18
   org.eclipse.mylyn.docs.epub.opf,
19
   org.eclipse.mylyn.docs.epub.dc,
20
   org.eclipse.emf.ecore.impl,
21
   org.eclipse.emf.common.notify",
22
 org.eclipse.mylyn.docs.epub.dc.util;
23
  uses:="org.eclipse.emf.ecore.xmi.impl,
24
   org.eclipse.emf.ecore.resource,
25
   org.eclipse.emf.common.util,
26
   org.eclipse.emf.ecore.resource.impl,
27
   org.eclipse.emf.common.notify,
28
   org.eclipse.emf.ecore.xmi.util,
29
   org.eclipse.emf.ecore.util,
30
   org.eclipse.emf.ecore,
31
   org.eclipse.emf.common.notify.impl,
32
   org.eclipse.mylyn.docs.epub.dc",
33
 org.eclipse.mylyn.docs.epub.ncx;uses:="org.eclipse.emf.ecore.util,org.eclipse.emf.ecore,org.eclipse.emf.common.util",
34
 org.eclipse.mylyn.docs.epub.ncx.impl;
35
  uses:="org.eclipse.emf.ecore.util,
36
   org.eclipse.emf.ecore,
37
   org.eclipse.emf.common.util,
38
   org.eclipse.emf.ecore.impl,
39
   org.eclipse.emf.common.notify,
40
   org.eclipse.mylyn.docs.epub.ncx",
41
 org.eclipse.mylyn.docs.epub.ncx.util;
42
  uses:="org.eclipse.emf.ecore.resource,
43
   org.eclipse.emf.ecore.xmi.impl,
44
   org.eclipse.emf.common.util,
45
   org.eclipse.emf.ecore.xmi.util,
46
   org.eclipse.emf.ecore.resource.impl,
47
   org.eclipse.emf.common.notify,
48
   org.eclipse.mylyn.docs.epub.ncx,
49
   org.eclipse.emf.ecore.util,
50
   org.eclipse.emf.ecore,
51
   org.eclipse.emf.common.notify.impl",
52
 org.eclipse.mylyn.docs.epub.ocf,
53
 org.eclipse.mylyn.docs.epub.opf;uses:="org.eclipse.emf.ecore,org.eclipse.emf.common.util,org.eclipse.mylyn.docs.epub.dc",
54
 org.eclipse.mylyn.docs.epub.opf.impl;
55
  uses:="org.eclipse.emf.ecore,
56
   org.eclipse.emf.common.util,
57
   org.eclipse.mylyn.docs.epub.dc,
58
   org.eclipse.emf.common.notify,
59
   org.eclipse.emf.ecore.impl,
60
   org.eclipse.mylyn.docs.epub.opf",
61
 org.eclipse.mylyn.docs.epub.opf.util;
62
  uses:="org.eclipse.emf.ecore.xmi.impl,
63
   org.eclipse.emf.ecore.resource,
64
   org.eclipse.emf.common.util,
65
   org.eclipse.emf.common.notify,
66
   org.eclipse.mylyn.docs.epub.opf,
67
   org.eclipse.emf.ecore.xmi.util,
68
   org.eclipse.emf.ecore.resource.impl,
69
   org.eclipse.emf.ecore.util,
70
   org.eclipse.emf.ecore,
71
   org.eclipse.emf.common.notify.impl",
72
 org.eclipse.mylyn.internal.docs.epub.core;x-internal:=true
73
Bundle-ClassPath: .
(-)a/org.eclipse.mylyn.docs.epub.core/build.ant (+34 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
	Copyright (c) 2011 Torkild U. Resheim and others.
4
    All rights reserved. This program and the accompanying materials
5
    are made available under the terms of the Eclipse Public License v1.0
6
    which accompanies this distribution, and is available at
7
    http://www.eclipse.org/legal/epl-v10.html
8
    
9
    Contributors:
10
        Torkild U. Resheim - initial API and implementation
11
-->
12
<project name="Build EPUB Model" default="build">
13
14
	<target name="build">
15
		<!--
16
		<delete failonerror="false">
17
			<fileset dir="${basedir}/src-gen/org/eclipse/mylyn/docs/epub/">
18
				<include name="*/**" />
19
			</fileset>
20
		</delete>
21
22
		<eclipse.refreshLocal resource="${basedir}/src-gen" depth="infinite" />
23
24
		<emf.Ecore2Java copyright="Copyright © 2011 Torkild U. Resheim" 
25
			reconcileGenModel="reload" 
26
			generateJavaCode="true" 
27
			model="${basedir}/model/dc.ecore" 
28
			genmodel="${basedir}/model/dc.genmodel" 
29
			modelproject="org.eclipse.mylyn.docs.epub.core" 
30
			modelprojectfragmentpath="src-gen" />
31
		-->
32
	</target>
33
34
</project>
(-)a/org.eclipse.mylyn.docs.epub.core/build.properties (+10 lines)
Added Link Here
1
source.. = src/,\
2
           src-gen/
3
output.. = bin/
4
bin.includes = META-INF/,\
5
               .,\
6
               plugin.xml,\
7
               plugin.properties
8
src.includes = model/,\
9
               build.ant
10
(-)a/org.eclipse.mylyn.docs.epub.core/model/.gitignore (+1 lines)
Added Link Here
1
/relacode.ecore
(-)a/org.eclipse.mylyn.docs.epub.core/model/dc.ecore (+153 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ecore:EPackage xmi:version="2.0"
3
    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="dc"
5
    nsURI="http://purl.org/dc/elements/1.1/" nsPrefix="dc">
6
  <eClassifiers xsi:type="ecore:EClass" name="Title" eSuperTypes="#//LocalizedDCType">
7
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
8
      <details key="kind" value="mixed"/>
9
    </eAnnotations>
10
  </eClassifiers>
11
  <eClassifiers xsi:type="ecore:EClass" name="Creator" eSuperTypes="#//LocalizedDCType">
12
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
13
      <details key="kind" value="mixed"/>
14
    </eAnnotations>
15
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="role" eType="ecore:EEnum opf.ecore#//Role"
16
        unsettable="true">
17
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
18
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
19
      </eAnnotations>
20
    </eStructuralFeatures>
21
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileAs" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
22
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
23
        <details key="name" value="file-as"/>
24
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
25
      </eAnnotations>
26
    </eStructuralFeatures>
27
  </eClassifiers>
28
  <eClassifiers xsi:type="ecore:EClass" name="Subject" eSuperTypes="#//LocalizedDCType">
29
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
30
      <details key="kind" value="mixed"/>
31
    </eAnnotations>
32
  </eClassifiers>
33
  <eClassifiers xsi:type="ecore:EClass" name="Description" eSuperTypes="#//LocalizedDCType">
34
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
35
      <details key="kind" value="mixed"/>
36
    </eAnnotations>
37
  </eClassifiers>
38
  <eClassifiers xsi:type="ecore:EClass" name="Publisher" eSuperTypes="#//LocalizedDCType">
39
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
40
      <details key="kind" value="mixed"/>
41
    </eAnnotations>
42
  </eClassifiers>
43
  <eClassifiers xsi:type="ecore:EClass" name="Contributor" eSuperTypes="#//LocalizedDCType">
44
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
45
      <details key="kind" value="mixed"/>
46
    </eAnnotations>
47
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="role" eType="ecore:EEnum opf.ecore#//Role"
48
        defaultValueLiteral="" unsettable="true">
49
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
50
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
51
      </eAnnotations>
52
    </eStructuralFeatures>
53
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileAs" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
54
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
55
        <details key="name" value="file-as"/>
56
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
57
      </eAnnotations>
58
    </eStructuralFeatures>
59
  </eClassifiers>
60
  <eClassifiers xsi:type="ecore:EClass" name="Date" eSuperTypes="#//DCType">
61
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
62
      <details key="kind" value="mixed"/>
63
    </eAnnotations>
64
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="event" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
65
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
66
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
67
      </eAnnotations>
68
    </eStructuralFeatures>
69
  </eClassifiers>
70
  <eClassifiers xsi:type="ecore:EClass" name="Type" eSuperTypes="#//DCType">
71
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
72
      <details key="kind" value="mixed"/>
73
    </eAnnotations>
74
  </eClassifiers>
75
  <eClassifiers xsi:type="ecore:EClass" name="Format" eSuperTypes="#//DCType">
76
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
77
      <details key="kind" value="mixed"/>
78
    </eAnnotations>
79
  </eClassifiers>
80
  <eClassifiers xsi:type="ecore:EClass" name="Identifier">
81
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
82
      <details key="kind" value="mixed"/>
83
    </eAnnotations>
84
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
85
      <details key="kind" value="mixed"/>
86
    </eAnnotations>
87
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
88
        defaultValueLiteral="BookId"/>
89
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="scheme" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
90
        unsettable="true">
91
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
92
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
93
      </eAnnotations>
94
    </eStructuralFeatures>
95
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" lowerBound="1" upperBound="-1"
96
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
97
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
98
        <details key="kind" value="elementWildcard"/>
99
        <details key="name" value=":mixed"/>
100
      </eAnnotations>
101
    </eStructuralFeatures>
102
  </eClassifiers>
103
  <eClassifiers xsi:type="ecore:EClass" name="Source" eSuperTypes="#//LocalizedDCType">
104
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
105
      <details key="kind" value="mixed"/>
106
    </eAnnotations>
107
  </eClassifiers>
108
  <eClassifiers xsi:type="ecore:EClass" name="Language" eSuperTypes="#//DCType">
109
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
110
      <details key="kind" value="mixed"/>
111
    </eAnnotations>
112
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
113
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
114
        <details key="namespace" value="http://www.w3.org/2001/XMLSchema-instance"/>
115
      </eAnnotations>
116
    </eStructuralFeatures>
117
  </eClassifiers>
118
  <eClassifiers xsi:type="ecore:EClass" name="Relation" eSuperTypes="#//LocalizedDCType">
119
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
120
      <details key="kind" value="mixed"/>
121
    </eAnnotations>
122
  </eClassifiers>
123
  <eClassifiers xsi:type="ecore:EClass" name="Coverage" eSuperTypes="#//LocalizedDCType">
124
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
125
      <details key="kind" value="mixed"/>
126
    </eAnnotations>
127
  </eClassifiers>
128
  <eClassifiers xsi:type="ecore:EClass" name="Rights" eSuperTypes="#//LocalizedDCType">
129
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
130
      <details key="kind" value="mixed"/>
131
    </eAnnotations>
132
  </eClassifiers>
133
  <eClassifiers xsi:type="ecore:EClass" name="DCType" abstract="true">
134
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
135
      <details key="kind" value="mixed"/>
136
    </eAnnotations>
137
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
138
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" lowerBound="1" upperBound="-1"
139
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
140
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
141
        <details key="kind" value="elementWildcard"/>
142
        <details key="name" value=":mixed"/>
143
      </eAnnotations>
144
    </eStructuralFeatures>
145
  </eClassifiers>
146
  <eClassifiers xsi:type="ecore:EClass" name="LocalizedDCType" abstract="true" eSuperTypes="#//DCType">
147
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="lang" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
148
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
149
        <details key="namespace" value="http://www.w3.org/XML/1998/namespace"/>
150
      </eAnnotations>
151
    </eStructuralFeatures>
152
  </eClassifiers>
153
</ecore:EPackage>
(-)a/org.eclipse.mylyn.docs.epub.core/model/ncx.ecore (+695 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ecore:EPackage xmi:version="2.0"
3
    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="ncx"
5
    nsURI="http://www.daisy.org/z3986/2005/ncx/" nsPrefix="ncx">
6
  <eClassifiers xsi:type="ecore:EClass" name="Audio">
7
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
8
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
9
        <details key="kind" value="attribute"/>
10
        <details key="name" value="class"/>
11
      </eAnnotations>
12
    </eStructuralFeatures>
13
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="clipBegin" lowerBound="1"
14
        eType="#//SMILtimeVal">
15
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
16
        <details key="kind" value="attribute"/>
17
        <details key="name" value="clipBegin"/>
18
      </eAnnotations>
19
    </eStructuralFeatures>
20
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="clipEnd" lowerBound="1"
21
        eType="#//SMILtimeVal">
22
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
23
        <details key="kind" value="attribute"/>
24
        <details key="name" value="clipEnd"/>
25
      </eAnnotations>
26
    </eStructuralFeatures>
27
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
28
        iD="true">
29
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
30
        <details key="kind" value="attribute"/>
31
        <details key="name" value="id"/>
32
      </eAnnotations>
33
    </eStructuralFeatures>
34
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="src" lowerBound="1" eType="#//URI">
35
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
36
        <details key="kind" value="attribute"/>
37
        <details key="name" value="src"/>
38
      </eAnnotations>
39
    </eStructuralFeatures>
40
  </eClassifiers>
41
  <eClassifiers xsi:type="ecore:EEnum" name="BookStruct">
42
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
43
      <details key="name" value="bookStruct_._type"/>
44
    </eAnnotations>
45
    <eLiterals name="PAGENUMBER" literal="PAGE_NUMBER"/>
46
    <eLiterals name="NOTE" value="1"/>
47
    <eLiterals name="NOTEREFERENCE" value="2" literal="NOTE_REFERENCE"/>
48
    <eLiterals name="ANNOTATION" value="3"/>
49
    <eLiterals name="LINENUMBER" value="4" literal="LINE_NUMBER"/>
50
    <eLiterals name="OPTIONALSIDEBAR" value="5" literal="OPTIONAL_SIDEBAR"/>
51
    <eLiterals name="OPTIONALPRODUCERNOTE" value="6" literal="OPTIONAL_PRODUCER_NOTE"/>
52
  </eClassifiers>
53
  <eClassifiers xsi:type="ecore:EDataType" name="BookStructObject" instanceClassName="org.eclipse.emf.common.util.Enumerator">
54
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
55
      <details key="name" value="bookStruct_._type:Object"/>
56
      <details key="baseType" value="bookStruct_._type"/>
57
    </eAnnotations>
58
  </eClassifiers>
59
  <eClassifiers xsi:type="ecore:EClass" name="Content">
60
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
61
        iD="true">
62
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
63
        <details key="kind" value="attribute"/>
64
        <details key="name" value="id"/>
65
      </eAnnotations>
66
    </eStructuralFeatures>
67
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="src" lowerBound="1" eType="#//URI">
68
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
69
        <details key="kind" value="attribute"/>
70
        <details key="name" value="src"/>
71
      </eAnnotations>
72
    </eStructuralFeatures>
73
  </eClassifiers>
74
  <eClassifiers xsi:type="ecore:EEnum" name="DefaultState">
75
    <eLiterals name="true"/>
76
    <eLiterals name="false" value="1"/>
77
  </eClassifiers>
78
  <eClassifiers xsi:type="ecore:EDataType" name="DefaultStateObject" instanceClassName="org.eclipse.emf.common.util.Enumerator">
79
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
80
      <details key="name" value="defaultState_._type:Object"/>
81
      <details key="baseType" value="defaultState_._type"/>
82
    </eAnnotations>
83
  </eClassifiers>
84
  <eClassifiers xsi:type="ecore:EEnum" name="DirType">
85
    <eLiterals name="ltr"/>
86
    <eLiterals name="rtl" value="1"/>
87
  </eClassifiers>
88
  <eClassifiers xsi:type="ecore:EDataType" name="DirTypeObject" instanceClassName="org.eclipse.emf.common.util.Enumerator"/>
89
  <eClassifiers xsi:type="ecore:EClass" name="DocAuthor">
90
    <eStructuralFeatures xsi:type="ecore:EReference" name="text" lowerBound="1" eType="#//Text"
91
        containment="true" resolveProxies="false">
92
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
93
        <details key="kind" value="element"/>
94
        <details key="name" value="text"/>
95
        <details key="namespace" value="##targetNamespace"/>
96
      </eAnnotations>
97
    </eStructuralFeatures>
98
    <eStructuralFeatures xsi:type="ecore:EReference" name="audio" eType="#//Audio"
99
        containment="true" resolveProxies="false">
100
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
101
        <details key="kind" value="element"/>
102
        <details key="name" value="audio"/>
103
        <details key="namespace" value="##targetNamespace"/>
104
      </eAnnotations>
105
    </eStructuralFeatures>
106
    <eStructuralFeatures xsi:type="ecore:EReference" name="img" eType="#//Img" containment="true"
107
        resolveProxies="false">
108
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
109
        <details key="kind" value="element"/>
110
        <details key="name" value="img"/>
111
        <details key="namespace" value="##targetNamespace"/>
112
      </eAnnotations>
113
    </eStructuralFeatures>
114
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="dir" eType="#//DirType"
115
        unsettable="true">
116
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
117
        <details key="kind" value="attribute"/>
118
        <details key="name" value="dir"/>
119
      </eAnnotations>
120
    </eStructuralFeatures>
121
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
122
        iD="true">
123
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
124
        <details key="kind" value="attribute"/>
125
        <details key="name" value="id"/>
126
      </eAnnotations>
127
    </eStructuralFeatures>
128
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="lang" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//NMTOKEN">
129
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
130
        <details key="kind" value="attribute"/>
131
        <details key="name" value="lang"/>
132
        <details key="namespace" value="http://www.w3.org/XML/1998/namespace"/>
133
      </eAnnotations>
134
    </eStructuralFeatures>
135
  </eClassifiers>
136
  <eClassifiers xsi:type="ecore:EClass" name="DocTitle">
137
    <eStructuralFeatures xsi:type="ecore:EReference" name="text" lowerBound="1" eType="#//Text"
138
        containment="true" resolveProxies="false">
139
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
140
        <details key="kind" value="element"/>
141
        <details key="name" value="text"/>
142
        <details key="namespace" value="##targetNamespace"/>
143
      </eAnnotations>
144
    </eStructuralFeatures>
145
    <eStructuralFeatures xsi:type="ecore:EReference" name="audio" eType="#//Audio"
146
        containment="true" resolveProxies="false">
147
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
148
        <details key="kind" value="element"/>
149
        <details key="name" value="audio"/>
150
        <details key="namespace" value="##targetNamespace"/>
151
      </eAnnotations>
152
    </eStructuralFeatures>
153
    <eStructuralFeatures xsi:type="ecore:EReference" name="img" eType="#//Img" containment="true"
154
        resolveProxies="false">
155
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
156
        <details key="kind" value="element"/>
157
        <details key="name" value="img"/>
158
        <details key="namespace" value="##targetNamespace"/>
159
      </eAnnotations>
160
    </eStructuralFeatures>
161
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="dir" eType="#//DirType"
162
        unsettable="true">
163
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
164
        <details key="kind" value="attribute"/>
165
        <details key="name" value="dir"/>
166
      </eAnnotations>
167
    </eStructuralFeatures>
168
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
169
        iD="true">
170
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
171
        <details key="kind" value="attribute"/>
172
        <details key="name" value="id"/>
173
      </eAnnotations>
174
    </eStructuralFeatures>
175
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="lang" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//NMTOKEN">
176
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
177
        <details key="kind" value="attribute"/>
178
        <details key="name" value="lang"/>
179
        <details key="namespace" value="http://www.w3.org/XML/1998/namespace"/>
180
      </eAnnotations>
181
    </eStructuralFeatures>
182
  </eClassifiers>
183
  <eClassifiers xsi:type="ecore:EClass" name="Head">
184
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="groups" unique="false"
185
        upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
186
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
187
        <details key="kind" value="group"/>
188
        <details key="name" value="group:0"/>
189
      </eAnnotations>
190
    </eStructuralFeatures>
191
    <eStructuralFeatures xsi:type="ecore:EReference" name="smilCustomTests" upperBound="-1"
192
        eType="#//SmilCustomTest" volatile="true" transient="true" derived="true"
193
        containment="true" resolveProxies="false">
194
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
195
        <details key="kind" value="element"/>
196
        <details key="name" value="smilCustomTest"/>
197
        <details key="namespace" value="##targetNamespace"/>
198
        <details key="group" value="#group:0"/>
199
      </eAnnotations>
200
    </eStructuralFeatures>
201
    <eStructuralFeatures xsi:type="ecore:EReference" name="metas" upperBound="-1"
202
        eType="#//Meta" volatile="true" transient="true" derived="true" containment="true"
203
        resolveProxies="false">
204
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
205
        <details key="kind" value="element"/>
206
        <details key="name" value="meta"/>
207
        <details key="namespace" value="##targetNamespace"/>
208
        <details key="group" value="#group:0"/>
209
      </eAnnotations>
210
    </eStructuralFeatures>
211
  </eClassifiers>
212
  <eClassifiers xsi:type="ecore:EClass" name="Img">
213
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
214
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
215
        <details key="kind" value="attribute"/>
216
        <details key="name" value="class"/>
217
      </eAnnotations>
218
    </eStructuralFeatures>
219
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
220
        iD="true">
221
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
222
        <details key="kind" value="attribute"/>
223
        <details key="name" value="id"/>
224
      </eAnnotations>
225
    </eStructuralFeatures>
226
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="src" lowerBound="1" eType="#//URI">
227
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
228
        <details key="kind" value="attribute"/>
229
        <details key="name" value="src"/>
230
      </eAnnotations>
231
    </eStructuralFeatures>
232
  </eClassifiers>
233
  <eClassifiers xsi:type="ecore:EClass" name="Meta">
234
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="content" lowerBound="1"
235
        eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
236
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
237
        <details key="kind" value="attribute"/>
238
        <details key="name" value="content"/>
239
      </eAnnotations>
240
    </eStructuralFeatures>
241
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
242
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
243
        <details key="kind" value="attribute"/>
244
        <details key="name" value="name"/>
245
      </eAnnotations>
246
    </eStructuralFeatures>
247
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="scheme" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
248
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
249
        <details key="kind" value="attribute"/>
250
        <details key="name" value="scheme"/>
251
      </eAnnotations>
252
    </eStructuralFeatures>
253
  </eClassifiers>
254
  <eClassifiers xsi:type="ecore:EClass" name="NavInfo">
255
    <eStructuralFeatures xsi:type="ecore:EReference" name="text" eType="#//Text" containment="true"
256
        resolveProxies="false">
257
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
258
        <details key="kind" value="element"/>
259
        <details key="name" value="text"/>
260
        <details key="namespace" value="##targetNamespace"/>
261
      </eAnnotations>
262
    </eStructuralFeatures>
263
    <eStructuralFeatures xsi:type="ecore:EReference" name="audio" eType="#//Audio"
264
        containment="true" resolveProxies="false">
265
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
266
        <details key="kind" value="element"/>
267
        <details key="name" value="audio"/>
268
        <details key="namespace" value="##targetNamespace"/>
269
      </eAnnotations>
270
    </eStructuralFeatures>
271
    <eStructuralFeatures xsi:type="ecore:EReference" name="img" eType="#//Img" containment="true"
272
        resolveProxies="false">
273
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
274
        <details key="kind" value="element"/>
275
        <details key="name" value="img"/>
276
        <details key="namespace" value="##targetNamespace"/>
277
      </eAnnotations>
278
    </eStructuralFeatures>
279
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="dir" eType="#//DirType"
280
        unsettable="true">
281
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
282
        <details key="kind" value="attribute"/>
283
        <details key="name" value="dir"/>
284
      </eAnnotations>
285
    </eStructuralFeatures>
286
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="lang" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//NMTOKEN">
287
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
288
        <details key="kind" value="attribute"/>
289
        <details key="name" value="lang"/>
290
        <details key="namespace" value="http://www.w3.org/XML/1998/namespace"/>
291
      </eAnnotations>
292
    </eStructuralFeatures>
293
  </eClassifiers>
294
  <eClassifiers xsi:type="ecore:EClass" name="NavLabel">
295
    <eStructuralFeatures xsi:type="ecore:EReference" name="text" eType="#//Text" containment="true"
296
        resolveProxies="false">
297
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
298
        <details key="kind" value="element"/>
299
        <details key="name" value="text"/>
300
        <details key="namespace" value="##targetNamespace"/>
301
      </eAnnotations>
302
    </eStructuralFeatures>
303
    <eStructuralFeatures xsi:type="ecore:EReference" name="audio" eType="#//Audio"
304
        containment="true" resolveProxies="false">
305
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
306
        <details key="kind" value="element"/>
307
        <details key="name" value="audio"/>
308
        <details key="namespace" value="##targetNamespace"/>
309
      </eAnnotations>
310
    </eStructuralFeatures>
311
    <eStructuralFeatures xsi:type="ecore:EReference" name="img" eType="#//Img" containment="true"
312
        resolveProxies="false">
313
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
314
        <details key="kind" value="element"/>
315
        <details key="name" value="img"/>
316
        <details key="namespace" value="##targetNamespace"/>
317
      </eAnnotations>
318
    </eStructuralFeatures>
319
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="dir" eType="#//DirType"
320
        unsettable="true">
321
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
322
        <details key="kind" value="attribute"/>
323
        <details key="name" value="dir"/>
324
      </eAnnotations>
325
    </eStructuralFeatures>
326
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="lang" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//NMTOKEN">
327
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
328
        <details key="kind" value="attribute"/>
329
        <details key="name" value="lang"/>
330
        <details key="namespace" value="http://www.w3.org/XML/1998/namespace"/>
331
      </eAnnotations>
332
    </eStructuralFeatures>
333
  </eClassifiers>
334
  <eClassifiers xsi:type="ecore:EClass" name="NavList">
335
    <eStructuralFeatures xsi:type="ecore:EReference" name="navInfos" upperBound="-1"
336
        eType="#//NavInfo" containment="true" resolveProxies="false">
337
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
338
        <details key="kind" value="element"/>
339
        <details key="name" value="navInfo"/>
340
        <details key="namespace" value="##targetNamespace"/>
341
      </eAnnotations>
342
    </eStructuralFeatures>
343
    <eStructuralFeatures xsi:type="ecore:EReference" name="navLabels" lowerBound="1"
344
        upperBound="-1" eType="#//NavLabel" containment="true" resolveProxies="false">
345
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
346
        <details key="kind" value="element"/>
347
        <details key="name" value="navLabel"/>
348
        <details key="namespace" value="##targetNamespace"/>
349
      </eAnnotations>
350
    </eStructuralFeatures>
351
    <eStructuralFeatures xsi:type="ecore:EReference" name="navTargets" lowerBound="1"
352
        upperBound="-1" eType="#//NavTarget" containment="true" resolveProxies="false">
353
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
354
        <details key="kind" value="element"/>
355
        <details key="name" value="navTarget"/>
356
        <details key="namespace" value="##targetNamespace"/>
357
      </eAnnotations>
358
    </eStructuralFeatures>
359
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
360
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
361
        <details key="kind" value="attribute"/>
362
        <details key="name" value="class"/>
363
      </eAnnotations>
364
    </eStructuralFeatures>
365
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
366
        iD="true">
367
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
368
        <details key="kind" value="attribute"/>
369
        <details key="name" value="id"/>
370
      </eAnnotations>
371
    </eStructuralFeatures>
372
  </eClassifiers>
373
  <eClassifiers xsi:type="ecore:EClass" name="NavMap">
374
    <eStructuralFeatures xsi:type="ecore:EReference" name="navInfos" upperBound="-1"
375
        eType="#//NavInfo" containment="true" resolveProxies="false">
376
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
377
        <details key="kind" value="element"/>
378
        <details key="name" value="navInfo"/>
379
        <details key="namespace" value="##targetNamespace"/>
380
      </eAnnotations>
381
    </eStructuralFeatures>
382
    <eStructuralFeatures xsi:type="ecore:EReference" name="navLabels" upperBound="-1"
383
        eType="#//NavLabel" containment="true" resolveProxies="false">
384
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
385
        <details key="kind" value="element"/>
386
        <details key="name" value="navLabel"/>
387
        <details key="namespace" value="##targetNamespace"/>
388
      </eAnnotations>
389
    </eStructuralFeatures>
390
    <eStructuralFeatures xsi:type="ecore:EReference" name="navPoints" lowerBound="1"
391
        upperBound="-1" eType="#//NavPoint" containment="true" resolveProxies="false">
392
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
393
        <details key="kind" value="element"/>
394
        <details key="name" value="navPoint"/>
395
        <details key="namespace" value="##targetNamespace"/>
396
      </eAnnotations>
397
    </eStructuralFeatures>
398
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
399
        iD="true">
400
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
401
        <details key="kind" value="attribute"/>
402
        <details key="name" value="id"/>
403
      </eAnnotations>
404
    </eStructuralFeatures>
405
  </eClassifiers>
406
  <eClassifiers xsi:type="ecore:EClass" name="NavPoint">
407
    <eStructuralFeatures xsi:type="ecore:EReference" name="navLabels" lowerBound="1"
408
        upperBound="-1" eType="#//NavLabel" containment="true" resolveProxies="false">
409
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
410
        <details key="name" value="navLabel"/>
411
        <details key="namespace" value="##targetNamespace"/>
412
      </eAnnotations>
413
    </eStructuralFeatures>
414
    <eStructuralFeatures xsi:type="ecore:EReference" name="content" lowerBound="1"
415
        eType="#//Content" containment="true" resolveProxies="false">
416
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
417
        <details key="kind" value="element"/>
418
        <details key="name" value="content"/>
419
        <details key="namespace" value="##targetNamespace"/>
420
      </eAnnotations>
421
    </eStructuralFeatures>
422
    <eStructuralFeatures xsi:type="ecore:EReference" name="navPoints" upperBound="-1"
423
        eType="#//NavPoint" containment="true" resolveProxies="false">
424
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
425
        <details key="kind" value="element"/>
426
        <details key="name" value="navPoint"/>
427
        <details key="namespace" value="##targetNamespace"/>
428
      </eAnnotations>
429
    </eStructuralFeatures>
430
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
431
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
432
        <details key="kind" value="attribute"/>
433
        <details key="name" value="class"/>
434
      </eAnnotations>
435
    </eStructuralFeatures>
436
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
437
        iD="true">
438
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
439
        <details key="kind" value="attribute"/>
440
        <details key="name" value="id"/>
441
      </eAnnotations>
442
    </eStructuralFeatures>
443
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="playOrder" lowerBound="1"
444
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
445
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
446
        <details key="kind" value="attribute"/>
447
        <details key="name" value="playOrder"/>
448
      </eAnnotations>
449
    </eStructuralFeatures>
450
  </eClassifiers>
451
  <eClassifiers xsi:type="ecore:EClass" name="NavTarget">
452
    <eStructuralFeatures xsi:type="ecore:EReference" name="navLabels" lowerBound="1"
453
        upperBound="-1" eType="#//NavLabel" containment="true" resolveProxies="false">
454
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
455
        <details key="kind" value="element"/>
456
        <details key="name" value="navLabel"/>
457
        <details key="namespace" value="##targetNamespace"/>
458
      </eAnnotations>
459
    </eStructuralFeatures>
460
    <eStructuralFeatures xsi:type="ecore:EReference" name="content" lowerBound="1"
461
        eType="#//Content" containment="true" resolveProxies="false">
462
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
463
        <details key="kind" value="element"/>
464
        <details key="name" value="content"/>
465
        <details key="namespace" value="##targetNamespace"/>
466
      </eAnnotations>
467
    </eStructuralFeatures>
468
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
469
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
470
        <details key="kind" value="attribute"/>
471
        <details key="name" value="class"/>
472
      </eAnnotations>
473
    </eStructuralFeatures>
474
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
475
        iD="true">
476
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
477
        <details key="kind" value="attribute"/>
478
        <details key="name" value="id"/>
479
      </eAnnotations>
480
    </eStructuralFeatures>
481
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="playOrder" lowerBound="1"
482
        eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
483
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
484
        <details key="kind" value="attribute"/>
485
        <details key="name" value="playOrder"/>
486
      </eAnnotations>
487
    </eStructuralFeatures>
488
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
489
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
490
        <details key="kind" value="attribute"/>
491
        <details key="name" value="value"/>
492
      </eAnnotations>
493
    </eStructuralFeatures>
494
  </eClassifiers>
495
  <eClassifiers xsi:type="ecore:EClass" name="Ncx">
496
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
497
      <details key="name" value="ncx"/>
498
    </eAnnotations>
499
    <eStructuralFeatures xsi:type="ecore:EReference" name="head" lowerBound="1" eType="#//Head"
500
        containment="true" resolveProxies="false">
501
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
502
        <details key="kind" value="element"/>
503
        <details key="name" value="head"/>
504
        <details key="namespace" value="##targetNamespace"/>
505
      </eAnnotations>
506
    </eStructuralFeatures>
507
    <eStructuralFeatures xsi:type="ecore:EReference" name="docTitle" lowerBound="1"
508
        eType="#//DocTitle" containment="true" resolveProxies="false">
509
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
510
        <details key="kind" value="element"/>
511
        <details key="name" value="docTitle"/>
512
        <details key="namespace" value="##targetNamespace"/>
513
      </eAnnotations>
514
    </eStructuralFeatures>
515
    <eStructuralFeatures xsi:type="ecore:EReference" name="docAuthors" upperBound="-1"
516
        eType="#//DocAuthor" containment="true" resolveProxies="false">
517
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
518
        <details key="kind" value="element"/>
519
        <details key="name" value="docAuthor"/>
520
        <details key="namespace" value="##targetNamespace"/>
521
      </eAnnotations>
522
    </eStructuralFeatures>
523
    <eStructuralFeatures xsi:type="ecore:EReference" name="navMap" lowerBound="1"
524
        eType="#//NavMap" containment="true" resolveProxies="false">
525
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
526
        <details key="kind" value="element"/>
527
        <details key="name" value="navMap"/>
528
        <details key="namespace" value="##targetNamespace"/>
529
      </eAnnotations>
530
    </eStructuralFeatures>
531
    <eStructuralFeatures xsi:type="ecore:EReference" name="pageList" eType="#//PageList"
532
        containment="true" resolveProxies="false">
533
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
534
        <details key="kind" value="element"/>
535
        <details key="name" value="pageList"/>
536
        <details key="namespace" value="##targetNamespace"/>
537
      </eAnnotations>
538
    </eStructuralFeatures>
539
    <eStructuralFeatures xsi:type="ecore:EReference" name="navLists" upperBound="-1"
540
        eType="#//NavList" containment="true" resolveProxies="false">
541
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
542
        <details key="kind" value="element"/>
543
        <details key="name" value="navList"/>
544
        <details key="namespace" value="##targetNamespace"/>
545
      </eAnnotations>
546
    </eStructuralFeatures>
547
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="dir" eType="#//DirType"
548
        unsettable="true">
549
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
550
        <details key="kind" value="attribute"/>
551
        <details key="name" value="dir"/>
552
      </eAnnotations>
553
    </eStructuralFeatures>
554
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="lang" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//NMTOKEN">
555
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
556
        <details key="kind" value="attribute"/>
557
        <details key="name" value="lang"/>
558
        <details key="namespace" value="http://www.w3.org/XML/1998/namespace"/>
559
      </eAnnotations>
560
    </eStructuralFeatures>
561
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" lowerBound="1"
562
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="2005-1"
563
        unsettable="true">
564
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
565
        <details key="kind" value="attribute"/>
566
        <details key="name" value="version"/>
567
      </eAnnotations>
568
    </eStructuralFeatures>
569
  </eClassifiers>
570
  <eClassifiers xsi:type="ecore:EEnum" name="OverrideType">
571
    <eLiterals name="visible"/>
572
    <eLiterals name="hidden" value="1"/>
573
  </eClassifiers>
574
  <eClassifiers xsi:type="ecore:EDataType" name="OverrideObject" instanceClassName="org.eclipse.emf.common.util.Enumerator"/>
575
  <eClassifiers xsi:type="ecore:EClass" name="PageList">
576
    <eStructuralFeatures xsi:type="ecore:EReference" name="navInfos" upperBound="-1"
577
        eType="#//NavInfo" containment="true" resolveProxies="false">
578
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
579
        <details key="kind" value="element"/>
580
        <details key="name" value="navInfo"/>
581
        <details key="namespace" value="##targetNamespace"/>
582
      </eAnnotations>
583
    </eStructuralFeatures>
584
    <eStructuralFeatures xsi:type="ecore:EReference" name="navLabels" upperBound="-1"
585
        eType="#//NavLabel" containment="true" resolveProxies="false">
586
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
587
        <details key="kind" value="element"/>
588
        <details key="name" value="navLabel"/>
589
        <details key="namespace" value="##targetNamespace"/>
590
      </eAnnotations>
591
    </eStructuralFeatures>
592
    <eStructuralFeatures xsi:type="ecore:EReference" name="pageTargets" lowerBound="1"
593
        upperBound="-1" eType="#//PageTarget" containment="true" resolveProxies="false">
594
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
595
        <details key="kind" value="element"/>
596
        <details key="name" value="pageTarget"/>
597
        <details key="namespace" value="##targetNamespace"/>
598
      </eAnnotations>
599
    </eStructuralFeatures>
600
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
601
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
602
        <details key="kind" value="attribute"/>
603
        <details key="name" value="class"/>
604
      </eAnnotations>
605
    </eStructuralFeatures>
606
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
607
        iD="true">
608
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
609
        <details key="kind" value="attribute"/>
610
        <details key="name" value="id"/>
611
      </eAnnotations>
612
    </eStructuralFeatures>
613
  </eClassifiers>
614
  <eClassifiers xsi:type="ecore:EClass" name="PageTarget">
615
    <eStructuralFeatures xsi:type="ecore:EReference" name="navLabels" lowerBound="1"
616
        upperBound="-1" eType="#//NavLabel" containment="true" resolveProxies="false">
617
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
618
        <details key="namespace" value="##targetNamespace"/>
619
      </eAnnotations>
620
    </eStructuralFeatures>
621
    <eStructuralFeatures xsi:type="ecore:EReference" name="content" lowerBound="1"
622
        eType="#//Content" containment="true" resolveProxies="false">
623
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
624
        <details key="namespace" value="##targetNamespace"/>
625
      </eAnnotations>
626
    </eStructuralFeatures>
627
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType"/>
628
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
629
        iD="true"/>
630
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="playOrder" lowerBound="1"
631
        eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType"/>
632
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" lowerBound="1" eType="#//Type"
633
        unsettable="true"/>
634
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType"/>
635
  </eClassifiers>
636
  <eClassifiers xsi:type="ecore:EClass" name="SmilCustomTest">
637
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="bookStruct" eType="#//BookStruct"
638
        unsettable="true"/>
639
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultState" eType="#//DefaultState"
640
        defaultValueLiteral="false" unsettable="true"/>
641
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
642
        iD="true"/>
643
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="override" eType="#//OverrideType"
644
        defaultValueLiteral="hidden" unsettable="true"/>
645
  </eClassifiers>
646
  <eClassifiers xsi:type="ecore:EDataType" name="SMILtimeVal" instanceClassName="java.lang.String">
647
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
648
      <details key="name" value="SMILtimeVal"/>
649
      <details key="baseType" value="http://www.eclipse.org/emf/2003/XMLType#string"/>
650
    </eAnnotations>
651
  </eClassifiers>
652
  <eClassifiers xsi:type="ecore:EClass" name="Text">
653
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
654
      <details key="kind" value="mixed"/>
655
    </eAnnotations>
656
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" unique="false" upperBound="-1"
657
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry">
658
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
659
        <details key="kind" value="elementWildcard"/>
660
        <details key="name" value=":mixed"/>
661
      </eAnnotations>
662
    </eStructuralFeatures>
663
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//AnySimpleType">
664
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
665
        <details key="kind" value="attribute"/>
666
        <details key="name" value="class"/>
667
      </eAnnotations>
668
    </eStructuralFeatures>
669
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//ID"
670
        iD="true">
671
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
672
        <details key="kind" value="attribute"/>
673
        <details key="name" value="id"/>
674
      </eAnnotations>
675
    </eStructuralFeatures>
676
  </eClassifiers>
677
  <eClassifiers xsi:type="ecore:EEnum" name="Type">
678
    <eLiterals name="front"/>
679
    <eLiterals name="normal" value="1"/>
680
    <eLiterals name="special" value="2"/>
681
  </eClassifiers>
682
  <eClassifiers xsi:type="ecore:EDataType" name="TypeObject" instanceClassName="org.eclipse.emf.common.util.Enumerator"/>
683
  <eClassifiers xsi:type="ecore:EDataType" name="URI" instanceClassName="java.lang.String">
684
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
685
      <details key="name" value="URI"/>
686
      <details key="baseType" value="http://www.eclipse.org/emf/2003/XMLType#string"/>
687
    </eAnnotations>
688
  </eClassifiers>
689
  <eClassifiers xsi:type="ecore:EDataType" name="VersionObject" instanceClassName="org.eclipse.emf.common.util.Enumerator">
690
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
691
      <details key="name" value="version_._type:Object"/>
692
      <details key="baseType" value="version_._type"/>
693
    </eAnnotations>
694
  </eClassifiers>
695
</ecore:EPackage>
(-)a/org.eclipse.mylyn.docs.epub.core/model/ncx.genmodel (+168 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<genmodel:GenModel xmi:version="2.0"
3
    xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
4
    xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.mylyn.docs.epub.core/src-gen"
5
    modelPluginID="org.eclipse.mylyn.docs.epub.core" modelName="NCX-2005-1" importerID="org.eclipse.emf.importer.ecore"
6
    complianceLevel="5.0" copyrightFields="false" runtimeVersion="2.6">
7
  <foreignModel>ncx.ecore</foreignModel>
8
  <genPackages prefix="NCX" basePackage="org.eclipse.mylyn.docs.epub" resource="XML"
9
      disposableProviderFactory="true" ecorePackage="ncx.ecore#/">
10
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="ncx.ecore#//BookStruct">
11
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//BookStruct/PAGENUMBER"/>
12
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//BookStruct/NOTE"/>
13
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//BookStruct/NOTEREFERENCE"/>
14
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//BookStruct/ANNOTATION"/>
15
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//BookStruct/LINENUMBER"/>
16
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//BookStruct/OPTIONALSIDEBAR"/>
17
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//BookStruct/OPTIONALPRODUCERNOTE"/>
18
    </genEnums>
19
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="ncx.ecore#//DefaultState">
20
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//DefaultState/true"/>
21
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//DefaultState/false"/>
22
    </genEnums>
23
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="ncx.ecore#//DirType">
24
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//DirType/ltr"/>
25
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//DirType/rtl"/>
26
    </genEnums>
27
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="ncx.ecore#//OverrideType">
28
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//OverrideType/visible"/>
29
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//OverrideType/hidden"/>
30
    </genEnums>
31
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="ncx.ecore#//Type">
32
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//Type/front"/>
33
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//Type/normal"/>
34
      <genEnumLiterals ecoreEnumLiteral="ncx.ecore#//Type/special"/>
35
    </genEnums>
36
    <genDataTypes ecoreDataType="ncx.ecore#//BookStructObject"/>
37
    <genDataTypes ecoreDataType="ncx.ecore#//DefaultStateObject"/>
38
    <genDataTypes ecoreDataType="ncx.ecore#//DirTypeObject"/>
39
    <genDataTypes ecoreDataType="ncx.ecore#//OverrideObject"/>
40
    <genDataTypes ecoreDataType="ncx.ecore#//SMILtimeVal"/>
41
    <genDataTypes ecoreDataType="ncx.ecore#//TypeObject"/>
42
    <genDataTypes ecoreDataType="ncx.ecore#//URI"/>
43
    <genDataTypes ecoreDataType="ncx.ecore#//VersionObject"/>
44
    <genClasses ecoreClass="ncx.ecore#//Audio">
45
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Audio/class"/>
46
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Audio/clipBegin"/>
47
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Audio/clipEnd"/>
48
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Audio/id"/>
49
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Audio/src"/>
50
    </genClasses>
51
    <genClasses ecoreClass="ncx.ecore#//Content">
52
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Content/id"/>
53
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Content/src"/>
54
    </genClasses>
55
    <genClasses ecoreClass="ncx.ecore#//DocAuthor">
56
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//DocAuthor/text"/>
57
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//DocAuthor/audio"/>
58
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//DocAuthor/img"/>
59
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//DocAuthor/dir"/>
60
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//DocAuthor/id"/>
61
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//DocAuthor/lang"/>
62
    </genClasses>
63
    <genClasses ecoreClass="ncx.ecore#//DocTitle">
64
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//DocTitle/text"/>
65
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//DocTitle/audio"/>
66
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//DocTitle/img"/>
67
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//DocTitle/dir"/>
68
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//DocTitle/id"/>
69
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//DocTitle/lang"/>
70
    </genClasses>
71
    <genClasses ecoreClass="ncx.ecore#//Head">
72
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute ncx.ecore#//Head/group"/>
73
      <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference ncx.ecore#//Head/smilCustomTest"/>
74
      <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference ncx.ecore#//Head/meta"/>
75
    </genClasses>
76
    <genClasses ecoreClass="ncx.ecore#//Img">
77
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Img/class"/>
78
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Img/id"/>
79
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Img/src"/>
80
    </genClasses>
81
    <genClasses ecoreClass="ncx.ecore#//Meta">
82
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Meta/content"/>
83
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Meta/name"/>
84
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Meta/scheme"/>
85
    </genClasses>
86
    <genClasses ecoreClass="ncx.ecore#//NavInfo">
87
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavInfo/text"/>
88
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavInfo/audio"/>
89
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavInfo/img"/>
90
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavInfo/dir"/>
91
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavInfo/lang"/>
92
    </genClasses>
93
    <genClasses ecoreClass="ncx.ecore#//NavLabel">
94
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavLabel/text"/>
95
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavLabel/audio"/>
96
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavLabel/img"/>
97
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavLabel/dir"/>
98
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavLabel/lang"/>
99
    </genClasses>
100
    <genClasses ecoreClass="ncx.ecore#//NavList">
101
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavList/navInfo"/>
102
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavList/navLabel"/>
103
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavList/navTarget"/>
104
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavList/class"/>
105
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavList/id"/>
106
    </genClasses>
107
    <genClasses ecoreClass="ncx.ecore#//NavMap">
108
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavMap/navInfo"/>
109
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavMap/navLabel"/>
110
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavMap/navPoint"/>
111
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavMap/id"/>
112
    </genClasses>
113
    <genClasses ecoreClass="ncx.ecore#//NavPoint">
114
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavPoint/navLabels"/>
115
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavPoint/content"/>
116
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavPoint/navPoint"/>
117
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavPoint/class"/>
118
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavPoint/id"/>
119
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavPoint/playOrder"/>
120
    </genClasses>
121
    <genClasses ecoreClass="ncx.ecore#//NavTarget">
122
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavTarget/navLabel"/>
123
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//NavTarget/content"/>
124
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavTarget/class"/>
125
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavTarget/id"/>
126
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavTarget/playOrder"/>
127
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//NavTarget/value"/>
128
    </genClasses>
129
    <genClasses ecoreClass="ncx.ecore#//Ncx">
130
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//Ncx/head"/>
131
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//Ncx/docTitle"/>
132
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//Ncx/docAuthor"/>
133
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//Ncx/navMap"/>
134
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//Ncx/pageList"/>
135
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//Ncx/navList"/>
136
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Ncx/dir"/>
137
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Ncx/lang"/>
138
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Ncx/version"/>
139
    </genClasses>
140
    <genClasses ecoreClass="ncx.ecore#//PageList">
141
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//PageList/navInfo"/>
142
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//PageList/navLabel"/>
143
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//PageList/pageTarget"/>
144
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//PageList/class"/>
145
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//PageList/id"/>
146
    </genClasses>
147
    <genClasses ecoreClass="ncx.ecore#//PageTarget">
148
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//PageTarget/navLabel"/>
149
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ncx.ecore#//PageTarget/content"/>
150
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//PageTarget/class"/>
151
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//PageTarget/id"/>
152
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//PageTarget/playOrder"/>
153
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//PageTarget/type"/>
154
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//PageTarget/value"/>
155
    </genClasses>
156
    <genClasses ecoreClass="ncx.ecore#//SmilCustomTest">
157
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//SmilCustomTest/bookStruct"/>
158
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//SmilCustomTest/defaultState"/>
159
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//SmilCustomTest/id"/>
160
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//SmilCustomTest/override"/>
161
    </genClasses>
162
    <genClasses ecoreClass="ncx.ecore#//Text">
163
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute ncx.ecore#//Text/mixed"/>
164
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Text/class"/>
165
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ncx.ecore#//Text/id"/>
166
    </genClasses>
167
  </genPackages>
168
</genmodel:GenModel>
(-)a/org.eclipse.mylyn.docs.epub.core/model/ocf.ecore (+45 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ecore:EPackage xmi:version="2.0"
3
    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="ocf"
5
    nsURI="urn:oasis:names:tc:opendocument:xmlns:container" nsPrefix="ocf">
6
  <eClassifiers xsi:type="ecore:EClass" name="Container">
7
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
8
      <details key="name" value="container"/>
9
      <details key="namespace" value="urn:oasis:names:tc:opendocument:xmlns:container"/>
10
    </eAnnotations>
11
    <eStructuralFeatures xsi:type="ecore:EReference" name="rootfiles" lowerBound="1"
12
        eType="#//RootFiles" containment="true">
13
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
14
        <details key="name" value="rootfiles"/>
15
        <details key="namespace" value="urn:oasis:names:tc:opendocument:xmlns:container"/>
16
      </eAnnotations>
17
    </eStructuralFeatures>
18
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
19
  </eClassifiers>
20
  <eClassifiers xsi:type="ecore:EClass" name="RootFiles">
21
    <eStructuralFeatures xsi:type="ecore:EReference" name="rootfiles" lowerBound="1"
22
        upperBound="-1" eType="#//RootFile" containment="true">
23
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
24
        <details key="name" value="rootfile"/>
25
        <details key="namespace" value="urn:oasis:names:tc:opendocument:xmlns:container"/>
26
      </eAnnotations>
27
    </eStructuralFeatures>
28
  </eClassifiers>
29
  <eClassifiers xsi:type="ecore:EClass" name="RootFile">
30
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="fullPath" lowerBound="1"
31
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
32
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
33
        <details key="name" value="full-path"/>
34
      </eAnnotations>
35
    </eStructuralFeatures>
36
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="mediaType" lowerBound="1"
37
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
38
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
39
        <details key="name" value="media-type"/>
40
      </eAnnotations>
41
    </eStructuralFeatures>
42
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="publication" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"
43
        transient="true"/>
44
  </eClassifiers>
45
</ecore:EPackage>
(-)a/org.eclipse.mylyn.docs.epub.core/model/ocf.genmodel (+21 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<genmodel:GenModel xmi:version="2.0"
3
    xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
4
    xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.mylyn.docs.epub.core/src-gen"
5
    modelPluginID="org.eclipse.mylyn.docs.epub.core" modelName="Ocf" importerID="org.eclipse.emf.importer.ecore"
6
    complianceLevel="5.0" copyrightFields="false" runtimeVersion="2.6">
7
  <foreignModel>ocf.ecore</foreignModel>
8
  <genPackages prefix="OCF" basePackage="org.eclipse.mylyn.docs.epub" resource="XML"
9
      disposableProviderFactory="true" ecorePackage="ocf.ecore#/">
10
    <genClasses ecoreClass="ocf.ecore#//Container">
11
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ocf.ecore#//Container/rootfiles"/>
12
    </genClasses>
13
    <genClasses ecoreClass="ocf.ecore#//RootFiles">
14
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference ocf.ecore#//RootFiles/rootfiles"/>
15
    </genClasses>
16
    <genClasses ecoreClass="ocf.ecore#//RootFile">
17
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ocf.ecore#//RootFile/fullPath"/>
18
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute ocf.ecore#//RootFile/mediaType"/>
19
    </genClasses>
20
  </genPackages>
21
</genmodel:GenModel>
(-)a/org.eclipse.mylyn.docs.epub.core/model/opf.ecore (+498 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ecore:EPackage xmi:version="2.0"
3
    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="opf"
5
    nsURI="http://www.idpf.org/2007/opf" nsPrefix="opf">
6
  <eClassifiers xsi:type="ecore:EClass" name="Package">
7
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
8
      <details key="name" value="package"/>
9
      <details key="namespace" value="http://www.idpf.org/2007/opf"/>
10
    </eAnnotations>
11
    <eStructuralFeatures xsi:type="ecore:EReference" name="metadata" lowerBound="1"
12
        eType="#//Metadata" containment="true">
13
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
14
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
15
      </eAnnotations>
16
    </eStructuralFeatures>
17
    <eStructuralFeatures xsi:type="ecore:EReference" name="manifest" lowerBound="1"
18
        eType="#//Manifest" containment="true">
19
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
20
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
21
      </eAnnotations>
22
    </eStructuralFeatures>
23
    <eStructuralFeatures xsi:type="ecore:EReference" name="spine" lowerBound="1" eType="#//Spine"
24
        containment="true">
25
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
26
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
27
      </eAnnotations>
28
    </eStructuralFeatures>
29
    <eStructuralFeatures xsi:type="ecore:EReference" name="guide" eType="#//Guide"
30
        containment="true">
31
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
32
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
33
      </eAnnotations>
34
    </eStructuralFeatures>
35
    <eStructuralFeatures xsi:type="ecore:EReference" name="tours" eType="#//Tours">
36
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
37
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
38
      </eAnnotations>
39
    </eStructuralFeatures>
40
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" lowerBound="1"
41
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="2.0"
42
        unsettable="true"/>
43
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="uniqueIdentifier" lowerBound="1"
44
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
45
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
46
        <details key="name" value="unique-identifier"/>
47
      </eAnnotations>
48
    </eStructuralFeatures>
49
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="generateCoverHTML" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
50
        transient="true"/>
51
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="generateTableOfContents"
52
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" transient="true"/>
53
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="includeReferencedResources"
54
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" transient="true"/>
55
  </eClassifiers>
56
  <eClassifiers xsi:type="ecore:EClass" name="Metadata">
57
    <eStructuralFeatures xsi:type="ecore:EReference" name="titles" lowerBound="1"
58
        upperBound="-1" eType="ecore:EClass dc.ecore#//Title" containment="true">
59
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
60
        <details key="name" value="title"/>
61
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
62
      </eAnnotations>
63
    </eStructuralFeatures>
64
    <eStructuralFeatures xsi:type="ecore:EReference" name="creators" upperBound="-1"
65
        eType="ecore:EClass dc.ecore#//Creator" containment="true">
66
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
67
        <details key="name" value="creator"/>
68
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
69
      </eAnnotations>
70
    </eStructuralFeatures>
71
    <eStructuralFeatures xsi:type="ecore:EReference" name="subjects" lowerBound="1"
72
        upperBound="-1" eType="ecore:EClass dc.ecore#//Subject" containment="true">
73
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
74
        <details key="name" value="subject"/>
75
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
76
      </eAnnotations>
77
    </eStructuralFeatures>
78
    <eStructuralFeatures xsi:type="ecore:EReference" name="descriptions" upperBound="-1"
79
        eType="ecore:EClass dc.ecore#//Description" containment="true">
80
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
81
        <details key="name" value="description"/>
82
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
83
      </eAnnotations>
84
    </eStructuralFeatures>
85
    <eStructuralFeatures xsi:type="ecore:EReference" name="publishers" upperBound="-1"
86
        eType="ecore:EClass dc.ecore#//Publisher" containment="true">
87
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
88
        <details key="name" value="publisher"/>
89
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
90
      </eAnnotations>
91
    </eStructuralFeatures>
92
    <eStructuralFeatures xsi:type="ecore:EReference" name="contributors" upperBound="-1"
93
        eType="ecore:EClass dc.ecore#//Contributor" containment="true">
94
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
95
        <details key="name" value="contributor"/>
96
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
97
      </eAnnotations>
98
    </eStructuralFeatures>
99
    <eStructuralFeatures xsi:type="ecore:EReference" name="dates" upperBound="-1"
100
        eType="ecore:EClass dc.ecore#//Date" containment="true">
101
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
102
        <details key="name" value="date"/>
103
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
104
      </eAnnotations>
105
    </eStructuralFeatures>
106
    <eStructuralFeatures xsi:type="ecore:EReference" name="types" upperBound="-1"
107
        eType="ecore:EClass dc.ecore#//Type" containment="true">
108
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
109
        <details key="name" value="type"/>
110
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
111
      </eAnnotations>
112
    </eStructuralFeatures>
113
    <eStructuralFeatures xsi:type="ecore:EReference" name="formats" upperBound="-1"
114
        eType="ecore:EClass dc.ecore#//Format" containment="true">
115
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
116
        <details key="name" value="format"/>
117
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
118
      </eAnnotations>
119
    </eStructuralFeatures>
120
    <eStructuralFeatures xsi:type="ecore:EReference" name="identifiers" lowerBound="1"
121
        upperBound="-1" eType="ecore:EClass dc.ecore#//Identifier" containment="true">
122
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
123
        <details key="name" value="identifier"/>
124
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
125
      </eAnnotations>
126
    </eStructuralFeatures>
127
    <eStructuralFeatures xsi:type="ecore:EReference" name="sources" upperBound="-1"
128
        eType="ecore:EClass dc.ecore#//Source" containment="true">
129
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
130
        <details key="name" value="source"/>
131
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
132
      </eAnnotations>
133
    </eStructuralFeatures>
134
    <eStructuralFeatures xsi:type="ecore:EReference" name="languages" lowerBound="1"
135
        upperBound="-1" eType="ecore:EClass dc.ecore#//Language" containment="true">
136
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
137
        <details key="name" value="language"/>
138
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
139
      </eAnnotations>
140
    </eStructuralFeatures>
141
    <eStructuralFeatures xsi:type="ecore:EReference" name="relations" upperBound="-1"
142
        eType="ecore:EClass dc.ecore#//Relation" containment="true">
143
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
144
        <details key="name" value="relation"/>
145
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
146
      </eAnnotations>
147
    </eStructuralFeatures>
148
    <eStructuralFeatures xsi:type="ecore:EReference" name="coverages" upperBound="-1"
149
        eType="ecore:EClass dc.ecore#//Coverage" containment="true">
150
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
151
        <details key="name" value="coverage"/>
152
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
153
      </eAnnotations>
154
    </eStructuralFeatures>
155
    <eStructuralFeatures xsi:type="ecore:EReference" name="rights" upperBound="-1"
156
        eType="ecore:EClass dc.ecore#//Rights" containment="true">
157
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
158
        <details key="name" value="rights"/>
159
        <details key="namespace" value="http://purl.org/dc/elements/1.1/"/>
160
      </eAnnotations>
161
    </eStructuralFeatures>
162
    <eStructuralFeatures xsi:type="ecore:EReference" name="metas" upperBound="-1"
163
        eType="#//Meta" containment="true">
164
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
165
        <details key="name" value="meta"/>
166
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
167
      </eAnnotations>
168
    </eStructuralFeatures>
169
  </eClassifiers>
170
  <eClassifiers xsi:type="ecore:EClass" name="Manifest">
171
    <eStructuralFeatures xsi:type="ecore:EReference" name="items" lowerBound="1" upperBound="-1"
172
        eType="#//Item" containment="true">
173
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
174
        <details key="name" value="item"/>
175
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
176
      </eAnnotations>
177
    </eStructuralFeatures>
178
  </eClassifiers>
179
  <eClassifiers xsi:type="ecore:EClass" name="Item">
180
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
181
        iD="true"/>
182
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="href" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
183
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="media_type" lowerBound="1"
184
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
185
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
186
        <details key="name" value="media-type"/>
187
      </eAnnotations>
188
    </eStructuralFeatures>
189
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="fallback" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
190
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="fallback_style" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
191
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
192
        <details key="name" value="fallback-style"/>
193
      </eAnnotations>
194
    </eStructuralFeatures>
195
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="required_namespace" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
196
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
197
        <details key="name" value="required-namespace"/>
198
      </eAnnotations>
199
    </eStructuralFeatures>
200
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="required_modules" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
201
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
202
        <details key="name" value="required-modules"/>
203
      </eAnnotations>
204
    </eStructuralFeatures>
205
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="file" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
206
        transient="true"/>
207
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="noToc" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
208
        transient="true"/>
209
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
210
        transient="true"/>
211
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="generated" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
212
        transient="true"/>
213
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="sourcePath" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
214
        transient="true"/>
215
  </eClassifiers>
216
  <eClassifiers xsi:type="ecore:EClass" name="Spine">
217
    <eStructuralFeatures xsi:type="ecore:EReference" name="spineItems" upperBound="-1"
218
        eType="#//Itemref" containment="true">
219
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
220
        <details key="name" value="itemref"/>
221
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
222
      </eAnnotations>
223
    </eStructuralFeatures>
224
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="toc" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
225
  </eClassifiers>
226
  <eClassifiers xsi:type="ecore:EClass" name="Guide">
227
    <eStructuralFeatures xsi:type="ecore:EReference" name="guideItems" upperBound="-1"
228
        eType="#//Reference" containment="true">
229
      <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
230
        <details key="name" value="reference"/>
231
        <details key="namespace" value="http://www.idpf.org/2007/opf"/>
232
      </eAnnotations>
233
    </eStructuralFeatures>
234
  </eClassifiers>
235
  <eClassifiers xsi:type="ecore:EClass" name="Reference">
236
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" lowerBound="1" eType="#//Type"
237
        unsettable="true"/>
238
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
239
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="href" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
240
  </eClassifiers>
241
  <eClassifiers xsi:type="ecore:EClass" name="Itemref">
242
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="idref" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
243
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="linear" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
244
  </eClassifiers>
245
  <eClassifiers xsi:type="ecore:EClass" name="Tours"/>
246
  <eClassifiers xsi:type="ecore:EEnum" name="Role">
247
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
248
      <details key="namespace" value="##targetNamespace"/>
249
    </eAnnotations>
250
    <eLiterals name="Art_copyist" literal="acp"/>
251
    <eLiterals name="Actor" literal="act"/>
252
    <eLiterals name="Adapter" literal="adp"/>
253
    <eLiterals name="Author_of_afterword_colophon_etc" literal="aft"/>
254
    <eLiterals name="Analyst" literal="anl"/>
255
    <eLiterals name="Animator" literal="anm"/>
256
    <eLiterals name="Annotator" literal="ann"/>
257
    <eLiterals name="Bibliographic_antecedent" literal="ant"/>
258
    <eLiterals name="Applicant" literal="app"/>
259
    <eLiterals name="Author_in_quotations_or_text_abstracts" literal="aqt"/>
260
    <eLiterals name="Architect" literal="arc"/>
261
    <eLiterals name="Artistic_director" literal="ard"/>
262
    <eLiterals name="Arranger" literal="arr"/>
263
    <eLiterals name="Artist" literal="art"/>
264
    <eLiterals name="Assignee" literal="asg"/>
265
    <eLiterals name="Associated_name" literal="asn"/>
266
    <eLiterals name="Attributed_name" literal="att"/>
267
    <eLiterals name="Auctioneer" literal="auc"/>
268
    <eLiterals name="Author_of_dialog" literal="aud"/>
269
    <eLiterals name="Author_of_introduction" literal="aui"/>
270
    <eLiterals name="Author_of_screenplay" literal="aus"/>
271
    <eLiterals name="Author" literal="aut"/>
272
    <eLiterals name="Binding_designer" literal="bdd"/>
273
    <eLiterals name="Bookjacket_designer" literal="bjd"/>
274
    <eLiterals name="Book_designer" literal="bkd"/>
275
    <eLiterals name="Book_producer" literal="bkp"/>
276
    <eLiterals name="Blurb_writer" literal="blw"/>
277
    <eLiterals name="Binder" literal="bnd"/>
278
    <eLiterals name="Bookplate_designer" literal="bpd"/>
279
    <eLiterals name="Bookseller" literal="bsl"/>
280
    <eLiterals name="Conceptor" literal="ccp"/>
281
    <eLiterals name="Choreographer" literal="chr"/>
282
    <eLiterals name="Collaborator" literal="clb"/>
283
    <eLiterals name="Client" literal="cli"/>
284
    <eLiterals name="Calligrapher" literal="cll"/>
285
    <eLiterals name="Colorist" literal="clr"/>
286
    <eLiterals name="Collotyper" literal="clt"/>
287
    <eLiterals name="Commentator" literal="cmm"/>
288
    <eLiterals name="Composer" literal="cmp"/>
289
    <eLiterals name="Compositor" literal="cmt"/>
290
    <eLiterals name="Cinematographer" literal="cng"/>
291
    <eLiterals name="Conductor" literal="cnd"/>
292
    <eLiterals name="Censor" literal="cns"/>
293
    <eLiterals name="Contestant_appellee" literal="coe"/>
294
    <eLiterals name="Collector" literal="col"/>
295
    <eLiterals name="Compiler" literal="com"/>
296
    <eLiterals name="Conservator" literal="con"/>
297
    <eLiterals name="Contestant" literal="cos"/>
298
    <eLiterals name="Contestant_appellant" literal="cot"/>
299
    <eLiterals name="Cover_designer" literal="cov"/>
300
    <eLiterals name="Copyright_claimant" literal="cpc"/>
301
    <eLiterals name="Complainant_appellee" literal="cpe"/>
302
    <eLiterals name="Copyright_holder" literal="cph"/>
303
    <eLiterals name="Complainant" literal="cpl"/>
304
    <eLiterals name="Complainant_appellant" literal="cpt"/>
305
    <eLiterals name="Creator" literal="cre"/>
306
    <eLiterals name="Correspondent" literal="crp"/>
307
    <eLiterals name="Corrector" literal="crr"/>
308
    <eLiterals name="Consultant" literal="csl"/>
309
    <eLiterals name="Consultant_to_a_project" literal="csp"/>
310
    <eLiterals name="Costume_designer" literal="cst"/>
311
    <eLiterals name="Contributor" literal="ctb"/>
312
    <eLiterals name="Contestee_appellee" literal="cte"/>
313
    <eLiterals name="Cartographer" literal="ctg"/>
314
    <eLiterals name="Contractor" literal="ctr"/>
315
    <eLiterals name="Contestee" literal="cts"/>
316
    <eLiterals name="Contestee_appellant" literal="ctt"/>
317
    <eLiterals name="Curator" literal="cur"/>
318
    <eLiterals name="Commentator_for_written_text" literal="cwt"/>
319
    <eLiterals name="Defendant" literal="dfd"/>
320
    <eLiterals name="Defendant_appellee" literal="dfe"/>
321
    <eLiterals name="Defendant_appellant" literal="dft"/>
322
    <eLiterals name="Degree_grantor" literal="dgg"/>
323
    <eLiterals name="Dissertant" literal="dis"/>
324
    <eLiterals name="Delineator" literal="dln"/>
325
    <eLiterals name="Dancer" literal="dnc"/>
326
    <eLiterals name="Donor" literal="dnr"/>
327
    <eLiterals name="Distribution_place" literal="dpb"/>
328
    <eLiterals name="Depicted" literal="dpc"/>
329
    <eLiterals name="Depositor" literal="dpt"/>
330
    <eLiterals name="Draftsman" literal="drm"/>
331
    <eLiterals name="Director" literal="drt"/>
332
    <eLiterals name="Designer" literal="dsr"/>
333
    <eLiterals name="Distributor" literal="dst"/>
334
    <eLiterals name="Data_contributor" literal="dtc"/>
335
    <eLiterals name="Dedicatee" literal="dte"/>
336
    <eLiterals name="Data_manager" literal="dtm"/>
337
    <eLiterals name="Dedicator" literal="dto"/>
338
    <eLiterals name="Dubious_author" literal="dub"/>
339
    <eLiterals name="Editor" literal="edt"/>
340
    <eLiterals name="Engraver" literal="egr"/>
341
    <eLiterals name="Electrician" literal="elg"/>
342
    <eLiterals name="Electrotyper" literal="elt"/>
343
    <eLiterals name="Engineer" literal="eng"/>
344
    <eLiterals name="Etcher" literal="etr"/>
345
    <eLiterals name="Event_place" literal="evp"/>
346
    <eLiterals name="Expert" literal="exp"/>
347
    <eLiterals name="Facsimilist" literal="fac"/>
348
    <eLiterals name="Field_director" literal="fld"/>
349
    <eLiterals name="Film_editor" literal="flm"/>
350
    <eLiterals name="Former_owner" literal="fmo"/>
351
    <eLiterals name="First_party" literal="fpy"/>
352
    <eLiterals name="Funder" literal="fnd"/>
353
    <eLiterals name="Forger" literal="frg"/>
354
    <eLiterals name="Geographic_information_specialist" literal="gis"/>
355
    <eLiterals name="Graphic_technician" literal="_grt"/>
356
    <eLiterals name="Honoree" literal="hnr"/>
357
    <eLiterals name="Host" literal="hst"/>
358
    <eLiterals name="Illustrator" literal="ill"/>
359
    <eLiterals name="Illuminator" literal="ilu"/>
360
    <eLiterals name="Inscriber" literal="ins"/>
361
    <eLiterals name="Inventor" literal="inv"/>
362
    <eLiterals name="Instrumentalist" literal="itr"/>
363
    <eLiterals name="Interviewee" literal="ive"/>
364
    <eLiterals name="Interviewer" literal="ivr"/>
365
    <eLiterals name="Laboratory" literal="lbr"/>
366
    <eLiterals name="Librettist" literal="lbt"/>
367
    <eLiterals name="Laboratory_director" literal="ldr"/>
368
    <eLiterals name="Lead" literal="led"/>
369
    <eLiterals name="Libelee_appellee" literal="lee"/>
370
    <eLiterals name="Libelee" literal="lel"/>
371
    <eLiterals name="Lender" literal="len"/>
372
    <eLiterals name="Libelee_appellant" literal="let"/>
373
    <eLiterals name="Lighting_designer" literal="lgd"/>
374
    <eLiterals name="Libelant_appellee" literal="lie"/>
375
    <eLiterals name="Libelant" literal="lil"/>
376
    <eLiterals name="Libelant_appellant" literal="lit"/>
377
    <eLiterals name="Landscape_architect" literal="lsa"/>
378
    <eLiterals name="Licensee" literal="lse"/>
379
    <eLiterals name="Licensor" literal="lso"/>
380
    <eLiterals name="Lithographer" literal="ltg"/>
381
    <eLiterals name="Lyricist" literal="lyr"/>
382
    <eLiterals name="Music_copyist" literal="mcp"/>
383
    <eLiterals name="Manufacture_place" literal="mfp"/>
384
    <eLiterals name="Manufacturer" literal="mfr"/>
385
    <eLiterals name="Metadata_contact" literal="mdc"/>
386
    <eLiterals name="Moderator" literal="mod"/>
387
    <eLiterals name="Monitor" literal="mon"/>
388
    <eLiterals name="Marbler" literal="mrb"/>
389
    <eLiterals name="Markup_editor" literal="mrk"/>
390
    <eLiterals name="Musical_director" literal="msd"/>
391
    <eLiterals name="Metal_engraver" literal="mte"/>
392
    <eLiterals name="Musician" literal="mus"/>
393
    <eLiterals name="Narrator" literal="nrt"/>
394
    <eLiterals name="Opponent" literal="opn"/>
395
    <eLiterals name="Originator" literal="org"/>
396
    <eLiterals name="Organizer_of_meeting" literal="orm"/>
397
    <eLiterals name="Other" literal="oth"/>
398
    <eLiterals name="Owner" literal="own"/>
399
    <eLiterals name="Patron" literal="pat"/>
400
    <eLiterals name="Publishing_director" literal="pbd"/>
401
    <eLiterals name="Publisher" literal="pbl"/>
402
    <eLiterals name="Project_director" literal="pdr"/>
403
    <eLiterals name="Proofreader" literal="pfr"/>
404
    <eLiterals name="Photographer" literal="pht"/>
405
    <eLiterals name="Platemaker" literal="plt"/>
406
    <eLiterals name="Permitting_agency" literal="pma"/>
407
    <eLiterals name="Production_manager" literal="pmn"/>
408
    <eLiterals name="Printer_of_plates" literal="pop"/>
409
    <eLiterals name="Papermaker" literal="ppm"/>
410
    <eLiterals name="Puppeteer" literal="ppt"/>
411
    <eLiterals name="Process_contact" literal="prc"/>
412
    <eLiterals name="Production_personnel" literal="prd"/>
413
    <eLiterals name="Performer" literal="prf"/>
414
    <eLiterals name="Programmer" literal="prg"/>
415
    <eLiterals name="Printmaker" literal="prm"/>
416
    <eLiterals name="Producer" literal="pro"/>
417
    <eLiterals name="Production_place" literal="prp"/>
418
    <eLiterals name="Printer" literal="prt"/>
419
    <eLiterals name="Patent_applicant" literal="pta"/>
420
    <eLiterals name="Plaintiff_appellee" literal="pte"/>
421
    <eLiterals name="Plaintiff" literal="ptf"/>
422
    <eLiterals name="Patent_holder" literal="pth"/>
423
    <eLiterals name="Plaintiff_appellant" literal="ptt"/>
424
    <eLiterals name="Publication_place" literal="pup"/>
425
    <eLiterals name="Rubricator" literal="rbr"/>
426
    <eLiterals name="Recording_engineer" literal="rce"/>
427
    <eLiterals name="Recipient" literal="rcp"/>
428
    <eLiterals name="Redactor" literal="red"/>
429
    <eLiterals name="Renderer" literal="ren"/>
430
    <eLiterals name="Researcher" literal="res"/>
431
    <eLiterals name="Reviewer" literal="rev"/>
432
    <eLiterals name="Repository" literal="rps"/>
433
    <eLiterals name="Reporter" literal="rpt"/>
434
    <eLiterals name="Responsible_party" literal="rpy"/>
435
    <eLiterals name="Respondent_appellee" literal="rse"/>
436
    <eLiterals name="Restager" literal="rsg"/>
437
    <eLiterals name="Respondent" literal="rsp"/>
438
    <eLiterals name="Respondent_appellant" literal="rst"/>
439
    <eLiterals name="Research_team_head" literal="rth"/>
440
    <eLiterals name="Research_team_member" literal="rtm"/>
441
    <eLiterals name="Scientific_advisor" literal="sad"/>
442
    <eLiterals name="Scenarist" literal="sce"/>
443
    <eLiterals name="Sculptor" literal="scl"/>
444
    <eLiterals name="Scribe" literal="scr"/>
445
    <eLiterals name="Sound_designer" literal="sds"/>
446
    <eLiterals name="Secretary" literal="sec"/>
447
    <eLiterals name="Signer" literal="sgn"/>
448
    <eLiterals name="Supporting_host" literal="sht"/>
449
    <eLiterals name="Singer" literal="sng"/>
450
    <eLiterals name="Speaker" literal="spk"/>
451
    <eLiterals name="Sponsor" literal="spn"/>
452
    <eLiterals name="Second_party" literal="spy"/>
453
    <eLiterals name="Surveyor" literal="srv"/>
454
    <eLiterals name="Set_designer" literal="std"/>
455
    <eLiterals name="Storyteller" literal="stl"/>
456
    <eLiterals name="Stage_manager" literal="stm"/>
457
    <eLiterals name="Standards_body" literal="stn"/>
458
    <eLiterals name="Stereotyper" literal="str"/>
459
    <eLiterals name="Technical_director" literal="tcd"/>
460
    <eLiterals name="Teacher" literal="tch"/>
461
    <eLiterals name="Thesis_advisor" literal="ths"/>
462
    <eLiterals name="Transcriber" literal="trc"/>
463
    <eLiterals name="Translator" literal="trl"/>
464
    <eLiterals name="Type_designer" literal="tyd"/>
465
    <eLiterals name="Typographer" literal="tyg"/>
466
    <eLiterals name="University_place" literal="uvp"/>
467
    <eLiterals name="Videographer" literal="vdg"/>
468
    <eLiterals name="Vocalist" literal="voc"/>
469
    <eLiterals name="Writer_of_accompanying_material" literal="wam"/>
470
    <eLiterals name="Woodcutter" literal="wdc"/>
471
    <eLiterals name="Wood_engraver" literal="wde"/>
472
    <eLiterals name="Witness" literal="wit"/>
473
  </eClassifiers>
474
  <eClassifiers xsi:type="ecore:EEnum" name="Type">
475
    <eLiterals name="Cover" value="1" literal="cover"/>
476
    <eLiterals name="Title" value="2" literal="title-page"/>
477
    <eLiterals name="TOC" value="3" literal="toc"/>
478
    <eLiterals name="Index" value="4" literal="index"/>
479
    <eLiterals name="Glossary" value="5" literal="glossary"/>
480
    <eLiterals name="Acknowledgements" value="6" literal="acknowledgements"/>
481
    <eLiterals name="Bibliography" value="7" literal="bibliography"/>
482
    <eLiterals name="Colophon" value="8" literal="colophon"/>
483
    <eLiterals name="Copyright" value="9" literal="copyright-page"/>
484
    <eLiterals name="Dedication" value="10" literal="dedication"/>
485
    <eLiterals name="Epigraph" value="11" literal="epigraph"/>
486
    <eLiterals name="Foreword" value="12" literal="foreword"/>
487
    <eLiterals name="Illustrations" value="13" literal="loi"/>
488
    <eLiterals name="Tables" value="14" literal="lot"/>
489
    <eLiterals name="Notes" value="15" literal="notes"/>
490
    <eLiterals name="Preface" value="16" literal="preface"/>
491
    <eLiterals name="Text" value="17" literal="text"/>
492
  </eClassifiers>
493
  <eClassifiers xsi:type="ecore:EClass" name="Meta">
494
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
495
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="content" lowerBound="1"
496
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
497
  </eClassifiers>
498
</ecore:EPackage>
(-)a/org.eclipse.mylyn.docs.epub.core/model/opf.genmodel (+371 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<genmodel:GenModel xmi:version="2.0"
3
    xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
4
    xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.mylyn.docs.epub.core/src-gen"
5
    modelPluginID="org.eclipse.mylyn.docs.epub.core" modelName="OPF-2.0.1" modelPluginClass=""
6
    nonNLSMarkers="true" runtimeCompatibility="true" testsDirectory="/org.eclipse.mylyn.docs.epub.tests/src-gen"
7
    importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false"
8
    publicConstructors="true" runtimeVersion="2.6" language="en" interfaceNamePattern="">
9
  <foreignModel>opf.ecore</foreignModel>
10
  <genPackages prefix="OPF" basePackage="org.eclipse.mylyn.docs.epub" resource="XML"
11
      disposableProviderFactory="true" dataTypeConverters="true" ecorePackage="opf.ecore#/">
12
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="opf.ecore#//Role">
13
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Art_copyist"/>
14
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Actor"/>
15
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Adapter"/>
16
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Author_of_afterword_colophon_etc"/>
17
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Analyst"/>
18
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Animator"/>
19
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Annotator"/>
20
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Bibliographic_antecedent"/>
21
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Applicant"/>
22
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Author_in_quotations_or_text_abstracts"/>
23
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Architect"/>
24
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Artistic_director"/>
25
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Arranger"/>
26
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Artist"/>
27
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Assignee"/>
28
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Associated_name"/>
29
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Attributed_name"/>
30
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Auctioneer"/>
31
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Author_of_dialog"/>
32
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Author_of_introduction"/>
33
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Author_of_screenplay"/>
34
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Author"/>
35
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Binding_designer"/>
36
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Bookjacket_designer"/>
37
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Book_designer"/>
38
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Book_producer"/>
39
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Blurb_writer"/>
40
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Binder"/>
41
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Bookplate_designer"/>
42
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Bookseller"/>
43
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Conceptor"/>
44
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Choreographer"/>
45
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Collaborator"/>
46
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Client"/>
47
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Calligrapher"/>
48
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Colorist"/>
49
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Collotyper"/>
50
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Commentator"/>
51
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Composer"/>
52
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Compositor"/>
53
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Cinematographer"/>
54
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Conductor"/>
55
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Censor"/>
56
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contestant_appellee"/>
57
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Collector"/>
58
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Compiler"/>
59
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Conservator"/>
60
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contestant"/>
61
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contestant_appellant"/>
62
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Cover_designer"/>
63
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Copyright_claimant"/>
64
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Complainant_appellee"/>
65
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Copyright_holder"/>
66
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Complainant"/>
67
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Complainant_appellant"/>
68
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Creator"/>
69
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Correspondent"/>
70
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Corrector"/>
71
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Consultant"/>
72
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Consultant_to_a_project"/>
73
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Costume_designer"/>
74
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contributor"/>
75
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contestee_appellee"/>
76
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Cartographer"/>
77
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contractor"/>
78
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contestee"/>
79
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Contestee_appellant"/>
80
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Curator"/>
81
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Commentator_for_written_text"/>
82
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Defendant"/>
83
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Defendant_appellee"/>
84
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Defendant_appellant"/>
85
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Degree_grantor"/>
86
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Dissertant"/>
87
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Delineator"/>
88
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Dancer"/>
89
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Donor"/>
90
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Distribution_place"/>
91
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Depicted"/>
92
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Depositor"/>
93
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Draftsman"/>
94
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Director"/>
95
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Designer"/>
96
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Distributor"/>
97
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Data_contributor"/>
98
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Dedicatee"/>
99
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Data_manager"/>
100
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Dedicator"/>
101
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Dubious_author"/>
102
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Editor"/>
103
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Engraver"/>
104
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Electrician"/>
105
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Electrotyper"/>
106
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Engineer"/>
107
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Etcher"/>
108
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Event_place"/>
109
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Expert"/>
110
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Facsimilist"/>
111
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Field_director"/>
112
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Film_editor"/>
113
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Former_owner"/>
114
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/First_party"/>
115
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Funder"/>
116
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Forger"/>
117
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Geographic_information_specialist"/>
118
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Graphic_technician"/>
119
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Honoree"/>
120
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Host"/>
121
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Illustrator"/>
122
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Illuminator"/>
123
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Inscriber"/>
124
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Inventor"/>
125
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Instrumentalist"/>
126
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Interviewee"/>
127
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Interviewer"/>
128
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Laboratory"/>
129
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Librettist"/>
130
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Laboratory_director"/>
131
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Lead"/>
132
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Libelee_appellee"/>
133
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Libelee"/>
134
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Lender"/>
135
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Libelee_appellant"/>
136
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Lighting_designer"/>
137
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Libelant_appellee"/>
138
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Libelant"/>
139
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Libelant_appellant"/>
140
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Landscape_architect"/>
141
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Licensee"/>
142
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Licensor"/>
143
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Lithographer"/>
144
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Lyricist"/>
145
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Music_copyist"/>
146
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Manufacture_place"/>
147
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Manufacturer"/>
148
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Metadata_contact"/>
149
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Moderator"/>
150
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Monitor"/>
151
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Marbler"/>
152
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Markup_editor"/>
153
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Musical_director"/>
154
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Metal_engraver"/>
155
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Musician"/>
156
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Narrator"/>
157
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Opponent"/>
158
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Originator"/>
159
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Organizer_of_meeting"/>
160
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Other"/>
161
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Owner"/>
162
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Patron"/>
163
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Publishing_director"/>
164
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Publisher"/>
165
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Project_director"/>
166
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Proofreader"/>
167
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Photographer"/>
168
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Platemaker"/>
169
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Permitting_agency"/>
170
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Production_manager"/>
171
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Printer_of_plates"/>
172
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Papermaker"/>
173
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Puppeteer"/>
174
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Process_contact"/>
175
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Production_personnel"/>
176
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Performer"/>
177
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Programmer"/>
178
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Printmaker"/>
179
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Producer"/>
180
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Production_place"/>
181
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Printer"/>
182
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Patent_applicant"/>
183
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Plaintiff_appellee"/>
184
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Plaintiff"/>
185
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Patent_holder"/>
186
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Plaintiff_appellant"/>
187
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Publication_place"/>
188
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Rubricator"/>
189
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Recording_engineer"/>
190
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Recipient"/>
191
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Redactor"/>
192
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Renderer"/>
193
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Researcher"/>
194
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Reviewer"/>
195
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Repository"/>
196
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Reporter"/>
197
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Responsible_party"/>
198
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Respondent_appellee"/>
199
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Restager"/>
200
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Respondent"/>
201
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Respondent_appellant"/>
202
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Research_team_head"/>
203
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Research_team_member"/>
204
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Scientific_advisor"/>
205
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Scenarist"/>
206
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Sculptor"/>
207
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Scribe"/>
208
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Sound_designer"/>
209
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Secretary"/>
210
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Signer"/>
211
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Supporting_host"/>
212
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Singer"/>
213
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Speaker"/>
214
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Sponsor"/>
215
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Second_party"/>
216
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Surveyor"/>
217
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Set_designer"/>
218
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Storyteller"/>
219
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Stage_manager"/>
220
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Standards_body"/>
221
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Stereotyper"/>
222
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Technical_director"/>
223
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Teacher"/>
224
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Thesis_advisor"/>
225
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Transcriber"/>
226
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Translator"/>
227
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Type_designer"/>
228
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Typographer"/>
229
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/University_place"/>
230
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Videographer"/>
231
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Vocalist"/>
232
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Writer_of_accompanying_material"/>
233
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Woodcutter"/>
234
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Wood_engraver"/>
235
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Role/Witness"/>
236
    </genEnums>
237
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="opf.ecore#//Scheme">
238
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Scheme/ISBN"/>
239
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Scheme/URI"/>
240
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Scheme/URL"/>
241
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Scheme/UUID"/>
242
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Scheme/URN"/>
243
    </genEnums>
244
    <genEnums typeSafeEnumCompatible="false" ecoreEnum="opf.ecore#//Type">
245
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Cover"/>
246
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Title"/>
247
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/TOC"/>
248
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Index"/>
249
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Glossary"/>
250
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Acknowledgements"/>
251
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Bibliography"/>
252
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Colophon"/>
253
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Copyright"/>
254
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Dedication"/>
255
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Epigraph"/>
256
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Foreword"/>
257
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Illustrations"/>
258
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Tables"/>
259
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Notes"/>
260
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Preface"/>
261
      <genEnumLiterals ecoreEnumLiteral="opf.ecore#//Type/Text"/>
262
    </genEnums>
263
    <genClasses ecoreClass="opf.ecore#//Package">
264
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Package/metadata"/>
265
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Package/manifest"/>
266
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Package/spine"/>
267
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Package/guide"/>
268
      <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference opf.ecore#//Package/tours"/>
269
      <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Package/version"/>
270
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Package/uniqueIdentifier"/>
271
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Package/generateCoverHTML"/>
272
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Package/generateTableOfContents"/>
273
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Package/includeReferencedResources"/>
274
    </genClasses>
275
    <genClasses ecoreClass="opf.ecore#//Metadata">
276
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/titles"/>
277
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/creators"/>
278
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/subjects"/>
279
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/descriptions"/>
280
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/publishers"/>
281
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/contributors"/>
282
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/dates"/>
283
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/types"/>
284
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/formats"/>
285
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/identifiers"/>
286
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/sources"/>
287
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/languages"/>
288
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/relations"/>
289
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/coverages"/>
290
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/rights"/>
291
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Metadata/metas"/>
292
    </genClasses>
293
    <genClasses ecoreClass="opf.ecore#//Manifest">
294
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Manifest/items"/>
295
    </genClasses>
296
    <genClasses ecoreClass="opf.ecore#//Item">
297
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/id"/>
298
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/href"/>
299
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/media_type"/>
300
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/fallback"/>
301
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/fallback_style"/>
302
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/required_namespace"/>
303
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/required_modules"/>
304
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/file"/>
305
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/noToc"/>
306
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/title"/>
307
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/generated"/>
308
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Item/sourcePath"/>
309
    </genClasses>
310
    <genClasses ecoreClass="opf.ecore#//Spine">
311
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Spine/spineItems"/>
312
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Spine/toc"/>
313
    </genClasses>
314
    <genClasses ecoreClass="opf.ecore#//Guide">
315
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference opf.ecore#//Guide/guideItems"/>
316
    </genClasses>
317
    <genClasses ecoreClass="opf.ecore#//Reference">
318
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Reference/type"/>
319
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Reference/title"/>
320
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Reference/href"/>
321
    </genClasses>
322
    <genClasses ecoreClass="opf.ecore#//Itemref">
323
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Itemref/idref"/>
324
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Itemref/linear"/>
325
    </genClasses>
326
    <genClasses ecoreClass="opf.ecore#//Tours"/>
327
    <genClasses ecoreClass="opf.ecore#//Meta">
328
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Meta/name"/>
329
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute opf.ecore#//Meta/content"/>
330
    </genClasses>
331
  </genPackages>
332
  <genPackages prefix="DC" basePackage="org.eclipse.mylyn.docs.epub" resource="XML"
333
      disposableProviderFactory="true" ecorePackage="dc.ecore#/">
334
    <genClasses ecoreClass="dc.ecore#//Title"/>
335
    <genClasses ecoreClass="dc.ecore#//Creator">
336
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Creator/role"/>
337
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Creator/fileAs"/>
338
    </genClasses>
339
    <genClasses ecoreClass="dc.ecore#//Subject"/>
340
    <genClasses ecoreClass="dc.ecore#//Description"/>
341
    <genClasses ecoreClass="dc.ecore#//Publisher"/>
342
    <genClasses ecoreClass="dc.ecore#//Contributor">
343
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Contributor/role"/>
344
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Contributor/fileAs"/>
345
    </genClasses>
346
    <genClasses ecoreClass="dc.ecore#//Date">
347
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Date/event"/>
348
    </genClasses>
349
    <genClasses ecoreClass="dc.ecore#//Type"/>
350
    <genClasses ecoreClass="dc.ecore#//Format"/>
351
    <genClasses ecoreClass="dc.ecore#//Identifier">
352
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Identifier/id"/>
353
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Identifier/scheme"/>
354
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute dc.ecore#//Identifier/mixed"/>
355
    </genClasses>
356
    <genClasses ecoreClass="dc.ecore#//Source"/>
357
    <genClasses ecoreClass="dc.ecore#//Language">
358
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//Language/type"/>
359
    </genClasses>
360
    <genClasses ecoreClass="dc.ecore#//Relation"/>
361
    <genClasses ecoreClass="dc.ecore#//Coverage"/>
362
    <genClasses ecoreClass="dc.ecore#//Rights"/>
363
    <genClasses image="false" ecoreClass="dc.ecore#//DCType">
364
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//DCType/id"/>
365
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute dc.ecore#//DCType/mixed"/>
366
    </genClasses>
367
    <genClasses image="false" ecoreClass="dc.ecore#//LocalizedDCType">
368
      <genFeatures createChild="false" ecoreFeature="ecore:EAttribute dc.ecore#//LocalizedDCType/lang"/>
369
    </genClasses>
370
  </genPackages>
371
</genmodel:GenModel>
(-)a/org.eclipse.mylyn.docs.epub.core/model/readme.txt (+3 lines)
Added Link Here
1
This implementation is based on EPUB version 2.0.1 http://idpf.org/epub/201.
2
There is a newer version in the works (3.0).
3
(-)a/org.eclipse.mylyn.docs.epub.core/model/relacode.ant (+28 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
	Copyright (c) 2011 Torkild U. Resheim and others.
4
    All rights reserved. This program and the accompanying materials
5
    are made available under the terms of the Eclipse Public License v1.0
6
    which accompanies this distribution, and is available at
7
    http://www.eclipse.org/legal/epl-v10.html
8
    
9
    Contributors:
10
        Torkild U. Resheim - initial API and implementation
11
-->
12
<project name="Generate MARC Code List for Relators" default="build">
13
14
	<!-- This target will take the MARC relators list and convert it to ecore
15
	     for use in the EPUB ecore model. Whenver the list has changed it can be
16
	     obtained from http://www.loc.gov/marc/relators/relacode.html and the
17
	     model can be updated with the new version using this ANT project. The
18
	     generated code must be copy-pasted into epub2.ecore. -->
19
	<target name="build">
20
		<copyfile dest="${basedir}/relacode.ecore" src="${basedir}/relacode.src" forceoverwrite="true"/>		
21
		<replaceregexp
22
			file="${basedir}/relacode.ecore"
23
			match="([\S]+)[\s](.+)"
24
			byline="true"
25
			replace="&lt;eLiterals name=&quot;\2&quot; literal=&quot;\1&quot;/&gt;"/>
26
	</target>
27
28
</project>
(-)a/org.eclipse.mylyn.docs.epub.core/model/relacode.src (+223 lines)
Added Link Here
1
acp	Art copyist
2
act	Actor
3
adp	Adapter
4
aft	Author of afterword, colophon, etc.
5
anl	Analyst
6
anm	Animator
7
ann	Annotator
8
ant	Bibliographic antecedent
9
app	Applicant
10
aqt	Author in quotations or text abstracts
11
arc	Architect
12
ard	Artistic director
13
arr	Arranger
14
art	Artist
15
asg	Assignee
16
asn	Associated name
17
att	Attributed name
18
auc	Auctioneer
19
aud	Author of dialog
20
aui	Author of introduction
21
aus	Author of screenplay
22
aut	Author
23
bdd	Binding designer
24
bjd	Bookjacket designer
25
bkd	Book designer
26
bkp	Book producer
27
blw	Blurb writer
28
bnd	Binder
29
bpd	Bookplate designer
30
bsl	Bookseller
31
ccp	Conceptor
32
chr	Choreographer
33
clb	Collaborator
34
cli	Client
35
cll	Calligrapher
36
clr	Colorist
37
clt	Collotyper
38
cmm	Commentator
39
cmp	Composer
40
cmt	Compositor
41
cng	Cinematographer
42
cnd	Conductor
43
cns	Censor
44
coe	Contestant -appellee
45
col	Collector
46
com	Compiler
47
con	Conservator
48
cos	Contestant
49
cot	Contestant -appellant
50
cov	Cover designer
51
cpc	Copyright claimant
52
cpe	Complainant-appellee
53
cph	Copyright holder
54
cpl	Complainant
55
cpt	Complainant-appellant
56
cre	Creator
57
crp	Correspondent
58
crr	Corrector
59
csl	Consultant
60
csp	Consultant to a project
61
cst	Costume designer
62
ctb	Contributor
63
cte	Contestee-appellee
64
ctg	Cartographer
65
ctr	Contractor
66
cts	Contestee
67
ctt	Contestee-appellant
68
cur	Curator
69
cwt	Commentator for written text
70
dfd	Defendant
71
dfe	Defendant-appellee
72
dft	Defendant-appellant
73
dgg	Degree grantor
74
dis	Dissertant
75
dln	Delineator
76
dnc	Dancer
77
dnr	Donor
78
dpb	Distribution place
79
dpc	Depicted
80
dpt	Depositor
81
drm	Draftsman
82
drt	Director
83
dsr	Designer
84
dst	Distributor
85
dtc	Data contributor
86
dte	Dedicatee
87
dtm	Data manager
88
dto	Dedicator
89
dub	Dubious author
90
edt	Editor
91
egr	Engraver
92
elg	Electrician
93
elt	Electrotyper
94
eng	Engineer
95
etr	Etcher
96
evp	Event place
97
exp	Expert
98
fac	Facsimilist
99
fld	Field director
100
flm	Film editor
101
fmo	Former owner
102
fpy	First party
103
fnd	Funder
104
frg	Forger
105
gis	Geographic information specialist
106
-grt	Graphic technician
107
hnr	Honoree
108
hst	Host
109
ill	Illustrator
110
ilu	Illuminator
111
ins	Inscriber
112
inv	Inventor
113
itr	Instrumentalist
114
ive	Interviewee
115
ivr	Interviewer
116
lbr	Laboratory
117
lbt	Librettist
118
ldr	Laboratory director
119
led	Lead
120
lee	Libelee-appellee
121
lel	Libelee
122
len	Lender
123
let	Libelee-appellant
124
lgd	Lighting designer
125
lie	Libelant-appellee
126
lil	Libelant
127
lit	Libelant-appellant
128
lsa	Landscape architect
129
lse	Licensee
130
lso	Licensor
131
ltg	Lithographer
132
lyr	Lyricist
133
mcp	Music copyist
134
mfp	Manufacture place
135
mfr	Manufacturer
136
mdc	Metadata contact
137
mod	Moderator
138
mon	Monitor
139
mrb	Marbler
140
mrk	Markup editor
141
msd	Musical director
142
mte	Metal-engraver
143
mus	Musician
144
nrt	Narrator
145
opn	Opponent
146
org	Originator
147
orm	Organizer of meeting
148
oth	Other
149
own	Owner
150
pat	Patron
151
pbd	Publishing director
152
pbl	Publisher
153
pdr	Project director
154
pfr	Proofreader
155
pht	Photographer
156
plt	Platemaker
157
pma	Permitting agency
158
pmn	Production manager
159
pop	Printer of plates
160
ppm	Papermaker
161
ppt	Puppeteer
162
prc	Process contact
163
prd	Production personnel
164
prf	Performer
165
prg	Programmer
166
prm	Printmaker
167
pro	Producer
168
prp	Production place
169
prt	Printer
170
pta	Patent applicant
171
pte	Plaintiff -appellee
172
ptf	Plaintiff
173
pth	Patent holder
174
ptt	Plaintiff-appellant
175
pup	Publication place
176
rbr	Rubricator
177
rce	Recording engineer
178
rcp	Recipient
179
red	Redactor
180
ren	Renderer
181
res	Researcher
182
rev	Reviewer
183
rps	Repository
184
rpt	Reporter
185
rpy	Responsible party
186
rse	Respondent-appellee
187
rsg	Restager
188
rsp	Respondent
189
rst	Respondent-appellant
190
rth	Research team head
191
rtm	Research team member
192
sad	Scientific advisor
193
sce	Scenarist
194
scl	Sculptor
195
scr	Scribe
196
sds	Sound designer
197
sec	Secretary
198
sgn	Signer
199
sht	Supporting host
200
sng	Singer
201
spk	Speaker
202
spn	Sponsor
203
spy	Second party
204
srv	Surveyor
205
std	Set designer
206
stl	Storyteller
207
stm	Stage manager
208
stn	Standards body
209
str	Stereotyper
210
tcd	Technical director
211
tch	Teacher
212
ths	Thesis advisor
213
trc	Transcriber
214
trl	Translator
215
tyd	Type designer
216
tyg	Typographer
217
uvp	University place
218
vdg	Videographer
219
voc	Vocalist
220
wam	Writer of accompanying material
221
wdc	Woodcutter
222
wde	Wood-engraver
223
wit	Witness
(-)a/org.eclipse.mylyn.docs.epub.core/plugin.properties (+12 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2011 Torkild U. Resheim.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     Torkild U. Resheim - initial API and implementation
10
###############################################################################
11
pluginName = ePUB Model
12
providerName = www.example.org
(-)a/org.eclipse.mylyn.docs.epub.core/plugin.xml (+23 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.0"?>
3
4
<!--
5
 &copy; 2011 Torkild U. Resheim
6
-->
7
8
<plugin>
9
   <extension
10
         point="org.eclipse.emf.ecore.generated_package">
11
      <package
12
            class="org.eclipse.mylyn.docs.epub.opf.OPFPackage"
13
            genModel="model/opf.genmodel"
14
            uri="http://eclipse.org/mylyn/docs/epub/opf">
15
      </package>
16
      <package
17
            class="org.eclipse.mylyn.docs.epub.dc.DCPackage"
18
            uri="http://eclipse.org/mylyn/docs/epub/dc">
19
      </package>
20
   </extension>
21
22
23
</plugin>
(-)a/org.eclipse.mylyn.docs.epub.core/pom.xml (+30 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
  <modelVersion>4.0.0</modelVersion>
5
  <parent>
6
    <artifactId>org.eclipse.mylyn.docs-parent</artifactId>
7
    <groupId>org.eclipse.mylyn.docs</groupId>
8
    <version>1.6.0-SNAPSHOT</version>
9
  </parent>
10
  <artifactId>org.eclipse.mylyn.docs.epub.core</artifactId>
11
  <version>0.8.0-SNAPSHOT</version>
12
  <packaging>eclipse-plugin</packaging>
13
  <build>
14
    <plugins>
15
      <plugin>
16
        <groupId>org.eclipse.tycho</groupId>
17
        <artifactId>tycho-source-plugin</artifactId>
18
      </plugin>
19
      <plugin>
20
        <groupId>org.codehaus.mojo</groupId>
21
        <artifactId>findbugs-maven-plugin</artifactId>
22
      </plugin>
23
      <plugin>
24
        <groupId>org.apache.maven.plugins</groupId>
25
        <artifactId>maven-pmd-plugin</artifactId>
26
      </plugin>
27
    </plugins>
28
  </build>
29
  <groupId>org.eclipse.mylyn.docs.epub</groupId>
30
</project>
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/docs/epub/core/EPUB.java (+324 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.core;
12
13
import java.io.File;
14
import java.io.IOException;
15
import java.util.ArrayList;
16
import java.util.List;
17
import java.util.Map;
18
19
import org.eclipse.emf.common.util.EList;
20
import org.eclipse.emf.common.util.URI;
21
import org.eclipse.emf.ecore.resource.Resource;
22
import org.eclipse.emf.ecore.resource.ResourceSet;
23
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
24
import org.eclipse.emf.ecore.xmi.XMLResource;
25
import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
26
import org.eclipse.mylyn.docs.epub.ocf.Container;
27
import org.eclipse.mylyn.docs.epub.ocf.OCFFactory;
28
import org.eclipse.mylyn.docs.epub.ocf.OCFPackage;
29
import org.eclipse.mylyn.docs.epub.ocf.RootFile;
30
import org.eclipse.mylyn.docs.epub.ocf.RootFiles;
31
import org.eclipse.mylyn.docs.epub.ocf.util.OCFResourceImpl;
32
import org.eclipse.mylyn.internal.docs.epub.core.EPUBFileUtil;
33
34
/**
35
 * Represents one EPUB file. One or more publications can be added and will be a
36
 * part of the distribution when packed. See the <a
37
 * href="http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section1.2">OPS
38
 * specification</a> for definitions of words and terms.
39
 * 
40
 * @author Torkild U. Resheim
41
 * @see http://idpf.org/epub/20/spec/OPS_2.0.1_draft.html
42
 * @see http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm
43
 */
44
public class EPUB {
45
46
	/** OEBPS (OPS+OPF) mimetype */
47
	private static final String MIMETYPE_OEBPS = "application/oebps-package+xml";
48
49
	/** Suffix for OCF files */
50
	private static final String OCF_FILE_SUFFIX = "xml";
51
52
	/** The encoding to use for the OCF */
53
	private static final String OCF_FILE_ENCODING = "UTF-8";
54
55
	private Container ocfContainer;
56
57
	/**
58
	 * Creates a new <b>empty</b> instance of an EPUB. Use
59
	 * {@link #add(OPSPublication)} and {@link #pack(File)} to add publications
60
	 * and ready the EPUB for distribution.
61
	 */
62
	public EPUB() {
63
		ocfContainer = OCFFactory.eINSTANCE.createContainer();
64
		RootFiles rootFiles = OCFFactory.eINSTANCE.createRootFiles();
65
		ocfContainer.setRootfiles(rootFiles);
66
		ocfContainer.setVersion("2.0");
67
		registerOCFResourceFactory();
68
	}
69
70
	/**
71
	 * Returns the container instance of the EPUB.
72
	 * 
73
	 * @return the container instance
74
	 */
75
	public Container getContainer() {
76
		return ocfContainer;
77
	}
78
79
	/**
80
	 * Adds a new OPS publication to the EPUB.
81
	 * 
82
	 * @param oebps
83
	 *            the publication to add.
84
	 */
85
	public void add(OPSPublication oebps) {
86
		RootFiles rootFiles = ocfContainer.getRootfiles();
87
		int count = rootFiles.getRootfiles().size();
88
		String rootFileName = count > 0 ? "OEBPS_" + count : "OEBPS";
89
		rootFileName += "/content.opf";
90
		RootFile rootFile = OCFFactory.eINSTANCE.createRootFile();
91
		rootFile.setFullPath(rootFileName);
92
		rootFile.setMediaType(MIMETYPE_OEBPS);
93
		rootFile.setPublication(oebps);
94
		rootFiles.getRootfiles().add(rootFile);
95
	}
96
97
	/**
98
	 * Adds a new publication to the EPUB
99
	 * 
100
	 * @param file
101
	 *            the publication to add
102
	 * @param type
103
	 *            the MIME type of the publication
104
	 */
105
	public void add(File file, String type) {
106
		String name = type.substring(type.lastIndexOf('/') + 1, type.length()).toUpperCase();
107
		RootFiles rootFiles = ocfContainer.getRootfiles();
108
		int count = rootFiles.getRootfiles().size();
109
		String rootFileName = count > 0 ? name + "_" + count : name;
110
		rootFileName += File.separator + file.getName();
111
		RootFile rootFile = OCFFactory.eINSTANCE.createRootFile();
112
		rootFile.setFullPath(rootFileName);
113
		rootFile.setMediaType(type);
114
		rootFile.setPublication(file);
115
		rootFiles.getRootfiles().add(rootFile);
116
	}
117
118
	/**
119
	 * Returns a list of all <i>OPS publications</i> contained within the EPUB.
120
	 * 
121
	 * @return a list of all OPS publications
122
	 */
123
	public List<OPSPublication> getOPSPublications() {
124
		ArrayList<OPSPublication> publications = new ArrayList<OPSPublication>();
125
		EList<RootFile> rootFiles = ocfContainer.getRootfiles().getRootfiles();
126
		for (RootFile rootFile : rootFiles) {
127
			if (rootFile.getMediaType().equals(MIMETYPE_OEBPS)) {
128
				publications.add((OPSPublication) rootFile.getPublication());
129
			}
130
		}
131
		return publications;
132
	}
133
134
	/**
135
	 * Assembles the EPUB file using a temporary working folder. The folder will
136
	 * be deleted as soon as the assembly has completed.
137
	 * 
138
	 * @param epubFile
139
	 *            the target EPUB file
140
	 * 
141
	 * @throws Exception
142
	 */
143
	public File pack(File epubFile) throws Exception {
144
		File workingFolder = File.createTempFile("epub_", null);
145
		if (workingFolder.delete() && workingFolder.mkdirs()) {
146
			pack(epubFile, workingFolder);
147
		}
148
		deleteFolder(workingFolder);
149
		return workingFolder;
150
	}
151
152
	/**
153
	 * Assembles the EPUB file using the specified working folder.
154
	 * 
155
	 * @param epubFile
156
	 *            the target EPUB file
157
	 * @param workingFolder
158
	 *            the working folder
159
	 * @throws Exception
160
	 */
161
	public void pack(File epubFile, File workingFolder) throws Exception {
162
		if (ocfContainer.getRootfiles().getRootfiles().isEmpty()) {
163
			throw new IllegalArgumentException("EPUB does not contain any publications");
164
		}
165
		workingFolder.mkdirs();
166
		if (workingFolder.isDirectory() || workingFolder.mkdirs()) {
167
			writeOCF(workingFolder);
168
			EList<RootFile> publications = ocfContainer.getRootfiles().getRootfiles();
169
			for (RootFile rootFile : publications) {
170
				Object publication = rootFile.getPublication();
171
				File root = new File(workingFolder.getAbsolutePath() + File.separator + rootFile.getFullPath());
172
				if (publication instanceof OPSPublication) {
173
					((OPSPublication) publication).pack(root);
174
				} else {
175
					if (rootFile.getPublication() instanceof File) {
176
						EPUBFileUtil.copy((File) rootFile.getPublication(), root);
177
					} else {
178
						throw new IllegalArgumentException("Unknown publication type");
179
					}
180
				}
181
			}
182
			EPUBFileUtil.zip(epubFile, workingFolder);
183
		} else {
184
			throw new IOException("Could not create working folder in " + workingFolder.getAbsolutePath());
185
		}
186
	}
187
188
	/**
189
	 * Reads the <i>Open Container Format</i> formatted list of the contents of
190
	 * this EPUB.
191
	 * 
192
	 * @param workingFolder
193
	 *            the folder where the EPUB was unpacked
194
	 * @throws IOException
195
	 * @see {@link #unpack(File)}
196
	 * @see {@link #unpack(File, File)}
197
	 */
198
	private void readOCF(File workingFolder) throws IOException {
199
		// These file names are listed in the OCF specification and must not be
200
		// changed.
201
		File metaFolder = new File(workingFolder.getAbsolutePath() + File.separator + "META-INF");
202
		File containerFile = new File(metaFolder.getAbsolutePath() + File.separator + "container.xml");
203
		ResourceSet resourceSet = new ResourceSetImpl();
204
		URI fileURI = URI.createFileURI(containerFile.getAbsolutePath());
205
		Resource resource = resourceSet.createResource(fileURI);
206
		resource.load(null);
207
		ocfContainer = (Container) resource.getContents().get(0);
208
	}
209
210
	/**
211
	 * Registers a new resource factory for OCF data structures. This is
212
	 * normally done through Eclipse extension points but we also need to be
213
	 * able to create this factory without the Eclipse runtime.
214
	 */
215
	private void registerOCFResourceFactory() {
216
		// Register package so that it is available even without the Eclipse
217
		// runtime
218
		@SuppressWarnings("unused")
219
		OCFPackage packageInstance = OCFPackage.eINSTANCE;
220
221
		// Register the file suffix
222
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(OCF_FILE_SUFFIX,
223
				new XMLResourceFactoryImpl() {
224
225
					@Override
226
					public Resource createResource(URI uri) {
227
						OCFResourceImpl xmiResource = new OCFResourceImpl(uri);
228
						Map<Object, Object> loadOptions = xmiResource.getDefaultLoadOptions();
229
						Map<Object, Object> saveOptions = xmiResource.getDefaultSaveOptions();
230
						// We use extended metadata
231
						saveOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
232
						loadOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
233
						// Required in order to correctly read in attributes
234
						loadOptions.put(XMLResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE);
235
						// Treat "href" attributes as features
236
						loadOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
237
						// UTF-8 encoding is required per specification
238
						saveOptions.put(XMLResource.OPTION_ENCODING, OCF_FILE_ENCODING);
239
						return xmiResource;
240
					}
241
242
				});
243
	}
244
245
	/**
246
	 * Unpacks the EPUB file to a temporary location and populates the data
247
	 * model with the content.
248
	 * 
249
	 * @param epubFile
250
	 *            the EPUB file to unpack
251
	 * @return the location when the EPUB is unpacked
252
	 * @throws Exception
253
	 */
254
	public File unpack(File epubFile) throws Exception {
255
		File workingFolder = File.createTempFile("epub_", null);
256
		workingFolder.deleteOnExit();
257
		if (workingFolder.delete() && workingFolder.mkdirs()) {
258
			unpack(epubFile, workingFolder);
259
		}
260
		return workingFolder;
261
	}
262
263
	/**
264
	 * Unpacks the given EPUB file into the specified destination and populates
265
	 * the data model with the content.
266
	 * 
267
	 * @param epubFile
268
	 *            the EPUB file to unpack
269
	 * @param destination
270
	 *            the destination folder
271
	 * @throws Exception
272
	 */
273
	public void unpack(File epubFile, File destination) throws Exception {
274
		EPUBFileUtil.unzip(epubFile, destination);
275
		readOCF(destination);
276
		EList<RootFile> rootFiles = ocfContainer.getRootfiles().getRootfiles();
277
		for (RootFile rootFile : rootFiles) {
278
			if (rootFile.getMediaType().equals(MIMETYPE_OEBPS)) {
279
				// XXX: Handle this better when adding support for EPUB 3
280
				OPSPublication ops = OPSPublication.getVersion2Instance();
281
				File root = new File(destination.getAbsolutePath() + File.separator + rootFile.getFullPath());
282
				ops.unpack(root);
283
				rootFile.setPublication(ops);
284
			}
285
		}
286
	}
287
288
	/**
289
	 * Creates a new folder named META-INF and writes the required
290
	 * <b>container.xml</b> in that folder.
291
	 * 
292
	 * @param workingFolder
293
	 *            the root folder
294
	 */
295
	private void writeOCF(File workingFolder) throws IOException {
296
		File metaFolder = new File(workingFolder.getAbsolutePath() + File.separator + "META-INF");
297
		if (metaFolder.mkdir()) {
298
			File containerFile = new File(metaFolder.getAbsolutePath() + File.separator + "container.xml");
299
			ResourceSet resourceSet = new ResourceSetImpl();
300
			// Register the packages to make it available during loading.
301
			URI fileURI = URI.createFileURI(containerFile.getAbsolutePath());
302
			Resource resource = resourceSet.createResource(fileURI);
303
			resource.getContents().add(ocfContainer);
304
			resource.save(null);
305
		}
306
	}
307
308
	/**
309
	 * Delete the folder recursively.
310
	 * 
311
	 * @param folder
312
	 *            the folder to delete
313
	 * @return
314
	 */
315
	private void deleteFolder(File folder) {
316
		if (folder.isDirectory()) {
317
			String[] children = folder.list();
318
			for (int i = 0; i < children.length; i++) {
319
				deleteFolder(new File(folder, children[i]));
320
			}
321
		}
322
		folder.delete();
323
	}
324
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/docs/epub/core/OPS2Publication.java (+288 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.core;
12
13
import java.io.File;
14
import java.io.FileReader;
15
import java.io.IOException;
16
import java.util.ArrayList;
17
import java.util.HashMap;
18
import java.util.List;
19
import java.util.Map;
20
21
import javax.xml.parsers.ParserConfigurationException;
22
23
import org.eclipse.emf.common.util.EList;
24
import org.eclipse.emf.common.util.URI;
25
import org.eclipse.emf.ecore.resource.Resource;
26
import org.eclipse.emf.ecore.resource.ResourceSet;
27
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
28
import org.eclipse.emf.ecore.util.FeatureMapUtil;
29
import org.eclipse.emf.ecore.xmi.XMLHelper;
30
import org.eclipse.emf.ecore.xmi.XMLResource;
31
import org.eclipse.mylyn.docs.epub.ncx.DocTitle;
32
import org.eclipse.mylyn.docs.epub.ncx.Head;
33
import org.eclipse.mylyn.docs.epub.ncx.Meta;
34
import org.eclipse.mylyn.docs.epub.ncx.NCXFactory;
35
import org.eclipse.mylyn.docs.epub.ncx.NCXPackage;
36
import org.eclipse.mylyn.docs.epub.ncx.NavMap;
37
import org.eclipse.mylyn.docs.epub.ncx.Ncx;
38
import org.eclipse.mylyn.docs.epub.ncx.Text;
39
import org.eclipse.mylyn.docs.epub.ncx.util.NCXResourceFactoryImpl;
40
import org.eclipse.mylyn.docs.epub.ncx.util.NCXResourceImpl;
41
import org.eclipse.mylyn.docs.epub.opf.Guide;
42
import org.eclipse.mylyn.docs.epub.opf.Item;
43
import org.eclipse.mylyn.docs.epub.opf.Itemref;
44
import org.eclipse.mylyn.docs.epub.opf.Manifest;
45
import org.eclipse.mylyn.docs.epub.opf.Metadata;
46
import org.eclipse.mylyn.docs.epub.opf.OPFFactory;
47
import org.eclipse.mylyn.docs.epub.opf.Spine;
48
import org.eclipse.mylyn.internal.docs.epub.core.EPUBXMLHelperImp;
49
import org.eclipse.mylyn.internal.docs.epub.core.OPS2Validator;
50
import org.eclipse.mylyn.internal.docs.epub.core.TOCGenerator;
51
import org.xml.sax.InputSource;
52
import org.xml.sax.SAXException;
53
54
/**
55
 * This type represents one EPUB revision 2.0.1 formatted publication. It
56
 * maintains a data structure representing the entire publication and API for
57
 * building it.
58
 * <p>
59
 * <b>Please note that this API is provisional and should not yet be used to
60
 * build applications.</b>
61
 * </p>
62
 * 
63
 * @author Torkild U. Resheim
64
 */
65
public class OPS2Publication extends OPSPublication {
66
67
	/** Default name for the table of contents */
68
	private static final String TOCFILE_NAME = "toc.ncx";
69
70
	/** MIME type for NCX documents */
71
	private static final String MIMETYPE_NCX = "application/x-dtbncx+xml";
72
73
	private Ncx ncxTOC;
74
75
	/**
76
	 * Creates a new EPUB.
77
	 */
78
	public OPS2Publication() {
79
		super();
80
		opfPackage.setVersion("2.0");
81
		ncxTOC = NCXFactory.eINSTANCE.createNcx();
82
		Metadata opfMetadata = OPFFactory.eINSTANCE.createMetadata();
83
		opfPackage.setMetadata(opfMetadata);
84
		Guide opfGuide = OPFFactory.eINSTANCE.createGuide();
85
		opfPackage.setGuide(opfGuide);
86
		Manifest opfManifest = OPFFactory.eINSTANCE.createManifest();
87
		opfPackage.setManifest(opfManifest);
88
		// Create the spine and set a reference to the table of contents
89
		// item which will be added to the manifest on a later stage.
90
		Spine opfSpine = OPFFactory.eINSTANCE.createSpine();
91
		opfSpine.setToc(TABLE_OF_CONTENTS_ID);
92
		opfPackage.setSpine(opfSpine);
93
94
		registerNCXResourceFactory();
95
		opfPackage.setGenerateTableOfContents(true);
96
	}
97
98
	/**
99
	 * This mechanism will traverse the spine of the publication (which is
100
	 * representing the reading order) and parse each file for information that
101
	 * can be used to assemble a table of contents.
102
	 * 
103
	 * @throws SAXException
104
	 * @throws IOException
105
	 * @throws ParserConfigurationException
106
	 */
107
	@Override
108
	protected void generateTableOfContents() throws Exception {
109
		NavMap navMap = NCXFactory.eINSTANCE.createNavMap();
110
		ncxTOC.setNavMap(navMap);
111
		ncxTOC.setVersion("2005-1");
112
		// Create the required head element
113
		Head head = NCXFactory.eINSTANCE.createHead();
114
		ncxTOC.setHead(head);
115
		Meta meta = NCXFactory.eINSTANCE.createMeta();
116
		meta.setName("dtb:uid");
117
		meta.setContent(getIdentifier().getMixed().getValue(0).toString());
118
		head.getMetas().add(meta);
119
		DocTitle docTitle = NCXFactory.eINSTANCE.createDocTitle();
120
		Text text = NCXFactory.eINSTANCE.createText();
121
		FeatureMapUtil.addText(text.getMixed(), "Table of contents");
122
		docTitle.setText(text);
123
		ncxTOC.setDocTitle(docTitle);
124
		int playOrder = 0;
125
		// Iterate over the spine
126
		EList<Itemref> spineItems = getSpine().getSpineItems();
127
		EList<Item> manifestItems = opfPackage.getManifest().getItems();
128
		for (Itemref itemref : spineItems) {
129
			Item referencedItem = null;
130
			String id = itemref.getIdref();
131
			// Find the manifest item that is referenced
132
			for (Item item : manifestItems) {
133
				if (item.getId().equals(id)) {
134
					referencedItem = item;
135
					break;
136
				}
137
			}
138
			if (referencedItem != null && !referencedItem.isNoToc()) {
139
				File file = new File(referencedItem.getFile());
140
				FileReader fr = new FileReader(file);
141
				playOrder = TOCGenerator.parse(new InputSource(fr), referencedItem.getHref(), ncxTOC, playOrder);
142
			}
143
		}
144
	}
145
146
	/**
147
	 * This method will only validate items that are in the spine, or in reading
148
	 * order.
149
	 */
150
	@Override
151
	protected List<ValidationMessage> validateContents() throws Exception {
152
		EList<Itemref> spineItems = getSpine().getSpineItems();
153
		EList<Item> manifestItems = opfPackage.getManifest().getItems();
154
		ArrayList<ValidationMessage> messages = new ArrayList<ValidationMessage>();
155
		for (Itemref itemref : spineItems) {
156
			Item referencedItem = null;
157
			String id = itemref.getIdref();
158
			// Find the manifest item that is referenced
159
			for (Item item : manifestItems) {
160
				if (item.getId().equals(id)) {
161
					referencedItem = item;
162
					break;
163
				}
164
			}
165
			if (referencedItem != null && !referencedItem.isNoToc()) {
166
				File file = new File(referencedItem.getFile());
167
				FileReader fr = new FileReader(file);
168
				messages.addAll(OPS2Validator.validate(new InputSource(fr), referencedItem.getHref()));
169
			}
170
		}
171
		return messages;
172
	}
173
174
	/** Identifier of the table of contents file */
175
	protected static final String TABLE_OF_CONTENTS_ID = "ncx";
176
177
	protected static final String NCX_FILE_SUFFIX = "ncx";
178
179
	/**
180
	 * Registers a new resource factory for NCX data structures. This is
181
	 * normally done through Eclipse extension points but we also need to be
182
	 * able to create this factory without the Eclipse runtime.
183
	 */
184
	private void registerNCXResourceFactory() {
185
		// Register package so that it is available even without the Eclipse
186
		// runtime
187
		@SuppressWarnings("unused")
188
		NCXPackage packageInstance = NCXPackage.eINSTANCE;
189
190
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(NCX_FILE_SUFFIX,
191
				new NCXResourceFactoryImpl() {
192
					@Override
193
					public Resource createResource(URI uri) {
194
						NCXResourceImpl xmiResource = new NCXResourceImpl(uri) {
195
196
							@Override
197
							protected XMLHelper createXMLHelper() {
198
								EPUBXMLHelperImp xmlHelper = new EPUBXMLHelperImp();
199
								return xmlHelper;
200
							}
201
202
						};
203
						Map<Object, Object> loadOptions = xmiResource.getDefaultLoadOptions();
204
						Map<Object, Object> saveOptions = xmiResource.getDefaultSaveOptions();
205
						// We use extended metadata
206
						saveOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
207
						loadOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
208
						// Required in order to correctly read in attributes
209
						loadOptions.put(XMLResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE);
210
						// Treat "href" attributes as features
211
						loadOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
212
						// UTF-8 encoding is required per specification
213
						saveOptions.put(XMLResource.OPTION_ENCODING, XML_ENCODING);
214
						return xmiResource;
215
					}
216
217
				});
218
	}
219
220
	@Override
221
	public void setTableOfContents(File ncxFile) {
222
		// Add the file to the publication and make sure we use the table of
223
		// contents identifier.
224
		Item item = addItem(opfPackage.getSpine().getToc(), null, ncxFile, null, MIMETYPE_NCX, false, false, false);
225
		// The table of contents file must be first.
226
		opfPackage.getManifest().getItems().move(0, item);
227
228
	}
229
230
	/**
231
	 * Writes the table of contents file in the specified folder using the NCX
232
	 * format. If a table of contents file has not been specified an empty one
233
	 * will be created (since it is required to have one). If in addition it has
234
	 * been specified that the table of contents should be created, the content
235
	 * files will be parsed and a TOC will be generated.
236
	 * 
237
	 * @param oepbsFolder
238
	 *            the folder to create the NCX file in
239
	 * @throws IOException
240
	 * @throws SAXException
241
	 * @throws ParserConfigurationException
242
	 * @see {@link #setTableOfContents(File)}
243
	 */
244
	@Override
245
	protected void writeTableOfContents(File oepbsFolder) throws Exception {
246
		// If a table of contents file has not been specified we must create
247
		// one. If it has been specified it will be copied.
248
		if (getItemById(opfPackage.getSpine().getToc()) == null) {
249
			File ncxFile = new File(oepbsFolder.getAbsolutePath() + File.separator + TOCFILE_NAME);
250
			ResourceSet resourceSet = new ResourceSetImpl();
251
			// Register the packages to make it available during loading.
252
			resourceSet.getPackageRegistry().put(NCXPackage.eNS_URI, NCXPackage.eINSTANCE);
253
			URI fileURI = URI.createFileURI(ncxFile.getAbsolutePath());
254
			Resource resource = resourceSet.createResource(fileURI);
255
			// We've been asked to generate a table of contents using pages
256
			// contained in the spine.
257
			if (opfPackage.isGenerateTableOfContents()) {
258
				generateTableOfContents();
259
			}
260
			resource.getContents().add(ncxTOC);
261
			Map<String, Object> options = new HashMap<String, Object>();
262
			// NCX requires that we encode using UTF-8
263
			options.put(XMLResource.OPTION_ENCODING, XML_ENCODING);
264
			options.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
265
			resource.save(options);
266
			// Make sure the table of contents file is in the manifest and
267
			// referenced in the spine. We also want it to be the first element
268
			// in the manifest.
269
			Item item = addItem(opfPackage.getSpine().getToc(), null, ncxFile, null, MIMETYPE_NCX, false, false, false);
270
			opfPackage.getManifest().getItems().move(0, item);
271
		}
272
	}
273
274
	@Override
275
	protected void readTableOfContents(File tocFile) throws IOException {
276
		ResourceSet resourceSet = new ResourceSetImpl();
277
		URI fileURI = URI.createFileURI(tocFile.getAbsolutePath());
278
		Resource resource = resourceSet.createResource(fileURI);
279
		resource.load(null);
280
		ncxTOC = (Ncx) resource.getContents().get(0);
281
	}
282
283
	@Override
284
	public Object getTableOfContents() {
285
		return ncxTOC;
286
	}
287
288
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/docs/epub/core/OPSPublication.java (+1157 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: 
10
 * Torkild U. Resheim - initial API and implementation
11
 *******************************************************************************/
12
package org.eclipse.mylyn.docs.epub.core;
13
14
import java.io.File;
15
import java.io.FileWriter;
16
import java.io.IOException;
17
import java.text.SimpleDateFormat;
18
import java.util.ArrayList;
19
import java.util.HashMap;
20
import java.util.List;
21
import java.util.Locale;
22
import java.util.Map;
23
import java.util.TimeZone;
24
import java.util.UUID;
25
26
import javax.xml.parsers.ParserConfigurationException;
27
28
import org.eclipse.emf.common.util.BasicDiagnostic;
29
import org.eclipse.emf.common.util.Diagnostic;
30
import org.eclipse.emf.common.util.EList;
31
import org.eclipse.emf.common.util.URI;
32
import org.eclipse.emf.ecore.EObject;
33
import org.eclipse.emf.ecore.EValidator;
34
import org.eclipse.emf.ecore.resource.Resource;
35
import org.eclipse.emf.ecore.resource.ResourceSet;
36
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
37
import org.eclipse.emf.ecore.util.Diagnostician;
38
import org.eclipse.emf.ecore.util.EcoreValidator;
39
import org.eclipse.emf.ecore.util.FeatureMapUtil;
40
import org.eclipse.emf.ecore.xmi.XMLHelper;
41
import org.eclipse.emf.ecore.xmi.XMLResource;
42
import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
43
import org.eclipse.mylyn.docs.epub.dc.Contributor;
44
import org.eclipse.mylyn.docs.epub.dc.Coverage;
45
import org.eclipse.mylyn.docs.epub.dc.Creator;
46
import org.eclipse.mylyn.docs.epub.dc.DCFactory;
47
import org.eclipse.mylyn.docs.epub.dc.DCType;
48
import org.eclipse.mylyn.docs.epub.dc.Date;
49
import org.eclipse.mylyn.docs.epub.dc.Description;
50
import org.eclipse.mylyn.docs.epub.dc.Format;
51
import org.eclipse.mylyn.docs.epub.dc.Identifier;
52
import org.eclipse.mylyn.docs.epub.dc.Language;
53
import org.eclipse.mylyn.docs.epub.dc.LocalizedDCType;
54
import org.eclipse.mylyn.docs.epub.dc.Publisher;
55
import org.eclipse.mylyn.docs.epub.dc.Relation;
56
import org.eclipse.mylyn.docs.epub.dc.Rights;
57
import org.eclipse.mylyn.docs.epub.dc.Source;
58
import org.eclipse.mylyn.docs.epub.dc.Subject;
59
import org.eclipse.mylyn.docs.epub.dc.Title;
60
import org.eclipse.mylyn.docs.epub.opf.Item;
61
import org.eclipse.mylyn.docs.epub.opf.Itemref;
62
import org.eclipse.mylyn.docs.epub.opf.OPFFactory;
63
import org.eclipse.mylyn.docs.epub.opf.OPFPackage;
64
import org.eclipse.mylyn.docs.epub.opf.Package;
65
import org.eclipse.mylyn.docs.epub.opf.Reference;
66
import org.eclipse.mylyn.docs.epub.opf.Role;
67
import org.eclipse.mylyn.docs.epub.opf.Spine;
68
import org.eclipse.mylyn.docs.epub.opf.Type;
69
import org.eclipse.mylyn.docs.epub.opf.util.OPFResourceImpl;
70
import org.eclipse.mylyn.internal.docs.epub.core.EPUBFileUtil;
71
import org.eclipse.mylyn.internal.docs.epub.core.EPUBXMLHelperImp;
72
import org.eclipse.mylyn.internal.docs.epub.core.ReferenceScanner;
73
import org.xml.sax.SAXException;
74
75
/**
76
 * This type represents one <i>OPS publication</i>. This includes the <i>OPF
77
 * package document</i> and <i>OPS content documents</i>. It maintains a data
78
 * structure representing the entire publication and API for building it.
79
 * <p>
80
 * Please note that this API is provisional and should not yet be used to build
81
 * applications.
82
 * </p>
83
 * 
84
 * @author Torkild U. Resheim
85
 */
86
public abstract class OPSPublication {
87
	// Rules of engagement:
88
	// * Keep all data in the model, use "transient" for temporary variables
89
	// * Do not create anything before the final assemble
90
91
	/** Default identifier for the cover page */
92
	private static final String COVER_ID = "cover";
93
94
	/** Publication identifier for the cover image item */
95
	public static final String COVER_IMAGE_ID = "cover-image";
96
97
	protected static final String CREATION_DATE_ID = "creation";
98
99
	public final static String MIMETYPE_CSS = "text/css";
100
101
	public static final String MIMETYPE_EPUB = "application/epub+zip";
102
103
	public static final String MIMETYPE_XHTML = "application/xhtml+xml";
104
105
	private static final String OPF_FILE_SUFFIX = "opf";
106
107
	protected static final String UUID_SCHEME = "uuid";
108
109
	/** The encoding to use in XML files */
110
	protected static final String XML_ENCODING = "UTF-8";
111
112
	/**
113
	 * Returns an EPUB version 2.0.1 instance.
114
	 * 
115
	 * @return an EPUB instance
116
	 */
117
	public static OPSPublication getVersion2Instance() {
118
		return new OPS2Publication();
119
	}
120
121
	public List<ValidationMessage> messages;
122
123
	/** The root model element */
124
	protected Package opfPackage;
125
126
	/** The root folder TODO: Move to opfPackage */
127
	private File rootFolder;
128
129
	protected OPSPublication() {
130
		opfPackage = OPFFactory.eINSTANCE.createPackage();
131
		registerOPFResourceFactory();
132
	}
133
134
	/**
135
	 * Adds data to the publication that we always want to be present.
136
	 * <ul>
137
	 * <li>The creation date.</li>
138
	 * <li><i>Eclipse committers and contributors</i> as contributor redactor
139
	 * role.</li>
140
	 * <li>A unique identifier if none has been specified.</li>
141
	 * <li>A empty description if none has been specified.</li>
142
	 * <li>Language "English" if none has been specified.</li>
143
	 * <li>A dummy title if none has been specified.</li>
144
	 * <li>The publication format if none has been specified.</li>
145
	 * </ul>
146
	 */
147
	private void addCompulsoryData() {
148
		addDate(null, new java.util.Date(System.currentTimeMillis()), CREATION_DATE_ID);
149
		addContributor(null, null, "Eclipse Committers and Contributors", Role.REDACTOR, null);
150
		if (getIdentifier() == null) {
151
			addIdentifier(UUID_SCHEME, "uuid", UUID.randomUUID().toString());
152
			setIdentifierId(UUID_SCHEME);
153
		}
154
		// Add empty subject
155
		if (opfPackage.getMetadata().getSubjects().isEmpty()) {
156
			addSubject(null, null, "");
157
		}
158
		// Add English language
159
		if (opfPackage.getMetadata().getLanguages().isEmpty()) {
160
			addLanguage(null, Locale.ENGLISH.toString());
161
		}
162
		// Add dummy title
163
		if (opfPackage.getMetadata().getTitles().isEmpty()) {
164
			addTitle(null, null, "No title specified");
165
		}
166
		// Set the publication format
167
		if (opfPackage.getMetadata().getFormats().isEmpty()) {
168
			addFormat(null, MIMETYPE_EPUB);
169
		}
170
	}
171
172
	/**
173
	 * Specifies a new contributor for the publication.
174
	 * 
175
	 * @param id
176
	 *            an identifier or <code>null</code>
177
	 * @param name
178
	 *            name of the creator
179
	 * @param role
180
	 *            the role or <code>null</code>
181
	 * @param fileAs
182
	 *            name to file the creator under or <code>null</code>
183
	 * @param lang
184
	 *            the language code or <code>null</code>
185
	 * @return the new creator
186
	 */
187
	public Contributor addContributor(String id, Locale lang, String name, Role role, String fileAs) {
188
		Contributor dc = DCFactory.eINSTANCE.createContributor();
189
		setDcLocalized(dc, id, lang, name);
190
		if (role != null) {
191
			dc.setRole(role);
192
		}
193
		if (fileAs != null) {
194
			dc.setFileAs(fileAs);
195
		}
196
		opfPackage.getMetadata().getContributors().add(dc);
197
		return dc;
198
	}
199
200
	/**
201
	 * Specifies a new &quot;coverage&quot; for the publication.
202
	 * 
203
	 * @param id
204
	 *            an identifier or <code>null</code>
205
	 * @param lang
206
	 *            the language code or <code>null</code>
207
	 * @param value
208
	 *            value of the item
209
	 * @return the new coverage
210
	 */
211
	public Coverage addCoverage(String id, Locale lang, String value) {
212
		if (value == null) {
213
			throw new IllegalArgumentException("A value must be specified");
214
		}
215
		Coverage dc = DCFactory.eINSTANCE.createCoverage();
216
		setDcLocalized(dc, id, lang, value);
217
		opfPackage.getMetadata().getCoverages().add(dc);
218
		return dc;
219
	}
220
221
	/**
222
	 * Specifies a new creator for the publication.
223
	 * 
224
	 * 
225
	 * @param id
226
	 *            a unique identifier or <code>null</code>
227
	 * @param lang
228
	 *            the language code or <code>null</code>
229
	 * @param name
230
	 *            name of the creator
231
	 * @param role
232
	 *            the role or <code>null</code>
233
	 * @param fileAs
234
	 *            name to file the creator under or <code>null</code>
235
	 * @return the new creator
236
	 */
237
	public Creator addCreator(String id, Locale lang, String name, Role role, String fileAs) {
238
		Creator dc = DCFactory.eINSTANCE.createCreator();
239
		setDcLocalized(dc, id, lang, name);
240
		if (role != null) {
241
			dc.setRole(role);
242
		}
243
		if (fileAs != null) {
244
			dc.setFileAs(fileAs);
245
		}
246
		opfPackage.getMetadata().getCreators().add(dc);
247
		return dc;
248
	}
249
250
	/**
251
	 * Adds a new date to the publication. The given instance will be
252
	 * represented in a format defined by "Date and Time Formats" at
253
	 * http://www.w3.org/TR/NOTE-datetime and by ISO 8601 on which it is based.
254
	 * 
255
	 * @param id
256
	 *            optional identifier
257
	 * @param date
258
	 *            the date
259
	 * @param event
260
	 *            the event
261
	 * @return the new date
262
	 * @see #addDate(String, String, String)
263
	 */
264
	public Date addDate(String id, java.util.Date date, String event) {
265
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
266
		TimeZone tz = TimeZone.getTimeZone("UTC");
267
		df.setTimeZone(tz);
268
		Date dc = DCFactory.eINSTANCE.createDate();
269
		setDcCommon(dc, id, df.format(date));
270
		if (event != null) {
271
			dc.setEvent(event);
272
		}
273
		opfPackage.getMetadata().getDates().add(dc);
274
		return dc;
275
	}
276
277
	/**
278
	 * Date of publication, in the format defined by "Date and Time Formats" at
279
	 * http://www.w3.org/TR/NOTE-datetime and by ISO 8601. In particular, dates
280
	 * without times must be represented in the form YYYY[-MM[-DD]]: a required
281
	 * 4-digit year, an optional 2-digit month, and if the month is given, an
282
	 * optional 2-digit day of month. The event attribute is optional, possible
283
	 * values may include: "creation", "publication", and "modification".
284
	 * 
285
	 * @param value
286
	 *            the date string
287
	 * @param event
288
	 *            an optional event description
289
	 * @return the new date
290
	 */
291
	public Date addDate(String id, String value, String event) {
292
		if (value == null) {
293
			throw new IllegalArgumentException("A value must be specified");
294
		}
295
		Date dc = DCFactory.eINSTANCE.createDate();
296
		setDcCommon(dc, id, value);
297
		if (event != null) {
298
			dc.setEvent(event);
299
		}
300
		opfPackage.getMetadata().getDates().add(dc);
301
		return dc;
302
	}
303
304
	/**
305
	 * Adds a new description to the publication.
306
	 * 
307
	 * @param id
308
	 *            identifier or <code>null</code>
309
	 * @param lang
310
	 *            the language code or <code>null</code>
311
	 * @param value
312
	 *            the description text
313
	 * @return the new description
314
	 */
315
	public Description addDescription(String id, Locale lang, String value) {
316
		if (value == null) {
317
			throw new IllegalArgumentException("A value must be specified");
318
		}
319
		Description dc = DCFactory.eINSTANCE.createDescription();
320
		setDcLocalized(dc, id, lang, value);
321
		opfPackage.getMetadata().getDescriptions().add(dc);
322
		return dc;
323
	}
324
325
	/**
326
	 * Adds an optional publication format.
327
	 * 
328
	 * @param id
329
	 *            identifier or <code>null</code>
330
	 * @param value
331
	 *            the format to add
332
	 * @return the new format
333
	 */
334
	public Format addFormat(String id, String value) {
335
		Format dc = DCFactory.eINSTANCE.createFormat();
336
		setDcCommon(dc, id, value);
337
		opfPackage.getMetadata().getFormats().add(dc);
338
		return dc;
339
	}
340
341
	/**
342
	 * Adds a new identifier to the publication.
343
	 * 
344
	 * @param id
345
	 *            the identifier id
346
	 * @param scheme
347
	 *            the scheme used for representing the identifier
348
	 * @param value
349
	 *            the identifier value
350
	 * @return the new identifier
351
	 */
352
	public Identifier addIdentifier(String id, String scheme, String value) {
353
		if (value == null) {
354
			throw new IllegalArgumentException("A value must be specified");
355
		}
356
		Identifier dc = DCFactory.eINSTANCE.createIdentifier();
357
		dc.setId(id);
358
		dc.setScheme(scheme);
359
		FeatureMapUtil.addText(dc.getMixed(), value);
360
		opfPackage.getMetadata().getIdentifiers().add(dc);
361
		return dc;
362
	}
363
364
	/**
365
	 * Adds a new item to the manifest using default values for properties not
366
	 * specified. Same as
367
	 * <code>addItem(null, null, file, null, null, true, false);</code>.
368
	 * 
369
	 * @param file
370
	 * @return the new item
371
	 */
372
	public Item addItem(File file) {
373
		return addItem(null, null, file, null, null, true, true, false);
374
	}
375
376
	/**
377
	 * Adds a new item to the manifest. If an identifier is not specified it
378
	 * will automatically be assigned.
379
	 * 
380
	 * <p>
381
	 * The <i>spine</i> defines the reading order, so the order items are added
382
	 * and whether or not <i>spine</i> is <code>true</code> does matter. Unless
383
	 * a table of contents file has been specified it will be generated. All
384
	 * files that have been added to the spine will be examined unless the
385
	 * <i>noToc</i> attribute has been set to <code>true</code>.
386
	 * </p>
387
	 * 
388
	 * @param file
389
	 *            the file to add
390
	 * @param dest
391
	 *            the destination sub-folder or <code>null</code>
392
	 * @param id
393
	 *            identifier or <code>null</code>
394
	 * @param type
395
	 *            MIME file type
396
	 * @param spine
397
	 *            whether or not to add the item to the spine
398
	 * @param linear
399
	 *            whether or not the item is part of the reading order
400
	 * @param noToc
401
	 *            whether or not to include in TOC when automatically generated
402
	 * @return the new item
403
	 */
404
	public Item addItem(String id, Locale lang, File file, String dest, String type, boolean spine, boolean linear,
405
			boolean noToc) {
406
		if (file == null || !file.exists()) {
407
			throw new IllegalArgumentException("\"file\" " + file.getAbsolutePath() + " must exist.");
408
		}
409
		if (file.isDirectory()) {
410
			throw new IllegalArgumentException("\"file\" " + file.getAbsolutePath() + " must not be a directory.");
411
		}
412
		Item item = OPFFactory.eINSTANCE.createItem();
413
		if (type == null) {
414
			type = EPUBFileUtil.getMimeType(file);
415
			if (type == null) {
416
				throw new IllegalArgumentException("Could not automatically determine MIME type for file " + file
417
						+ ". Please specify the correct value");
418
			}
419
		}
420
		if (id == null) {
421
			String prefix = "";
422
			if (!type.equals(MIMETYPE_XHTML)) {
423
				prefix = (type.indexOf('/')) == -1 ? type : type.substring(0, type.indexOf('/')) + "-";
424
			}
425
			id = prefix + file.getName().substring(0, file.getName().lastIndexOf('.'));
426
		}
427
		item.setId(id);
428
		if (dest == null) {
429
			item.setHref(file.getName());
430
		} else {
431
			item.setHref(dest + '/' + file.getName());
432
		}
433
		item.setNoToc(noToc);
434
		item.setMedia_type(type);
435
		item.setFile(file.getAbsolutePath());
436
		opfPackage.getManifest().getItems().add(item);
437
		if (spine) {
438
			Itemref ref = OPFFactory.eINSTANCE.createItemref();
439
			if (!linear) {
440
				ref.setLinear("no");
441
			}
442
			ref.setIdref(id);
443
			getSpine().getSpineItems().add(ref);
444
		}
445
		return item;
446
	}
447
448
	/**
449
	 * Adds a new language specification to the publication.
450
	 * 
451
	 * @param id
452
	 *            identifier or <code>null</code>
453
	 * @param lang
454
	 *            the language code or <code>null</code>
455
	 * @param lang
456
	 *            the RFC-3066 format of the language code
457
	 * @return the language instance
458
	 */
459
	public Language addLanguage(String id, String value) {
460
		if (value == null) {
461
			throw new IllegalArgumentException("A value must be specified");
462
		}
463
		Language dc = DCFactory.eINSTANCE.createLanguage();
464
		setDcCommon(dc, id, value);
465
		opfPackage.getMetadata().getLanguages().add(dc);
466
		return dc;
467
	}
468
469
	/**
470
	 * Adds a new meta item to the publication.
471
	 * 
472
	 * @param name
473
	 *            name of the item
474
	 * @param value
475
	 *            content of the item
476
	 * @return the new meta
477
	 */
478
	public org.eclipse.mylyn.docs.epub.opf.Meta addMeta(String name, String value) {
479
		if (value == null) {
480
			throw new IllegalArgumentException("A value must be specified");
481
		}
482
		if (name == null) {
483
			throw new IllegalArgumentException("A name must be specified");
484
		}
485
		org.eclipse.mylyn.docs.epub.opf.Meta opf = OPFFactory.eINSTANCE.createMeta();
486
		opf.setName(name);
487
		opf.setContent(value);
488
		opfPackage.getMetadata().getMetas().add(opf);
489
		return opf;
490
	}
491
492
	/**
493
	 * Adds a new publisher to the publication.
494
	 * 
495
	 * @param id
496
	 *            identifier or <code>null</code>
497
	 * @param lang
498
	 *            the language code or <code>null</code>
499
	 * @param value
500
	 *            name of the publisher
501
	 * @return the new publisher
502
	 */
503
	public Publisher addPublisher(String id, Locale lang, String value) {
504
		if (value == null) {
505
			throw new IllegalArgumentException("A value must be specified");
506
		}
507
		Publisher dc = DCFactory.eINSTANCE.createPublisher();
508
		setDcLocalized(dc, id, lang, value);
509
		opfPackage.getMetadata().getPublishers().add(dc);
510
		return dc;
511
	}
512
513
	/**
514
	 * The structural components of the books are listed in reference elements
515
	 * contained within the guide element. These components could refer to the
516
	 * table of contents, list of illustrations, foreword, bibliography, and
517
	 * many other standard parts of the book. Reading systems are not required
518
	 * to use the guide element but it is a good idea to use it.
519
	 * 
520
	 * @param href
521
	 *            the item referenced
522
	 * @param title
523
	 *            title of the reference
524
	 * @param value
525
	 *            type of the reference
526
	 * @return the reference
527
	 */
528
	public Reference addReference(String href, String title, Type value) {
529
		if (value == null) {
530
			throw new IllegalArgumentException("A value must be specified");
531
		}
532
		if (href == null) {
533
			throw new IllegalArgumentException("A href must be specified");
534
		}
535
		if (title == null) {
536
			throw new IllegalArgumentException("A title must be specified");
537
		}
538
		Reference reference = OPFFactory.eINSTANCE.createReference();
539
		reference.setHref(href);
540
		reference.setTitle(title);
541
		reference.setType(value);
542
		opfPackage.getGuide().getGuideItems().add(reference);
543
		return reference;
544
	}
545
546
	/**
547
	 * Adds a optional <i>relation</i> specification to the publication.
548
	 * 
549
	 * @param id
550
	 *            identifier or <code>null</code>
551
	 * @param lang
552
	 *            the language code or <code>null</code>
553
	 * @param value
554
	 *            the value of the relation
555
	 * @return the new relation
556
	 */
557
	public Relation addRelation(String id, Locale lang, String value) {
558
		if (value == null) {
559
			throw new IllegalArgumentException("A value must be specified");
560
		}
561
		Relation dc = DCFactory.eINSTANCE.createRelation();
562
		setDcLocalized(dc, id, lang, value);
563
		opfPackage.getMetadata().getRelations().add(dc);
564
		return dc;
565
	}
566
567
	/**
568
	 * Adds a optional <i>rights</i> specification to the publication.
569
	 * 
570
	 * @param id
571
	 *            identifier or <code>null</code>
572
	 * @param lang
573
	 *            the language code or <code>null</code>
574
	 * @param value
575
	 *            the rights text
576
	 * @return the new rights element
577
	 */
578
	public Rights addRights(String id, Locale lang, String value) {
579
		if (value == null) {
580
			throw new IllegalArgumentException("A value must be specified");
581
		}
582
		Rights dc = DCFactory.eINSTANCE.createRights();
583
		setDcLocalized(dc, id, lang, value);
584
		opfPackage.getMetadata().getRights().add(dc);
585
		return dc;
586
	}
587
588
	/**
589
	 * Adds a optional <i>source</i> specification to the publication.
590
	 * 
591
	 * @param id
592
	 *            identifier or <code>null</code>
593
	 * @param lang
594
	 *            the language code or <code>null</code>
595
	 * @param value
596
	 *            the source text
597
	 * @return the new source element
598
	 */
599
	public Source addSource(String id, Locale lang, String value) {
600
		if (value == null) {
601
			throw new IllegalArgumentException("A value must be specified");
602
		}
603
		Source dc = DCFactory.eINSTANCE.createSource();
604
		setDcLocalized(dc, id, lang, value);
605
		opfPackage.getMetadata().getSources().add(dc);
606
		return dc;
607
	}
608
609
	/**
610
	 * Adds a required <i>subject</i> specification to the publication.
611
	 * 
612
	 * @param id
613
	 *            identifier or <code>null</code>
614
	 * @param lang
615
	 *            the language code or <code>null</code>
616
	 * @param value
617
	 *            the subject
618
	 */
619
	public Subject addSubject(String id, Locale lang, String value) {
620
		if (value == null) {
621
			throw new IllegalArgumentException("A value must be specified");
622
		}
623
		Subject dc = DCFactory.eINSTANCE.createSubject();
624
		setDcLocalized(dc, id, lang, value);
625
		opfPackage.getMetadata().getSubjects().add(dc);
626
		return dc;
627
	}
628
629
	/**
630
	 * Adds a required <i>title</i> specification to the publication.
631
	 * 
632
	 * @param id
633
	 *            identifier or <code>null</code>
634
	 * @param lang
635
	 *            the language code or <code>null</code>
636
	 * @param value
637
	 *            the new title
638
	 * @return the new title
639
	 */
640
	public Title addTitle(String id, Locale lang, String value) {
641
		if (value == null) {
642
			throw new IllegalArgumentException("A value must be specified");
643
		}
644
		Title dc = DCFactory.eINSTANCE.createTitle();
645
		setDcLocalized(dc, id, lang, value);
646
		opfPackage.getMetadata().getTitles().add(dc);
647
		return dc;
648
	}
649
650
	/**
651
	 * Adds a optional <i>type</i> specification to the publication.
652
	 * 
653
	 * @param id
654
	 *            identifier or <code>null</code>
655
	 * @param type
656
	 *            the type to add
657
	 * @return the new type
658
	 */
659
	public org.eclipse.mylyn.docs.epub.dc.Type addType(String id, String value) {
660
		if (value == null) {
661
			throw new IllegalArgumentException("A value must be specified");
662
		}
663
		org.eclipse.mylyn.docs.epub.dc.Type dc = DCFactory.eINSTANCE.createType();
664
		setDcCommon(dc, id, value);
665
		opfPackage.getMetadata().getTypes().add(dc);
666
		return dc;
667
	}
668
669
	/**
670
	 * Copies all items part of the publication into the OEPBS folder unless the
671
	 * item in question will be generated.
672
	 * 
673
	 * @param rootFolder
674
	 *            the folder to copy into.
675
	 * @throws IOException
676
	 */
677
	private void copyContent(File rootFolder) throws IOException {
678
		EList<Item> items = opfPackage.getManifest().getItems();
679
		for (Item item : items) {
680
			if (!item.isGenerated()) {
681
				File source = new File(item.getFile());
682
				File destination = new File(rootFolder.getAbsolutePath() + File.separator + item.getHref());
683
				EPUBFileUtil.copy(source, destination);
684
			}
685
		}
686
	}
687
688
	/**
689
	 * Implement to handle generation of table of contents from the items added
690
	 * to the <i>spine</i>.
691
	 * 
692
	 * @throws Exception
693
	 */
694
	protected abstract void generateTableOfContents() throws Exception;
695
696
	/**
697
	 * Returns the main identifier of the publication or <code>null</code> if it
698
	 * could not be determined.
699
	 * 
700
	 * @return the main identifier or <code>null</code>
701
	 */
702
	protected Identifier getIdentifier() {
703
		EList<Identifier> identifiers = opfPackage.getMetadata().getIdentifiers();
704
		for (Identifier identifier : identifiers) {
705
			if (identifier.getId().equals(opfPackage.getUniqueIdentifier())) {
706
				return identifier;
707
			}
708
		}
709
		return null;
710
	}
711
712
	/**
713
	 * Locates and returns an item from the manifest corresponding to the given
714
	 * identifier.
715
	 * 
716
	 * @param id
717
	 *            the identifier
718
	 * @return the item
719
	 */
720
	public Item getItemById(String id) {
721
		EList<Item> items = opfPackage.getManifest().getItems();
722
		for (Item item : items) {
723
			if (item.getId().equals(id)) {
724
				return item;
725
			}
726
		}
727
		return null;
728
	}
729
730
	/**
731
	 * Returns a list of all manifest items that have the specified MIME type.
732
	 * 
733
	 * @param mimetype
734
	 *            the MIME type to search for
735
	 * @return a list of all items
736
	 */
737
	public List<Item> getItemsByMIMEType(String mimetype) {
738
		ArrayList<Item> stylesheets = new ArrayList<Item>();
739
		EList<Item> items = opfPackage.getManifest().getItems();
740
		for (Item item : items) {
741
			if (item.getMedia_type().equals(mimetype)) {
742
				stylesheets.add(item);
743
			}
744
		}
745
		return stylesheets;
746
	}
747
748
	public Package getOpfPackage() {
749
		return opfPackage;
750
	}
751
752
	/**
753
	 * Returns the root folder of the publication. This is the folder where the
754
	 * OPF file resides. Note that this property will only have a value if this
755
	 * instance has been populated using an existing publication, such as when
756
	 * unpacking an EPUB file.
757
	 * 
758
	 * @return the root folder or <code>null</code>
759
	 */
760
	public File getRootFolder() {
761
		return rootFolder;
762
	}
763
764
	/**
765
	 * Returns the publication spine.
766
	 * 
767
	 * @return the spine
768
	 */
769
	protected Spine getSpine() {
770
		return opfPackage.getSpine();
771
	}
772
773
	/**
774
	 * Returns the table of contents for the publication. As the actual
775
	 * implementation may vary depending on
776
	 * 
777
	 * @return the table of contents
778
	 */
779
	public abstract Object getTableOfContents();
780
781
	/**
782
	 * Returns a list of validation messages. This list is only populated when
783
	 * {@link #pack(File)} has taken place.
784
	 * 
785
	 * @return a list of validation messages
786
	 */
787
	public List<ValidationMessage> getValidationMessages() {
788
		return messages;
789
	}
790
791
	/**
792
	 * Iterates over all files in the manifest attempting to determine
793
	 * referenced resources such as image files and adds these to the manifest.
794
	 * 
795
	 * @throws ParserConfigurationException
796
	 * @throws SAXException
797
	 * @throws IOException
798
	 */
799
	private void includeReferencedResources() throws ParserConfigurationException, SAXException, IOException {
800
		EList<Item> manifestItems = opfPackage.getManifest().getItems();
801
		// Compose a list of file references
802
		HashMap<File, List<File>> references = new HashMap<File, List<File>>();
803
		for (Item item : manifestItems) {
804
			// Only parse XHTML-files and files that are not generated
805
			if (item.getMedia_type().equals(MIMETYPE_XHTML) && !item.isGenerated()) {
806
				if (item.getSourcePath() != null) {
807
					File source = new File(item.getSourcePath());
808
					references.put(source, ReferenceScanner.parse(item));
809
				} else {
810
					File source = new File(item.getFile());
811
					references.put(source, ReferenceScanner.parse(item));
812
				}
813
			}
814
		}
815
		for (File root : references.keySet()) {
816
			List<File> images = references.get(root);
817
			for (File image : images) {
818
				File relativePath = new File(EPUBFileUtil.getRelativePath(root, image));
819
				addItem(null, null, image, relativePath.getParent(), null, false, false, false);
820
			}
821
		}
822
823
	}
824
825
	/**
826
	 * Assembles the OPS publication in a location relative to the root file.
827
	 * 
828
	 * @param rootFile
829
	 *            the root file
830
	 * @throws Exception
831
	 */
832
	void pack(File rootFile) throws Exception {
833
		if (opfPackage.getSpine().getSpineItems().isEmpty()) {
834
			throw new IllegalArgumentException("Spine does not contain any items");
835
		}
836
		// Note that order is important here. Some of the steps for assembling
837
		// the EPUB may insert data into the EPUB structure. Hence the OPF must
838
		// be written last.
839
		this.rootFolder = rootFile.getAbsoluteFile().getParentFile();
840
		addCompulsoryData();
841
		if (rootFolder.isDirectory() || rootFolder.mkdirs()) {
842
			if (opfPackage.isGenerateCoverHTML()) {
843
				writeCoverHTML(rootFolder);
844
			}
845
			if (opfPackage.isIncludeReferencedResources()) {
846
				includeReferencedResources();
847
			}
848
			copyContent(rootFolder);
849
			messages = validateContents();
850
			writeTableOfContents(rootFolder);
851
			writeOPF(rootFile);
852
		} else {
853
			throw new IOException("Could not create OEBPS folder in " + rootFolder.getAbsolutePath());
854
		}
855
		validateMetadata();
856
	}
857
858
	/**
859
	 * Reads the root file.
860
	 * 
861
	 * @param rootFile
862
	 *            the file to read
863
	 * @throws IOException
864
	 */
865
	private void readOPF(File rootFile) throws IOException {
866
		ResourceSet resourceSet = new ResourceSetImpl();
867
		URI fileURI = URI.createFileURI(rootFile.getAbsolutePath());
868
		Resource resource = resourceSet.createResource(fileURI);
869
		resource.load(null);
870
		opfPackage = (Package) resource.getContents().get(0);
871
	}
872
873
	/**
874
	 * Implement to read the table of contents for the particular OEPBS
875
	 * implementation.
876
	 * 
877
	 * @param tocFile
878
	 *            the table of contents file
879
	 * @throws IOException
880
	 */
881
	protected abstract void readTableOfContents(File tocFile) throws IOException;
882
883
	/**
884
	 * Registers a new resource factory for OPF data structures. This is
885
	 * normally done through Eclipse extension points but we also need to be
886
	 * able to create this factory without the Eclipse runtime.
887
	 */
888
	private void registerOPFResourceFactory() {
889
		// Register package so that it is available even without the Eclipse
890
		// runtime
891
		@SuppressWarnings("unused")
892
		OPFPackage packageInstance = OPFPackage.eINSTANCE;
893
894
		// Register the file suffix
895
		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(OPF_FILE_SUFFIX,
896
				new XMLResourceFactoryImpl() {
897
898
					@Override
899
					public Resource createResource(URI uri) {
900
						OPFResourceImpl xmiResource = new OPFResourceImpl(uri) {
901
902
							@Override
903
							protected XMLHelper createXMLHelper() {
904
								EPUBXMLHelperImp xmlHelper = new EPUBXMLHelperImp();
905
								return xmlHelper;
906
							}
907
908
						};
909
						Map<Object, Object> loadOptions = xmiResource.getDefaultLoadOptions();
910
						Map<Object, Object> saveOptions = xmiResource.getDefaultSaveOptions();
911
						// We use extended metadata
912
						saveOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
913
						loadOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
914
						// Required in order to correctly read in attributes
915
						loadOptions.put(XMLResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE);
916
						// Treat "href" attributes as features
917
						loadOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
918
						// UTF-8 encoding is required per specification
919
						saveOptions.put(XMLResource.OPTION_ENCODING, XML_ENCODING);
920
						return xmiResource;
921
					}
922
923
				});
924
	}
925
926
	/**
927
	 * Convenience method for adding a cover to the publication. This method
928
	 * will make sure the required actions are taken to provide a cover page for
929
	 * all reading systems.
930
	 * 
931
	 * @param image
932
	 *            the cover image (jpeg, png, svg or gif)
933
	 * @param title
934
	 *            title of the cover page
935
	 */
936
	public void setCover(File image, String title) {
937
		// Add the cover image to the manifest
938
		Item item = addItem(COVER_IMAGE_ID, null, image, null, null, false, false, true);
939
		item.setTitle(title);
940
		// Point to the cover using a meta tag
941
		addMeta(COVER_ID, COVER_IMAGE_ID);
942
		opfPackage.setGenerateCoverHTML(true);
943
944
	}
945
946
	/**
947
	 * Sets common properties for <i>Dublin Core</i> elements.
948
	 * 
949
	 * @param dc
950
	 *            the Dublin Core element
951
	 * @param id
952
	 *            optional identifier
953
	 * @param value
954
	 *            value of the element
955
	 */
956
	private void setDcCommon(DCType dc, String id, String value) {
957
		FeatureMapUtil.addText(dc.getMixed(), value);
958
		if (id != null) {
959
			dc.setId(id);
960
		}
961
	}
962
963
	/**
964
	 * Sets common properties for localized <i>Dublin Core</i> elements.
965
	 * 
966
	 * @param dc
967
	 *            the Dublin Core element
968
	 * @param id
969
	 *            optional identifier
970
	 * @param lang
971
	 *            language code
972
	 * @param value
973
	 *            value of the element
974
	 */
975
	private void setDcLocalized(LocalizedDCType dc, String id, Locale lang, String value) {
976
		setDcCommon(dc, id, value);
977
		if (lang != null) {
978
			dc.setLang(lang.toString());
979
		}
980
	}
981
982
	/**
983
	 * Specifies whether or not to automatically generate table of contents from
984
	 * the publication contents. The default is <code>true</code>
985
	 * 
986
	 * @param generateToc
987
	 *            whether or not to generate a table of contents
988
	 */
989
	public void setGenerateToc(boolean generateToc) {
990
		opfPackage.setGenerateTableOfContents(generateToc);
991
	}
992
993
	/**
994
	 * Specifies the id of the identifier used for the publication.
995
	 * 
996
	 * @param identifier_id
997
	 *            the identifier id
998
	 * @see #addIdentifier(String, String, String)
999
	 */
1000
	public void setIdentifierId(String identifier_id) {
1001
		opfPackage.setUniqueIdentifier(identifier_id);
1002
	}
1003
1004
	/**
1005
	 * Specifies whether or not to automatically include resources (files) that
1006
	 * are referenced in the contents. The default is <code>false</code>.
1007
	 * 
1008
	 * @param include
1009
	 *            whether or not automatically include resources
1010
	 */
1011
	public void setIncludeReferencedResources(boolean include) {
1012
		opfPackage.setIncludeReferencedResources(include);
1013
	}
1014
1015
	/**
1016
	 * Specifies a target of contents file for the publication. This is an
1017
	 * alternative to {@link #setGenerateToc(boolean)}.
1018
	 * 
1019
	 * @param tocFile
1020
	 *            the table of contents file
1021
	 */
1022
	public abstract void setTableOfContents(File tocFile);
1023
1024
	/**
1025
	 * Populates the data model with the content from an unpacked EPUB.
1026
	 * 
1027
	 * @param epubFile
1028
	 *            the EPUB file to unpack
1029
	 * @param destination
1030
	 *            the destination folder
1031
	 * @throws Exception
1032
	 */
1033
	void unpack(File rootFile) throws Exception {
1034
		readOPF(rootFile);
1035
		rootFolder = rootFile.getAbsoluteFile().getParentFile();
1036
		String tocId = opfPackage.getSpine().getToc();
1037
		Item tocItem = getItemById(tocId);
1038
		File tocFile = new File(rootFolder.getAbsolutePath() + File.separator + tocItem.getHref());
1039
		readTableOfContents(tocFile);
1040
	}
1041
1042
	/**
1043
	 * Implement to validate contents.
1044
	 * 
1045
	 * @throws Exception
1046
	 */
1047
	protected abstract List<ValidationMessage> validateContents() throws Exception;
1048
1049
	/**
1050
	 * Validates the data model contents.
1051
	 * 
1052
	 * @return a list of EMF diagnostics
1053
	 */
1054
	public List<Diagnostic> validateMetadata() {
1055
		EValidator.Registry.INSTANCE.put(OPFPackage.eINSTANCE, new EcoreValidator());
1056
		BasicDiagnostic diagnostics = new BasicDiagnostic();
1057
		for (EObject eo : opfPackage.eContents()) {
1058
			Map<Object, Object> context = new HashMap<Object, Object>();
1059
			Diagnostician.INSTANCE.validate(eo, diagnostics, context);
1060
		}
1061
		return diagnostics.getChildren();
1062
	}
1063
1064
	/**
1065
	 * Writes a XHTML-file for the cover image. This is added to the publication
1066
	 * and all required references set.
1067
	 * 
1068
	 * @param rootFolder
1069
	 *            the publication root folder
1070
	 * @throws IOException
1071
	 * 
1072
	 */
1073
	private void writeCoverHTML(File rootFolder) throws IOException {
1074
		Item coverImage = getItemById(COVER_IMAGE_ID);
1075
		File coverFile = new File(rootFolder.getAbsolutePath() + File.separator + "cover-page.xhtml");
1076
		if (!coverFile.exists()) {
1077
1078
			try {
1079
				FileWriter fw = new FileWriter(coverFile);
1080
				fw.append("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n");
1081
				fw.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n");
1082
				fw.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
1083
				fw.append("  <head>\n");
1084
				fw.append("    <title>" + coverImage.getTitle() + "</title>\n");
1085
				fw.append("    <style type=\"text/css\">");
1086
				fw.append("      #cover-body {\n");
1087
				fw.append("        margin: 0px;\n");
1088
				fw.append("        text-align: center;\n");
1089
				fw.append("        background-color: #222222;\n");
1090
				fw.append("      }\n");
1091
				fw.append("      #cover-block {\n");
1092
				fw.append("        height: 100%;\n");
1093
				fw.append("        margin-top: 0;\n");
1094
				fw.append("      }\n");
1095
				fw.append("      #cover-image {\n");
1096
				fw.append("        height: 100%;\n");
1097
				fw.append("        text-align: center;\n");
1098
				fw.append("        max-width: 100%;\n");
1099
				fw.append("      }\n");
1100
				fw.append("    </style>\n");
1101
				fw.append("  </head>\n");
1102
				fw.append("  <body id=\"cover-body\">\n");
1103
				fw.append("    <div id=\"cover-block\">\n");
1104
				fw.append("      <img id=\"cover-image\" src=\"" + coverImage.getHref() + "\" alt=\""
1105
						+ coverImage.getTitle() + "\"/>\n");
1106
				fw.append("    </div>\n");
1107
				fw.append("  </body>\n");
1108
				fw.append("</html>\n");
1109
				fw.close();
1110
			} catch (IOException e) {
1111
				e.printStackTrace();
1112
			}
1113
		}
1114
		// Add the cover page item
1115
		Item coverPage = addItem(COVER_ID, null, coverFile, null, MIMETYPE_XHTML, true, false, false);
1116
		coverPage.setGenerated(true);
1117
		addReference(coverPage.getHref(), coverImage.getTitle(), Type.COVER);
1118
		// Move the cover page first in the spine.
1119
		EList<Itemref> spine = opfPackage.getSpine().getSpineItems();
1120
		Itemref cover = null;
1121
		for (Itemref itemref : spine) {
1122
			if (itemref.getIdref().equals(COVER_ID)) {
1123
				cover = itemref;
1124
			}
1125
		}
1126
		if (cover != null) {
1127
			spine.move(0, cover);
1128
		}
1129
	}
1130
1131
	/**
1132
	 * Writes the <b>content.opf</b> file.
1133
	 * 
1134
	 * @param rootFolder
1135
	 *            the folder where to write the file.
1136
	 * @throws IOException
1137
	 */
1138
	private void writeOPF(File opfFile) throws IOException {
1139
		ResourceSet resourceSet = new ResourceSetImpl();
1140
		// Register the packages to make it available during loading.
1141
		URI fileURI = URI.createFileURI(opfFile.getAbsolutePath());
1142
		Resource resource = resourceSet.createResource(fileURI);
1143
		resource.getContents().add(opfPackage);
1144
		resource.save(null);
1145
	}
1146
1147
	/**
1148
	 * Implement to handle writing of the table of contents. Note that this
1149
	 * method should do nothing if the table of contents has already been
1150
	 * specified using {@link #setTableOfContents(File)}.
1151
	 * 
1152
	 * @param rootFolder
1153
	 *            the folder to write in
1154
	 * @throws Exception
1155
	 */
1156
	protected abstract void writeTableOfContents(File rootFolder) throws Exception;
1157
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/docs/epub/core/ValidationMessage.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.core;
12
13
public class ValidationMessage {
14
15
	public enum Severity {
16
		WARNING, ERROR
17
	}
18
19
	private final Severity severity;
20
21
	private final String message;
22
23
	public ValidationMessage(Severity severity, String message) {
24
		this.severity = severity;
25
		this.message = message;
26
	}
27
28
	public Severity getSeverity() {
29
		return severity;
30
	}
31
32
	public String getMessage() {
33
		return message;
34
	}
35
36
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/docs/epub/core/wikitext/MarkupToOPS.java (+99 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.core.wikitext;
12
13
import java.io.File;
14
import java.io.FileNotFoundException;
15
import java.io.FileReader;
16
import java.io.FileWriter;
17
import java.io.IOException;
18
import java.io.Writer;
19
import java.util.List;
20
21
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
22
import org.eclipse.mylyn.docs.epub.opf.Item;
23
import org.eclipse.mylyn.wikitext.core.parser.MarkupParser;
24
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder;
25
import org.eclipse.mylyn.wikitext.core.parser.builder.HtmlDocumentBuilder.Stylesheet;
26
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
27
import org.eclipse.mylyn.wikitext.core.util.XmlStreamWriter;
28
29
/**
30
 * This type can be used to populate an OPS publication directly from WikiText
31
 * markup.
32
 * 
33
 * @author Torkild U. Resheim
34
 * @since 1.0
35
 */
36
public class MarkupToOPS {
37
38
	private MarkupLanguage markupLanguage;
39
40
	/**
41
	 * Parses the markup file and populates the OPS data.
42
	 * 
43
	 * @param ops
44
	 *            the OPS publication the content will be added to
45
	 * @param markupFile
46
	 *            the WikiText markup file
47
	 * 
48
	 * @return the temporary folder used for generating the HTML from markup
49
	 */
50
	public File parse(OPSPublication ops, File markupFile) throws IOException, FileNotFoundException {
51
		if (markupLanguage == null) {
52
			throw new IllegalStateException("must set markupLanguage"); //$NON-NLS-1$
53
		}
54
		// Create a temporary working folder
55
		File workingFolder = File.createTempFile("wikitext_", null);
56
		if (workingFolder.delete() && workingFolder.mkdirs()) {
57
			File htmlFile = new File(workingFolder.getAbsolutePath() + File.separator + "markup.html");
58
			FileWriter out = new FileWriter(htmlFile);
59
			HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out) {
60
				@Override
61
				protected XmlStreamWriter createXmlStreamWriter(Writer out) {
62
					return super.createFormattingXmlStreamWriter(out);
63
				}
64
			};
65
66
			List<Item> stylesheets = ops.getItemsByMIMEType(OPSPublication.MIMETYPE_CSS);
67
			for (Item item : stylesheets) {
68
				File file = new File(item.getFile());
69
				Stylesheet css = new Stylesheet(file);
70
				builder.addCssStylesheet(css);
71
			}
72
73
			builder.setXhtmlStrict(true);
74
75
			MarkupParser markupParser = new MarkupParser();
76
77
			markupParser.setBuilder(builder);
78
			markupParser.setMarkupLanguage(markupLanguage);
79
			markupParser.parse(new FileReader(markupFile));
80
			// Convert the generated HTML to EPUB
81
			ops.setGenerateToc(true);
82
			ops.setIncludeReferencedResources(true);
83
			Item item = ops.addItem(htmlFile);
84
			item.setSourcePath(markupFile.getAbsolutePath());
85
		}
86
		return workingFolder;
87
	}
88
89
	/**
90
	 * Sets the markup language to use when generating HTML from markup.
91
	 * 
92
	 * @param markupLanguage
93
	 *            the markup language
94
	 */
95
	public void setMarkupLanguage(MarkupLanguage markupLanguage) {
96
		this.markupLanguage = markupLanguage;
97
	}
98
99
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/internal/docs/epub/core/AbstractXHTMLScanner.java (+89 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.core;
12
13
import org.xml.sax.Attributes;
14
import org.xml.sax.SAXException;
15
import org.xml.sax.ext.DefaultHandler2;
16
17
/**
18
 * This abstract type should be used to form the basis for all types that are
19
 * used to scan EPUB XHTML content files.
20
 * 
21
 * @author Torkild U. Resheim
22
 */
23
public abstract class AbstractXHTMLScanner extends DefaultHandler2 {
24
25
	/** Buffer holding element text */
26
	protected StringBuilder buffer = null;
27
28
	/** Whether or not we are capturing element text */
29
	protected boolean recording = false;
30
31
	protected String currentHref = null;
32
33
	protected boolean insideHead;
34
35
	public AbstractXHTMLScanner() {
36
		super();
37
		buffer = new StringBuilder();
38
	}
39
40
	/**
41
	 * Determines whether or not the given element name represents a HTML
42
	 * header.
43
	 * 
44
	 * @param qName
45
	 *            the element name
46
	 * @return <code>true</code> if the element is a header
47
	 */
48
	protected int isHeader(String qName) {
49
		if (qName.startsWith("h") || qName.startsWith("H")) {
50
			if (qName.length() == 2 && !qName.equalsIgnoreCase("hr")) {
51
				String n = qName.substring(1);
52
				try {
53
					int i = Integer.parseInt(n);
54
					// Levels must be between 1 and 6
55
					if (i > 0 && i < 7) {
56
						return i;
57
					}
58
				} catch (NumberFormatException e) {
59
					System.err.println("Bad header in " + currentHref);
60
				}
61
			}
62
		}
63
		return 0;
64
	}
65
66
	@Override
67
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
68
		if (qName.equalsIgnoreCase("head")) {
69
			insideHead = true;
70
		}
71
	}
72
73
	@Override
74
	public void endElement(String uri, String localName, String qName) throws SAXException {
75
		if (qName.equalsIgnoreCase("head")) {
76
			insideHead = false;
77
		}
78
	}
79
80
	@Override
81
	public void characters(char[] ch, int start, int length) throws SAXException {
82
		// Some titles actually contain newlines – so we need to remove them.
83
		if (recording) {
84
			String s = new String(ch, start, length);
85
			buffer.append(s.replace("\n", ""));
86
		}
87
	}
88
89
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/internal/docs/epub/core/EPUBFileUtil.java (+304 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.core;
12
13
import java.io.BufferedInputStream;
14
import java.io.File;
15
import java.io.FileInputStream;
16
import java.io.FileNotFoundException;
17
import java.io.FileOutputStream;
18
import java.io.IOException;
19
import java.io.InputStream;
20
import java.net.URLConnection;
21
import java.util.ArrayList;
22
import java.util.zip.CRC32;
23
import java.util.zip.ZipEntry;
24
import java.util.zip.ZipException;
25
import java.util.zip.ZipInputStream;
26
import java.util.zip.ZipOutputStream;
27
28
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
29
30
/**
31
 * Various EPUB file related utilities.
32
 * 
33
 * @author Torkild U. Resheim
34
 */
35
public class EPUBFileUtil {
36
37
	static final int BUFFERSIZE = 2048;
38
39
	/**
40
	 * Copies the contents of <i>source</i> to the new <i>destination</i> file.
41
	 * 
42
	 * @param source
43
	 *            the source file
44
	 * @param destination
45
	 *            the destination file
46
	 * @throws IOException
47
	 */
48
	public static void copy(File source, File destination) throws IOException {
49
		destination.getParentFile().mkdirs();
50
		FileInputStream from = null;
51
		FileOutputStream to = null;
52
		try {
53
			from = new FileInputStream(source);
54
			to = new FileOutputStream(destination);
55
			byte[] buffer = new byte[4096];
56
			int bytesRead;
57
58
			while ((bytesRead = from.read(buffer)) != -1) {
59
				to.write(buffer, 0, bytesRead);
60
			}
61
		} finally {
62
			if (from != null)
63
				try {
64
					from.close();
65
				} catch (IOException e) {
66
				}
67
			if (to != null)
68
				try {
69
					to.close();
70
				} catch (IOException e) {
71
				}
72
		}
73
	}
74
75
	/**
76
	 * Attempts to figure out the MIME-type for the file.
77
	 * 
78
	 * @param file
79
	 *            the file to determine MIME-type for
80
	 * @return the MIME-type or <code>null</code>
81
	 */
82
	public static String getMimeType(File file) {
83
		String name = file.getName().toLowerCase();
84
		// These are not (correctly) detected by URLConnection
85
		if (name.endsWith("xhtml")) {
86
			return "application/xhtml+xml";
87
		}
88
		if (name.endsWith(".otf")) {
89
			return "font/opentype";
90
		}
91
		if (name.endsWith(".svg")) {
92
			return "image/svg+xml";
93
		}
94
		if (name.endsWith(".css")) {
95
			return "text/css";
96
		}
97
		// Use URLConnection or content type detection
98
		String mimeType = URLConnection.guessContentTypeFromName(file.getName());
99
		if (mimeType == null) {
100
			try {
101
				InputStream is = new BufferedInputStream(new FileInputStream(file));
102
				mimeType = URLConnection.guessContentTypeFromStream(is);
103
				is.close();
104
			} catch (FileNotFoundException e) {
105
				e.printStackTrace();
106
			} catch (IOException e) {
107
				e.printStackTrace();
108
			}
109
		}
110
		return mimeType;
111
	}
112
113
	/**
114
	 * Creates a path segment list.
115
	 * 
116
	 * @param root
117
	 *            the root folder
118
	 * @param file
119
	 *            the destination file
120
	 * @param segments
121
	 * @see #getRelativePath(File, File)
122
	 */
123
	private static void getPathSegments(File root, File file, ArrayList<String> segments) {
124
		if (root.equals(file)) {
125
			return;
126
		}
127
		segments.add(0, file.getName());
128
		getPathSegments(root, file.getParentFile(), segments);
129
	}
130
131
	/**
132
	 * Determines the <i>root</i> relative path of <i>file</i> in a platform
133
	 * independent manner. The returned string is a path starting from but
134
	 * excluding <i>root</i> using the '/' character as a directory separator.
135
	 * If the <i>file</i> argument is a folder a trailing directory separator is
136
	 * added. if the <i>root</i> argument is a file, it's parent folder will be
137
	 * used.
138
	 * 
139
	 * @param root
140
	 *            the root directory or file
141
	 * @param file
142
	 *            the root contained file or directory
143
	 * @return the platform independent, relative path
144
	 */
145
	public static String getRelativePath(File root, File file) {
146
		ArrayList<String> segments = new ArrayList<String>();
147
		if (root.isFile()) {
148
			root = root.getParentFile();
149
		}
150
		getPathSegments(root, file, segments);
151
		StringBuilder path = new StringBuilder();
152
		for (int p = 0; p < segments.size(); p++) {
153
			if (p > 0) {
154
				path.append('/');
155
			}
156
			path.append(segments.get(p));
157
		}
158
		if (file.isDirectory()) {
159
			path.append('/');
160
		}
161
		return path.toString();
162
	}
163
164
	/**
165
	 * Unpacks the given <i>epubfile</i> to the <i>destination</i> directory.
166
	 * This method will also validate the first item contained in the EPUB (see
167
	 * {@link #writeEPUBHeader(ZipOutputStream)}).
168
	 * 
169
	 * @param epubfile
170
	 *            the EPUB file
171
	 * @param destination
172
	 *            the destination folder
173
	 * @throws IOException
174
	 *             if the operation was unsuccessful
175
	 */
176
	public static void unzip(File epubfile, File destination) throws IOException {
177
		if (!destination.exists()) {
178
			if (!destination.mkdirs()) {
179
				throw new IOException("Could not create directory for EPUB contents");
180
			}
181
		}
182
		ZipInputStream in = new ZipInputStream(new FileInputStream(epubfile));
183
		byte[] buf = new byte[BUFFERSIZE];
184
		ZipEntry entry = null;
185
		boolean checkFirstItem = true;
186
		while ((entry = in.getNextEntry()) != null) {
187
			// for each entry to be extracted
188
			String entryName = entry.getName();
189
			File newFile = new File(destination.getAbsolutePath() + File.separator + entryName);
190
			if (entry.isDirectory()) {
191
				newFile.mkdirs();
192
				continue;
193
			} else {
194
				newFile.getParentFile().mkdirs();
195
			}
196
			int n;
197
			FileOutputStream fileoutputstream = new FileOutputStream(newFile);
198
			while ((n = in.read(buf, 0, BUFFERSIZE)) > -1) {
199
				fileoutputstream.write(buf, 0, n);
200
			}
201
			fileoutputstream.close();
202
			in.closeEntry();
203
			if (checkFirstItem) {
204
				if (!entryName.equals("mimetype")) {
205
					throw new IOException("Invalid EPUB file. First item must be \"mimetype\"");
206
				}
207
				String type = new String(buf);
208
				if (!type.trim().equals(OPSPublication.MIMETYPE_EPUB)) {
209
					throw new IOException("Invalid EPUB file. Expected \"" + OPSPublication.MIMETYPE_EPUB + "\"");
210
				}
211
				checkFirstItem = false;
212
			}
213
		}
214
	}
215
216
	/**
217
	 * A correctly formatted EPUB file must contain an uncompressed entry named
218
	 * <b>mimetype</b> that is placed at the beginning. The contents of this
219
	 * file must be the ASCII-encoded string <b>application/epub+zip</b>. This
220
	 * method will create this file.
221
	 * 
222
	 * @param zos
223
	 *            the zip output stream to write to.
224
	 * @throws IOException
225
	 */
226
	public static void writeEPUBHeader(ZipOutputStream zos) throws IOException {
227
		byte[] bytes = OPSPublication.MIMETYPE_EPUB.getBytes("ASCII");
228
		ZipEntry mimetype = new ZipEntry("mimetype");
229
		mimetype.setMethod(ZipOutputStream.STORED);
230
		mimetype.setSize(bytes.length);
231
		mimetype.setCompressedSize(bytes.length);
232
		CRC32 crc = new CRC32();
233
		crc.update(bytes);
234
		mimetype.setCrc(crc.getValue());
235
		zos.putNextEntry(mimetype);
236
		zos.write(bytes);
237
		zos.closeEntry();
238
	}
239
240
	/**
241
	 * Recursively compresses contents of the given folder into a zip-file. If a
242
	 * file already exists in the given location an exception will be thrown.
243
	 * 
244
	 * @param destination
245
	 *            the destination file
246
	 * @param folder
247
	 *            the source folder
248
	 * @param uncompressed
249
	 *            a list of files to keep uncompressed
250
	 * @throws ZipException
251
	 * @throws IOException
252
	 */
253
	public static void zip(File destination, File folder) throws ZipException, IOException {
254
		if (destination.exists()) {
255
			throw new IOException("A file already exists at " + destination.getAbsolutePath());
256
		}
257
		ZipOutputStream out = new ZipOutputStream(new FileOutputStream(destination));
258
		writeEPUBHeader(out);
259
		zip(folder, folder, out);
260
		out.close();
261
	}
262
263
	/**
264
	 * Adds a folder recursively to the output stream.
265
	 * 
266
	 * @param folder
267
	 *            the root folder
268
	 * @param out
269
	 *            the output stream
270
	 * @throws IOException
271
	 */
272
	private static void zip(File root, File folder, ZipOutputStream out) throws IOException {
273
		// Files first in order to make sure "metadata" is placed first in the
274
		// zip file. We need that in order to support EPUB properly.
275
		File[] files = folder.listFiles(new java.io.FileFilter() {
276
			public boolean accept(File pathname) {
277
				return !pathname.isDirectory();
278
			}
279
		});
280
		byte[] tmpBuf = new byte[BUFFERSIZE];
281
282
		for (int i = 0; i < files.length; i++) {
283
			FileInputStream in = new FileInputStream(files[i].getAbsolutePath());
284
			ZipEntry zipEntry = new ZipEntry(getRelativePath(root, files[i]));
285
			out.putNextEntry(zipEntry);
286
			int len;
287
			while ((len = in.read(tmpBuf)) > 0) {
288
				out.write(tmpBuf, 0, len);
289
			}
290
			out.closeEntry();
291
			in.close();
292
		}
293
		File[] dirs = folder.listFiles(new java.io.FileFilter() {
294
			public boolean accept(File pathname) {
295
				return pathname.isDirectory();
296
			}
297
		});
298
		for (int i = 0; i < dirs.length; i++) {
299
			out.putNextEntry(new ZipEntry(getRelativePath(root, dirs[i])));
300
			zip(root, dirs[i], out);
301
		}
302
	}
303
304
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/internal/docs/epub/core/EPUBXMLHelperImp.java (+21 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.core;
12
13
import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl;
14
15
/**
16
 * 
17
 * @author Torkild U. Resheim
18
 */
19
public class EPUBXMLHelperImp extends XMLHelperImpl {
20
21
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/internal/docs/epub/core/MetadataScanner.java (+70 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.core;
12
13
import java.io.IOException;
14
15
import javax.xml.parsers.ParserConfigurationException;
16
import javax.xml.parsers.SAXParser;
17
import javax.xml.parsers.SAXParserFactory;
18
19
import org.eclipse.mylyn.docs.epub.opf.Metadata;
20
import org.xml.sax.Attributes;
21
import org.xml.sax.InputSource;
22
import org.xml.sax.SAXException;
23
24
/**
25
 * This type is used to scan XHTML files for information that may be used in
26
 * EPUB metadata. This can be the publication title, copyright and author. Some
27
 * of this information can be found inside Dublin Core elements.
28
 * 
29
 * XXX: Not in use yet
30
 * 
31
 * @author Torkild U. Resheim
32
 * @see http://dublincore.org/documents/dc-html/
33
 * @see http://dublincore.org/documents/dcq-html/ (obsolete)
34
 */
35
public final class MetadataScanner extends AbstractXHTMLScanner {
36
37
	@Override
38
	public void endElement(String uri, String localName, String qName) throws SAXException {
39
	}
40
41
	@Override
42
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
43
	}
44
45
	private final Metadata metadata;
46
47
	public MetadataScanner(Metadata metadata) {
48
		super();
49
		this.metadata = metadata;
50
	}
51
52
	public static void parse(InputSource file, Metadata metadata) throws ParserConfigurationException, SAXException,
53
			IOException {
54
		SAXParserFactory factory = SAXParserFactory.newInstance();
55
		factory.setFeature("http://xml.org/sax/features/validation", false);
56
		factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
57
		SAXParser parser = factory.newSAXParser();
58
		MetadataScanner tocGenerator = new MetadataScanner(metadata);
59
		try {
60
			parser.parse(file, tocGenerator);
61
		} catch (SAXException e) {
62
			e.printStackTrace();
63
		}
64
	}
65
66
	public Metadata getMetadata() {
67
		return metadata;
68
	}
69
70
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/internal/docs/epub/core/OPS2Validator.java (+214 lines)
Added Link Here
1
package org.eclipse.mylyn.internal.docs.epub.core;
2
3
import java.io.IOException;
4
import java.util.ArrayList;
5
import java.util.List;
6
7
import javax.xml.parsers.ParserConfigurationException;
8
import javax.xml.parsers.SAXParser;
9
import javax.xml.parsers.SAXParserFactory;
10
11
import org.eclipse.mylyn.docs.epub.core.ValidationMessage;
12
import org.eclipse.mylyn.docs.epub.core.ValidationMessage.Severity;
13
import org.xml.sax.Attributes;
14
import org.xml.sax.InputSource;
15
import org.xml.sax.SAXException;
16
import org.xml.sax.helpers.DefaultHandler;
17
18
/**
19
 * This type is a SAX parser that will read a XHTML file and produce a new
20
 * version where elements and attributes not in the EPUB 2.0.1 <b>preferred</b>
21
 * vocabulary are stripped. Alternatively warnings can be issued when such
22
 * elements and attributes are found.
23
 * 
24
 * @author Torkild U. Resheim
25
 * @see http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm
26
 */
27
public class OPS2Validator extends DefaultHandler {
28
29
	public enum Mode {
30
		/** Remove non-preferred elements and attributes */
31
		REMOVE,
32
		/** Issue warnings when non-preferred elements or attributes are found */
33
		WARN
34
	}
35
36
	private StringBuilder contents = null;
37
38
	private final ArrayList<ValidationMessage> messages;
39
40
	public StringBuilder getContents() {
41
		return contents;
42
	}
43
44
	public ArrayList<ValidationMessage> getMessages() {
45
		return messages;
46
	}
47
48
	public static List<ValidationMessage> validate(InputSource file, String href)
49
			throws ParserConfigurationException,
50
			SAXException, IOException {
51
		SAXParserFactory factory = SAXParserFactory.newInstance();
52
		factory.setFeature("http://xml.org/sax/features/validation", false);
53
		factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
54
		SAXParser parser = factory.newSAXParser();
55
		OPS2Validator tocGenerator = new OPS2Validator(href, Mode.WARN);
56
		try {
57
			parser.parse(file, tocGenerator);
58
			return tocGenerator.getMessages();
59
		} catch (SAXException e) {
60
			System.err.println("Could not parse " + href);
61
			e.printStackTrace();
62
		}
63
		return null;
64
	}
65
66
	public static String clean(InputSource file, String href) throws ParserConfigurationException, SAXException,
67
			IOException {
68
		SAXParserFactory factory = SAXParserFactory.newInstance();
69
		factory.setFeature("http://xml.org/sax/features/validation", false);
70
		factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
71
		SAXParser parser = factory.newSAXParser();
72
		OPS2Validator tocGenerator = new OPS2Validator(href, Mode.REMOVE);
73
		try {
74
			parser.parse(file, tocGenerator);
75
			return tocGenerator.getContents().toString();
76
		} catch (SAXException e) {
77
			System.err.println("Could not parse " + href);
78
			e.printStackTrace();
79
		}
80
		return null;
81
	}
82
	private StringBuilder buffer = null;
83
84
	private final String[] legalAttributes = new String[] { "accesskey", "charset", "class", "coords", "dir", "href",
85
			"hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type", "xml:lang",
86
			/* Are these OK? */
87
			"xmlns", "src", "alt" };
88
89
	/**
90
	 * A list of legal elements according to the EPUB 2.0.1 specification
91
	 * 
92
	 * @see http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section1.3.4
93
	 * @see http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section2.2
94
	 */
95
	private final String[] legalElements = new String[] { "body", "head", "html", "title", "abbr", "acronym",
96
			"address", "blockquote", "br", "cite", "code", "dfn", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6",
97
			"kbd", "p", "pre", "q", "samp", "span", "strong", "var", "a", "dl", "dt", "dd", "ol", "ul", "li", "object",
98
			"param", "b", "big", "hr", "i", "small", "sub", "sup", "tt", "del", "ins", "bdo", "caption", "col",
99
			"colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "img", "area", "map", "style", "link",
100
			"base" };
101
102
	private Mode mode = Mode.WARN;
103
104
	/**
105
	 * A list of elements that should be let through regardless of contents.
106
	 */
107
	private final String[] passthroughElements = new String[] { "meta" };
108
109
	private boolean recording = false;
110
111
	public OPS2Validator(String href, Mode mode) {
112
		super();
113
		buffer = new StringBuilder();
114
		contents = new StringBuilder();
115
		messages = new ArrayList<ValidationMessage>();
116
		this.mode = mode;
117
	}
118
119
	@Override
120
	public void characters(char[] ch, int start, int length) throws SAXException {
121
		if (recording) {
122
			buffer.append(ch, start, length);
123
		}
124
	}
125
126
	@Override
127
	public void endElement(String uri, String localName, String qName) throws SAXException {
128
		if (isLegalElement(qName)) {
129
			contents.append(buffer);
130
			contents.append("</" + qName + ">");
131
			buffer.setLength(0);
132
		}
133
		recording = false;
134
	}
135
136
	/**
137
	 * Returns <code>true</code> if the given attribute name is legal.
138
	 * 
139
	 * @param name
140
	 * @return
141
	 */
142
	private boolean isLegalAttribute(String name) {
143
		for (String legal : legalAttributes) {
144
			if (name.equalsIgnoreCase(legal)) {
145
				return true;
146
			}
147
		}
148
		return false;
149
	}
150
151
	private boolean isLegalElement(String name) {
152
		for (String legal : legalElements) {
153
			if (name.equalsIgnoreCase(legal)) {
154
				return true;
155
			}
156
		}
157
		return false;
158
	}
159
160
	private boolean isPassthroughElement(String name) {
161
		for (String legal : passthroughElements) {
162
			if (name.equalsIgnoreCase(legal)) {
163
				return true;
164
			}
165
		}
166
		return false;
167
	}
168
169
	@Override
170
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
171
		if (isPassthroughElement(qName)) {
172
			// Record any text content
173
			contents.append('<');
174
			contents.append(qName);
175
			for (int i = 0; i < attributes.getLength(); i++) {
176
				String name = attributes.getQName(i);
177
				contents.append(' ');
178
				contents.append(name);
179
				contents.append("=\"");
180
				contents.append(attributes.getValue(i));
181
				contents.append("\"");
182
			}
183
			contents.append('>');
184
			recording = true;
185
186
		} else if (mode.equals(Mode.WARN) || isLegalElement(qName)) {
187
			// Record any text content
188
			contents.append('<');
189
			contents.append(qName);
190
			for (int i = 0; i < attributes.getLength(); i++) {
191
				String name = attributes.getQName(i);
192
				if (mode.equals(Mode.WARN) || isLegalAttribute(name)) {
193
					contents.append(' ');
194
					contents.append(name);
195
					contents.append("=\"");
196
					contents.append(attributes.getValue(i));
197
					contents.append("\"");
198
					if (!isLegalAttribute(name)) {
199
						messages.add(new ValidationMessage(Severity.WARNING, "Attribute " + name
200
								+ " is not in OPS Preferred Vocabularies."));
201
					}
202
				}
203
			}
204
			contents.append('>');
205
			recording = true;
206
			if (!isLegalElement(qName)) {
207
				messages.add(new ValidationMessage(Severity.WARNING, "Element " + qName
208
						+ " is not in OPS Preferred Vocabularies."));
209
210
			}
211
		}
212
	}
213
214
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/internal/docs/epub/core/ReferenceScanner.java (+130 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.core;
12
13
import java.io.File;
14
import java.io.FileReader;
15
import java.io.IOException;
16
import java.util.ArrayList;
17
import java.util.List;
18
19
import javax.xml.parsers.ParserConfigurationException;
20
import javax.xml.parsers.SAXParser;
21
import javax.xml.parsers.SAXParserFactory;
22
23
import org.eclipse.mylyn.docs.epub.opf.Item;
24
import org.xml.sax.Attributes;
25
import org.xml.sax.InputSource;
26
import org.xml.sax.SAXException;
27
28
/**
29
 * This type is a SAX parser that will read a XHTML file and create a list of
30
 * all images that are referenced either through an <i>img<i/> tag or a link.
31
 * 
32
 * @author Torkild U. Resheim
33
 */
34
public class ReferenceScanner extends AbstractXHTMLScanner {
35
36
	public static List<File> parse(Item item) throws ParserConfigurationException, SAXException, IOException {
37
		FileReader fr = new FileReader(item.getFile());
38
		InputSource file = new InputSource(fr);
39
		SAXParserFactory factory = SAXParserFactory.newInstance();
40
		factory.setFeature("http://xml.org/sax/features/validation", false);
41
		factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
42
		SAXParser parser = factory.newSAXParser();
43
		String href = item.getHref();
44
		ReferenceScanner scanner = new ReferenceScanner(item);
45
		try {
46
			parser.parse(file, scanner);
47
			return scanner.files;
48
		} catch (SAXException e) {
49
			System.err.println("Could not parse " + href);
50
			e.printStackTrace();
51
		}
52
		return null;
53
	}
54
55
	Item currentItem;
56
57
	ArrayList<File> files;
58
59
	public ReferenceScanner(Item item) {
60
		super();
61
		files = new ArrayList<File>();
62
		currentItem = item;
63
	}
64
65
	/**
66
	 * Case-insensitive method for obtaining an attribute.
67
	 * 
68
	 * @param attributes
69
	 *            SAX attributes
70
	 * @param name
71
	 *            the attribute name
72
	 * @return the attribute value or <code>null</code>
73
	 */
74
	private String getAttribute(Attributes attributes, String name) {
75
		for (int i = 0; i < attributes.getLength(); i++) {
76
			String aname = attributes.getQName(i);
77
			if (aname.equalsIgnoreCase(name)) {
78
				return attributes.getValue(i);
79
			}
80
		}
81
		return null;
82
	}
83
84
	@Override
85
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
86
87
		// Handle inline image files
88
		if (qName.equalsIgnoreCase("img")) {
89
			String ref = getAttribute(attributes, "src");
90
			if (ref != null) {
91
				String t = ref.toLowerCase();
92
				if (t.startsWith("http://") || t.startsWith("https://")) {
93
					return;
94
				}
95
				// If the item was generated for instance by WikiText we need to
96
				// use the original path. Otherwise we use the item path.
97
				String source = currentItem.getSourcePath();
98
				if (source == null) {
99
					source = currentItem.getFile();
100
				}
101
				File sourceFile = new File(source);
102
				File file = new File(sourceFile.getParentFile().getAbsolutePath() + File.separator + ref);
103
				files.add(file);
104
			}
105
		}
106
107
		// Also handle links to image files
108
		if (qName.equalsIgnoreCase("a")) {
109
			String ref = getAttribute(attributes, "href");
110
			if (ref != null) {
111
				String t = ref.toLowerCase();
112
				if (t.startsWith("#") || t.startsWith("http://") || t.startsWith("https://")) {
113
					return;
114
				}
115
				// If the item was generated for instance by WikiText we need to
116
				// use the original path. Otherwise we use the item path.
117
				String source = currentItem.getSourcePath();
118
				if (source == null) {
119
					source = currentItem.getFile();
120
				}
121
				File sourceFile = new File(source);
122
				File file = new File(sourceFile.getParentFile().getAbsolutePath() + File.separator + ref);
123
				if (!file.isDirectory()) {
124
					files.add(file);
125
				}
126
			}
127
		}
128
	}
129
130
}
(-)a/org.eclipse.mylyn.docs.epub.core/src/org/eclipse/mylyn/internal/docs/epub/core/TOCGenerator.java (+144 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.core;
12
13
import java.io.IOException;
14
15
import javax.xml.parsers.ParserConfigurationException;
16
import javax.xml.parsers.SAXParser;
17
import javax.xml.parsers.SAXParserFactory;
18
19
import org.eclipse.emf.ecore.util.FeatureMapUtil;
20
import org.eclipse.mylyn.docs.epub.ncx.Content;
21
import org.eclipse.mylyn.docs.epub.ncx.NCXFactory;
22
import org.eclipse.mylyn.docs.epub.ncx.NavLabel;
23
import org.eclipse.mylyn.docs.epub.ncx.NavPoint;
24
import org.eclipse.mylyn.docs.epub.ncx.Ncx;
25
import org.eclipse.mylyn.docs.epub.ncx.Text;
26
import org.xml.sax.Attributes;
27
import org.xml.sax.InputSource;
28
import org.xml.sax.SAXException;
29
30
/**
31
 * This type is a SAX parser that will read a XHTML file, locate headers and
32
 * create NCX items for the EPUB table of contents. Each header must have an
33
 * "id" attribute or it will not be possible to link to the header.
34
 * 
35
 * @author Torkild U. Resheim
36
 */
37
public class TOCGenerator extends AbstractXHTMLScanner {
38
39
	private String currentId = null;
40
41
	private NavPoint[] headers = null;
42
43
	private final Ncx ncx;
44
45
	private int playOrder;
46
47
	public int getPlayOrder() {
48
		return playOrder;
49
	}
50
51
	public TOCGenerator(String href, Ncx ncx, int playOrder) {
52
		super();
53
		buffer = new StringBuilder();
54
		currentHref = href;
55
		headers = new NavPoint[6];
56
		this.ncx = ncx;
57
		this.playOrder = playOrder;
58
	}
59
60
61
	@Override
62
	public void endElement(String uri, String localName, String qName) throws SAXException {
63
		int level = isHeader(qName);
64
		if (level > 0) {
65
			recording = false;
66
			NavPoint np = createNavPoint(buffer.toString());
67
			// Determine the parent header
68
			NavPoint h = headers[level - 1];
69
			while (level > 1 && h == null) {
70
				level--;
71
				if (level == 1) {
72
					h = headers[0];
73
					break;
74
				}
75
				h = headers[level - 1];
76
			}
77
			// Add to the parent header or to the root
78
			if (level > 1) {
79
				h.getNavPoints().add(np);
80
			} else {
81
				ncx.getNavMap().getNavPoints().add(np);
82
			}
83
			headers[level] = np;
84
			buffer.setLength(0);
85
		}
86
	}
87
88
	private NavPoint createNavPoint(String title) {
89
		NavPoint np = NCXFactory.eINSTANCE.createNavPoint();
90
		NavLabel nl = NCXFactory.eINSTANCE.createNavLabel();
91
		Content c = NCXFactory.eINSTANCE.createContent();
92
		c.setSrc(currentId == null ? currentHref : currentHref + "#" + currentId);
93
		Text text = NCXFactory.eINSTANCE.createText();
94
		FeatureMapUtil.addText(text.getMixed(), title);
95
		nl.setText(text);
96
		np.getNavLabels().add(nl);
97
		np.setPlayOrder(++playOrder);
98
		np.setId("navpoint" + playOrder);
99
		np.setContent(c);
100
		return np;
101
	}
102
103
	@Override
104
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
105
		if (isHeader(qName) > 0) {
106
			recording = true;
107
			if (attributes.getValue("id") != null) {
108
				currentId = attributes.getValue("id");
109
			} else {
110
				currentId = null;
111
			}
112
		}
113
	}
114
115
	/**
116
	 * 
117
	 * @param file
118
	 * @param href
119
	 * @param ncx
120
	 *            the NCX
121
	 * @param playOrder
122
	 *            initial play order
123
	 * @return
124
	 * @throws ParserConfigurationException
125
	 * @throws SAXException
126
	 * @throws IOException
127
	 */
128
	public static int parse(InputSource file, String href, Ncx ncx, int playOrder) throws ParserConfigurationException,
129
			SAXException, IOException {
130
		SAXParserFactory factory = SAXParserFactory.newInstance();
131
		factory.setFeature("http://xml.org/sax/features/validation", false);
132
		factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
133
		SAXParser parser = factory.newSAXParser();
134
		TOCGenerator tocGenerator = new TOCGenerator(href, ncx, playOrder);
135
		try {
136
			parser.parse(file, tocGenerator);
137
		} catch (SAXException e) {
138
			System.err.println("Could not parse " + href);
139
			e.printStackTrace();
140
		}
141
		return tocGenerator.getPlayOrder();
142
	}
143
144
}
(-)a/org.eclipse.mylyn.docs.epub.examples/.project (+11 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.mylyn.docs.epub.examples</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
	</buildSpec>
9
	<natures>
10
	</natures>
11
</projectDescription>
(-)a/org.eclipse.mylyn.docs.epub.examples/.settings/org.eclipse.core.resources.prefs (+3 lines)
Added Link Here
1
#Fri Oct 07 19:59:34 CEST 2011
2
eclipse.preferences.version=1
3
encoding/<project>=UTF-8
(-)a/org.eclipse.mylyn.docs.epub.examples/.settings/org.eclipse.core.runtime.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:31 CEST 2011
2
eclipse.preferences.version=1
3
line.separator=\n
(-)a/org.eclipse.mylyn.docs.epub.examples/book/build-book.xml (+83 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
    Copyright (c) 2011 Torkild U. Resheim and others
4
    All rights reserved. This program and the accompanying materials
5
    are made available under the terms of the Eclipse Public License v1.0
6
    which accompanies this distribution, and is available at
7
    http://www.eclipse.org/legal/epl-v10.html
8
    
9
    Contributors:
10
        Torkild U. Resheim - initial API and implementation
11
 -->
12
13
<project name="org.eclipse.mylyn.docs.epub.ui.docs" default="plugin-book">
14
15
	<!-- Location of the user guide markup files -->
16
	<property name="srcdir" location="${basedir}/../../org.eclipse.mylyn.docs.epub.help/docs" />
17
	<!-- Location of EPUB related files -->
18
	<property name="bookdir" location="${basedir}" />
19
	<!-- Location of the finished EPUB -->
20
	<property name="epubfile" location="${basedir}/Building_EPUBs.epub" />
21
22
	<path id="wikitext.ant.classpath">
23
		<pathelement location="../../org.eclipse.mylyn.wikitext.core/bin"/>
24
		<pathelement location="../../org.eclipse.mylyn.wikitext.textile.core/bin"/>
25
	</path>
26
27
	<taskdef resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" classpathref="wikitext.ant.classpath"/>
28
29
	<target name="init">
30
31
		<delete file="${epubfile}" failonerror="false" />
32
33
		<!-- Convert the Textile markup to HTML -->
34
		<wikitext-to-html markupLanguage="org.eclipse.mylyn.wikitext.textile.core.TextileLanguage" 
35
			emitdoctype="true" overwrite="true" xhtmlstrict="true" 
36
			htmlDoctype="&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&gt;">
37
			<fileset dir="${srcdir}">
38
				<include name="*.textile" />
39
			</fileset>
40
			<fileset dir="${basedir}">
41
				<include name="*.textile" />
42
			</fileset>
43
			<stylesheet url="style.css" />
44
		</wikitext-to-html>
45
	</target>
46
47
	<!-- contributor, date -->
48
	<target name="plugin-book" depends="init">
49
		<epub identifierId="uuid" file="${epubfile}">
50
			<language code="en" />
51
			<identifier id="uuid" scheme="UUID">70ce7c20-8f9e-11e0-91e4-0800200c9a66</identifier>
52
			<title>Building EPUBs</title>
53
			<subject>Computing, Eclipse, Mylyn, EPUB</subject>
54
			<publisher>Eclipse.Org</publisher>
55
			<creator name="Torkild Ulvøy Resheim" fileAs="Resheim, Torkild Ulvøy" role="aut" />
56
			<rights>Copyright (c) 2011, Torkild Ulvøy Resheim. Licensed under the Eclipse Public License version 1.0</rights>
57
			<type>Technical article.</type>
58
			<!-- The DejaVu Fonts - http://dejavu-fonts.org/wiki/License -->
59
			<contributor name="Bitstream" fileAs="Bitstream" role="art" />
60
			<cover image="${basedir}/cover.jpg">Cover page</cover>
61
			<item file="${basedir}/title-page.html" />
62
			<item file="${basedir}/copyright.html" />
63
			<item file="${srcdir}/introduction.html" />
64
			<item file="${srcdir}/epub-format.html" />
65
			<item file="${srcdir}/generate-ant.html" />
66
			<item file="${srcdir}/generate-epub.html" />
67
			<item file="${srcdir}/epub-ant-task.html" />
68
			<item file="${srcdir}/examples.html" />
69
			<item file="${basedir}/style.css" type="text/css" spine="false" />
70
			<reference href="title-page.html" type="title-page" title="Building EPUBs" />
71
			<reference href="introduction.html" type="preface" title="Introduction" />
72
			<reference href="copyright.html" type="copyright-page" title="Copyright" />
73
			<toc generate="true" />
74
			<fileset dir="${srcdir}">
75
				<include name="*.gif" />
76
				<include name="*.png" />
77
				<include name="*.jpg" />
78
				<include name="fonts/*.otf" />
79
			</fileset>
80
		</epub>
81
	</target>
82
83
</project>
(-)a/org.eclipse.mylyn.docs.epub.examples/book/copyright.textile (+9 lines)
Added Link Here
1
h1. Copyrights
2
3
p. The EPUB 2.0.1 Specification is Copyright &copy; 2007 by International Digital Publishing Forum(tm).
4
5
p. The Dublin Core Specification is Copyright &copy; 1995-2011 DCMI. All Rights Reserved. Licensed under a Creative Commons Attribution 3.0 Unported License.
6
7
p. The DejaVu Sans Mono fonts used in this publication are Copyright &copy; 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
8
9
p. This book is Copyright &copy; 2011 by Torkild U. Resheim
(-)a/org.eclipse.mylyn.docs.epub.examples/book/fonts/DejaVuSansMono.license (+97 lines)
Added Link Here
1
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
2
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
3
4
Bitstream Vera Fonts Copyright
5
———————————————
6
7
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
8
a trademark of Bitstream, Inc.
9
10
Permission is hereby granted, free of charge, to any person obtaining a copy
11
of the fonts accompanying this license (“Fonts”) and associated
12
documentation files (the “Font Software”), to reproduce and distribute the
13
Font Software, including without limitation the rights to use, copy, merge,
14
publish, distribute, and/or sell copies of the Font Software, and to permit
15
persons to whom the Font Software is furnished to do so, subject to the
16
following conditions:
17
18
The above copyright and trademark notices and this permission notice shall
19
be included in all copies of one or more of the Font Software typefaces.
20
21
The Font Software may be modified, altered, or added to, and in particular
22
the designs of glyphs or characters in the Fonts may be modified and
23
additional glyphs or characters may be added to the Fonts, only if the fonts
24
are renamed to names not containing either the words “Bitstream” or the word
25
“Vera”.
26
27
This License becomes null and void to the extent applicable to Fonts or Font
28
Software that has been modified and is distributed under the “Bitstream
29
Vera” names.
30
31
The Font Software may be sold as part of a larger software package but no
32
copy of one or more of the Font Software typefaces may be sold by itself.
33
34
THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
35
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
36
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
37
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
38
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
39
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
40
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
41
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
42
FONT SOFTWARE.
43
44
Except as contained in this notice, the names of Gnome, the Gnome
45
Foundation, and Bitstream Inc., shall not be used in advertising or
46
otherwise to promote the sale, use or other dealings in this Font Software
47
without prior written authorization from the Gnome Foundation or Bitstream
48
Inc., respectively. For further information, contact: fonts at gnome dot
49
org.
50
51
Arev Fonts Copyright
52
———————————————
53
54
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
55
56
Permission is hereby granted, free of charge, to any person obtaining
57
a copy of the fonts accompanying this license (“Fonts”) and
58
associated documentation files (the “Font Software”), to reproduce
59
and distribute the modifications to the Bitstream Vera Font Software,
60
including without limitation the rights to use, copy, merge, publish,
61
distribute, and/or sell copies of the Font Software, and to permit
62
persons to whom the Font Software is furnished to do so, subject to
63
the following conditions:
64
65
The above copyright and trademark notices and this permission notice
66
shall be included in all copies of one or more of the Font Software
67
typefaces.
68
69
The Font Software may be modified, altered, or added to, and in
70
particular the designs of glyphs or characters in the Fonts may be
71
modified and additional glyphs or characters may be added to the
72
Fonts, only if the fonts are renamed to names not containing either
73
the words “Tavmjong Bah” or the word “Arev”.
74
75
This License becomes null and void to the extent applicable to Fonts
76
or Font Software that has been modified and is distributed under the 
77
“Tavmjong Bah Arev” names.
78
79
The Font Software may be sold as part of a larger software package but
80
no copy of one or more of the Font Software typefaces may be sold by
81
itself.
82
83
THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
84
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
85
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
86
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
87
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
88
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
89
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
90
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
91
OTHER DEALINGS IN THE FONT SOFTWARE.
92
93
Except as contained in this notice, the name of Tavmjong Bah shall not
94
be used in advertising or otherwise to promote the sale, use or other
95
dealings in this Font Software without prior written authorization
96
from Tavmjong Bah. For further information, contact: tavmjong @ free
97
. fr.
(-)a/org.eclipse.mylyn.docs.epub.examples/book/style.css (+204 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
12
@page {
13
  margin-left: 0px;
14
  margin-right: 0px;
15
}
16
17
p {
18
  text-align: justify; 
19
  line-height: 1.5em;
20
}
21
22
/*
23
 * PREFORMATTED TEXT
24
 */
25
code strong em, code em strong, pre strong em, pre em strong, tt strong em, tt em strong {
26
  font-weight: bold;
27
  font-style: italic;
28
  font-family: "DejaVu Sans Mono Bold Oblique", monospace;
29
  color: #3a587a;
30
  font-size: 0.8em;
31
}
32
33
code em, em code, pre em, em pre, tt em, em tt {
34
  font-style: italic;
35
  font-family: "DejaVu Sans Mono Oblique", monospace;
36
  color: #3a587a;
37
  font-size: 0.8em;
38
}
39
40
code strong, strong code, pre strong, strong pre, tt strong, strong tt {
41
  font-weight: bold;
42
  font-family: "DejaVu Sans Mono Bold", monospace;
43
  color: #3a587a;
44
  font-size: 0.8em;
45
}
46
47
code, pre, tt { 
48
  font-family: "DejaVu Sans Mono", monospace;
49
  color: #3a587a;
50
  font-size: 0.8em;
51
}
52
53
/*
54
 * TABLES
55
 */
56
table, td, th {
57
  border-color: #d5d399; 
58
  border-style: solid;
59
}
60
61
table {
62
  width: 100%;
63
  border-width: 0 0 1px 1px; 
64
  border-spacing: 0; 
65
  border-collapse: collapse;
66
}
67
68
td, th {
69
  margin: 0; 
70
  padding: 4px; 
71
  border-width: 1px 1px 0 0; 
72
  font-size: 0.9em;
73
}
74
75
th {
76
  background-color: #e4e3bd;
77
  font-family: "Helvetica", sans-serif;
78
  font-weight: bold;
79
}
80
81
td {
82
  background-color: #f3f2e1;
83
  font-family: "Helvetica", sans-serif;
84
}
85
86
.logo {
87
  display: block; margin-left: auto; margin-right: auto;
88
}
89
90
.title {
91
  color: #000000;
92
  font-size: 2em; 
93
  text-align: center;
94
  border-bottom: 1px black solid; 
95
  font-family: "Palatino", serif;
96
  font-weight: bold;
97
}
98
99
.author, .copyright {
100
  font-size: 1em; color: #000000;
101
  font-family: "Palatino", serif;
102
  font-weight: bold;
103
  text-align: center;
104
}
105
106
/*
107
 * HEADERS
108
 */
109
h1, h2, h3, h4, h5, h6 {
110
  text-align: left;
111
  page-break-inside: avoid;
112
  page-break-after: avoid;
113
  font-weight: bold;
114
  display: block;
115
}
116
117
h1 {
118
  font-size: 1.7em;
119
  text-align: center;
120
  border-top: 1px #000000 solid;
121
  border-bottom: 1px #000000 solid;
122
  padding-top: 0.5em;
123
  padding-bottom: 0.5em;
124
  margin-bottom: 1.5em;
125
  font-family: "Palatino", serif;
126
  font-weight: bold;
127
}
128
129
h2 {
130
  font-size: 1.5em;
131
  font-family: "Palatino", serif;
132
  font-weight: bold;
133
}
134
135
h3 {
136
  font-size: 1.3em;
137
  font-family: "Palatino", serif;
138
  font-weight: bold;
139
}
140
141
h4 {
142
  font-size: 1.2em;
143
  font-style: italic;
144
  font-family: "Palatino", serif;
145
  font-weight: bold;
146
}
147
148
h5 {
149
  font-size: 1em;
150
  font-style: italic;
151
  font-family: "Palatino", serif;
152
}
153
154
h6 {
155
  font-size: 1em;
156
  font-style: italic;
157
  font-family: "Palatino", serif;
158
}
159
160
hr {
161
  width: 80%;
162
  backgrund-color: #aaaaaa;
163
  height: 1px;
164
}
165
166
/* 
167
 * fonts (keep at bottom); using DejaVu for its rich set of glyphs (and being
168
 * free for use)
169
 */
170
@font-face {
171
  font-family: "DejaVu Sans Mono";
172
  font-weight: normal;
173
  font-style: normal;
174
  src: url(DejaVuSansMono.otf);
175
}
176
177
@font-face {
178
  font-family: "DejaVu Sans Mono Bold";
179
  font-weight: bold;
180
  font-style: normal;
181
  src: url(DejaVuSansMono-Bold.otf);
182
}
183
184
@font-face {
185
  font-family: "DejaVu Sans Mono Oblique";
186
  font-weight: normal;
187
  font-style: italic;
188
  src: url(DejaVuSansMono-Oblique.otf);
189
}
190
191
@font-face {
192
  font-family: "DejaVu Sans Mono Bold Oblique";
193
  font-weight: bold;
194
  font-style: italic;
195
  src: url(DejaVuSansMono-BoldOblique.otf);
196
}
197
198
body {
199
  font-size: 1em;
200
  margin: 0;
201
  padding: 0;
202
  text-align: left;
203
  font-family: "Palatino"
204
}
(-)a/org.eclipse.mylyn.docs.epub.examples/book/title-page.html (+20 lines)
Added Link Here
1
<?xml version='1.0' encoding='utf-8' ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
<title>Building EPUBs</title>
7
<link type="text/css" rel="stylesheet" href="style.css" />
8
</head>
9
<body>
10
	<p class="title">
11
		<span>Building EPUBs</span>
12
	</p>
13
	<p class="author">
14
		<span>by Torkild U. Resheim</span>
15
	</p>
16
	<p class="copyright">
17
		<span>Copyright &copy; 2011</span>
18
	</p>
19
</body>
20
</html>
(-)a/org.eclipse.mylyn.docs.epub.examples/simple/my_chapter.xhtml (+39 lines)
Added Link Here
1
<?xml version='1.0' encoding='utf-8' ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<title>My Chapter</title>
6
<link type="text/css" rel="stylesheet" href="style.css" />
7
</head>
8
<body>
9
  <h1>Lorem Ipsum</h1>
10
	<p>Lorem ipsum dolor sit amet feugiat in gravida felis. Et pede erat
11
		curabitur faucibus nec condimentum turpis risus ipsum rutrum lorem mi augue
12
		donec. Consectetuer quam cursus feugiat amet eget. Lacus id pulvinar nec eu
13
		phasellus. Eu ut nullam. Inceptos lorem malesuada sed vitae augue erat in eu.
14
		Ac mauris vel. In et elit et sit donec. Convallis at ac qui fermentum purus.
15
		Sodales vulputate eu. Sed massa amet dui ut pharetra vel nec in. Magna donec
16
		ut eget duis natoque. Amet suscipit et. Consequat facilisi inceptos. Nunc
17
		nulla orci. Donec conubia est amet venenatis risus. Quisque mauris porta. At
18
		est ut pede est accumsan mauris eu mauris dui augue cras. Augue volutpat sit
19
		nibh malesuada mus. Integer odio suscipit elit metus blandit adipiscing lorem
20
		pede. Venenatis magna nulla. Nec at in. Praesent rhoncus malesuada. Felis
21
		gravida donec morbi aliquam do. Suspendisse risus ut condimentum fusce id
22
		enim facilisi sem.</p>
23
	<p>Condimentum sit rhoncus sed integer semper sollicitudin id dictum.
24
		Viverra tincidunt a. Nec leo est dui aenean lacus suspendisse eros euismod
25
		rutrum eget ea. Aenean libero quisque. Wisi nonummy sit.</p>
26
	<p>Amet augue nec sapien luctus turpis. Enim donec mollis suspendisse non
27
		maecenas. Aptent nullam sed arcu sociosqu pede a vehicula faucibus massa
28
		laoreet pellentesque wisi morbi expedita laoreet praesent hendrerit.
29
		Hymenaeos elit sed. Luctus venenatis odio aenean orci vestibulum vehicula
30
		dolorem ac ipsum neque urna. Elit deleniti vulputate. Consequat nibh sem
31
		neque nec duis aptent vitae montes. Eget nisl pellentesque eu felis quis. Sed
32
		enim magna. Sed urna tempus ultricies id sociis mollis ullamcorper ut
33
		elementum maecenas eget. In lectus accumsan eget amet voluptate. Eu sed
34
		justo. Et pellentesque lectus aliquam id laoreet. Cupidatat placerat urna
35
		malesuada massa posuere. Viverra sed egestas. Habitasse tempus sit. Ipsum
36
		vestibulum dui. Potenti tincidunt ut nullam dolor lorem. Suspendisse at elit.
37
		Tortor eget vulputate.</p>
38
</body>
39
</html>
(-)a/org.eclipse.mylyn.docs.epub.examples/simple/simple.xml (+18 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- Copyright (c) 2011 Torkild U. Resheim and others All rights reserved. 
3
	This program and the accompanying materials are made available under the 
4
	terms of the Eclipse Public License v1.0 which accompanies this distribution, 
5
	and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: 
6
	Torkild U. Resheim - initial API and implementation -->
7
8
<project name="EPUB Simple Example" basedir="." default="epub">
9
10
	<target name="epub">
11
		<epub file="My Book.epub">
12
			<title>My Book</title>
13
			<subject>My Book's subject</subject>
14
			<item file="my_chapter.xhtml" />
15
		</epub>
16
	</target>
17
18
</project>
(-)a/org.eclipse.mylyn.docs.epub.help/.classpath (+7 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
(-)a/org.eclipse.mylyn.docs.epub.help/.gitignore (+4 lines)
Added Link Here
1
/build
2
/bin
3
/Building_EPUBs.epub
4
/help
(-)a/org.eclipse.mylyn.docs.epub.help/.project (+28 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.mylyn.docs.epub.help</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
(-)a/org.eclipse.mylyn.docs.epub.help/.settings/org.eclipse.core.resources.prefs (+3 lines)
Added Link Here
1
#Thu Oct 06 23:37:22 CEST 2011
2
eclipse.preferences.version=1
3
encoding/<project>=UTF-8
(-)a/org.eclipse.mylyn.docs.epub.help/.settings/org.eclipse.core.runtime.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:44 CEST 2011
2
eclipse.preferences.version=1
3
line.separator=\n
(-)a/org.eclipse.mylyn.docs.epub.help/.settings/org.eclipse.jdt.core.prefs (+8 lines)
Added Link Here
1
#Wed Aug 31 09:27:04 CEST 2011
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5
org.eclipse.jdt.core.compiler.compliance=1.6
6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8
org.eclipse.jdt.core.compiler.source=1.6
(-)a/org.eclipse.mylyn.docs.epub.help/META-INF/MANIFEST.MF (+9 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: EPUB Help and User Guide
4
Bundle-SymbolicName: org.eclipse.mylyn.docs.epub.help;singleton:=true
5
Bundle-Version: 0.8.0.qualifier
6
Bundle-Vendor: Torkild U. Resheim
7
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
8
Require-Bundle: org.eclipse.mylyn.docs.epub.core;bundle-version="0.8.0",
9
 org.eclipse.mylyn.docs.epub.ant.core;bundle-version="0.8.0"
(-)a/org.eclipse.mylyn.docs.epub.help/build-docs.xml (+70 lines)
Added Link Here
1
<?xml version='1.0' encoding='utf-8'?>
2
<!--
3
    Copyright (c) 2007, 2009 David Green and others.
4
    All rights reserved. This program and the accompanying materials
5
    are made available under the terms of the Eclipse Public License v1.0
6
    which accompanies this distribution, and is available at
7
    http://www.eclipse.org/legal/epl-v10.html
8
    
9
    Contributors:
10
        David Green - initial API and implementation
11
        Torkild U. Resheim - Adapted for building the EPUB user guide
12
 -->
13
14
<!-- Will currently only work when called from Maven - see pom.xml -->
15
<project name="org.eclipse.mylyn.docs.epub.ui.docs" default="all">
16
17
	<property name="wikitext.help" location="../org.eclipse.mylyn.wikitext.help.ui" />
18
19
	<path id="wikitext.ant.classpath">
20
		<pathelement path="${compile_classpath}"/>
21
	</path>
22
23
	<target name="clean">
24
		<delete failonerror="false">
25
			<fileset dir="help">
26
				<include name="**/*"/>
27
			</fileset>
28
		</delete>
29
		<delete dir="${wikitext.ui.textile.bin}" failonerror="false"/>
30
	</target>
31
32
	<target name="all" depends="plugin-docs">
33
	</target>
34
35
	<target name="plugin-docs" description="generate plugin help documentation">
36
		<taskdef resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" classpathref="wikitext.ant.classpath"/>
37
38
		<mkdir dir="${basedir}/help"/>
39
40
		<wikitext-to-eclipse-help markupLanguage="org.eclipse.mylyn.wikitext.textile.core.TextileLanguage"
41
			overwrite="true" 
42
			multipleOutputFiles="true"
43
			navigationImages="true"
44
			helpPrefix="help">
45
			<fileset dir="docs">
46
				<include name="*.textile"/>
47
			</fileset>
48
			<stylesheet url="../../PRODUCT_PLUGIN/book.css"/>
49
			<stylesheet file="${wikitext.help}/help/styles/main.css"/>
50
			<stylesheet file="${basedir}/docs/style.css"/>
51
		</wikitext-to-eclipse-help>
52
53
		<move todir="${basedir}/help">
54
			<fileset dir="${basedir}/docs">
55
				<include name="*.html" />
56
				<include name="*-toc.xml" />
57
			</fileset>
58
		</move>
59
60
		<copy todir="${basedir}/help">
61
			<fileset dir="${basedir}/docs">
62
				<include name="*.gif" />
63
				<include name="*.png" />
64
				<include name="*.jpg" />
65
			</fileset>
66
		</copy>
67
68
	</target>
69
70
</project>
(-)a/org.eclipse.mylyn.docs.epub.help/build.properties (+7 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .,\
5
               help/,\
6
               toc.xml,\
7
               plugin.xml
(-)a/org.eclipse.mylyn.docs.epub.help/docs/epub-ant-task.textile (+361 lines)
Added Link Here
1
h1. The EPUB ANT task
2
3
The **epub** "Ant":http://www.apache.org task is used to assemble an EPUB file from a given set of source items. It is assumes that most of the source material such as HTML-files and illustrations has been prepared beforehand. Ant version 1.7 and newer is supported.
4
5
The following is an approximate DTD for the task: 
6
7
bc.. 
8
9
<!ELEMENT epub (identifier | type | subject | reference | creator | meta | 
10
	publisher | source | language | rights | contributor | format | cover | 
11
	toc | item | date | title | fileset)*>
12
<!ATTLIST epub
13
          id ID #IMPLIED
14
          taskname CDATA #IMPLIED
15
          identifierid CDATA #IMPLIED
16
          file CDATA #IMPLIED
17
          description CDATA #IMPLIED
18
          workingfolder CDATA #IMPLIED
19
          includeReferenced %boolean; #IMPLIED>
20
21
p. 
22
* **id** - item identifier
23
* **taskname** - name to use for task when logging
24
* **identifierid** - reference to an identifier added using the **identifier** element. 
25
* **file** - path to the resulting EPUB file.
26
* **description** - description of the task.
27
* **workingfolder** - optionally used to specify the folder used for assembling the EPUB. If not specified a temporary folder will be used and deleted when the processing has completed.
28
* **includeReferenced** - optionally used to automatically include referenced items in the finished publication. When setting this to **true** there should be no need to explicitly add for instance referenced image files. This value is per default **false**.
29
30
h2. Adding "header" information
31
32
Certain elements are required in the header of the publication. These include the title of the publication, the identifier and the language code. It is possible to add more than one element of some types.
33
34
The following elements can be used:
35
|_. id |_. Required |_. Description |
36
|"title":#Publicationtitle|yes|The publication title|
37
|"identifier":#Publicationidentifiers|yes|The publication identifier|
38
|"language":#Languagespecification|yes|The publication language|
39
|"publisher":#Publisher|no|Name of the publisher|
40
|"subject":#Publicationsubject|no|Subject of the publication|
41
|"creator":#ContributorsandCreators|no|One or more creators|
42
|"contributor":#ContributorsandCreators|no|One or more contributors|
43
|"date":#Dates|no|One or more dates|
44
|"cover":#Cover|no|The cover page|
45
46
h3. Publication title
47
48
p. Typically, the title will be a name by which the resource is formally known.
49
50
bc.. 
51
<!ELEMENT title (#PCDATA)>
52
<!ATTLIST title
53
          id ID #IMPLIED
54
          lang CDATA #IMPLIED>
55
56
h3. Publication identifiers
57
58
p. The recommended best practice is to identify the resource by means of a string or number conforming to a formal identification system. These include but are not limited to the "Uniform Resource Identifier":http://en.wikipedia.org/wiki/Uniform_Resource_Identifier, the "Digital Object Identifier":http://en.wikipedia.org/wiki/Digital_object_identifier (DOI) and the "International Standard Book Number":http://en.wikipedia.org/wiki/International_Standard_Book_Number (ISBN).
59
60
bc.. 
61
<!ELEMENT identifier (#PCDATA)>
62
<!ATTLIST identifier
63
          id ID #IMPLIED
64
          scheme CDATA #IMPLIED>
65
66
p. If an identifier is not specified, one will be generated based using a random "UUID":http://en.wikipedia.org/wiki/Universally_unique_identifier. However it is probably a good idea to specify an identifier. Reading systems may use this field as intended and replace older versions of the publication when a newer is added to the library.
67
68
h3. Language specification
69
70
p. The recommended best practice is to use RFC 3066 which, in conjunction with "ISO639":http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes , defines two- and three-letter primary language tags with optional subtags. Examples include "no" for Norwegian, "en" for English", and "en-GB" for English used in the United Kingdom.
71
72
bc.. 
73
<!ELEMENT language EMPTY>
74
<!ATTLIST language
75
          id ID #IMPLIED
76
          code CDATA #IMPLIED>
77
78
p.          
79
* **id** - optional unique identifier.
80
* **code** - the language code.
81
82
p. If a language is not specified it will be set to "en" for generic English.
83
84
h3. Publisher
85
 
86
bc.. 
87
<!ELEMENT publisher (#PCDATA)>
88
<!ATTLIST publisher
89
          id ID #IMPLIED
90
          lang CDATA #IMPLIED>
91
p.          
92
* **id** - optional unique identifier.
93
* **lang** - optional language code.
94
* **text** - name of the publisher.
95
96
h3. Publication subject
97
98
p. The subject will typically be represented using keywords, key phrases, or classification codes.
99
100
bc.. 
101
<!ELEMENT subject (#PCDATA)>
102
<!ATTLIST subject
103
          id ID #IMPLIED
104
          lang CDATA #IMPLIED>
105
106
h3. Contributors and Creators
107
108
p. Examples of a contributor and creator include a person, an organization, or a service. 
109
110
bc.. 
111
<!ELEMENT contributor EMPTY>
112
<!ATTLIST contributor
113
          id ID #IMPLIED
114
          fileAs CDATA #IMPLIED
115
          name CDATA #IMPLIED
116
          lang CDATA #IMPLIED
117
          role CDATA #IMPLIED>
118
119
<!ELEMENT creator EMPTY>
120
<!ATTLIST creator
121
          id ID #IMPLIED
122
          fileAs CDATA #IMPLIED
123
          name CDATA #IMPLIED
124
          lang CDATA #IMPLIED
125
          role CDATA #IMPLIED>
126
127
p. 
128
* **id** - optional unique identifier.
129
* **fileAs** - optional filing specification.
130
* **name** - name of the creator or contributor.
131
* **lang** - optional language code.
132
* **role** - optional MARC relator code.
133
          
134
Optionally one can specify **fileas** to indicate a formal way of filing the entry. For instance "Last name, first name".
135
136
bc.. 
137
<creator name="Nomen Nescio" file-as="Nescio, Nomen" role="aut/>
138
139
p. This tooling will automatically add "Eclipse Committers and Contributors" in the redactor role.
140
141
p. In **role** "MARC relator codes":http://www.loc.gov/marc/relators/ are used for indicating the role of the entity. The complete list is quite long. Some of the more typical are:
142
143
|_. Name |_. Code |_. Description |
144
|Artist|art|Use for a person (e.g., a painter) who conceives, and perhaps also implements, an original graphic design or work of art, if specific codes (e.g., [egr], [etr]) are not desired. For book illustrators, prefer Illustrator [ill].|
145
|Author|aut|Use for a person or corporate body chiefly responsible for the intellectual or artistic content of a work. This term may also be used when more than one person or body bears such responsibility.|
146
|Author in quotations or text extracts|aqt|Use for a person whose work is largely quoted or extracted in a works to which he or she did not contribute directly. Such quotations are found particularly in exhibition catalogs, collections of photographs, etc.|
147
|Author of afterword, colophon, etc.|aft|Use for a person or corporate body responsible for an afterword, postface, colophon, etc. but who is not the chief author of a work.|
148
|Author of introduction, etc.|aui|Use for a person or corporate body responsible for an introduction, preface, foreword, or other critical matter, but who is not the chief author.|
149
|Collaborator|clb|Use for a person or corporate body that takes a limited part in the elaboration of a work of another author or that brings complements (e.g., appendices, notes) to the work of another author.|
150
|Compiler|com|Use for a person who produces a work or publication by selecting and putting together material from the works of various persons or bodies.|
151
|Designer|dsr|Use for a person or organization responsible for design if specific codes (e.g., [bkd], [tyd]) are not desired.|
152
|Editor|edt|Use for a person who prepares for publication a work not primarily his/her own, such as by elucidating text, adding introductory or other critical matter, or technically directing an editorial staff.|
153
|Illustrator|ill|Use for the person who conceives, and perhaps also implements, a design or illustration, usually to accompany a written text.|
154
|Photographer|pht|Use for the person or organization responsible for taking photographs, whether they are used in their original form or as reproductions.|
155
|Redactor|red|Use for a person who writes or develops the framework for an item without being intellectually responsible for its content.|
156
|Reviewer|rev|Use for a person or corporate body responsible for the review of book, motion picture, performance, etc.|
157
158
h3. Dates
159
160
bc.. 
161
<!ELEMENT date EMPTY>
162
<!ATTLIST date
163
          id ID #IMPLIED
164
          date CDATA #IMPLIED
165
          event CDATA #IMPLIED>
166
          
167
p.           
168
* **id** - optional unique identifier.
169
* **date** - a date on the format YYYY[-MM[-DD]].
170
* **event** - an optional event specification.     
171
          
172
p. Date of publication, in the format defined by "Date and Time Formats":http://www.w3.org/TR/NOTE-datetime and by ISO 8601 on which it is based. In particular, dates without times are represented in the form YYYY[-MM[-DD]]: a required 4-digit year, an optional 2-digit month, and if the month is given, an optional 2-digit day of month.
173
174
p. You may also set the **event** attribute. Legal values are not defined but may include "creation", "publication" and "modification".
175
176
p. The epub task will always add a "creation" date using the current date when assembling the epub file. 
177
178
h3. Types
179
180
p. type includes terms describing general categories, functions, genres, or aggregation levels for content. The advised best practice is to select a value from a controlled vocabulary.
181
182
p. Type includes terms describing general categories, functions, genres, or aggregation levels for content. Recommended best practice is to select a value from a controlled vocabulary (for example, the DCMI Type Vocabulary [DCT1]). To describe the physical or digital manifestation of the resource, use the FORMAT element.
183
184
bc.. 
185
<!ELEMENT type (#PCDATA)>
186
<!ATTLIST type
187
          id ID #IMPLIED>
188
189
h3. Formats
190
191
p. Use to specify the format of the publication. Typically this is the MIME type or the software, hardware, or other equipment needed. The epub task will always set the format to "application/epub+zip" unless a different format is specified.
192
193
bc.. 
194
<!ELEMENT format (#PCDATA)>
195
<!ATTLIST format
196
          id ID #IMPLIED
197
          lang CDATA #IMPLIED>
198
199
h3. Source
200
201
p. The publication may be derived from another resource in whole or part. Recommended best practice is to identify the referenced resource by means of a string or number conforming to a formal identification system. If the publication is built from a web site it would be a good idea to use the URL of the entry page. 
202
203
bc.. 
204
<!ELEMENT source (#PCDATA)>
205
<!ATTLIST source
206
          id ID #IMPLIED
207
          lang CDATA #IMPLIED>
208
209
h3. Rights
210
211
p. A statement about rights, or a reference to one. In this specification, the copyright notice and any further rights description should appear directly.
212
This specification does not address the manner in which a Content Provider specifies to a secure distributor any licensing terms under which readership rights or copies of the content could be sold.
213
214
p. Typically, Rights will contain a rights management statement for the resource, or reference a service providing such information. Rights information often encompasses Intellectual Property Rights (IPR), Copyright, and various Property Rights. If the Rights element is absent, no assumptions may be made about any rights held in or over the resource.
215
216
bc.. 
217
<!ELEMENT rights (#PCDATA)>
218
<!ATTLIST rights
219
          id ID #IMPLIED
220
          lang CDATA #IMPLIED>
221
          
222
h3. Coverage
223
224
p. The extent or scope of the publication’s content. The advised best practice is to select a value from a controlled vocabulary; see the Dublin Core Metadata Element Set (http://dublincore.org/documents/2004/12/20/dces/).
225
226
p. Typically, Coverage will include spatial location (a place name or geographic coordinates), temporal period (a period label, date, or date range) or jurisdiction (such as a named administrative entity). Recommended best practice is to select a value from a controlled vocabulary (for example, the Thesaurus of Geographic Names [TGN]) and to use, where appropriate, named places or time periods in preference to numeric identifiers such as sets of coordinates or date ranges.
227
228
bc.. 
229
<!ELEMENT coverage (#PCDATA)>
230
<!ATTLIST coverage
231
          id ID #IMPLIED
232
          lang CDATA #IMPLIED>
233
234
235
h3. Relation
236
          
237
p. Recommended best practice is to identify the referenced resource by means of a string or number conforming to a formal identification system.
238
239
bc.. 
240
<!ELEMENT relation (#PCDATA)>
241
<!ATTLIST relation
242
          id ID #IMPLIED
243
          lang CDATA #IMPLIED>
244
245
h3. Meta
246
          
247
p. This type is used to express arbitrary metadata beyond the data described by the Dublin Core specification.
248
249
bc.. 
250
<!ELEMENT meta EMPTY>
251
<!ATTLIST meta
252
          id ID #IMPLIED
253
          name CDATA #IMPLIED
254
          content CDATA #IMPLIED>
255
256
h3. Cover
257
          
258
bc.. 
259
<!ELEMENT cover EMPTY>
260
<!ATTLIST cover
261
          image CDATA #IMPLIED
262
          title CDATA #IMPLIED>
263
264
p. Adds a cover page using the supplied image file.
265
266
h2. Adding content
267
268
p. No publication is complete without content. So you will have to add at a minimum one chapter.
269
270
h3. Primary content files
271
272
p. Content is added using the **item** element. At a minimum you will have to specify the **file** attribute. This points to the file that will be added to the __spine__. The __spine__ is a structure within the publication that defines the reading order. So the order you add items does matter. If you're adding other types of files such as cascading style sheets you will have to specify the type and whether or not to add it to the spine.
273
274
bc.. 
275
<!ELEMENT item EMPTY>
276
<!ATTLIST item
277
          id ID #IMPLIED
278
          file CDATA #IMPLIED
279
          type CDATA #IMPLIED
280
          page CDATA #IMPLIED
281
          spine %boolean; #IMPLIED>
282
283
p. 
284
* **file** - points to a file to include in the manifest
285
* **type** - The MIME type of the file. If omitted it will be automatically detected if possible.
286
* **spine** - Whether or not to include the file in the reading order of the publication.
287
288
h3. Secondary content files
289
290
p. Files that are not required to be in the __spine__ and which MIME-type can be automatically determined may be added to the publication using a nested **fileset**. This is identical to the "fileset":http://ant.apache.org/manual/Types/fileset.html element type found in ANT except that you may add a extra **dest** and **lang** attributes. The new attribute can be used to specify the destination sub-folder of the files. If you for instance have illustrations in the form of JPEG, PNG or GIF images; this is the most straightforward to add these.
291
292
p. An identifier will automatically be created for each file added. It is on the form __&lt;mimetype&gt;-&lt;filename&gt;__. So a JPEG file named __my_house.jpg__ will be identified as __image-my_house__. If you have another file named __my_house.gif__ you will get a conflict so it would be wise to rename one of the files or add both using the **item** element and specify the identifier.
293
294
An example of use is shown below:
295
296
bc.. 
297
<fileset dir="${srcdir}" dest="images/" lang="en">
298
	<include name="*.gif" />
299
	<include name="*.png" />
300
	<include name="*.jpg" />
301
	<include name="*.otf" />
302
</fileset>
303
304
h3. References
305
306
The __guide__ allows you to specify the role of each file in the publication. While not required it is recommended that this feature is used. It is basically a list of references to each of the content files and the role they play. Some reading systems will for instance open a fresh book on the first page that contains __text__.
307
308
bc.. 
309
<!ELEMENT reference EMPTY>
310
<!ATTLIST reference
311
          id ID #IMPLIED
312
          href CDATA #IMPLIED
313
          type CDATA #IMPLIED
314
          title CDATA #IMPLIED>
315
p. 
316
* **id** - optional unique identifier.
317
* **href** - the file that is referenced.
318
* **type** - the role.
319
* **title** - title of the reference.          
320
321
bc.. 
322
<reference href="cover.html" type="cover" title="Cover Page" />
323
<reference href="title-page.html" type="title-page" title="Building EPUBs" />
324
<reference href="introduction.html" type="preface" title="Introduction" />
325
326
327
p. The following types are allowed:
328
329
|_. Type |_. Description |
330
|cover|The book cover(s), jacket information, etc.|
331
|title-page|Page with possibly title, author, publisher, and other metadata|
332
|toc|table of contents|
333
|index|Back-of-book style index|
334
|glossary|An alphabetical list of terms peculiar to the publication with definitions or explanations|
335
|acknowledgements|Author’s statement acknowledging his use of the works of other authors|	
336
|bibliography|A list of books or other material on a subject|	
337
|colophon|A publisher's emblem on a book|
338
|copyright-page|Subject to or controlled by copyright|	
339
|dedication|To address or inscribe (a book, artistic performance, etc) to a person, cause, etc as a token of affection or respect.|
340
|epigraph|A quotation at the beginning of a book, chapter, etc, suggesting its theme.|
341
|foreword|A phrase or passage from a book, poem, play, etc, remembered and spoken, esp to illustrate succinctly or support a point or an argument.|	
342
|loi|A list of illustrations|
343
|lot|A list of tables|
344
|notes|A brief summary or record in writing, esp a jotting for future reference|	
345
|preface|A statement written as an introduction to a literary or other work, typically explaining its scope, intention, method, etc; foreword.|	
346
|text|First "real" page of content (e.g. "Chapter 1").|
347
			
348
h3. Table of contents
349
350
bc.. 
351
<!ELEMENT toc EMPTY>
352
<!ATTLIST toc
353
          id ID #IMPLIED
354
          generate %boolean; #IMPLIED
355
          file CDATA #IMPLIED>
356
357
p. Exactly one **toc** element is used to declare a table of contents. There are two ways of doing this. Either by pointing to a readily prepared __ncx__  file using the **file** attribute or by setting **generate** to **true**. This will iterate through all the elements in the spine and figure out the table of contents based on the header elements. 
358
359
p. If the **file** attribute is used the task will automatically do the house-keeping. The file will be copied into the OEPBS folder of the publication, it will be placed first in the content declaration and properly referenced.
360
361
p. If this element is not used - a table of contents will still be generated in order to satisfy EPUB requirements. However it will be empty.
(-)a/org.eclipse.mylyn.docs.epub.help/docs/epub-format.textile (+19 lines)
Added Link Here
1
h1. The EPUB file format
2
3
p. The __EPUB file format__ is basically a ZIP-file with a defined set of contents. The first file in the container is a file by the ASCII name of "mimetype" which holds the MIME type for the ZIP container. This file must be treated a bit special as the contents are defined and the file must not be compressed, nor encrypted and there must be no extra fields in it's ZIP header. 
4
5
p. The EPUB also have a META-INF folder that contains a file named __container.xml__. This declares the format of the publication(s) and points to the main entry, which in most cases is __content.opf__. If there is a table of contents (__toc.ncx__) the main entry will point to it. 
6
7
p. "The OCF (Open Container Format) specification":http://idpf.org/epub/20/spec/OCF_2.0.1_draft.doc states that one can add multiple publications to one EPUB. For instance an OEBPS (aka EPUB) and one PDF. Or two OEBPS publications in different languages. While the current API does handle this – the Ant task or UI action does not. 
8
9
p. The actual content of an EPUB version 2.0.1 formatted publication may be of the following OPS Core Media types:
10
* XHTML (but only with a subset of the full HTML element types).
11
* Cascading Style Sheets (CSS) for styling of the publication.
12
* Graphics in the form of SVG, PNG, GIF and JPEG formatted files.
13
* Fonts as TTF or OTF.
14
15
Other types may be used, but then a __fallback__ item must be specified for reading systems that does not support the type. This tooling currently does not support the fallback mechanism.
16
17
!Illustrations.002.jpg(Contents of a example EPUB container.)! 
18
19
The illustration shows the contents of an example publication. The marked files and folders marked are ones created by the EPUB tooling.
(-)a/org.eclipse.mylyn.docs.epub.help/docs/examples.textile (+89 lines)
Added Link Here
1
h1. Practical examples
2
3
h2. Building the example book
4
5
The example below shows the how the example book is assembled. If you want to play around with it, you will find the examples project in the "org.eclipse.mylyn.docs":http://git.eclipse.org/c/mylyn/org.eclipse.mylyn.docs.git/ Git repository.
6
7
bc.. 
8
<epub identifierId="uuid" file="${epubfile}" workingFolder="${workdir}">
9
	<language code="en" />
10
	<identifier id="uuid" scheme="UUID">70ce7c20-8f9e-11e0-91e4-0800200c9a66</identifier>
11
	<title>Building EPUBs</title>
12
	<subject>Computing, Eclipse, Mylyn, EPUB</subject>
13
	<publisher>Eclipse.Org</publisher>
14
	<creator name="Torkild Ulvøy Resheim" fileAs="Resheim, Torkild Ulvøy" role="aut" />
15
	<rights>Copyright (c) 2011, Torkild Ulvøy Resheim. Licensed under the Eclipse Public License version 1.0</rights>
16
	<type>Technical article.</type>
17
	<!-- The DejaVu Fonts - http://dejavu-fonts.org/wiki/License -->
18
	<contributor name="Bitstream" fileAs="Bitstream" role="art" />
19
	<cover image="${srcdir}/epub/cover.jpg">Cover page</cover>
20
	<item file="${srcdir}/title-page.html" />
21
	<item file="${tempdir}/copyright.html" />
22
	<item file="${tempdir}/introduction.html" />
23
	<item file="${tempdir}/epub-format.html" />
24
	<item file="${tempdir}/generate-ant.html" />
25
	<item file="${tempdir}/generate-ui.html" />
26
	<item file="${tempdir}/epub-ant-task.html" />
27
	<item file="${tempdir}/examples.html" />
28
	<item file="${srcdir}/epub/style.css" type="text/css" spine="false" />
29
	<reference href="title-page.html" type="title-page" title="Building EPUBs" />
30
	<reference href="introduction.html" type="preface" title="Introduction" />
31
	<reference href="copyright.html" type="copyright-page" title="Copyright" />
32
	<toc generate="true" />
33
	<fileset dir="${srcdir}">
34
		<include name="*.gif" />
35
		<include name="*.png" />
36
		<include name="*.jpg" />
37
		<include name="fonts/*.otf" />
38
	</fileset>
39
</epub>
40
41
42
h2. Adding a cover
43
44
p. Correctly adding a cover to a publication can be a bit awkward as different reading systems expect different input. So there is a shortcut:
45
46
bc.. 
47
<cover image="cover.jpg" title="My Title"/> 
48
49
p. Simply point to the file in question and this EPUB tooling will take care of the rest. There is of course another, more laborious way allowing more control. The procedure is as follows: 
50
51
# Add a cover image to the publication
52
# Add a HTML file using the image
53
# Reference the HTML file
54
# Add a meta element pointing to the image
55
56
p. Assuming the cover image is at hand we will add it using the **item** element as this:
57
58
bc.. 
59
<item file="images/cover.jpg" id="cover-image" type="image/jpg" spine="false" />
60
61
p. Next we add a XHTML file (named __cover.html__) to the publication. This will be used by some reading systems.
62
63
bc.. 
64
<?xml version="1.0" encoding="utf-8" standalone="no"?>
65
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
66
<html xmlns="http://www.w3.org/1999/xhtml">
67
  <head>
68
    <title>Cover Page</title>
69
    <style type="text/css"> img { max-width: 100%; }</style>
70
  </head>
71
  <body>
72
    <div id="cover-image">
73
      <img src="cover.jpg" alt="Building EPUBs"/>
74
    </div>
75
  </body>
76
</html>
77
78
p. Then some more Ant code:
79
80
bc.. 
81
<item file="cover.xhtml"/>
82
<reference href="cover.xhtml" type="cover" title="Cover Page" />
83
<meta name="cover" content="cover-image"/>
84
85
p. This method will produce a cover page that will work with all the tested reading systems; including Calibre, iBooks, Nook for Mac, Adobe Digital Editions and Kindle (after converting to MOBI using Calibre).
86
87
!nook-cover.png(The cover of this book as it is rendered on Nook for Mac.)!
88
89
p. The end result can be something like the illustration above - showing the cover of the example book as it is rendered on Nook for Mac.
(-)a/org.eclipse.mylyn.docs.epub.help/docs/generate-ant.textile (+21 lines)
Added Link Here
1
h1. Generate EPUB using Ant
2
3
p. Using the **epub** Ant task one can assemble an EPUB during continuous building or from within Eclipse. The example below shows a complete minimum Ant script.
4
5
bc. 
6
<?xml version="1.0" encoding="UTF-8"?>
7
<project name="EPUB Simple Example" default="epub">
8
	<target name="epub">
9
		<epub file="My Book.epub">
10
			<title>My Book</title>
11
			<subject>My Book's subject</subject>
12
			<item file="my_chapter.xhtml" />
13
		</epub>
14
	</target>
15
</project>
16
17
p. In this example only some of the required fields have been specified, the rest will be automatically added. See the comprehensive description of the "epub":epub-ant-task.html Ant task for details. A more complete example is found in the "examples":examples.html chapter.
18
19
p. Note that in order for the script to execute the epub task must be in the classpath. If you execute the script from within Eclipse simply make sure that the runtime environment of the workspace is used.
20
21
!runtime-jre.png(External task launch configuration.)!
(-)a/org.eclipse.mylyn.docs.epub.help/docs/generate-epub.textile (+7 lines)
Added Link Here
1
h1. Generate EPUB directly from markup
2
3
p. Lightweight wikitext markup can easily be converted into EPUBs. From within Eclipse right click on any supported markup file (ending in @*.textile@, @*.mediawiki@ etc), then select **Wikitext > Generate EPUB** from the context menu. This will bring up a wizard as illustrated below.
4
5
!generate-epub.png! 
6
7
As the EPUB specification requires that certain properties are set for a publication - this dialog will offer the user interface for setting these. At a minimum you will have to enter a **title**, **language** and **subject**. 
(-)a/org.eclipse.mylyn.docs.epub.help/docs/introduction.textile (+30 lines)
Added Link Here
1
h1. Introduction
2
3
p. Electronic books are everywhere these days and new reading devices seem to be announced monthly. With a few exceptions (e.g. Amazon's Kindle) - all of these can display books formatted as EPUB. There are also a few decent desktop applications capable of displaying EPUBs. With this abundance of reading systems it could be wise to take advantage of the situation and publish for instance user guides and manuals in this format. This way users can read them at home, at the desktop and everywhere in between. Most reading systems also supports annotating and bookmarking with synchronization between devices.
4
5
p. There are several ways of assembling EPUBs: You can write a document in Apple's __Pages__ and directly export to EPUB. You can for example write it in Microsoft's __Word__ and convert it to EPUB using "EPUBGen":http://code.google.com/p/epub-tools/, in DocBook and convert it using "docbook2epub":http://code.google.com/p/epub-tools/ or even manually assembling the publication using various command line tools. The popular "Calibre":http://calibre-ebook.com/ tool can also be used to create a number of formats. All these methods have their merits but few can be easily used to assemble publications during a __continuous build__ and none can be used without adding a few extra dependencies such as Ruby or Python. 
6
7
p. Hence the primary goal of the EPUB support in Mylyn Docs is to create a mechanism that allows consistent building of EPUB files adhering to all relevant standards, using ANT tasks, while introducing as few dependencies as possible (only Java and parts of Eclipse). The secondary goal is to create an API that can be used for manipulating EPUBs. For instance loading an existing publication and altering it's contents or metadata. 
8
9
p. The EPUB support in Eclipse is built around an EMF data model describing the publication along with various mechanisms to manipulate this structure and assemble a EPUB file. The model is expressed in "Ecore":http://wiki.eclipse.org/Ecore, representing the "Open Packaging Format (OPF)":http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm, a subset of Dublin Core and the Navigation Control File (NCX). All required parts of a properly assembled EPUB file following the 2.0.1 revision of the standard.
10
11
p. The mechanisms mentioned is an API for handling the EPUB and a Ant task that can be used during building. The following code shows the minimum Ant script required to generate a publication.
12
13
bc.. 
14
<epub file="My Book.epub">
15
  <title>My Book</title>
16
  <subject>My Book's subject</subject>
17
  <item file="my_chapter.xhtml" />
18
</epub>
19
20
p. Some of the fields required by will be automatically created and added to the publication when not specified in the Ant script. The table of contents will for instance be automatically created, the language set to __en__ for "English" and an identifier (based on UUID) will be generated. Details can be found in the chapter describing the "epub":epub-ant-task.html Ant task.
21
22
h2. Learning more
23
24
If you would like to learn more about building EPUBs you may want to take a look at following resources:
25
26
* Elizabeth Castro: EPUB Straight to the Point - ISBN: 9780132366984
27
* International Digital Publishing Forum: "EPUB":http://idpf.org/epub
28
* Liza Daly: "Build a digital book with EPUB":http://www.ibm.com/developerworks/xml/tutorials/x-epubtut/index.html
29
* Harrison Ainsworth: "Epub Format Construction Guide":http://www.hxa.name/articles/content/epub-guide_hxa7241_2007.html
30
(-)a/org.eclipse.mylyn.docs.epub.help/docs/style.css (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
12
table, td, th {
13
  border-color: gray; 
14
  border-style: solid;
15
}
16
17
table {
18
  width: 100%;
19
  border-width: 0 0 1px 1px; 
20
  border-spacing: 0; 
21
  border-collapse: collapse;
22
  margin: 1em;
23
  padding: 1em;
24
  }
25
26
td, th {
27
  margin: 0; 
28
  padding: 4px; 
29
  border-width: 1px 1px 0 0; 
30
  font-size: 0.9em;
31
}
32
33
th {
34
  background-color: #c0c0c0;
35
  color: #ffffff;
36
  font-weight: bold;
37
}
38
39
td {
40
  background-color: #f0f0f0;
41
}
(-)a/org.eclipse.mylyn.docs.epub.help/plugin.xml (+15 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
5
	<extension point="org.eclipse.help.toc">
6
		<toc file="help/introduction-toc.xml" primary="false"/>
7
		<toc file="help/epub-format-toc.xml" primary="false"/>
8
		<toc file="help/generate-ant-toc.xml" primary="false"/>
9
		<toc file="help/generate-epub-toc.xml" primary="false"/>
10
		<toc file="help/epub-ant-task-toc.xml" primary="false"/>
11
		<toc file="help/examples-toc.xml" primary="false"/>
12
		<toc file="toc.xml" primary="true"/>
13
	</extension>
14
15
</plugin>
(-)a/org.eclipse.mylyn.docs.epub.help/pom.xml (+73 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5
	<modelVersion>4.0.0</modelVersion>
6
	<parent>
7
		<artifactId>org.eclipse.mylyn.docs-parent</artifactId>
8
		<groupId>org.eclipse.mylyn.docs</groupId>
9
		<version>1.6.0-SNAPSHOT</version>
10
	</parent>
11
	<artifactId>org.eclipse.mylyn.docs.epub.help</artifactId>
12
	<version>0.8.0-SNAPSHOT</version>
13
	<packaging>eclipse-plugin</packaging>
14
15
	<properties>
16
		<test.suite>${project.artifactId}.AllTests</test.suite>
17
	</properties>
18
19
	<build>
20
		<plugins>
21
			<plugin>
22
				<groupId>org.apache.maven.plugins</groupId>
23
				<artifactId>maven-antrun-plugin</artifactId>
24
				<version>1.6</version>
25
				<executions>
26
					<execution>
27
						<phase>generate-sources</phase>
28
						<configuration>
29
							<target>
30
								<pathconvert refid="maven.compile.classpath" property="compile_classpath"/>
31
								<ant antfile="build-docs.xml" inheritAll="true"/>
32
							</target>
33
						</configuration>
34
						<goals>
35
							<goal>run</goal>
36
						</goals>
37
					</execution>
38
				</executions>
39
				<dependencies>
40
					<!-- Make sure these are built first -->
41
					<dependency>
42
						<groupId>org.eclipse.mylyn.docs</groupId>
43
						<artifactId>org.eclipse.mylyn.wikitext.core</artifactId>
44
						<version>1.6.0-SNAPSHOT</version>
45
					</dependency>
46
					<dependency>
47
						<groupId>org.eclipse.mylyn.docs</groupId>
48
						<artifactId>org.eclipse.mylyn.wikitext.textile.core</artifactId>
49
						<version>1.6.0-SNAPSHOT</version>
50
					</dependency>
51
				</dependencies>				
52
			</plugin>
53
			<plugin>
54
				<groupId>org.eclipse.tycho</groupId>
55
				<artifactId>tycho-source-plugin</artifactId>
56
			</plugin>
57
			<plugin>
58
				<groupId>org.eclipse.tycho</groupId>
59
				<artifactId>target-platform-configuration</artifactId>
60
			</plugin>
61
			<plugin>
62
				<groupId>org.codehaus.mojo</groupId>
63
				<artifactId>findbugs-maven-plugin</artifactId>
64
			</plugin>
65
			<plugin>
66
				<groupId>org.apache.maven.plugins</groupId>
67
				<artifactId>maven-pmd-plugin</artifactId>
68
			</plugin>
69
		</plugins>
70
71
	</build>
72
	<groupId>org.eclipse.mylyn.docs.epub</groupId>
73
</project>
(-)a/org.eclipse.mylyn.docs.epub.help/src/readme.txt (+1 lines)
Added Link Here
1
Placeholder for future source code.
(-)a/org.eclipse.mylyn.docs.epub.help/toc.xml (+22 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
    Copyright (c) 2007, 2009 David Green and others.
4
    All rights reserved. This program and the accompanying materials
5
    are made available under the terms of the Eclipse Public License v1.0
6
    which accompanies this distribution, and is available at
7
    http://www.eclipse.org/legal/epl-v10.html
8
    
9
    Contributors:
10
        David Green - initial API and implementation
11
 -->
12
<toc label="Mylyn Docs EPUB Documentation" link_to="../org.eclipse.mylyn.help.ui/primary-toc.xml#additions">
13
   <topic label="EPUB User Guide">
14
      <link toc="help/introduction-toc.xml"/>
15
      <link toc="help/epub-format-toc.xml"/>
16
      <link toc="help/generate-ant-toc.xml"/>
17
      <link toc="help/generate-epub-toc.xml"/>
18
      <link toc="help/epub-ant-task-toc.xml"/>
19
      <link toc="help/examples-toc.xml"/>
20
   </topic>
21
   <anchor id="additions"/>
22
</toc>
(-)a/org.eclipse.mylyn.docs.epub.tests/.classpath (+10 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry exported="true" kind="lib" path="lib/saxon.jar"/>
7
	<classpathentry exported="true" kind="lib" path="lib/jing.jar"/>
8
	<classpathentry exported="true" kind="lib" path="lib/epubcheck-1.2.jar"/>
9
	<classpathentry kind="output" path="bin"/>
10
</classpath>
(-)a/org.eclipse.mylyn.docs.epub.tests/.gitignore (+3 lines)
Added Link Here
1
/test
2
/org.eclipse*/bin
3
/org.eclipse*/target
(-)a/org.eclipse.mylyn.docs.epub.tests/.project (+28 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.mylyn.docs.epub.tests</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
(-)a/org.eclipse.mylyn.docs.epub.tests/.settings/org.eclipse.core.resources.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:56 CEST 2011
2
eclipse.preferences.version=1
3
encoding/<project>=UTF-8
(-)a/org.eclipse.mylyn.docs.epub.tests/.settings/org.eclipse.core.runtime.prefs (+3 lines)
Added Link Here
1
#Sat Oct 08 16:01:56 CEST 2011
2
eclipse.preferences.version=1
3
line.separator=\n
(-)a/org.eclipse.mylyn.docs.epub.tests/.settings/org.eclipse.jdt.core.prefs (+12 lines)
Added Link Here
1
#Sun May 01 22:36:28 CEST 2011
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.5
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12
org.eclipse.jdt.core.compiler.source=1.5
(-)a/org.eclipse.mylyn.docs.epub.tests/META-INF/MANIFEST.MF (+22 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Mylyn EPUB Tests
4
Bundle-SymbolicName: org.eclipse.mylyn.docs.epub.tests
5
Bundle-Version: 0.8.0.qualifier
6
Bundle-Vendor: Torkild U. Resheim
7
Bundle-RequiredExecutionEnvironment: J2SE-1.5
8
Require-Bundle: org.eclipse.emf.databinding.edit;bundle-version="1.2.0",
9
 org.eclipse.emf.ecore.change.edit;bundle-version="2.5.0",
10
 org.eclipse.emf.ecore.editor;bundle-version="2.6.0",
11
 org.eclipse.emf.exporter;bundle-version="2.6.0",
12
 org.eclipse.emf.importer;bundle-version="2.6.0",
13
 org.eclipse.emf.mapping.ecore2ecore.editor;bundle-version="2.4.0",
14
 org.eclipse.emf.mapping.ecore2xml.ui;bundle-version="2.5.0",
15
 org.junit,
16
 org.apache.ant;bundle-version="1.8.2",
17
 org.eclipse.mylyn.docs.epub.core,
18
 org.apache.ant.source;bundle-version="1.8.2"
19
Bundle-ClassPath: .,
20
 lib/saxon.jar,
21
 lib/jing.jar,
22
 lib/epubcheck-1.2.jar
(-)a/org.eclipse.mylyn.docs.epub.tests/ant-test.xml (+39 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project name="Test markup-to-epub" basedir=".">
3
	<property name="testdir" location="${basedir}/test/ant" />
4
	<property name="srcdir" location="${basedir}/testdata" />
5
6
	<path id="java.class.path">
7
		<pathelement path="${java.class.path}" />
8
	</path>
9
10
	<path id="epub-classpath">
11
		<pathelement location="${basedir}/../org.eclipse.mylyn.docs.epub.core/bin/" />
12
		<pathelement location="${basedir}/../org.eclipse.mylyn.docs.epub.ant.core/bin/" />
13
	</path>
14
15
	<taskdef classpathref="epub-classpath" resource="org/eclipse/mylyn/docs/epub/ant/tasks.properties" />
16
17
	<!-- Prepare source files that we need for the tests -->
18
	<target name="init">
19
		<delete dir="${testdir}" failonerror="false">
20
			<fileset dir="${testdir}">
21
				<include name="**/*" />
22
			</fileset>
23
		</delete>
24
		<mkdir dir="${testdir}" />
25
	</target>
26
27
	<target name="test.publication">	
28
		<epub identifierId="uuid" file="${testdir}/simple.epub" workingFolder="${testdir}/work">			
29
			<title>Mylyn Docs Test EPUB</title>
30
			<language code="en" />
31
			<identifier id="uuid" scheme="UUID">urn:uuid:15bcb770-882d-11e0-9d78-0800200c9a66</identifier>
32
			<subject>Testing</subject>
33
			<creator fileAs="Resheim, Torkild U." role="aut" name="Torkild U. Resheim"/>
34
			<publisher>Eclipse.org</publisher>
35
			<item file="${srcdir}/plain-page.xhtml" />
36
		</epub>
37
	</target>
38
39
</project>
(-)a/org.eclipse.mylyn.docs.epub.tests/build.properties (+7 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .,\
5
               lib/saxon.jar,\
6
               lib/epubcheck-1.2.jar,\
7
               lib/jing.jar
(-)a/org.eclipse.mylyn.docs.epub.tests/lib/COPYING.txt (+19 lines)
Added Link Here
1
Copyright (c) 2007 Adobe Systems Incorporated
2
3
Permission is hereby granted, free of charge, to any person obtaining a copy of
4
this software and associated documentation files (the "Software"), to deal in
5
the Software without restriction, including without limitation the rights to
6
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
the Software, and to permit persons to whom the Software is furnished to do so,
8
subject to the following conditions:
9
10
The above copyright notice and this permission notice shall be included in all
11
copies or substantial portions of the Software.
12
13
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
(-)a/org.eclipse.mylyn.docs.epub.tests/lib/README.txt (+61 lines)
Added Link Here
1
This folder contains the distribution of epubcheck project.
2
3
EpubCheck is a tool to validate IDPF Epub files. It can detect many
4
types of errors in Epub. OCF container structure, OPF and OPS mark-up,
5
and internal reference consistency are checked. EpubCheck can be run
6
as a standalone command-line tool, installed as a web application or
7
used as a library.
8
9
Epubcheck project home: http://code.google.com/p/epubcheck/
10
11
BUILDING
12
13
To build epubcheck from the sources you need Java Development Kit (JDK) 1.5 or above
14
and Apache ant (http://ant.apache.org/) 1.6 or above installed
15
16
Run
17
18
ant -f build.xml
19
20
RUNNING
21
22
To run the tool you need Java Runtime (1.5 or above). Any OS should do. Run
23
it from the command line: 
24
25
java -jar epubcheck-x.x.x.jar file.epub
26
27
All detected errors are simply printed to stderr. 
28
29
USING AS A LIBRARY
30
31
You can also use EpubCheck as a library in your Java application. EpubCheck
32
public interfaces can be found in com.adobe.epubcheck.api package. EpubCheck
33
class can be used to instantiate a validation engine. Use one of its
34
constructors and then call validate() method. Report is an interface that
35
you can implement to get a list of the errors and warnings reported by the
36
validation engine (instead of the error list being printed out).
37
38
LICENSING
39
40
See COPYING.txt
41
42
AUTHORS
43
44
Peter Sorotokin 
45
Garth Conboy 
46
Markus Gylling 
47
Piotr Kula
48
49
Most of the EpubCheck functionality comes from the schema validation tool Jing
50
and schemas that were developed by IDPF and DAISY. EpubCheck development was
51
largely done at Adobe Systems. 
52
53
54
55
56
57
58
59
60
61
(-)a/org.eclipse.mylyn.docs.epub.tests/lib/epubcheck_license.txt (+19 lines)
Added Link Here
1
Copyright (c) 2007 Adobe Systems Incorporated
2
3
Permission is hereby granted, free of charge, to any person obtaining a copy of
4
this software and associated documentation files (the "Software"), to deal in
5
the Software without restriction, including without limitation the rights to
6
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
the Software, and to permit persons to whom the Software is furnished to do so,
8
subject to the following conditions:
9
10
The above copyright notice and this permission notice shall be included in all
11
copies or substantial portions of the Software.
12
13
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
(-)a/org.eclipse.mylyn.docs.epub.tests/lib/jing_license.txt (+12 lines)
Added Link Here
1
Jing Copying Conditions
2
3
Copyright (c) 2001-2003 Thai Open Source Software Center Ltd
4
All rights reserved.
5
6
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7
8
    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9
    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
    * Neither the name of the Thai Open Source Software Center Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
12
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(-)a/org.eclipse.mylyn.docs.epub.tests/pom.xml (+57 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project
3
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5
	<modelVersion>4.0.0</modelVersion>
6
	<parent>
7
		<artifactId>org.eclipse.mylyn.docs-parent</artifactId>
8
		<groupId>org.eclipse.mylyn.docs</groupId>
9
		<version>1.6.0-SNAPSHOT</version>
10
	</parent>
11
	<artifactId>org.eclipse.mylyn.docs.epub.tests</artifactId>
12
	<version>0.8.0-SNAPSHOT</version>
13
	<packaging>eclipse-test-plugin</packaging>
14
	
15
	<properties>
16
		<platform-version-name>indigo</platform-version-name>
17
		<eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>
18
		<test.suite>${project.artifactId}.AllTests</test.suite>
19
	</properties>
20
21
	<repositories>
22
		<repository>
23
			<id>indigo</id>
24
			<name>Eclipse Indigo p2 Repository</name>
25
			<layout>p2</layout>
26
			<url>${eclipse-site}</url>
27
		</repository>
28
	</repositories>
29
30
	<build>
31
		<plugins>
32
			<plugin>
33
				<groupId>org.eclipse.tycho</groupId>
34
				<artifactId>tycho-surefire-plugin</artifactId>
35
				<version>${tycho-version}</version>
36
				<configuration>
37
					<useUIHarness>false</useUIHarness>
38
					<testSuite>${project.artifactId}</testSuite>
39
					<testClass>${test.suite}</testClass>
40
				</configuration>
41
			</plugin>
42
			<plugin>
43
				<groupId>org.eclipse.tycho</groupId>
44
				<artifactId>tycho-source-plugin</artifactId>
45
			</plugin>
46
			<plugin>
47
				<groupId>org.eclipse.tycho</groupId>
48
				<artifactId>target-platform-configuration</artifactId>
49
				<version>${tycho-version}</version>
50
				<configuration>
51
					<resolver>p2</resolver>
52
				</configuration>
53
			</plugin>
54
		</plugins>
55
	</build>
56
	<groupId>org.eclipse.mylyn.docs.epub</groupId>
57
</project>
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/AllTests.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.tests;
12
13
import junit.framework.Test;
14
import junit.framework.TestSuite;
15
16
import org.eclipse.mylyn.docs.epub.tests.api.TestEPUB;
17
import org.eclipse.mylyn.docs.epub.tests.api.TestOPS2Publication;
18
import org.eclipse.mylyn.docs.epub.tests.api.TestOPSPublication;
19
import org.eclipse.mylyn.docs.epub.tests.core.TestOPS2Validator;
20
import org.eclipse.mylyn.docs.epub.tests.core.TestTOCGenerator;
21
22
public class AllTests {
23
	public static Test suite() {
24
		return suite(false);
25
	}
26
27
	public static Test suite(boolean defaultOnly) {
28
		TestSuite suite = new TestSuite("Tests for org.eclipse.mylyn.docs.epub");
29
		// API tests
30
		suite.addTestSuite(TestEPUB.class);
31
		suite.addTestSuite(TestOPS2Publication.class);
32
		suite.addTestSuite(TestOPSPublication.class);
33
		// Core tests
34
		suite.addTestSuite(TestOPS2Validator.class);
35
		suite.addTestSuite(TestTOCGenerator.class);
36
		// Ant tests
37
		// TODO: Also execute ANT tests.
38
		// suite.addTestSuite(TestAntTask.class);
39
		return suite;
40
	}
41
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/TestAPI.java (+301 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.tests;
12
13
import java.io.File;
14
import java.io.FileNotFoundException;
15
import java.io.IOException;
16
import java.net.URISyntaxException;
17
import java.util.Locale;
18
19
import javax.xml.parsers.DocumentBuilder;
20
import javax.xml.parsers.DocumentBuilderFactory;
21
import javax.xml.parsers.ParserConfigurationException;
22
23
import junit.framework.Assert;
24
25
import org.eclipse.mylyn.docs.epub.core.EPUB;
26
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
27
import org.eclipse.mylyn.docs.epub.opf.Role;
28
import org.eclipse.mylyn.docs.epub.opf.Type;
29
import org.junit.After;
30
import org.junit.Before;
31
import org.junit.Test;
32
import org.w3c.dom.Document;
33
import org.w3c.dom.Element;
34
import org.w3c.dom.Node;
35
import org.w3c.dom.NodeList;
36
import org.xml.sax.SAXException;
37
38
import com.adobe.epubcheck.api.EpubCheck;
39
40
/**
41
 * 
42
 * @author Torkild U. Resheim
43
 * 
44
 */
45
public class TestAPI {
46
47
	private File testRoot;
48
49
	private File packingFolder;
50
51
	private void delete(File f) throws IOException {
52
		if (f.isDirectory()) {
53
			for (File c : f.listFiles())
54
				delete(c);
55
		}
56
57
		if (f.exists() && !f.delete())
58
			throw new FileNotFoundException("Failed to delete file: " + f);
59
	}
60
61
	private boolean fileExists(String filename) {
62
		String path = packingFolder.getAbsolutePath() + File.separator
63
				+ "OEBPS" + File.separator + filename;
64
		File file = new File(path);
65
		return file.exists();
66
	}
67
68
	private File getFile(String path) throws URISyntaxException {
69
		return new File(path);
70
	}
71
72
	/**
73
	 * Reads the OPF into a DOM for further analysis.
74
	 * 
75
	 * @return the DOM document element
76
	 * @throws ParserConfigurationException
77
	 * @throws SAXException
78
	 * @throws IOException
79
	 */
80
	private Element readOPF() throws ParserConfigurationException,
81
			SAXException, IOException {
82
		File fXmlFile = new File(packingFolder.getAbsolutePath()
83
				+ File.separator + "OEBPS" + File.separator + "content.opf");
84
		Assert.assertEquals(true, fXmlFile.exists());
85
		DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
86
		DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
87
		Document doc = dBuilder.parse(fXmlFile);
88
		doc.getDocumentElement().normalize();
89
		return doc.getDocumentElement();
90
	}
91
92
	@Before
93
	public void setUp() throws Exception {
94
		packingFolder = getFile("test/api/pack");
95
		testRoot = getFile("test/api/");
96
		delete(testRoot);
97
	}
98
99
	@After
100
	public void tearDown() {
101
102
	}
103
104
	/**
105
	 * Tests node attributes.
106
	 * 
107
	 * @param node
108
	 *            the node to test
109
	 * @param ids
110
	 *            expected identifiers
111
	 * @param values
112
	 *            expected values
113
	 */
114
	private void testAttributes(Node node, String[] ids, String[] values) {
115
		Assert.assertEquals(ids.length, values.length);
116
		Assert.assertEquals(
117
				"Wrong number of attributes in '" + node.getNodeName() + "'",
118
				ids.length, node.getAttributes().getLength());
119
		for (int x = 0; x < ids.length; x++) {
120
			Assert.assertEquals("No such node '" + ids[x] + "'", true,
121
					node.getAttributes().getNamedItem(ids[x]) != null);
122
			Assert.assertEquals(values[x],
123
					node.getAttributes().getNamedItem(ids[x]).getNodeValue());
124
		}
125
	}
126
127
	/**
128
	 * Creates a new simple EPUB and tests whether it can be validated using
129
	 * "epubcheck".
130
	 * 
131
	 * @throws Exception
132
	 */
133
	@Test
134
	public void testPackSimpleEPUB() throws Exception {
135
		File epubfile = new File(testRoot.getAbsolutePath() + File.separator + "simple.epub");
136
		createSimpleEPUB(epubfile);
137
		EpubCheck checker = new EpubCheck(epubfile);
138
		Assert.assertTrue(checker.validate());
139
	}
140
141
	/**
142
	 * Creates a very simple EPUB file with only required metadata added and one
143
	 * single page.
144
	 * 
145
	 * @return the new EPUB file
146
	 * @throws URISyntaxException
147
	 * @throws Exception
148
	 */
149
	private OPSPublication createSimpleEPUB(File epubfile) throws URISyntaxException, Exception {
150
		OPSPublication ops = OPSPublication.getVersion2Instance();
151
		ops.addTitle(null, null, "Mylyn Docs Test EPUB");
152
		ops.addSubject(null, null, "Testing");
153
		ops.addItem(getFile("testdata/plain-page.xhtml"));
154
		ops.setGenerateToc(true);
155
		EPUB epub = new EPUB();
156
		epub.add(ops);
157
		epub.pack(epubfile, packingFolder);
158
		return ops;
159
	}
160
161
	/**
162
	 * See if all contributors are serialised properly.
163
	 * <ul>
164
	 * <li>Wrong number of attributes due to EMF default value handling.</li>
165
	 * <li>Unexpected attribute names and or values.</li>
166
	 * <li>Wrong element value.</li>
167
	 * </ul>
168
	 * 
169
	 * @throws Exception
170
	 */
171
	@Test
172
	public void testSerializationContributors() throws Exception {
173
		OPSPublication ops = OPSPublication.getVersion2Instance();
174
		File epubfile = new File(testRoot.getAbsolutePath() + File.separator + "simple.epub");
175
		Role[] roles = Role.values();
176
		for (Role role : roles) {
177
			ops.addContributor(role.getLiteral(), Locale.ENGLISH,
178
					"Nomen Nescio", role, "Nescio, Nomen");
179
		}
180
		EPUB epub = new EPUB();
181
		epub.add(ops);
182
		ops.addItem(new File("testdata/plain-page.xhtml"));
183
		epub.pack(epubfile, packingFolder);
184
		Element doc = readOPF();
185
		Node guide = doc.getElementsByTagName("opf:metadata").item(0);
186
		Node node = guide.getFirstChild(); // Discard first TEXT node
187
		node = discard(node); // title
188
		node = discard(node); // subject
189
		String[] ids = new String[] { "id", "xml:lang", "opf:role",
190
				"opf:file-as" };
191
		for (Role role : roles) {
192
			node = node.getNextSibling();
193
			String[] values = new String[] { role.getLiteral(),
194
					Locale.ENGLISH.getLanguage(),
195
					role.getLiteral(), "Nescio, Nomen" };
196
			assertNode(node, "dc:contributor", "Nomen Nescio");
197
			testAttributes(node, ids, values);
198
			node = node.getNextSibling(); // Discard next TEXT node
199
		}
200
	}
201
202
	private Node discard(Node node) {
203
		node = node.getNextSibling(); // Discard element node
204
		node = node.getNextSibling(); // Discard TEXT node
205
		return node;
206
	}
207
208
	private void assertNode(Node node, String name, String value) {
209
		Assert.assertEquals(name, node.getNodeName());
210
		if (value != null) {
211
			Assert.assertEquals(value, node.getFirstChild().getNodeValue());
212
		}
213
	}
214
215
216
	/**
217
	 * Checks the contents of the OPF when nothing has been added to the
218
	 * publication.
219
	 * <ul>
220
	 * <li>There should be a table of contents</li>
221
	 * <li>The metadata, manifest, spine and guide elements should exist.</li>
222
	 * </ul>
223
	 * 
224
	 * @throws Exception
225
	 */
226
	@Test
227
	public void testSerializationEmpty() throws Exception {
228
		OPSPublication ops = OPSPublication.getVersion2Instance();
229
		File epubfile = new File(testRoot.getAbsolutePath() + File.separator + "simple.epub");
230
		EPUB epub = new EPUB();
231
		epub.add(ops);
232
		ops.addItem(new File("testdata/plain-page.xhtml"));
233
		epub.pack(epubfile, packingFolder);
234
		Element doc = readOPF();
235
		Assert.assertEquals("opf:package", doc.getNodeName());
236
		NodeList nl = doc.getChildNodes();
237
		// Text nodes in between
238
		Assert.assertEquals("opf:metadata", nl.item(1).getNodeName());
239
		Assert.assertEquals("opf:manifest", nl.item(3).getNodeName());
240
		Assert.assertEquals("opf:spine", nl.item(5).getNodeName());
241
		Assert.assertEquals("opf:guide", nl.item(7).getNodeName());
242
243
		// Table of contents
244
		Node toc = nl.item(3).getFirstChild().getNextSibling();
245
		Assert.assertEquals("opf:item", toc.getNodeName());
246
		Assert.assertEquals("ncx", toc.getAttributes().getNamedItem("id")
247
				.getNodeValue());
248
		Assert.assertEquals("toc.ncx", toc.getAttributes().getNamedItem("href")
249
				.getNodeValue());
250
		Assert.assertEquals("application/x-dtbncx+xml", toc.getAttributes()
251
				.getNamedItem("media-type")
252
				.getNodeValue());
253
		Assert.assertEquals(true, fileExists("toc.ncx"));
254
		Node spine = nl.item(5);
255
		Assert.assertEquals("ncx", spine.getAttributes().getNamedItem("toc")
256
				.getNodeValue());
257
		doc = null;
258
	}
259
260
	/**
261
	 * See if all references are serialised properly.
262
	 * <ul>
263
	 * <li>Wrong number of attributes due to EMF default value handling.</li>
264
	 * <li>Unexpected attribute names and or values</li>
265
	 * </ul>
266
	 * 
267
	 * @throws Exception
268
	 */
269
	@Test
270
	public void testSerializationReferences() throws Exception {
271
		OPSPublication ops = OPSPublication.getVersion2Instance();
272
		File epubfile = new File(testRoot.getAbsolutePath() + File.separator + "simple.epub");
273
		Type[] types = Type.values();
274
		for (Type type : types) {
275
			ops.addReference(type.getLiteral() + ".xhtml", type.getName(),
276
					type);
277
		}
278
		EPUB epub = new EPUB();
279
		ops.addItem(new File("testdata/plain-page.xhtml"));
280
		epub.add(ops);
281
		epub.pack(epubfile, packingFolder);
282
		Element doc = readOPF();
283
		Node guide = doc.getElementsByTagName("opf:guide").item(0);
284
		Node ref = guide.getFirstChild(); // Discard first TEXT node
285
		String[] ids = new String[] { "title", "href", "type" };
286
		for (Type type : types) {
287
			ref = ref.getNextSibling();
288
			// The should be exactly three attributes
289
			Assert.assertEquals(
290
					"Wrong number of attributes in '" + type.getLiteral() + "'",
291
					3,
292
					ref.getAttributes().getLength());
293
			String[] values = new String[] { type.getName(),
294
					type.getLiteral() + ".xhtml", type.getLiteral() };
295
			testAttributes(ref, ids, values);
296
			ref = ref.getNextSibling();
297
		}
298
		doc = null;
299
	}
300
301
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/ant/TestAntTask.java (+86 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.tests.ant;
12
13
import java.io.File;
14
import java.io.PrintWriter;
15
import java.io.StringWriter;
16
17
import junit.framework.Assert;
18
19
import org.apache.tools.ant.BuildFileTest;
20
21
import com.adobe.epubcheck.api.EpubCheck;
22
23
/**
24
 * Tests for the <b>epub</b> ANT task.
25
 * 
26
 * @author Torkild U. Resheim
27
 */
28
public class TestAntTask extends BuildFileTest {
29
30
	static ClassLoader classLoader;
31
32
	private static final String SIMPLE_FILE_PATH = "test/ant/simple.epub";
33
34
	private static final String DOC_FILE_PATH = "../org.eclipse.mylyn.docs.epub.help/Building_EPUBs.epub";
35
36
	public TestAntTask(String s) {
37
		super(s);
38
		classLoader = getClass().getClassLoader();
39
	}
40
41
	private void assertEpub(String file) {
42
		File f = getFile(file);
43
		assertTrue("Missing publication " + file, f.exists());
44
		StringWriter sw = new StringWriter();
45
		PrintWriter pw = new PrintWriter(sw);
46
		EpubCheck checker = new EpubCheck(f, pw);
47
		checker.validate();
48
		Assert.assertTrue(sw.getBuffer().toString().trim(), checker.errorCount == 0);
49
	}
50
51
	private File getFile(String file) {
52
		return new File(getProjectDir().getAbsolutePath() + File.separator + file);
53
	}
54
55
	@Override
56
	public void setUp() {
57
		configureProject("ant-test.xml");
58
		project.setCoreLoader(this.getClass().getClassLoader());
59
	}
60
61
	/**
62
	 * Creates a simple book using the Ant task and tests it using the epub
63
	 * validator.
64
	 */
65
	public void testSimplePublication() {
66
		executeTarget("init");
67
		executeTarget("test.publication");
68
		assertEpub(SIMPLE_FILE_PATH);
69
	}
70
71
	/**
72
	 * Tests the "Building EPUBs" book (generated using the Ant task) using the
73
	 * epub validator. This book is assembled by building the
74
	 * "org.eclipse.mylyn.docs.epub.ui" bundle. The book contents is converted
75
	 * from Textile markup to HTML using WikiText.
76
	 */
77
	public void testDocumentationBook() {
78
		File file = getFile(DOC_FILE_PATH);
79
		assertTrue("Missing publication " + file, file.exists());
80
		StringWriter sw = new StringWriter();
81
		PrintWriter pw = new PrintWriter(sw);
82
		EpubCheck checker = new EpubCheck(file, pw);
83
		checker.validate();
84
		Assert.assertTrue(sw.getBuffer().toString().trim(), checker.errorCount == 0);
85
	}
86
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/api/AbstractTest.java (+87 lines)
Added Link Here
1
package org.eclipse.mylyn.docs.epub.tests.api;
2
3
import java.io.File;
4
5
import junit.framework.TestCase;
6
7
import org.eclipse.emf.ecore.EStructuralFeature;
8
import org.eclipse.emf.ecore.util.FeatureMap;
9
import org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList;
10
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
11
import org.eclipse.mylyn.docs.epub.dc.DCType;
12
import org.eclipse.mylyn.docs.epub.dc.Identifier;
13
import org.junit.After;
14
import org.junit.Before;
15
16
public abstract class AbstractTest extends TestCase {
17
	protected final File epubFile = new File("test" + File.separator + "test.epub");
18
19
	protected final File epubFolder = new File("test" + File.separator + "epub");
20
21
	protected static final EStructuralFeature TEXT = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text();
22
23
	@SuppressWarnings("rawtypes")
24
	public String getText(DCType identifier) {
25
		FeatureMap fm = identifier.getMixed();
26
			Object o = fm.get(TEXT, false);
27
			if (o instanceof FeatureEList) {
28
				if (((FeatureEList) o).size() > 0) {
29
					return ((FeatureEList) o).get(0).toString();
30
				}
31
			}
32
		return null;
33
	}
34
35
	public String getText(Identifier element) {
36
		FeatureMap fm = element.getMixed();
37
		Object o = fm.get(TEXT, false);
38
		if (o instanceof FeatureEList) {
39
			if (((FeatureEList) o).size() > 0) {
40
				return ((FeatureEList) o).get(0).toString();
41
			}
42
		}
43
		return null;
44
	}
45
	/**
46
	 * @throws java.lang.Exception
47
	 */
48
	@Override
49
	@Before
50
	public void setUp() throws Exception {
51
		if (epubFile.exists()) {
52
			epubFile.delete();
53
		}
54
		if (epubFolder.exists()) {
55
			deleteFolder(epubFolder);
56
		}
57
		epubFolder.mkdirs();
58
	}
59
60
	private boolean deleteFolder(File folder) {
61
		if (folder.isDirectory()) {
62
			String[] children = folder.list();
63
			for (int i = 0; i < children.length; i++) {
64
				boolean ok = deleteFolder(new File(folder, children[i]));
65
				if (!ok) {
66
					return false;
67
				}
68
			}
69
		}
70
		return folder.delete();
71
	}
72
73
	/**
74
	 * @throws java.lang.Exception
75
	 */
76
	@Override
77
	@After
78
	public void tearDown() throws Exception {
79
		if (epubFolder.exists()) {
80
			deleteFolder(epubFolder);
81
		}
82
		if (epubFile.exists()) {
83
			epubFile.delete();
84
		}
85
	}
86
87
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/api/TestEPUB.java (+347 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.tests.api;
12
13
import java.io.File;
14
15
import junit.framework.Assert;
16
17
import org.eclipse.emf.common.util.EList;
18
import org.eclipse.mylyn.docs.epub.core.EPUB;
19
import org.eclipse.mylyn.docs.epub.core.OPS2Publication;
20
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
21
import org.eclipse.mylyn.docs.epub.ocf.Container;
22
import org.eclipse.mylyn.docs.epub.ocf.RootFile;
23
import org.eclipse.mylyn.docs.epub.ocf.RootFiles;
24
import org.junit.After;
25
import org.junit.Before;
26
import org.junit.Test;
27
28
/**
29
 * @author Torkild U. Resheim
30
 * 
31
 */
32
public class TestEPUB extends AbstractTest {
33
34
	private final File epubFile = new File("test" + File.separator + "test.epub");
35
36
	private final File epubFolder = new File("test" + File.separator + "epub");
37
38
	/**
39
	 * @throws java.lang.Exception
40
	 */
41
	@Override
42
	@Before
43
	public void setUp() throws Exception {
44
		if (epubFile.exists()) {
45
			epubFile.delete();
46
		}
47
		if (epubFolder.exists()) {
48
			deleteFolder(epubFolder);
49
		}
50
		epubFolder.mkdirs();
51
	}
52
53
	private boolean deleteFolder(File folder) {
54
		if (folder.isDirectory()) {
55
			String[] children = folder.list();
56
			for (int i = 0; i < children.length; i++) {
57
				boolean ok = deleteFolder(new File(folder, children[i]));
58
				if (!ok) {
59
					return false;
60
				}
61
			}
62
		}
63
		return folder.delete();
64
	}
65
66
	/**
67
	 * @throws java.lang.Exception
68
	 */
69
	@Override
70
	@After
71
	public void tearDown() throws Exception {
72
		if (epubFolder.exists()) {
73
			deleteFolder(epubFolder);
74
		}
75
		if (epubFile.exists()) {
76
			epubFile.delete();
77
		}
78
	}
79
80
	/**
81
	 * Test method for {@link org.eclipse.mylyn.docs.epub.core.EPUB#EPUB()}.
82
	 * <p>
83
	 * It must be possible to obtain the publication list which must be empty.
84
	 * </p>
85
	 */
86
	@Test
87
	public final void testEPUB() {
88
		EPUB epub = new EPUB();
89
		Assert.assertEquals(true, epub.getOPSPublications().isEmpty());
90
91
	}
92
93
	/**
94
	 * Test method for
95
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#add(java.io.File, java.lang.String)}
96
	 * .
97
	 * <ul>
98
	 * <li>Publication MIME-type shall be correct</li>
99
	 * <li>Rootfile path shall be correct</li>
100
	 * <li>Rootfile object shall be correct.</li>
101
	 * </ul>
102
	 * 
103
	 * @throws Exception
104
	 */
105
	@Test
106
	public final void testAddFileString() throws Exception {
107
		EPUB epub = new EPUB();
108
		File drawing = new File("testdata/drawing-100x100.svg");
109
		epub.add(drawing, "image/svg+xml");
110
		Container container = epub.getContainer();
111
		RootFiles rootfiles = container.getRootfiles();
112
		EList<RootFile> files = rootfiles.getRootfiles();
113
		Assert.assertEquals(true, files.get(0).getFullPath().equals("SVG+XML/drawing-100x100.svg"));
114
		Assert.assertEquals(true, files.get(0).getMediaType().equals("image/svg+xml"));
115
		Assert.assertEquals(true, files.get(0).getPublication() == drawing);
116
	}
117
118
	/**
119
	 * Test method for
120
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#pack(java.io.File)}.
121
	 * <ul>
122
	 * <li>Shall throw exception when unknown publication type is added.</li>
123
	 * </ul>
124
	 * 
125
	 * @throws Exception
126
	 */
127
	@Test
128
	public final void testPackFail() throws Exception {
129
		EPUB epub = new EPUB();
130
		File drawing = new File("testdata/drawing-100x100.svg");
131
		epub.add(drawing, "image/svg+xml");
132
		Container container = epub.getContainer();
133
		RootFiles rootfiles = container.getRootfiles();
134
		EList<RootFile> files = rootfiles.getRootfiles();
135
		files.get(0).setPublication(null);
136
		try {
137
			epub.pack(epubFile);
138
			fail();
139
		} catch (Exception e) {
140
		}
141
	}
142
143
	/**
144
	 * Test method for
145
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#add(org.eclipse.mylyn.docs.epub.core.OPSPublication)}
146
	 * .
147
	 * <ul>
148
	 * <li>Container shall hold more than one OPS publication</li>
149
	 * <li>OPS structures shall follow naming conventions.</li>
150
	 * <li>OPS MIME-type shall be correct</li>
151
	 * <li>Rootfile object shall be correct.</li>
152
	 * </ul>
153
	 * 
154
	 * @throws Exception
155
	 */
156
	@Test
157
	public final void testAddOPSPublication() throws Exception {
158
		EPUB epub = new EPUB();
159
		OPSPublication oebps1 = new OPS2Publication();
160
		OPSPublication oebps2 = new OPS2Publication();
161
		epub.add(oebps1);
162
		epub.add(oebps2);
163
		Container container = epub.getContainer();
164
		RootFiles rootfiles = container.getRootfiles();
165
		EList<RootFile> files = rootfiles.getRootfiles();
166
		Assert.assertEquals(true, files.get(0).getFullPath().equals("OEBPS/content.opf"));
167
		Assert.assertEquals(true, files.get(1).getFullPath().equals("OEBPS_1/content.opf"));
168
		Assert.assertEquals(true, files.get(0).getMediaType().equals("application/oebps-package+xml"));
169
		Assert.assertEquals(true, files.get(1).getMediaType().equals("application/oebps-package+xml"));
170
		Assert.assertEquals(true, files.get(0).getPublication() == oebps1);
171
		Assert.assertEquals(true, files.get(1).getPublication() == oebps2);
172
	}
173
174
	/**
175
	 * Test method for
176
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#getOPSPublications()}.
177
	 * <p>
178
	 * One OPS-publication and one SVG drawing are added. Only the
179
	 * OPS-publication shall be returned.
180
	 * </p>
181
	 * 
182
	 * @throws Exception
183
	 */
184
	@Test
185
	public final void testGetOPSPublications() throws Exception {
186
		EPUB epub = new EPUB();
187
		OPSPublication oebps = new OPS2Publication();
188
		epub.add(oebps);
189
		File drawing = new File("testdata/drawing-100x100.svg");
190
		epub.add(drawing, "image/svg+xml");
191
		Assert.assertEquals(1, epub.getOPSPublications().size());
192
	}
193
194
	/**
195
	 * Test method for
196
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#pack(java.io.File)}.
197
	 * <ul>
198
	 * <li>Temporary folder shall not exist when job is done.</li>
199
	 * </ul>
200
	 * 
201
	 * @throws Exception
202
	 */
203
	@Test
204
	public final void testPackFile() throws Exception {
205
		EPUB epub = new EPUB();
206
		OPSPublication oebps = new OPS2Publication();
207
		oebps.addItem(new File("testdata/plain-page.xhtml"));
208
		epub.add(oebps);
209
		File drawing = new File("testdata/drawing-100x100.svg");
210
		epub.add(drawing, "image/svg+xml");
211
		File tempFolder = epub.pack(epubFile);
212
		Assert.assertEquals(false, tempFolder.exists());
213
	}
214
215
	/**
216
	 * Test method for
217
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#pack(java.io.File, java.io.File)}
218
	 * .
219
	 * <ul>
220
	 * <li>Work folder shall exist when job is done.</li>
221
	 * <li>Work folder shall contain EPUB artifacts.</li>
222
	 * <li>Exception shall be thrown if working folder already exist.</li>
223
	 * </ul>
224
	 * 
225
	 * @throws Exception
226
	 */
227
	@Test
228
	public final void testPackFileFile() throws Exception {
229
		EPUB epub = new EPUB();
230
		OPSPublication oebps = new OPS2Publication();
231
		oebps.addItem(new File("testdata/plain-page.xhtml"));
232
		epub.add(oebps);
233
		epub.pack(epubFile, epubFolder);
234
		// Make sure all required files are present
235
		File metaFolder = new File(epubFolder.getAbsolutePath() + File.separator + "META-INF");
236
		Assert.assertEquals(true, metaFolder.exists());
237
		Assert.assertEquals(true, metaFolder.isDirectory());
238
		File containerFile = new File(epubFolder.getAbsolutePath() + File.separator + "META-INF" + File.separator
239
				+ "container.xml");
240
		Assert.assertEquals(true, containerFile.exists());
241
		Assert.assertEquals(false, containerFile.isDirectory());
242
		File oebpsFolder = new File(epubFolder.getAbsolutePath() + File.separator + "OEBPS");
243
		Assert.assertEquals(true, oebpsFolder.exists());
244
		Assert.assertEquals(true, oebpsFolder.isDirectory());
245
	}
246
247
	/**
248
	 * Test method for
249
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#pack(java.io.File, java.io.File)}
250
	 * .
251
	 * <ul>
252
	 * <li>Exception shall be thrown if working folder already exist.</li>
253
	 * </ul>
254
	 * 
255
	 * @throws Exception
256
	 */
257
	@Test
258
	public final void testPackFileFileExists() throws Exception {
259
		File workingFolder = File.createTempFile("epub_", null);
260
		EPUB epub = new EPUB();
261
		OPSPublication oebps = new OPS2Publication();
262
		epub.add(oebps);
263
		try {
264
			epub.pack(epubFile, workingFolder);
265
			fail();
266
		} catch (Exception e) {
267
		}
268
	}
269
270
	/**
271
	 * Test method for
272
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#pack(java.io.File)} .
273
	 * <ul>
274
	 * <li>Exception shall be thrown if the EPUB is empty.</li>
275
	 * </ul>
276
	 * 
277
	 * @throws Exception
278
	 */
279
	@Test
280
	public final void testPackMissingPublication() throws Exception {
281
		EPUB epub = new EPUB();
282
		try {
283
			epub.pack(epubFile);
284
			fail();
285
		} catch (Exception e) {
286
		}
287
	}
288
289
	/**
290
	 * Test method for
291
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#unpack(java.io.File)}.
292
	 * <ul>
293
	 * <li>Unpacked EPUB shall have the same contents as the packed one.</li>
294
	 * </ul>
295
	 * 
296
	 * @throws Exception
297
	 */
298
	@Test
299
	public final void testUnpackFile() throws Exception {
300
		EPUB epub = new EPUB();
301
		OPSPublication oebps1 = new OPS2Publication();
302
		OPSPublication oebps2 = new OPS2Publication();
303
		oebps1.addItem(new File("testdata/plain-page.xhtml"));
304
		oebps2.addItem(new File("testdata/plain-page.xhtml"));
305
		epub.add(oebps1);
306
		epub.add(oebps2);
307
		epub.pack(epubFile, epubFolder);
308
		EPUB epub2 = new EPUB();
309
		epub2.unpack(epubFile);
310
		Assert.assertEquals(2, epub2.getOPSPublications().size());
311
	}
312
313
	/**
314
	 * Test method for
315
	 * {@link org.eclipse.mylyn.docs.epub.core.EPUB#unpack(java.io.File, java.io.File)}
316
	 * .
317
	 * 
318
	 * @throws Exception
319
	 */
320
	@Test
321
	public final void testUnpackFileFile() throws Exception {
322
		// First pack the EPUB
323
		EPUB epub = new EPUB();
324
		OPSPublication oebps = new OPS2Publication();
325
		oebps.addItem(new File("testdata/plain-page.xhtml"));
326
		epub.add(oebps);
327
		epub.pack(epubFile, epubFolder);
328
		deleteFolder(epubFolder);
329
330
		// Then check for some contents when unpacked
331
		EPUB epub2 = new EPUB();
332
		epub2.unpack(epubFile, epubFolder);
333
334
		// Make sure all required files are present
335
		File metaFolder = new File(epubFolder.getAbsolutePath() + File.separator + "META-INF");
336
		Assert.assertEquals(true, metaFolder.exists());
337
		Assert.assertEquals(true, metaFolder.isDirectory());
338
		File containerFile = new File(epubFolder.getAbsolutePath() + File.separator + "META-INF" + File.separator
339
				+ "container.xml");
340
		Assert.assertEquals(true, containerFile.exists());
341
		Assert.assertEquals(false, containerFile.isDirectory());
342
		File oebpsFolder = new File(epubFolder.getAbsolutePath() + File.separator + "OEBPS");
343
		Assert.assertEquals(true, oebpsFolder.exists());
344
		Assert.assertEquals(true, oebpsFolder.isDirectory());
345
	}
346
347
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/api/TestOPS2Publication.java (+250 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.tests.api;
12
13
import java.io.File;
14
15
import junit.framework.Assert;
16
17
import org.eclipse.emf.ecore.EStructuralFeature;
18
import org.eclipse.emf.ecore.util.FeatureMap;
19
import org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList;
20
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
21
import org.eclipse.mylyn.docs.epub.core.EPUB;
22
import org.eclipse.mylyn.docs.epub.core.OPS2Publication;
23
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
24
import org.eclipse.mylyn.docs.epub.core.ValidationMessage;
25
import org.eclipse.mylyn.docs.epub.core.ValidationMessage.Severity;
26
import org.eclipse.mylyn.docs.epub.ncx.Meta;
27
import org.eclipse.mylyn.docs.epub.ncx.NavPoint;
28
import org.eclipse.mylyn.docs.epub.ncx.Ncx;
29
import org.junit.After;
30
import org.junit.Before;
31
import org.junit.Test;
32
33
/**
34
 * @author Torkild U. Resheim
35
 *
36
 */
37
public class TestOPS2Publication extends AbstractTest {
38
39
	private static final EStructuralFeature TEXT = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text();
40
41
	private final static String TOCFILE_ID = "3063f615-672e-4083-911a-65c5ff245e75";
42
43
	private final File epubFile = new File("test" + File.separator + "test.epub");
44
45
	private final File epubFolder = new File("test" + File.separator + "epub");
46
47
	private boolean deleteFolder(File folder) {
48
		if (folder.isDirectory()) {
49
			String[] children = folder.list();
50
			for (int i = 0; i < children.length; i++) {
51
				boolean ok = deleteFolder(new File(folder, children[i]));
52
				if (!ok) {
53
					return false;
54
				}
55
			}
56
		}
57
		return folder.delete();
58
	}
59
60
	@SuppressWarnings("rawtypes")
61
	public String getText(Object element) {
62
		if (element instanceof NavPoint) {
63
			FeatureMap fm = ((NavPoint) element).getNavLabels().get(0).getText().getMixed();
64
			Object o = fm.get(TEXT, false);
65
			if (o instanceof FeatureEList) {
66
				if (((FeatureEList) o).size() > 0) {
67
					return ((FeatureEList) o).get(0).toString();
68
				}
69
			}
70
		}
71
		if (element instanceof Meta) {
72
			Object o = ((Meta) element).getContent();
73
			return o.toString();
74
		}
75
		return "null";
76
	}
77
78
	/**
79
	 * @throws java.lang.Exception
80
	 */
81
	@Override
82
	@Before
83
	public void setUp() throws Exception {
84
		if (epubFile.exists()) {
85
			epubFile.delete();
86
		}
87
		if (epubFolder.exists()) {
88
			deleteFolder(epubFolder);
89
		}
90
		epubFolder.mkdirs();
91
	}
92
93
	/**
94
	 * @throws java.lang.Exception
95
	 */
96
	@Override
97
	@After
98
	public void tearDown() throws Exception {
99
		if (epubFolder.exists()) {
100
			deleteFolder(epubFolder);
101
		}
102
		if (epubFile.exists()) {
103
			epubFile.delete();
104
		}
105
	}
106
107
	/**
108
	 * Test method for
109
	 * {@link org.eclipse.mylyn.docs.epub.core.OPS2Publication#generateTableOfContents()}
110
	 * .
111
	 * <ul>
112
	 * <li>Table of contents shall be generated from content per default.</li>
113
	 * <li>Table of contents shall exist but be empty if not otherwise
114
	 * specified.</li>
115
	 * </ul>
116
	 * 
117
	 * @throws Exception
118
	 */
119
	@Test
120
	public final void testGenerateTableOfContents() throws Exception {
121
		EPUB epub1 = new EPUB();
122
		OPSPublication oebps1 = new OPS2Publication();
123
		epub1.add(oebps1);
124
		oebps1.addItem(new File("testdata/plain-page.xhtml"));
125
		epub1.pack(epubFile);
126
		Assert.assertTrue(oebps1.getTableOfContents() != null);
127
		Assert.assertTrue(oebps1.getTableOfContents() instanceof Ncx);
128
		Ncx ncx = (Ncx) oebps1.getTableOfContents();
129
		NavPoint h1_1 = ncx.getNavMap().getNavPoints().get(0);
130
		NavPoint h1_2 = ncx.getNavMap().getNavPoints().get(1);
131
		Assert.assertEquals("First item", getText(h1_1));
132
		Assert.assertEquals("Second item", getText(h1_2));
133
		epubFile.delete();
134
135
	
136
		EPUB epub2 = new EPUB();
137
		OPSPublication oebps2 = new OPS2Publication();
138
		epub2.add(oebps2);
139
		oebps2.addItem(new File("testdata/plain-page.xhtml"));
140
		oebps2.setGenerateToc(false);
141
		epub2.pack(epubFile);
142
		Assert.assertTrue(oebps2.getTableOfContents() != null);
143
		Assert.assertTrue(oebps2.getTableOfContents() instanceof Ncx);
144
		Ncx ncx2 = (Ncx) oebps2.getTableOfContents();
145
		Assert.assertEquals(null, ncx2.getNavMap());
146
	}
147
148
	/**
149
	 * Test method for
150
	 * {@link org.eclipse.mylyn.docs.epub.core.OPS2Publication#getTableOfContents()}
151
	 * .
152
	 * <ul>
153
	 * <li>There shall be a table of contents, even if empty.</li>
154
	 * </ul>
155
	 * 
156
	 * @throws Exception
157
	 */
158
	@Test
159
	public final void testGetTableOfContents() throws Exception {
160
		EPUB epub = new EPUB();
161
		OPSPublication oebps = new OPS2Publication();
162
		epub.add(oebps);
163
		Assert.assertTrue(oebps.getTableOfContents() != null);
164
		Assert.assertTrue(oebps.getTableOfContents() instanceof Ncx);
165
	}
166
167
	/**
168
	 * Test method for
169
	 * {@link org.eclipse.mylyn.docs.epub.core.OPS2Publication#readTableOfContents(java.io.File)}
170
	 * .
171
	 * 
172
	 * @throws Exception
173
	 */
174
	@Test
175
	public final void testReadTableOfContents() throws Exception {
176
		EPUB epub_out = new EPUB();
177
		OPSPublication oebps_out = new OPS2Publication();
178
		epub_out.add(oebps_out);
179
		oebps_out.addItem(new File("testdata/plain-page.xhtml"));
180
		epub_out.pack(epubFile);
181
182
		EPUB epub_in = new EPUB();
183
		epub_in.unpack(epubFile, epubFolder);
184
		OPSPublication oebps_in = epub_in.getOPSPublications().get(0);
185
		Assert.assertTrue(oebps_in.getTableOfContents() != null);
186
		Assert.assertTrue(oebps_in.getTableOfContents() instanceof Ncx);
187
		Ncx ncx = (Ncx) oebps_in.getTableOfContents();
188
		NavPoint h1_1 = ncx.getNavMap().getNavPoints().get(0);
189
		NavPoint h1_2 = ncx.getNavMap().getNavPoints().get(1);
190
		Assert.assertEquals("First item", getText(h1_1));
191
		Assert.assertEquals("Second item", getText(h1_2));
192
	}
193
194
	/**
195
	 * Test method for
196
	 * {@link org.eclipse.mylyn.docs.epub.core.OPS2Publication#setTableOfContents(java.io.File)}
197
	 * .
198
	 * 
199
	 * @throws Exception
200
	 */
201
	@Test
202
	public final void testSetTableOfContents() throws Exception {
203
		EPUB epub_out = new EPUB();
204
		OPSPublication oebps_out = new OPS2Publication();
205
		oebps_out.setTableOfContents(new File("testdata/toc.ncx"));
206
		epub_out.add(oebps_out);
207
		oebps_out.addItem(new File("testdata/plain-page.xhtml"));
208
		epub_out.pack(epubFile);
209
		EPUB epub_in = new EPUB();
210
		epub_in.unpack(epubFile, epubFolder);
211
		OPSPublication oebps_in = epub_in.getOPSPublications().get(0);
212
		Assert.assertTrue(oebps_in.getTableOfContents() != null);
213
		Assert.assertTrue(oebps_in.getTableOfContents() instanceof Ncx);
214
		Ncx ncx = (Ncx) oebps_in.getTableOfContents();
215
		NavPoint h1_1 = ncx.getNavMap().getNavPoints().get(0);
216
		NavPoint h1_2 = ncx.getNavMap().getNavPoints().get(1);
217
		Assert.assertEquals("First item", getText(h1_1));
218
		Assert.assertEquals("Second item", getText(h1_2));
219
		Meta meta = ncx.getHead().getMetas().get(0);
220
		String id = getText(meta);
221
		// The UUID for the NCX file should be different if it comes from
222
		// another NCX than the one specified.
223
		Assert.assertTrue(TOCFILE_ID.equals(id));
224
225
	}
226
227
	/**
228
	 * Test method for
229
	 * {@link org.eclipse.mylyn.docs.epub.core.OPS2Publication#validateContents()}
230
	 * .
231
	 * <ul>
232
	 * <li>There shall be a warning message</li>
233
	 * </ul>
234
	 * 
235
	 * @throws Exception
236
	 */
237
	@Test
238
	public final void testValidateContents() throws Exception {
239
		EPUB epub_out = new EPUB();
240
		OPSPublication oebps_out = new OPS2Publication();
241
		epub_out.add(oebps_out);
242
		oebps_out.addItem(new File("testdata/plain-page_warnings.xhtml"));
243
		epub_out.pack(epubFile);
244
		Assert.assertEquals(1, oebps_out.getValidationMessages().size());
245
		ValidationMessage msg = oebps_out.getValidationMessages().get(0);
246
		Assert.assertEquals(Severity.WARNING, msg.getSeverity());
247
		Assert.assertEquals("Element bad is not in OPS Preferred Vocabularies.", msg.getMessage());
248
	}
249
250
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/api/TestOPSPublication.java (+738 lines)
Added Link Here
1
/**
2
 * 
3
 */
4
package org.eclipse.mylyn.docs.epub.tests.api;
5
6
import java.io.File;
7
import java.util.List;
8
import java.util.Locale;
9
10
import org.eclipse.emf.common.util.EList;
11
import org.eclipse.mylyn.docs.epub.core.EPUB;
12
import org.eclipse.mylyn.docs.epub.core.OPS2Publication;
13
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
14
import org.eclipse.mylyn.docs.epub.dc.Coverage;
15
import org.eclipse.mylyn.docs.epub.dc.Date;
16
import org.eclipse.mylyn.docs.epub.dc.Description;
17
import org.eclipse.mylyn.docs.epub.dc.Identifier;
18
import org.eclipse.mylyn.docs.epub.dc.Publisher;
19
import org.eclipse.mylyn.docs.epub.dc.Relation;
20
import org.eclipse.mylyn.docs.epub.dc.Rights;
21
import org.eclipse.mylyn.docs.epub.dc.Source;
22
import org.eclipse.mylyn.docs.epub.dc.Subject;
23
import org.eclipse.mylyn.docs.epub.dc.Title;
24
import org.eclipse.mylyn.docs.epub.dc.impl.DCTypeImpl;
25
import org.eclipse.mylyn.docs.epub.opf.Item;
26
import org.junit.After;
27
import org.junit.Assert;
28
import org.junit.Before;
29
import org.junit.Test;
30
31
import com.adobe.epubcheck.api.EpubCheck;
32
33
/**
34
 * @author Torkild U. Resheim
35
 * 
36
 */
37
public class TestOPSPublication extends AbstractTest {
38
39
	OPSPublication oebps;
40
41
	/**
42
	 * @throws java.lang.Exception
43
	 */
44
	@Override
45
	@Before
46
	public void setUp() throws Exception {
47
		super.setUp();
48
		oebps = new OPS2Publication();
49
	}
50
51
	/**
52
	 * @throws java.lang.Exception
53
	 */
54
	@Override
55
	@After
56
	public void tearDown() throws Exception {
57
		super.tearDown();
58
		oebps = null;
59
	}
60
61
	/**
62
	 * Test method for
63
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addContributor(java.lang.String, java.util.Locale, java.lang.String, org.eclipse.mylyn.docs.epub.opf.Role, java.lang.String)}
64
	 * .
65
	 */
66
	@Test
67
	public final void testAddContributor() {
68
		// TODO
69
	}
70
71
	/**
72
	 * Test method for
73
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addCoverage(java.lang.String, java.util.Locale, java.lang.String)}
74
	 * .
75
	 */
76
	@Test
77
	public final void testAddCoverage() {
78
		oebps.addCoverage("Coverage", Locale.CANADA_FRENCH, "My Coverage");
79
		oebps.addCoverage(null, Locale.CANADA_FRENCH, "My Coverage");
80
		oebps.addCoverage(null, null, "My Coverage");
81
		EList<Coverage> Coverages = oebps.getOpfPackage().getMetadata().getCoverages();
82
		Assert.assertEquals("Coverage", Coverages.get(0).getId());
83
		Assert.assertEquals("fr_CA", Coverages.get(0).getLang());
84
		Assert.assertEquals("My Coverage", getText((DCTypeImpl) Coverages.get(0)));
85
		Assert.assertEquals(null, Coverages.get(1).getId());
86
		Assert.assertEquals("fr_CA", Coverages.get(1).getLang());
87
		Assert.assertEquals("My Coverage", getText((DCTypeImpl) Coverages.get(1)));
88
		Assert.assertEquals(null, Coverages.get(2).getId());
89
		Assert.assertEquals(null, Coverages.get(2).getLang());
90
		Assert.assertEquals("My Coverage", getText((DCTypeImpl) Coverages.get(2)));
91
		try {
92
			oebps.addCoverage(null, null, null);
93
			fail();
94
		} catch (IllegalArgumentException e) {
95
		}
96
	}
97
98
	/**
99
	 * Test method for
100
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addCreator(java.lang.String, java.util.Locale, java.lang.String, org.eclipse.mylyn.docs.epub.opf.Role, java.lang.String)}
101
	 * .
102
	 */
103
	@Test
104
	public final void testAddCreator() {
105
		// TODO
106
	}
107
108
	/**
109
	 * Test method for
110
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addDate(java.lang.String, java.util.Date, java.lang.String)}
111
	 * .
112
	 */
113
	@Test
114
	public final void testAddDateStringDateString() {
115
		// TODO
116
	}
117
118
	/**
119
	 * Test method for
120
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addDate(java.lang.String, java.lang.String, java.lang.String)}
121
	 * .
122
	 */
123
	@Test
124
	public final void testAddDateStringStringString() {
125
		oebps.addDate(null, "1969", null);
126
		oebps.addDate(null, "1969-03", null);
127
		oebps.addDate(null, "1969-03-14", null);
128
		oebps.addDate(null, "1969-03-14", "event");
129
		EList<Date> dates = oebps.getOpfPackage().getMetadata().getDates();
130
		assertEquals("1969", getText((DCTypeImpl) dates.get(0)));
131
		assertEquals("1969-03", getText((DCTypeImpl) dates.get(1)));
132
		assertEquals("1969-03-14", getText((DCTypeImpl) dates.get(2)));
133
		assertEquals("event", dates.get(3).getEvent());
134
		try {
135
			oebps.addDate(null, (String) null, null);
136
			fail();
137
		} catch (IllegalArgumentException e) {
138
		}
139
	}
140
141
	/**
142
	 * Test method for
143
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addDescription(java.lang.String, java.util.Locale, java.lang.String)}
144
	 * .
145
	 */
146
	@Test
147
	public final void testAddDescription() {
148
		oebps.addDescription("Description", Locale.CANADA_FRENCH, "My Description");
149
		oebps.addDescription(null, Locale.CANADA_FRENCH, "My Description");
150
		oebps.addDescription(null, null, "My Description");
151
		EList<Description> Descriptions = oebps.getOpfPackage().getMetadata().getDescriptions();
152
		Assert.assertEquals("Description", Descriptions.get(0).getId());
153
		Assert.assertEquals("fr_CA", Descriptions.get(0).getLang());
154
		Assert.assertEquals("My Description", getText((DCTypeImpl) Descriptions.get(0)));
155
		Assert.assertEquals(null, Descriptions.get(1).getId());
156
		Assert.assertEquals("fr_CA", Descriptions.get(1).getLang());
157
		Assert.assertEquals("My Description", getText((DCTypeImpl) Descriptions.get(1)));
158
		Assert.assertEquals(null, Descriptions.get(2).getId());
159
		Assert.assertEquals(null, Descriptions.get(2).getLang());
160
		Assert.assertEquals("My Description", getText((DCTypeImpl) Descriptions.get(2)));
161
		try {
162
			oebps.addDescription(null, null, null);
163
			fail();
164
		} catch (IllegalArgumentException e) {
165
		}
166
	}
167
168
	/**
169
	 * Test method for
170
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addFormat(java.lang.String, java.lang.String)}
171
	 * .
172
	 */
173
	@Test
174
	public final void testAddFormat() {
175
		oebps.addDescription("Description", Locale.CANADA_FRENCH, "My Description");
176
		oebps.addDescription(null, Locale.CANADA_FRENCH, "My Description");
177
		oebps.addDescription(null, null, "My Description");
178
		EList<Description> Descriptions = oebps.getOpfPackage().getMetadata().getDescriptions();
179
		Assert.assertEquals("Description", Descriptions.get(0).getId());
180
		Assert.assertEquals("fr_CA", Descriptions.get(0).getLang());
181
		Assert.assertEquals("My Description", getText((DCTypeImpl) Descriptions.get(0)));
182
		Assert.assertEquals(null, Descriptions.get(1).getId());
183
		Assert.assertEquals("fr_CA", Descriptions.get(1).getLang());
184
		Assert.assertEquals("My Description", getText((DCTypeImpl) Descriptions.get(1)));
185
		Assert.assertEquals(null, Descriptions.get(2).getId());
186
		Assert.assertEquals(null, Descriptions.get(2).getLang());
187
		Assert.assertEquals("My Description", getText((DCTypeImpl) Descriptions.get(2)));
188
		try {
189
			oebps.addDescription(null, null, null);
190
			fail();
191
		} catch (IllegalArgumentException e) {
192
		}
193
	}
194
195
	/**
196
	 * Test method for
197
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addIdentifier(java.lang.String, java.lang.String, java.lang.String)}
198
	 * .
199
	 */
200
	@Test
201
	public final void testAddIdentifier() {
202
		oebps.addIdentifier("Identifier", "ID", "My Identifier");
203
		oebps.addIdentifier(null, "ID", "My Identifier");
204
		oebps.addIdentifier(null, null, "My Identifier");
205
		EList<Identifier> Identifiers = oebps.getOpfPackage().getMetadata().getIdentifiers();
206
		Assert.assertEquals("Identifier", Identifiers.get(0).getId());
207
		Assert.assertEquals("ID", Identifiers.get(0).getScheme());
208
		Assert.assertEquals("My Identifier", getText(Identifiers.get(0)));
209
		Assert.assertEquals(null, Identifiers.get(1).getId());
210
		Assert.assertEquals("ID", Identifiers.get(1).getScheme());
211
		Assert.assertEquals("My Identifier", getText(Identifiers.get(1)));
212
		Assert.assertEquals(null, Identifiers.get(2).getId());
213
		Assert.assertEquals(null, Identifiers.get(2).getScheme());
214
		Assert.assertEquals("My Identifier", getText(Identifiers.get(2)));
215
		try {
216
			oebps.addIdentifier(null, null, null);
217
			fail();
218
		} catch (IllegalArgumentException e) {
219
		}
220
	}
221
222
	/**
223
	 * Test method for
224
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addItem(java.io.File)}
225
	 * .
226
	 */
227
	@Test
228
	public final void testAddItemFile() {
229
		// TODO
230
	}
231
232
	/**
233
	 * Test method for
234
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addItem(java.lang.String, java.util.Locale, java.io.File, java.lang.String, java.lang.String, boolean, boolean, boolean)}
235
	 * .
236
	 */
237
	@Test
238
	public final void testAddItemStringLocaleFileStringStringBooleanBooleanBoolean() {
239
		// TODO
240
	}
241
242
	/**
243
	 * Test method for
244
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addLanguage(java.lang.String, java.lang.String)}
245
	 * .
246
	 */
247
	@Test
248
	public final void testAddLanguage() {
249
		oebps.addLanguage(null, "no");
250
		oebps.addLanguage("id", "no");
251
		Assert.assertEquals("no", getText((DCTypeImpl) oebps.getOpfPackage().getMetadata().getLanguages().get(0)));
252
		Assert.assertEquals("id", oebps.getOpfPackage().getMetadata().getLanguages().get(1).getId());
253
		try {
254
			oebps.addLanguage(null, null);
255
			fail();
256
		} catch (IllegalArgumentException e) {
257
		}
258
	}
259
260
	/**
261
	 * Test method for
262
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addMeta(java.lang.String, java.lang.String)}
263
	 * .
264
	 */
265
	@Test
266
	public final void testAddMeta() {
267
		oebps.addMeta("name", "value");
268
		assertEquals("name", oebps.getOpfPackage().getMetadata().getMetas().get(0).getName());
269
		assertEquals("value", oebps.getOpfPackage().getMetadata().getMetas().get(0).getContent());
270
		try {
271
			oebps.addMeta(null, "value");
272
			fail();
273
		} catch (IllegalArgumentException e) {
274
		}
275
		try {
276
			oebps.addMeta("name", null);
277
			fail();
278
		} catch (IllegalArgumentException e) {
279
		}
280
	}
281
282
	/**
283
	 * Test method for
284
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addPublisher(java.lang.String, java.util.Locale, java.lang.String)}
285
	 * .
286
	 */
287
	@Test
288
	public final void testAddPublisher() {
289
		oebps.addPublisher("Publisher", Locale.CANADA_FRENCH, "My Publisher");
290
		oebps.addPublisher(null, Locale.CANADA_FRENCH, "My Publisher");
291
		oebps.addPublisher(null, null, "My Publisher");
292
		EList<Publisher> Publishers = oebps.getOpfPackage().getMetadata().getPublishers();
293
		Assert.assertEquals("Publisher", Publishers.get(0).getId());
294
		Assert.assertEquals("fr_CA", Publishers.get(0).getLang());
295
		Assert.assertEquals("My Publisher", getText((DCTypeImpl) Publishers.get(0)));
296
		Assert.assertEquals(null, Publishers.get(1).getId());
297
		Assert.assertEquals("fr_CA", Publishers.get(1).getLang());
298
		Assert.assertEquals("My Publisher", getText((DCTypeImpl) Publishers.get(1)));
299
		Assert.assertEquals(null, Publishers.get(2).getId());
300
		Assert.assertEquals(null, Publishers.get(2).getLang());
301
		Assert.assertEquals("My Publisher", getText((DCTypeImpl) Publishers.get(2)));
302
		try {
303
			oebps.addPublisher(null, null, null);
304
			fail();
305
		} catch (IllegalArgumentException e) {
306
		}
307
	}
308
309
	/**
310
	 * Test method for
311
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addReference(java.lang.String, java.lang.String, org.eclipse.mylyn.docs.epub.opf.Type)}
312
	 * .
313
	 */
314
	@Test
315
	public final void testAddReference() {
316
		// TODO
317
	}
318
319
	/**
320
	 * Test method for
321
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addRelation(java.lang.String, java.util.Locale, java.lang.String)}
322
	 * .
323
	 */
324
	@Test
325
	public final void testAddRelation() {
326
		oebps.addRelation("Relation", Locale.CANADA_FRENCH, "My Relation");
327
		oebps.addRelation(null, Locale.CANADA_FRENCH, "My Relation");
328
		oebps.addRelation(null, null, "My Relation");
329
		EList<Relation> Relations = oebps.getOpfPackage().getMetadata().getRelations();
330
		Assert.assertEquals("Relation", Relations.get(0).getId());
331
		Assert.assertEquals("fr_CA", Relations.get(0).getLang());
332
		Assert.assertEquals("My Relation", getText((DCTypeImpl) Relations.get(0)));
333
		Assert.assertEquals(null, Relations.get(1).getId());
334
		Assert.assertEquals("fr_CA", Relations.get(1).getLang());
335
		Assert.assertEquals("My Relation", getText((DCTypeImpl) Relations.get(1)));
336
		Assert.assertEquals(null, Relations.get(2).getId());
337
		Assert.assertEquals(null, Relations.get(2).getLang());
338
		Assert.assertEquals("My Relation", getText((DCTypeImpl) Relations.get(2)));
339
		try {
340
			oebps.addRelation(null, null, null);
341
			fail();
342
		} catch (IllegalArgumentException e) {
343
		}
344
	}
345
346
	/**
347
	 * Test method for
348
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addRights(java.lang.String, java.util.Locale, java.lang.String)}
349
	 * .
350
	 */
351
	@Test
352
	public final void testAddRights() {
353
		oebps.addRights("Rights", Locale.CANADA_FRENCH, "My Rights");
354
		oebps.addRights(null, Locale.CANADA_FRENCH, "My Rights");
355
		oebps.addRights(null, null, "My Rights");
356
		EList<Rights> Rightss = oebps.getOpfPackage().getMetadata().getRights();
357
		Assert.assertEquals("Rights", Rightss.get(0).getId());
358
		Assert.assertEquals("fr_CA", Rightss.get(0).getLang());
359
		Assert.assertEquals("My Rights", getText((DCTypeImpl) Rightss.get(0)));
360
		Assert.assertEquals(null, Rightss.get(1).getId());
361
		Assert.assertEquals("fr_CA", Rightss.get(1).getLang());
362
		Assert.assertEquals("My Rights", getText((DCTypeImpl) Rightss.get(1)));
363
		Assert.assertEquals(null, Rightss.get(2).getId());
364
		Assert.assertEquals(null, Rightss.get(2).getLang());
365
		Assert.assertEquals("My Rights", getText((DCTypeImpl) Rightss.get(2)));
366
		try {
367
			oebps.addRights(null, null, null);
368
			fail();
369
		} catch (IllegalArgumentException e) {
370
		}
371
	}
372
373
	/**
374
	 * Test method for
375
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addSource(java.lang.String, java.util.Locale, java.lang.String)}
376
	 * .
377
	 */
378
	@Test
379
	public final void testAddSource() {
380
		oebps.addSource("Source", Locale.CANADA_FRENCH, "My Source");
381
		oebps.addSource(null, Locale.CANADA_FRENCH, "My Source");
382
		oebps.addSource(null, null, "My Source");
383
		EList<Source> Sources = oebps.getOpfPackage().getMetadata().getSources();
384
		Assert.assertEquals("Source", Sources.get(0).getId());
385
		Assert.assertEquals("fr_CA", Sources.get(0).getLang());
386
		Assert.assertEquals("My Source", getText((DCTypeImpl) Sources.get(0)));
387
		Assert.assertEquals(null, Sources.get(1).getId());
388
		Assert.assertEquals("fr_CA", Sources.get(1).getLang());
389
		Assert.assertEquals("My Source", getText((DCTypeImpl) Sources.get(1)));
390
		Assert.assertEquals(null, Sources.get(2).getId());
391
		Assert.assertEquals(null, Sources.get(2).getLang());
392
		Assert.assertEquals("My Source", getText((DCTypeImpl) Sources.get(2)));
393
		try {
394
			oebps.addSource(null, null, null);
395
			fail();
396
		} catch (IllegalArgumentException e) {
397
		}
398
	}
399
400
	/**
401
	 * Test method for
402
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addSubject(java.lang.String, java.util.Locale, java.lang.String)}
403
	 * .
404
	 */
405
	@Test
406
	public final void testAddSubject() {
407
		oebps.addSubject("Subject", Locale.CANADA_FRENCH, "My Subject");
408
		oebps.addSubject(null, Locale.CANADA_FRENCH, "My Subject");
409
		oebps.addSubject(null, null, "My Subject");
410
		EList<Subject> subjects = oebps.getOpfPackage().getMetadata().getSubjects();
411
		Assert.assertEquals("Subject", subjects.get(0).getId());
412
		Assert.assertEquals("fr_CA", subjects.get(0).getLang());
413
		Assert.assertEquals("My Subject", getText((DCTypeImpl) subjects.get(0)));
414
		Assert.assertEquals(null, subjects.get(1).getId());
415
		Assert.assertEquals("fr_CA", subjects.get(1).getLang());
416
		Assert.assertEquals("My Subject", getText((DCTypeImpl) subjects.get(1)));
417
		Assert.assertEquals(null, subjects.get(2).getId());
418
		Assert.assertEquals(null, subjects.get(2).getLang());
419
		Assert.assertEquals("My Subject", getText((DCTypeImpl) subjects.get(2)));
420
		try {
421
			oebps.addSubject(null, null, null);
422
			fail();
423
		} catch (IllegalArgumentException e) {
424
		}
425
	}
426
427
	/**
428
	 * Test method for
429
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addTitle(java.lang.String, java.util.Locale, java.lang.String)}
430
	 * .
431
	 */
432
	@Test
433
	public final void testAddTitle() {
434
		oebps.addTitle("Title", Locale.CANADA_FRENCH, "My Title");
435
		oebps.addTitle(null, Locale.CANADA_FRENCH, "My Title");
436
		oebps.addTitle(null, null, "My Title");
437
		EList<Title> titles = oebps.getOpfPackage().getMetadata().getTitles();
438
		Assert.assertEquals("Title", titles.get(0).getId());
439
		Assert.assertEquals("fr_CA", titles.get(0).getLang());
440
		Assert.assertEquals("My Title", getText((DCTypeImpl) titles.get(0)));
441
		Assert.assertEquals(null, titles.get(1).getId());
442
		Assert.assertEquals("fr_CA", titles.get(1).getLang());
443
		Assert.assertEquals("My Title", getText((DCTypeImpl) titles.get(1)));
444
		Assert.assertEquals(null, titles.get(2).getId());
445
		Assert.assertEquals(null, titles.get(2).getLang());
446
		Assert.assertEquals("My Title", getText((DCTypeImpl) titles.get(2)));
447
		try {
448
			oebps.addTitle(null, null, null);
449
			fail();
450
		} catch (IllegalArgumentException e) {
451
		}
452
	}
453
454
	/**
455
	 * Test method for
456
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#addType(java.lang.String, java.lang.String)}
457
	 * .
458
	 */
459
	@Test
460
	public final void testAddType() {
461
		oebps.addType("Type", "My Type");
462
		oebps.addType(null, "My Type");
463
		EList<org.eclipse.mylyn.docs.epub.dc.Type> Types = oebps.getOpfPackage().getMetadata().getTypes();
464
		Assert.assertEquals("Type", Types.get(0).getId());
465
		Assert.assertEquals("My Type", getText((DCTypeImpl) Types.get(0)));
466
		Assert.assertEquals(null, Types.get(1).getId());
467
		Assert.assertEquals("My Type", getText((DCTypeImpl) Types.get(1)));
468
		try {
469
			oebps.addType(null, null);
470
			fail();
471
		} catch (IllegalArgumentException e) {
472
		}
473
	}
474
475
	/**
476
	 * Test method for
477
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#generateTableOfContents()}
478
	 * .
479
	 */
480
	@Test
481
	public final void testGenerateTableOfContents() {
482
		// TODO
483
	}
484
485
	/**
486
	 * Test method for
487
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getIdentifier()}.
488
	 */
489
	@Test
490
	public final void testGetIdentifier() {
491
		// TODO
492
	}
493
494
	/**
495
	 * Test method for
496
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getItemById(java.lang.String)}
497
	 * .
498
	 */
499
	@Test
500
	public final void testGetItemById() {
501
		// TODO
502
	}
503
504
	/**
505
	 * Test method for
506
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getItemsByMIMEType(java.lang.String)}
507
	 * .
508
	 */
509
	@Test
510
	public final void testGetItemsByMIMEType() {
511
		Item i_in_1 = oebps.addItem(new File("testdata/drawing-100x100.svg"));
512
		Item i_in_2 = oebps.addItem(new File("testdata/plain-page.xhtml"));
513
		List<Item> i_out_1 = oebps.getItemsByMIMEType("image/svg+xml");
514
		assertEquals(1, i_out_1.size());
515
		assertEquals(i_in_1, i_out_1.get(0));
516
		List<Item> i_out_2 = oebps.getItemsByMIMEType("application/xhtml+xml");
517
		assertEquals(1, i_out_2.size());
518
		assertEquals(i_in_2, i_out_2.get(0));
519
	}
520
521
	/**
522
	 * Test method for
523
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getOpfPackage()}.
524
	 */
525
	@Test
526
	public final void testGetOpfPackage() {
527
		// TODO
528
	}
529
530
	/**
531
	 * Test method for
532
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getRootFolder()}.
533
	 */
534
	@Test
535
	public final void testGetRootFolder() {
536
		// TODO
537
	}
538
539
	/**
540
	 * Test method for
541
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getSpine()}.
542
	 */
543
	@Test
544
	public final void testGetSpine() {
545
		// TODO
546
	}
547
548
	/**
549
	 * Test method for
550
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getTableOfContents()}
551
	 * .
552
	 */
553
	@Test
554
	public final void testGetTableOfContents() {
555
		// TODO
556
	}
557
558
	/**
559
	 * Test method for
560
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#getValidationMessages()}
561
	 * .
562
	 */
563
	@Test
564
	public final void testGetValidationMessages() {
565
		// TODO
566
	}
567
568
	/**
569
	 * Test method for
570
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#pack(java.io.File)}
571
	 * .
572
	 * <ul>
573
	 * <li>An EPUB where only a single page has been added shall be packed
574
	 * without issues</li>
575
	 * <li>An EPUB with no content shall fail when packed</li>
576
	 * </ul>
577
	 * 
578
	 * @throws Exception
579
	 */
580
	@Test
581
	public final void testPack() throws Exception {
582
		EPUB epub = new EPUB();
583
		oebps.addItem(new File("testdata/plain-page.xhtml"));
584
		epub.add(oebps);
585
		epub.pack(epubFile);
586
		oebps.validateMetadata();
587
		EpubCheck checker = new EpubCheck(epubFile);
588
		Assert.assertTrue(checker.validate());
589
590
		EPUB epub2 = new EPUB();
591
		epub2.add(new OPS2Publication());
592
		try {
593
			epubFile.delete();
594
			epub2.pack(epubFile);
595
			fail();
596
		} catch (IllegalArgumentException e) {
597
		}
598
	}
599
600
	/**
601
	 * Test method for
602
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#readTableOfContents(java.io.File)}
603
	 * .
604
	 */
605
	@Test
606
	public final void testReadTableOfContents() {
607
		// TODO
608
	}
609
610
	/**
611
	 * Test method for
612
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#setCover(java.io.File, java.lang.String)}
613
	 * .
614
	 * <ul>
615
	 * <li>Cover page SVG shall exist in the unpacked folder</li>
616
	 * <li>Cover page HTML shall exist in the unpacked folder</li>
617
	 * </ul>
618
	 * 
619
	 * @throws Exception
620
	 */
621
	@Test
622
	public final void testSetCover() throws Exception {
623
		oebps.setCover(new File("testdata" + File.separator + "drawing-100x100.svg"), "Title");
624
		oebps.addItem(new File("testdata/plain-page.xhtml"));
625
		EPUB epub = new EPUB();
626
		epub.add(oebps);
627
		epub.pack(epubFile);
628
629
		EPUB epub2 = new EPUB();
630
		epub2.unpack(epubFile, epubFolder);
631
		oebps = epub2.getOPSPublications().get(0);
632
		File root = oebps.getRootFolder();
633
		File svg = new File(root.getAbsolutePath() + File.separator + "drawing-100x100.svg");
634
		Assert.assertTrue(svg.exists());
635
		File html = new File(root.getAbsolutePath() + File.separator + "cover-page.xhtml");
636
		Assert.assertTrue(html.exists());
637
	}
638
639
	/**
640
	 * Test method for
641
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#setGenerateToc(boolean)}
642
	 * .
643
	 */
644
	@Test
645
	public final void testSetGenerateToc() {
646
		// TODO
647
	}
648
649
	/**
650
	 * Test method for
651
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#setIdentifierId(java.lang.String)}
652
	 * .
653
	 */
654
	@Test
655
	public final void testSetIdentifierId() {
656
		// TODO
657
	}
658
659
	/**
660
	 * Test method for
661
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#setIncludeReferencedResources(boolean)}
662
	 * .
663
	 * 
664
	 * @throws Exception
665
	 */
666
	@Test
667
	public final void testSetIncludeReferencedResources() throws Exception {
668
		EPUB epub = new EPUB();
669
		oebps.setIncludeReferencedResources(true);
670
		oebps.addItem(new File("testdata/plain-page_link.xhtml"));
671
		epub.add(oebps);
672
		// Included resources will only be added when we pack
673
		epub.pack(epubFile);
674
675
		EPUB epub2 = new EPUB();
676
		epub2.unpack(epubFile, epubFolder);
677
		oebps = epub2.getOPSPublications().get(0);
678
		File root = oebps.getRootFolder();
679
		File svg = new File(root.getAbsolutePath() + File.separator + "drawing-100x100.svg");
680
		Assert.assertTrue(svg.exists());
681
		File html = new File(root.getAbsolutePath() + File.separator + "plain-page_no-header.xhtml");
682
		Assert.assertTrue(html.exists());
683
684
	}
685
686
	/**
687
	 * Test method for
688
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#setTableOfContents(java.io.File)}
689
	 * .
690
	 * 
691
	 * @see TestOPS2Publication#testSetTableOfContents()
692
	 */
693
	@Test
694
	public final void testSetTableOfContents() {
695
		// Handled by subclass test.
696
	}
697
698
	/**
699
	 * Test method for
700
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#unpack(java.io.File)}
701
	 * .
702
	 */
703
	@Test
704
	public final void testUnpack() {
705
		// TODO
706
	}
707
708
	/**
709
	 * Test method for
710
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#validateContents()}
711
	 * .
712
	 */
713
	@Test
714
	public final void testValidateContents() {
715
		// TODO
716
	}
717
718
	/**
719
	 * Test method for
720
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#validateMetadata()}
721
	 * .
722
	 */
723
	@Test
724
	public final void testValidateMetadata() {
725
		// TODO
726
	}
727
728
	/**
729
	 * Test method for
730
	 * {@link org.eclipse.mylyn.docs.epub.core.OPSPublication#writeTableOfContents(java.io.File)}
731
	 * .
732
	 */
733
	@Test
734
	public final void testWriteTableOfContents() {
735
		// TODO
736
	}
737
738
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/core/TestOPS2Validator.java (+101 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.tests.core;
12
13
import java.io.IOException;
14
import java.io.StringReader;
15
16
import javax.xml.parsers.ParserConfigurationException;
17
18
import junit.framework.Assert;
19
import junit.framework.TestCase;
20
21
import org.eclipse.mylyn.internal.docs.epub.core.OPS2Validator;
22
import org.junit.Test;
23
import org.xml.sax.InputSource;
24
import org.xml.sax.SAXException;
25
26
/**
27
 * Tests for the OPS2 validator.
28
 * 
29
 * @author Torkild U. Resheim
30
 * @see http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm
31
 */
32
@SuppressWarnings("restriction")
33
public class TestOPS2Validator extends TestCase {
34
35
	private final String[] illegalAttributes = new String[] { "anything", "goes", "in", "here" };
36
37
	private final String[] illegalElements = new String[] { "anything", "goes", "in", "here" };
38
39
	private final String[] legalAttributes = new String[] { "accesskey", "charset", "class", "coords", "dir", "href",
40
			"hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type", "xml:lang" };
41
42
	/**
43
	 * A list of legal elements according to the EPUB 2.0.1 specification
44
	 * 
45
	 * @see http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section1.3.4
46
	 * @see http://idpf.org/epub/20/spec/OPS_2.0.1_draft.htm#Section2.2
47
	 */
48
	private final String[] legalElements = new String[] { "body", "head", "html", "title", "abbr", "acronym",
49
			"address", "blockquote", "br", "cite", "code", "dfn", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6",
50
			"kbd", "p", "pre", "q", "samp", "span", "strong", "var", "a", "dl", "dt", "dd", "ol", "ul", "li", "object",
51
			"param", "b", "big", "hr", "i", "small", "sub", "sup", "tt", "del", "ins", "bdo", "caption", "col",
52
			"colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "img", "area", "map", "style", "link",
53
			"base" };
54
55
	@Test
56
	public void testIllegalAttributes() throws ParserConfigurationException, SAXException, IOException {
57
		for (String attr : illegalAttributes) {
58
			String in = "<html><body><div " + attr + "=\"test\">content</div></body></html>";
59
			String expected = "<html><body><div>content</div></body></html>";
60
			String out = OPS2Validator.clean(new InputSource(new StringReader(in)), "test.html");
61
			Assert.assertEquals(expected, out);
62
		}
63
	}
64
65
	@Test
66
	public void testIllegalElements() throws ParserConfigurationException, SAXException, IOException {
67
		for (String element : illegalElements) {
68
			String in = "<html><body><" + element + "></" + element + "></body></html>";
69
			String result = "<html><body></body></html>";
70
			String out = OPS2Validator.clean(new InputSource(new StringReader(in)), "test.html");
71
			Assert.assertEquals(result, out);
72
73
		}
74
	}
75
76
	@Test
77
	public void testLegalAttributes() throws ParserConfigurationException, SAXException, IOException {
78
		for (String attr : legalAttributes) {
79
			String in = "<html><body><div " + attr + "=\"test\"></div></body></html>";
80
			String out = OPS2Validator.clean(new InputSource(new StringReader(in)), "test.html");
81
			Assert.assertEquals(in, out);
82
		}
83
	}
84
85
	@Test
86
	public void testLegalElements() throws ParserConfigurationException, SAXException, IOException {
87
		for (String element : legalElements) {
88
			String in = "<html><body><" + element + ">content</" + element + "></body></html>";
89
			String out = OPS2Validator.clean(new InputSource(new StringReader(in)), "test.html");
90
			Assert.assertEquals(in, out);
91
92
		}
93
	}
94
95
	@Test
96
	public void testNormal() throws ParserConfigurationException, SAXException, IOException {
97
		String in = "<body><h1 id=\"h1-1\">test</h1></body>";
98
		String out = OPS2Validator.clean(new InputSource(new StringReader(in)), "test.html");
99
		Assert.assertEquals(in, out);
100
	}
101
}
(-)a/org.eclipse.mylyn.docs.epub.tests/src/org/eclipse/mylyn/docs/epub/tests/core/TestTOCGenerator.java (+120 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.docs.epub.tests.core;
12
13
import java.io.IOException;
14
import java.io.StringReader;
15
16
import javax.xml.parsers.ParserConfigurationException;
17
18
import junit.framework.Assert;
19
import junit.framework.TestCase;
20
21
import org.eclipse.emf.common.util.EList;
22
import org.eclipse.mylyn.docs.epub.ncx.NCXFactory;
23
import org.eclipse.mylyn.docs.epub.ncx.NavMap;
24
import org.eclipse.mylyn.docs.epub.ncx.NavPoint;
25
import org.eclipse.mylyn.docs.epub.ncx.Ncx;
26
import org.eclipse.mylyn.internal.docs.epub.core.TOCGenerator;
27
import org.junit.Test;
28
import org.xml.sax.InputSource;
29
import org.xml.sax.SAXException;
30
31
/**
32
 * Tests for the table of contents generator.
33
 * 
34
 * @author Torkild U. Resheim
35
 */
36
@SuppressWarnings("restriction")
37
public class TestTOCGenerator extends TestCase {
38
39
	@Test
40
	public void testNormal() throws ParserConfigurationException, SAXException,
41
			IOException {
42
		String html = "<body>" +
43
				"<h1 id='h1-1'>test</h1>" +
44
				"<h2 id='h2-1'>test</h2>" +
45
				"<h2 id='h2-2'>test</h2>" +
46
				"<h3 id='h3-1'>test</h3>" +
47
				"<h1 id='h1-2'>test</h1>" +
48
				"</body>";
49
		Ncx ncx = createNcx();
50
		TOCGenerator.parse(new InputSource(new StringReader(html)), "test.html",
51
				ncx,0);
52
		EList<NavPoint> points = ncx.getNavMap().getNavPoints();
53
		Assert.assertEquals(2,points.size());
54
		Assert.assertEquals(2, points.get(0).getNavPoints().size());
55
		Assert.assertEquals(1, points.get(0).getNavPoints().get(1).getNavPoints().size());
56
	}
57
	
58
	@Test
59
	public void testMissingIdentifier() throws ParserConfigurationException, SAXException, IOException{
60
		String html = "<body>" +
61
				"<h1 id='h1-1'>test</h1>" +
62
				"<h2>test</h2>" +
63
				"<h1 id='h1-2'>test</h1>" +
64
				"</body>";
65
		Ncx ncx = createNcx();
66
		TOCGenerator.parse(new InputSource(new StringReader(html)), "test.html",
67
				ncx,0);
68
		EList<NavPoint> points = ncx.getNavMap().getNavPoints();
69
		Assert.assertEquals(2,points.size());
70
		// "h2" will be added as a sub-node to the first "h1" regardless of the
71
		// missing identifier.
72
		Assert.assertEquals(1, points.get(0).getNavPoints().size());
73
	}
74
	
75
	/**
76
	 * All items should be placed at the root.
77
	 *  
78
	 * @throws ParserConfigurationException
79
	 * @throws SAXException
80
	 * @throws IOException
81
	 */
82
	@Test
83
	public void testCrazyStructure() throws ParserConfigurationException, SAXException, IOException{
84
		String html = "<body>" +
85
				"<h3 id='h3-1'>test</h3>" +
86
				"<h2 id='h2-1'>test</h2>" +
87
				"<h1 id='h1-1'>test</h1>" +
88
				"</body>";
89
		Ncx ncx = createNcx();
90
		TOCGenerator.parse(new InputSource(new StringReader(html)), "test.html",
91
				ncx,0);
92
		EList<NavPoint> points = ncx.getNavMap().getNavPoints();
93
		// "h3" will be created as a "h1" and "h2" added to it
94
		Assert.assertEquals(2, points.size());
95
	}
96
	
97
	@Test
98
	public void testMissingParent() throws ParserConfigurationException,
99
			SAXException, IOException {
100
		String html = "<body>" + 
101
			"<h1 id='h1-1'>test</h1>" + 
102
			"<h3 id='h3-1'>test</h3>" + 
103
			"<h1 id='h1-2'>test</h1>" + 
104
			"</body>";
105
		Ncx ncx = createNcx();
106
		TOCGenerator.parse(new InputSource(new StringReader(html)), "test.html",
107
				ncx,0);
108
		EList<NavPoint> points = ncx.getNavMap().getNavPoints();
109
		Assert.assertEquals(2,points.size());
110
		Assert.assertEquals(1, points.get(0).getNavPoints().size());
111
	}
112
	
113
114
	private Ncx createNcx() {
115
		Ncx ncx = NCXFactory.eINSTANCE.createNcx();
116
		NavMap navMap = NCXFactory.eINSTANCE.createNavMap();
117
		ncx.setNavMap(navMap);
118
		return ncx;
119
	}
120
}
(-)a/org.eclipse.mylyn.docs.epub.tests/testdata/drawing-100x100.svg (+209 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4
<svg
5
   xmlns:dc="http://purl.org/dc/elements/1.1/"
6
   xmlns:cc="http://creativecommons.org/ns#"
7
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
   xmlns:svg="http://www.w3.org/2000/svg"
9
   xmlns="http://www.w3.org/2000/svg"
10
   xmlns:xlink="http://www.w3.org/1999/xlink"
11
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
   width="100"
14
   height="100"
15
   id="svg2"
16
   version="1.1"
17
   inkscape:version="0.47 r22583"
18
   sodipodi:docname="EPUB Test File">
19
  <defs
20
     id="defs4">
21
    <linearGradient
22
       id="linearGradient3652">
23
      <stop
24
         style="stop-color:#ebed3c;stop-opacity:1;"
25
         offset="0"
26
         id="stop3654" />
27
      <stop
28
         style="stop-color:#ebedff;stop-opacity:1;"
29
         offset="1"
30
         id="stop3656" />
31
    </linearGradient>
32
    <linearGradient
33
       inkscape:collect="always"
34
       id="linearGradient3632">
35
      <stop
36
         style="stop-color:#9eeba2;stop-opacity:1;"
37
         offset="0"
38
         id="stop3634" />
39
      <stop
40
         style="stop-color:#9eeba2;stop-opacity:0;"
41
         offset="1"
42
         id="stop3636" />
43
    </linearGradient>
44
    <linearGradient
45
       id="linearGradient3590">
46
      <stop
47
         style="stop-color:#008400;stop-opacity:0.46368715;"
48
         offset="0"
49
         id="stop3592" />
50
      <stop
51
         style="stop-color:#ffffd4;stop-opacity:0;"
52
         offset="1"
53
         id="stop3594" />
54
    </linearGradient>
55
    <inkscape:perspective
56
       sodipodi:type="inkscape:persp3d"
57
       inkscape:vp_x="-26.423218 : -155.35634 : 1"
58
       inkscape:vp_y="-23.686995 : 425.71923 : 0"
59
       inkscape:vp_z="1021.8599 : -153.53301 : 1"
60
       inkscape:persp3d-origin="501.87287 : -229.11314 : 1"
61
       id="perspective10" />
62
    <linearGradient
63
       inkscape:collect="always"
64
       xlink:href="#linearGradient3590"
65
       id="linearGradient3596"
66
       x1="55.705997"
67
       y1="100.19342"
68
       x2="54.932304"
69
       y2="0.1934236"
70
       gradientUnits="userSpaceOnUse" />
71
    <radialGradient
72
       inkscape:collect="always"
73
       xlink:href="#linearGradient3632"
74
       id="radialGradient3640"
75
       cx="43.130703"
76
       cy="972.86798"
77
       fx="43.130703"
78
       fy="972.86798"
79
       r="39.445312"
80
       gradientTransform="matrix(1,0,0,0.39616756,6.5265487,646.07757)"
81
       gradientUnits="userSpaceOnUse" />
82
    <radialGradient
83
       inkscape:collect="always"
84
       xlink:href="#linearGradient3652"
85
       id="radialGradient3658"
86
       cx="18.032286"
87
       cy="43.940254"
88
       fx="18.032286"
89
       fy="43.940254"
90
       r="19.967714"
91
       gradientTransform="matrix(1,0,0,1.0101761,0,-0.4471386)"
92
       gradientUnits="userSpaceOnUse" />
93
  </defs>
94
  <sodipodi:namedview
95
     id="base"
96
     pagecolor="#ffffff"
97
     bordercolor="#666666"
98
     borderopacity="1.0"
99
     inkscape:pageopacity="0.0"
100
     inkscape:pageshadow="2"
101
     inkscape:zoom="9.04"
102
     inkscape:cx="28.871681"
103
     inkscape:cy="50.708853"
104
     inkscape:document-units="px"
105
     inkscape:current-layer="layer1"
106
     showgrid="false"
107
     inkscape:window-width="1920"
108
     inkscape:window-height="1152"
109
     inkscape:window-x="0"
110
     inkscape:window-y="0"
111
     inkscape:window-maximized="1" />
112
  <metadata
113
     id="metadata7">
114
    <rdf:RDF>
115
      <cc:Work
116
         rdf:about="">
117
        <dc:format>image/svg+xml</dc:format>
118
        <dc:type
119
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
120
        <dc:title></dc:title>
121
      </cc:Work>
122
    </rdf:RDF>
123
  </metadata>
124
  <g
125
     inkscape:label="Layer 1"
126
     inkscape:groupmode="layer"
127
     id="layer1"
128
     transform="translate(0,-952.36218)">
129
    <rect
130
       id="rect2816"
131
       width="100"
132
       height="100"
133
       x="-0.1934236"
134
       y="0.1934236"
135
       transform="translate(0,952.36218)"
136
       style="fill-opacity:1;fill:url(#linearGradient3596);stroke:#000000;stroke-opacity:1" />
137
    <g
138
       sodipodi:type="inkscape:box3d"
139
       id="g3612"
140
       inkscape:perspectiveID="#perspective10"
141
       inkscape:corner0="5.1502873 : 3.3791652 : 0 : 1"
142
       inkscape:corner7="4.4941374 : 3.1208021 : 0.25 : 1">
143
      <path
144
         sodipodi:type="inkscape:box3dside"
145
         id="path3624"
146
         style="fill:#e9e9ff;fill-rule:evenodd;stroke:none"
147
         inkscape:box3dsidetype="11"
148
         d="m 84.560018,994.40393 12.677559,-24.36681 1.065407,19.14824 -12.786783,22.40374 z" />
149
      <path
150
         sodipodi:type="inkscape:box3dside"
151
         id="path3614"
152
         style="fill:#353564;fill-rule:evenodd;stroke:none"
153
         inkscape:box3dsidetype="6"
154
         d="m 46.460177,985.80713 0.99505,17.88377 38.060974,7.8982 -0.956183,-17.18517 z" />
155
      <path
156
         sodipodi:type="inkscape:box3dside"
157
         id="path3616"
158
         style="fill:#4d4d9f;fill-rule:evenodd;stroke:none"
159
         inkscape:box3dsidetype="5"
160
         d="m 46.460177,985.80713 8.704266,-26.50227 42.073134,10.73226 -12.677559,24.36681 z" />
161
      <path
162
         sodipodi:type="inkscape:box3dside"
163
         id="path3622"
164
         style="fill:#afafde;fill-rule:evenodd;stroke:none"
165
         inkscape:box3dsidetype="13"
166
         d="m 47.455227,1003.6909 8.823102,-24.3665 42.024655,9.86096 -12.786783,22.40374 z" />
167
      <path
168
         sodipodi:type="inkscape:box3dside"
169
         id="path3620"
170
         style="fill:#d7d7ff;fill-rule:evenodd;stroke:none"
171
         inkscape:box3dsidetype="14"
172
         d="m 55.164443,959.30486 1.113886,20.01954 42.024655,9.86096 -1.065407,-19.14824 z" />
173
      <path
174
         sodipodi:type="inkscape:box3dside"
175
         id="path3618"
176
         style="fill:#8686bf;fill-rule:evenodd;stroke:none"
177
         inkscape:box3dsidetype="3"
178
         d="m 46.460177,985.80713 8.704266,-26.50227 1.113886,20.01954 -8.823102,24.3665 z" />
179
    </g>
180
    <path
181
       sodipodi:type="star"
182
       id="path3626"
183
       sodipodi:sides="5"
184
       sodipodi:cx="19.247787"
185
       sodipodi:cy="43.141594"
186
       sodipodi:r1="20.844067"
187
       sodipodi:r2="10.422033"
188
       sodipodi:arg1="0.50400573"
189
       sodipodi:arg2="1.1323243"
190
       inkscape:flatsided="false"
191
       inkscape:rounded="0"
192
       inkscape:randomized="0"
193
       d="M 37.5,53.207966 23.67253,52.577718 15.314343,63.61116 11.640821,50.265697 -1.4354278,45.72611 10.121681,38.108408 10.398302,24.269347 21.21451,32.906811 34.46172,28.893388 29.589395,41.849337 37.5,53.207966 z"
194
       transform="translate(7.3008848,933.66749)"
195
       style="fill:url(#radialGradient3658);fill-opacity:1;stroke:#9eeba2;stroke-opacity:1" />
196
    <text
197
       xml:space="preserve"
198
       style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#335900;fill-opacity:1;stroke:url(#radialGradient3640);stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
199
       x="8.0752211"
200
       y="1046.0568"
201
       id="text3628"
202
       sodipodi:linespacing="125%"><tspan
203
         sodipodi:role="line"
204
         id="tspan3630"
205
         x="8.0752211"
206
         y="1046.0568"
207
         style="fill:#335900;fill-opacity:1;stroke:url(#radialGradient3640)">SVG</tspan></text>
208
  </g>
209
</svg>
(-)a/org.eclipse.mylyn.docs.epub.tests/testdata/plain-page.xhtml (+57 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html
3
  PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
<head>
6
<title>XHTML Test</title>
7
</head>
8
<body>
9
	<h1 id="h1_1">First item</h1>
10
	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec
11
		odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem
12
		at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec
13
		tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget
14
		nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
15
		per inceptos himenaeos.</p>
16
	<p>
17
		Curabitur sodales ligula in libero. <i>Lorem ipsum dolor sit amet,
18
			consectetur adipiscing elit</i>. Sed dignissim lacinia nunc. Curabitur tortor.
19
		Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis.
20
		Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor.
21
		Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac
22
		turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus,
23
		ullamcorper vel, tincidunt sed, euismod in, nibh.
24
	</p>
25
	<h2 id="h2_1">First sub-item</h2>
26
	<p>
27
		Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora
28
		torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed
29
		lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus
30
		ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. <i>Aenean
31
			quam</i>. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin
32
		quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed
33
		lectus.
34
	</p>
35
	<h2 id="h2_2">Second sub-item</h2>
36
	<p>
37
		Integer euismod lacus luctus magna. <i>Class aptent taciti sociosqu ad
38
			litora torquent per conubia nostra, per inceptos himenaeos</i>. Quisque cursus,
39
		metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue
40
		eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
41
		posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor.
42
		Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit
43
		amet pede facilisis laoreet. <i>Ut fringilla</i>. Donec lacus nunc, viverra
44
		nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus.
45
		Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est
46
		pulvinar ullamcorper.
47
	</p>
48
	<h1 id="h1_2">Second item</h1>
49
	<p>Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed
50
		aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis,
51
		venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales
52
		libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo
53
		ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor,
54
		cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at
55
		pede suscipit sodales.</p>
56
</body>
57
</html>
(-)a/org.eclipse.mylyn.docs.epub.tests/testdata/plain-page_link.xhtml (+59 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html
3
  PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
<head>
6
<title>XHTML Test</title>
7
</head>
8
<body>
9
	<h1 id="h1_1">First item</h1>
10
	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec
11
		odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem
12
		at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec
13
		tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget
14
		nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
15
		per inceptos himenaeos.</p>
16
	<p>
17
		<img src="drawing-100x100.svg" alt="drawing"/>
18
		<a href="plain-page_no-header.xhtml">Link to another page</a>
19
		Curabitur sodales ligula in libero. <i>Lorem ipsum dolor sit amet,
20
			consectetur adipiscing elit</i>. Sed dignissim lacinia nunc. Curabitur tortor.
21
		Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis.
22
		Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor.
23
		Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac
24
		turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus,
25
		ullamcorper vel, tincidunt sed, euismod in, nibh.
26
	</p>
27
	<h2 id="h2_1">First sub-item</h2>
28
	<p>
29
		Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora
30
		torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed
31
		lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus
32
		ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. <i>Aenean
33
			quam</i>. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin
34
		quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed
35
		lectus.
36
	</p>
37
	<h2 id="h2_2">Second sub-item</h2>
38
	<p>
39
		Integer euismod lacus luctus magna. <i>Class aptent taciti sociosqu ad
40
			litora torquent per conubia nostra, per inceptos himenaeos</i>. Quisque cursus,
41
		metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue
42
		eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
43
		posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor.
44
		Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit
45
		amet pede facilisis laoreet. <i>Ut fringilla</i>. Donec lacus nunc, viverra
46
		nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus.
47
		Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est
48
		pulvinar ullamcorper.
49
	</p>
50
	<h1 id="h1_2">Second item</h1>
51
	<p>Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed
52
		aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis,
53
		venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales
54
		libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo
55
		ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor,
56
		cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at
57
		pede suscipit sodales.</p>
58
</body>
59
</html>
(-)a/org.eclipse.mylyn.docs.epub.tests/testdata/plain-page_no-header.xhtml (+55 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html
3
  PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
<head>
6
<title>XHTML Test</title>
7
<link rel="stylesheet" href="css/book.css" type="text/css" />
8
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
9
</head>
10
<body>
11
	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec
12
		odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem
13
		at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec
14
		tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget
15
		nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
16
		per inceptos himenaeos.</p>
17
	<p>
18
		Curabitur sodales ligula in libero. <i>Lorem ipsum dolor sit amet,
19
			consectetur adipiscing elit</i>. Sed dignissim lacinia nunc. Curabitur tortor.
20
		Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis.
21
		Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor.
22
		Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac
23
		turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus,
24
		ullamcorper vel, tincidunt sed, euismod in, nibh.
25
	</p>
26
	<p>
27
		Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora
28
		torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed
29
		lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus
30
		ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. <i>Aenean
31
			quam</i>. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin
32
		quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed
33
		lectus.
34
	</p>
35
	<p>
36
		Integer euismod lacus luctus magna. <i>Class aptent taciti sociosqu ad
37
			litora torquent per conubia nostra, per inceptos himenaeos</i>. Quisque cursus,
38
		metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue
39
		eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
40
		posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor.
41
		Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit
42
		amet pede facilisis laoreet. <i>Ut fringilla</i>. Donec lacus nunc, viverra
43
		nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus.
44
		Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est
45
		pulvinar ullamcorper.
46
	</p>
47
	<p>Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed
48
		aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis,
49
		venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales
50
		libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo
51
		ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor,
52
		cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at
53
		pede suscipit sodales.</p>
54
</body>
55
</html>
(-)a/org.eclipse.mylyn.docs.epub.tests/testdata/plain-page_warnings.xhtml (+58 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html
3
  PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
<head>
6
<title>XHTML Test</title>
7
</head>
8
<body>
9
    <bad>Not a XHTML 1.1 element</bad>
10
	<h1 id="h1_1">First item</h1>
11
	<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec
12
		odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem
13
		at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec
14
		tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget
15
		nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
16
		per inceptos himenaeos.</p>
17
	<p>
18
		Curabitur sodales ligula in libero. <i>Lorem ipsum dolor sit amet,
19
			consectetur adipiscing elit</i>. Sed dignissim lacinia nunc. Curabitur tortor.
20
		Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis.
21
		Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor.
22
		Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac
23
		turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus,
24
		ullamcorper vel, tincidunt sed, euismod in, nibh.
25
	</p>
26
	<h2 id="h2_1">First sub-item</h2>
27
	<p>
28
		Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora
29
		torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed
30
		lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus
31
		ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. <i>Aenean
32
			quam</i>. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin
33
		quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed
34
		lectus.
35
	</p>
36
	<h2 id="h2_2">Second sub-item</h2>
37
	<p>
38
		Integer euismod lacus luctus magna. <i>Class aptent taciti sociosqu ad
39
			litora torquent per conubia nostra, per inceptos himenaeos</i>. Quisque cursus,
40
		metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue
41
		eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
42
		posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor.
43
		Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit
44
		amet pede facilisis laoreet. <i>Ut fringilla</i>. Donec lacus nunc, viverra
45
		nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus.
46
		Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est
47
		pulvinar ullamcorper.
48
	</p>
49
	<h1 id="h1_2">Second item</h1>
50
	<p>Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed
51
		aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis,
52
		venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales
53
		libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo
54
		ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor,
55
		cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at
56
		pede suscipit sodales.</p>
57
</body>
58
</html>
(-)a/org.eclipse.mylyn.docs.epub.tests/testdata/toc.ncx (+35 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ncx:ncx xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
3
  <ncx:head>
4
    <ncx:meta content="3063f615-672e-4083-911a-65c5ff245e75" name="dtb:uid"/>
5
  </ncx:head>
6
  <ncx:docTitle>
7
    <ncx:text>Table of contents</ncx:text>
8
  </ncx:docTitle>
9
  <ncx:navMap>
10
    <ncx:navPoint id="navpoint1" playOrder="1">
11
      <ncx:navLabel>
12
        <ncx:text>First item</ncx:text>
13
      </ncx:navLabel>
14
      <ncx:content src="plain-page.xhtml#h1_1"/>
15
      <ncx:navPoint id="navpoint2" playOrder="2">
16
        <ncx:navLabel>
17
          <ncx:text>First sub-item</ncx:text>
18
        </ncx:navLabel>
19
        <ncx:content src="plain-page.xhtml#h2_1"/>
20
      </ncx:navPoint>
21
      <ncx:navPoint id="navpoint3" playOrder="3">
22
        <ncx:navLabel>
23
          <ncx:text>Second sub-item</ncx:text>
24
        </ncx:navLabel>
25
        <ncx:content src="plain-page.xhtml#h2_2"/>
26
      </ncx:navPoint>
27
    </ncx:navPoint>
28
    <ncx:navPoint id="navpoint4" playOrder="4">
29
      <ncx:navLabel>
30
        <ncx:text>Second item</ncx:text>
31
      </ncx:navLabel>
32
      <ncx:content src="plain-page.xhtml#h1_2"/>
33
    </ncx:navPoint>
34
  </ncx:navMap>
35
</ncx:ncx>
(-)a/org.eclipse.mylyn.docs.epub.ui/.classpath (+7 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
(-)a/org.eclipse.mylyn.docs.epub.ui/.gitignore (+4 lines)
Added Link Here
1
/build
2
/bin
3
/Building_EPUBs.epub
4
/help
(-)a/org.eclipse.mylyn.docs.epub.ui/.project (+29 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.mylyn.docs.epub.ui</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.mylyn.wikitext.ui.wikiTextValidationBuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.jdt.core.javabuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.ManifestBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.mylyn.wikitext.ui.wikiTextNature</nature>
27
		<nature>org.eclipse.jdt.core.javanature</nature>
28
	</natures>
29
</projectDescription>
(-)a/org.eclipse.mylyn.docs.epub.ui/.settings/org.eclipse.core.resources.prefs (+3 lines)
Added Link Here
1
#Fri May 20 15:07:41 CEST 2011
2
eclipse.preferences.version=1
3
encoding/<project>=UTF-8
(-)a/org.eclipse.mylyn.docs.epub.ui/.settings/org.eclipse.core.runtime.prefs (+3 lines)
Added Link Here
1
#Fri May 20 15:07:41 CEST 2011
2
eclipse.preferences.version=1
3
line.separator=\n
(-)a/org.eclipse.mylyn.docs.epub.ui/.settings/org.eclipse.jdt.core.prefs (+12 lines)
Added Link Here
1
#Sun May 01 15:29:11 CEST 2011
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.5
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12
org.eclipse.jdt.core.compiler.source=1.5
(-)a/org.eclipse.mylyn.docs.epub.ui/META-INF/MANIFEST.MF (+27 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %Bundle-Name
4
Bundle-SymbolicName: org.eclipse.mylyn.docs.epub.ui;singleton:=true
5
Bundle-Version: 0.8.0.qualifier
6
Bundle-Vendor: %Bundle-Vendor
7
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
8
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.6.0,4.0.0)",
9
 org.eclipse.mylyn.docs.epub.core;bundle-version="[0.8.0,1.0.0)",
10
 org.eclipse.mylyn.wikitext.ui;bundle-version="[1.5.0,2.0.0)",
11
 org.eclipse.mylyn.wikitext.core;bundle-version="[1.5.0,2.0.0)",
12
 org.eclipse.core.resources;bundle-version="[3.6.0,4.0.0)",
13
 org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
14
 org.eclipse.core.databinding,
15
 org.eclipse.core.databinding.beans,
16
 org.eclipse.core.databinding.observable,
17
 org.eclipse.core.databinding.property,
18
 org.eclipse.jface.databinding,
19
 com.ibm.icu,
20
 org.eclipse.emf;bundle-version="2.6.0",
21
 org.eclipse.emf.ecore;bundle-version="2.7.0",
22
 org.eclipse.emf.databinding,
23
 org.eclipse.emf.validation;bundle-version="1.4.0",
24
 org.eclipse.emf.validation.ui;bundle-version="1.3.0"
25
Bundle-ClassPath: .
26
Bundle-Activator: org.eclipse.mylyn.internal.docs.epub.ui.EPUBUIPlugin
27
Bundle-ActivationPolicy: lazy
(-)a/org.eclipse.mylyn.docs.epub.ui/OSGI-INF/l10n/bundle.properties (+15 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2011 Torkild U. Resheim.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     Torkild U. Resheim - initial API and implementation
10
###############################################################################
11
#Properties file for org.eclipse.mylyn.docs.epub.ui
12
Bundle-Vendor = Torkild U. Resheim
13
Bundle-Name = EPUB User Interface
14
command.name = Generate EPUB
15
command.label = Generate EPUB...
(-)a/org.eclipse.mylyn.docs.epub.ui/build.properties (+8 lines)
Added Link Here
1
source.. = src/
2
output.. = bin/
3
bin.includes = plugin.xml,\
4
               META-INF/,\
5
               OSGI-INF/l10n/bundle.properties,\
6
               OSGI-INF/,\
7
               icons/
8
jre.compilation.profile = J2SE-1.5
(-)a/org.eclipse.mylyn.docs.epub.ui/plugin.xml (+25 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension
5
         point="org.eclipse.ui.commands">
6
      <command
7
            defaultHandler="org.eclipse.mylyn.internal.docs.epub.ui.commands.ConvertMarkupToEPUB"
8
            id="org.eclipse.mylyn.docs.epub.ui.convertToEPUBCommand"
9
            name="%command.name">
10
      </command>
11
   </extension>
12
   <extension
13
         point="org.eclipse.ui.menus">
14
      <menuContribution
15
            allPopups="true"
16
            locationURI="popup:org.eclipse.mylyn.wikitext.ui.contextmenu?after=additions">
17
         <command
18
               commandId="org.eclipse.mylyn.docs.epub.ui.convertToEPUBCommand"
19
               label="%command.label"
20
               style="push">
21
         </command>
22
      </menuContribution>
23
   </extension>
24
25
</plugin>
(-)a/org.eclipse.mylyn.docs.epub.ui/pom.xml (+30 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
  <modelVersion>4.0.0</modelVersion>
5
  <parent>
6
    <artifactId>org.eclipse.mylyn.docs-parent</artifactId>
7
    <groupId>org.eclipse.mylyn.docs</groupId>
8
    <version>1.6.0-SNAPSHOT</version>
9
  </parent>
10
  <artifactId>org.eclipse.mylyn.docs.epub.ui</artifactId>
11
  <version>0.8.0-SNAPSHOT</version>
12
  <packaging>eclipse-plugin</packaging>
13
  <build>
14
    <plugins>
15
      <plugin>
16
        <groupId>org.eclipse.tycho</groupId>
17
        <artifactId>tycho-source-plugin</artifactId>
18
      </plugin>
19
      <plugin>
20
        <groupId>org.codehaus.mojo</groupId>
21
        <artifactId>findbugs-maven-plugin</artifactId>
22
      </plugin>
23
      <plugin>
24
        <groupId>org.apache.maven.plugins</groupId>
25
        <artifactId>maven-pmd-plugin</artifactId>
26
      </plugin>
27
    </plugins>
28
  </build>
29
  <groupId>org.eclipse.mylyn.docs.epub</groupId>
30
</project>
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/ConvertFromMarkupWizard.java (+154 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.ui;
12
13
import java.io.File;
14
import java.util.List;
15
16
import org.eclipse.core.resources.IFile;
17
import org.eclipse.core.resources.IResource;
18
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.MultiStatus;
21
import org.eclipse.core.runtime.Status;
22
import org.eclipse.emf.common.util.Diagnostic;
23
import org.eclipse.jface.operation.IRunnableWithProgress;
24
import org.eclipse.jface.wizard.Wizard;
25
import org.eclipse.mylyn.docs.epub.core.EPUB;
26
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
27
import org.eclipse.mylyn.docs.epub.core.wikitext.MarkupToOPS;
28
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
29
import org.eclipse.ui.statushandlers.StatusManager;
30
31
public class ConvertFromMarkupWizard extends Wizard {
32
33
	private static final String PLUGIN_ID = "org.eclipse.mylyn.docs.epub.ui";
34
35
	private EPUB2Bean bean;
36
37
	OPSPublication epub;
38
39
	private IFile epubFile;
40
41
	private File epubFolder;
42
43
	private IFile markupFile;
44
45
	private File markupFolder = null;
46
47
	private MarkupLanguage markupLanguage;
48
49
	private MainPage page;
50
51
	public ConvertFromMarkupWizard() {
52
		setWindowTitle("Generate EPUB");
53
		setNeedsProgressMonitor(true);
54
	}
55
56
	@Override
57
	public void addPages() {
58
		epub = OPSPublication.getVersion2Instance();
59
		// XXX: Read back epub
60
		File workingFolder = null;
61
		// if (epubFile.exists()) {
62
		// try {
63
		// workingFolder = epub.unpack(epubFile.getLocation().toFile());
64
		// } catch (Exception e) {
65
		// e.printStackTrace();
66
		// }
67
		// }
68
		bean = new EPUB2Bean(epub, markupFile.getLocation().toFile(), epubFile.getLocation().toFile(), workingFolder);
69
		page = new MainPage(bean);
70
		addPage(page);
71
	}
72
73
	/**
74
	 * Delete the folder recursively.
75
	 * 
76
	 * @param folder
77
	 *            the folder to delete
78
	 * @return <code>true</code> if the folder was deleted
79
	 */
80
	private void deleteFolder(File folder) {
81
		if (folder == null) {
82
			return;
83
		}
84
		if (folder.isDirectory() && folder.exists()) {
85
			String[] children = folder.list();
86
			for (int i = 0; i < children.length; i++) {
87
				deleteFolder(new File(folder, children[i]));
88
			}
89
		}
90
		if (folder.exists()) {
91
			folder.delete();
92
		}
93
	}
94
95
	public void init(IFile markupFile, IFile epubFile, MarkupLanguage markupLanguage) {
96
		this.markupFile = markupFile;
97
		this.epubFile = epubFile;
98
		this.markupLanguage = markupLanguage;
99
	}
100
101
	@Override
102
	public boolean performFinish() {
103
		final MarkupToOPS markupToEPUB = new MarkupToOPS();
104
		markupToEPUB.setMarkupLanguage(markupLanguage);
105
		final MultiStatus ms = new MultiStatus(PLUGIN_ID, 0, "Could not generate EPUB", null);
106
		try {
107
			getContainer().run(false, false, new IRunnableWithProgress() {
108
				public void run(IProgressMonitor monitor) {
109
					monitor.beginTask("Generate EPUB", 3);
110
					try {
111
						if (epubFile.exists()) {
112
							// Delete the old one
113
							epubFile.delete(true, monitor);
114
						}
115
						// Parse the wiki markup and populate the EPUB
116
						markupFolder = markupToEPUB.parse(epub, markupFile.getLocation().toFile());
117
						monitor.worked(1);
118
						List<Diagnostic> problems = epub.validateMetadata();
119
120
						if (problems.size() > 0) {
121
							for (Diagnostic diagnostic : problems) {
122
								ms.add(new Status(IStatus.ERROR, PLUGIN_ID, diagnostic.getMessage()));
123
							}
124
							monitor.setCanceled(true);
125
							StatusManager.getManager().handle(ms, StatusManager.BLOCK);
126
							return;
127
						}
128
						EPUB publication = new EPUB();
129
						publication.add(epub);
130
						epubFolder = publication.pack(epubFile.getLocation().toFile());
131
						monitor.worked(1);
132
						epubFile.refreshLocal(IResource.DEPTH_ONE, monitor);
133
						monitor.worked(1);
134
					} catch (Exception e) {
135
						e.printStackTrace();
136
						ms.add(new Status(IStatus.ERROR, EPUBUIPlugin.PLUGIN_ID, "Could not convert to EPUB", e));
137
						monitor.setCanceled(true);
138
						StatusManager.getManager().handle(ms, StatusManager.BLOCK);
139
						return;
140
					} finally {
141
						deleteFolder(epubFolder);
142
						deleteFolder(markupFolder);
143
						monitor.done();
144
					}
145
				}
146
			});
147
		} catch (Throwable e) {
148
			ms.add(new Status(IStatus.ERROR, EPUBUIPlugin.PLUGIN_ID, "Could not convert to EPUB", e));
149
			return false;
150
		}
151
		return ms.isOK();
152
	}
153
154
}
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/EPUB2Bean.java (+309 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse  License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.ui;
12
13
import java.io.File;
14
import java.util.Comparator;
15
import java.util.List;
16
import java.util.Locale;
17
import java.util.Map;
18
import java.util.TreeMap;
19
import java.util.UUID;
20
21
import org.eclipse.emf.common.util.EList;
22
import org.eclipse.emf.ecore.EStructuralFeature;
23
import org.eclipse.emf.ecore.util.FeatureMap;
24
import org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList;
25
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
26
import org.eclipse.mylyn.docs.epub.core.OPSPublication;
27
import org.eclipse.mylyn.docs.epub.dc.Creator;
28
import org.eclipse.mylyn.docs.epub.dc.Date;
29
import org.eclipse.mylyn.docs.epub.dc.Identifier;
30
import org.eclipse.mylyn.docs.epub.dc.Language;
31
import org.eclipse.mylyn.docs.epub.dc.Rights;
32
import org.eclipse.mylyn.docs.epub.dc.Subject;
33
import org.eclipse.mylyn.docs.epub.dc.Title;
34
import org.eclipse.mylyn.docs.epub.opf.Item;
35
36
/**
37
 * Simplified representation of an EPUB revision 2.0 instance.
38
 * 
39
 * @author Torkild U. Resheim
40
 * 
41
 */
42
class EPUB2Bean {
43
44
	private static final String STYLING_ID = "styling";
45
46
	private static final String EMPTY_STRING = "";
47
48
	private static final EStructuralFeature TEXT = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text();
49
50
	private final OPSPublication epub;
51
52
	private final File markupFile;
53
54
	public File getMarkupFile() {
55
		return markupFile;
56
	}
57
58
	public EPUB2Bean() {
59
		epub = OPSPublication.getVersion2Instance();
60
		markupFile = null;
61
	}
62
63
	class ValueComparator implements Comparator<String> {
64
65
		Map<String, String> base;
66
67
		public ValueComparator(Map<String, String> base) {
68
			this.base = base;
69
		}
70
71
		public int compare(String a, String b) {
72
			String key_a = a;
73
			String key_b = b;
74
75
			return key_a.compareTo(key_b);
76
		}
77
	}
78
79
	TreeMap<String, String> sorted_locales;
80
81
	public EPUB2Bean(OPSPublication epub, File markupFile, File epubFile, File workingFolder) {
82
		this.epub = epub;
83
		this.markupFile = markupFile;
84
		id = epub.getOpfPackage().getUniqueIdentifier();
85
		if (id == null || id.trim().length() == 0) {
86
			id = "id";
87
			epub.getOpfPackage().setUniqueIdentifier(id);
88
			epub.addIdentifier(id, "UUID", UUID.randomUUID().toString());
89
		}
90
		// Keep the cover image reference
91
		Item item = epub.getItemById(OPSPublication.COVER_IMAGE_ID);
92
		// Clear everything except the metadata
93
		epub.getOpfPackage().getManifest().getItems().clear();
94
		epub.getOpfPackage().getGuide().getGuideItems().clear();
95
		epub.getOpfPackage().getSpine().getSpineItems().clear();
96
97
		// if (epubFile.exists()) {
98
		// // Try to restore some information
99
		// File rootFolder = new File(workingFolder.getAbsolutePath() +
100
		// File.separator + epub.getRootFolder()[0]);
101
		// if (item != null) {
102
		// epub.setCover(new File(rootFolder.getAbsolutePath() + File.separator
103
		// + item.getHref()), item.getTitle());
104
		// }
105
		// }
106
107
		sorted_locales = new TreeMap<String, String>();
108
		String[] iso639s = Locale.getISOLanguages();
109
		for (String iso639 : iso639s) {
110
			Locale locale = new Locale(iso639);
111
			sorted_locales.put(locale.getDisplayLanguage(), locale.getLanguage());
112
		}
113
	}
114
115
	public String getCover() {
116
		Item item = epub.getItemById(OPSPublication.COVER_IMAGE_ID);
117
		if (item == null) {
118
			return EMPTY_STRING;
119
		} else {
120
			return item.getFile();
121
		}
122
	}
123
124
	@SuppressWarnings("rawtypes")
125
	public String getCreator() {
126
		EList<Creator> creators = epub.getOpfPackage().getMetadata().getCreators();
127
		if (creators.size() > 0) {
128
			FeatureMap fm = creators.get(0).getMixed();
129
			Object o = fm.get(TEXT, false);
130
			if (o instanceof FeatureEList) {
131
				if (((FeatureEList) o).size() > 0) {
132
					return ((FeatureEList) o).get(0).toString();
133
				}
134
			}
135
		}
136
		return EMPTY_STRING;
137
	}
138
139
	public OPSPublication getEPUB() {
140
		return epub;
141
	}
142
143
	@SuppressWarnings("rawtypes")
144
	public String getIdentifier() {
145
		EList<Identifier> identifiers = epub.getOpfPackage().getMetadata().getIdentifiers();
146
		if (identifiers.size() > 0) {
147
			FeatureMap fm = identifiers.get(0).getMixed();
148
			Object o = fm.get(TEXT, false);
149
			if (o instanceof FeatureEList) {
150
				if (((FeatureEList) o).size() > 0) {
151
					return ((FeatureEList) o).get(0).toString();
152
				}
153
			}
154
		}
155
		return EMPTY_STRING;
156
	}
157
158
	@SuppressWarnings("rawtypes")
159
	public String getLanguage() {
160
		EList<Language> languages = epub.getOpfPackage().getMetadata().getLanguages();
161
		if (languages.size() > 0) {
162
			FeatureMap fm = languages.get(0).getMixed();
163
			Object o = fm.get(TEXT, false);
164
			if (o instanceof FeatureEList) {
165
				if (((FeatureEList) o).size() > 0) {
166
					String iso639 = ((FeatureEList) o).get(0).toString();
167
					Locale l = new Locale(iso639);
168
					return l.getDisplayLanguage();
169
				}
170
			}
171
		}
172
		return EMPTY_STRING;
173
	}
174
	
175
	public void setLanguage(String language) {
176
		epub.getOpfPackage().getMetadata().getLanguages().clear();
177
		epub.addLanguage(null, sorted_locales.get(language));
178
	}
179
180
	@SuppressWarnings("rawtypes")
181
	public String getRights() {
182
		EList<Rights> rights = epub.getOpfPackage().getMetadata().getRights();
183
		if (rights.size() > 0) {
184
			FeatureMap fm = rights.get(0).getMixed();
185
			Object o = fm.get(TEXT, false);
186
			if (o instanceof FeatureEList) {
187
				if (((FeatureEList) o).size() > 0) {
188
					return ((FeatureEList) o).get(0).toString();
189
				}
190
			}
191
		}
192
		return EMPTY_STRING;
193
	}
194
195
	public String getStyleSheet() {
196
		List<Item> stylesheets = epub.getItemsByMIMEType(OPSPublication.MIMETYPE_CSS);
197
		if (stylesheets.isEmpty()) {
198
			return EMPTY_STRING;
199
		} else {
200
			return stylesheets.get(0).getHref();
201
		}
202
	}
203
204
	@SuppressWarnings("rawtypes")
205
	public String getSubject() {
206
		EList<Subject> subjects = epub.getOpfPackage().getMetadata().getSubjects();
207
		if (subjects.size() > 0) {
208
			FeatureMap fm = subjects.get(0).getMixed();
209
			Object o = fm.get(TEXT, false);
210
			if (o instanceof FeatureEList) {
211
				if (((FeatureEList) o).size() > 0) {
212
					return ((FeatureEList) o).get(0).toString();
213
				}
214
			}
215
		}
216
		return EMPTY_STRING;
217
	}
218
219
	@SuppressWarnings("rawtypes")
220
	public String getTitle() {
221
		EList<Title> titles = epub.getOpfPackage().getMetadata().getTitles();
222
		if (titles.size() > 0) {
223
			FeatureMap fm = titles.get(0).getMixed();
224
			Object o = fm.get(TEXT, false);
225
			if (o instanceof FeatureEList) {
226
				if (((FeatureEList) o).size() > 0) {
227
					return ((FeatureEList) o).get(0).toString();
228
				}
229
			}
230
		}
231
		return EMPTY_STRING;
232
	}
233
234
	public void setCover(String cover) {
235
		epub.setCover(new File(cover), "Cover page");
236
	}
237
238
	public void setCreator(String creator) {
239
		epub.getOpfPackage().getMetadata().getCreators().clear();
240
		epub.addCreator(null, null, creator, null, null);
241
	}
242
243
	private String id = "id";
244
245
	public void setIdentifier(String identifier) {
246
		epub.getOpfPackage().getMetadata().getIdentifiers().clear();
247
		epub.addIdentifier(id, getIdScheme(), identifier);
248
	}
249
250
	public void setIdScheme(String schemeName) {
251
		String identifier = getIdentifier();
252
		epub.getOpfPackage().getMetadata().getIdentifiers().clear();
253
		epub.addIdentifier(id, schemeName, identifier);
254
	}
255
256
	public String getIdScheme() {
257
		Identifier ident = epub.getOpfPackage().getMetadata().getIdentifiers().get(0);
258
		return ident.getScheme();
259
	}
260
261
	public void setRights(String rights) {
262
		epub.getOpfPackage().getMetadata().getRights().clear();
263
		epub.addRights(null, null, rights);
264
	}
265
266
	public void setStyleSheet(String css) {
267
		epub.getOpfPackage().getManifest().getItems().remove(epub.getItemsByMIMEType(OPSPublication.MIMETYPE_CSS));
268
		epub.addItem(STYLING_ID, null, new File(css), null, null, false, false, true);
269
	}
270
271
	public void setSubject(String subject) {
272
		epub.getOpfPackage().getMetadata().getSubjects().clear();
273
		epub.addSubject(null, null, subject);
274
	}
275
276
	public void setTitle(String title) {
277
		epub.getOpfPackage().getMetadata().getTitles().clear();
278
		epub.addTitle(null, null, title);
279
	}
280
281
	public void setPublicationDate(String date){
282
		epub.getOpfPackage().getMetadata().getDates().clear();
283
		epub.addDate(null, date, "publication");
284
	}
285
286
	@SuppressWarnings("rawtypes")
287
	public String getPublicationDate() {
288
		EList<Date> dates = epub.getOpfPackage().getMetadata().getDates();
289
		if (dates.size() > 0) {
290
			for (Date date : dates) {
291
				if (date.getEvent().equals("publication")) {
292
					FeatureMap fm = date.getMixed();
293
				Object o = fm.get(TEXT, false);
294
				if (o instanceof FeatureEList) {
295
					if (((FeatureEList) o).size() > 0) {
296
						return ((FeatureEList) o).get(0).toString();
297
					}
298
				}
299
				}
300
			}
301
		}
302
		return EMPTY_STRING;
303
304
	}
305
306
	public Map<String, String> getLocales() {
307
		return sorted_locales;
308
	}
309
}
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/EPUBUIPlugin.java (+39 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse License v1.0 which accompanies this
6
 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors: Torkild U. Resheim - initial API and implementation
9
 *******************************************************************************/
10
package org.eclipse.mylyn.internal.docs.epub.ui;
11
12
import org.eclipse.ui.plugin.AbstractUIPlugin;
13
import org.osgi.framework.BundleContext;
14
15
public class EPUBUIPlugin extends AbstractUIPlugin {
16
17
	private static EPUBUIPlugin plugin;
18
	
19
	public static final String PLUGIN_ID = "org.eclipse.mylyn.docs.epub.ui";
20
21
	@Override
22
	public void start(BundleContext context) throws Exception {
23
		super.start(context);
24
		plugin = this;
25
	}
26
27
	@Override
28
	public void stop(BundleContext context) throws Exception {
29
		if (plugin == this) {
30
			plugin = null;
31
		}
32
		super.stop(context);
33
	}
34
35
	public static EPUBUIPlugin getDefault() {
36
		return plugin;
37
	}
38
39
}
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/MainPage.java (+253 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.ui;
12
13
import java.util.Set;
14
15
import org.eclipse.core.databinding.DataBindingContext;
16
import org.eclipse.core.databinding.beans.PojoObservables;
17
import org.eclipse.core.databinding.observable.value.IObservableValue;
18
import org.eclipse.jface.databinding.swt.SWTObservables;
19
import org.eclipse.jface.wizard.WizardPage;
20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.events.SelectionAdapter;
22
import org.eclipse.swt.events.SelectionEvent;
23
import org.eclipse.swt.layout.GridData;
24
import org.eclipse.swt.layout.GridLayout;
25
import org.eclipse.swt.widgets.Button;
26
import org.eclipse.swt.widgets.Combo;
27
import org.eclipse.swt.widgets.Composite;
28
import org.eclipse.swt.widgets.DateTime;
29
import org.eclipse.swt.widgets.Display;
30
import org.eclipse.swt.widgets.FileDialog;
31
import org.eclipse.swt.widgets.Group;
32
import org.eclipse.swt.widgets.Label;
33
import org.eclipse.swt.widgets.Text;
34
35
public class MainPage extends WizardPage {
36
37
	@SuppressWarnings("unused")
38
	private DataBindingContext m_bindingContext;
39
40
	private Text titleText;
41
42
	private Text copyrightText;
43
44
	private Text coverText;
45
46
	private Text styleSheetText;
47
48
	private Text identifierText;
49
50
	private Text subjectText;
51
52
	/**
53
	 * @wbp.nonvisual location=681,21
54
	 */
55
	private EPUB2Bean bean = new EPUB2Bean();
56
57
	private Combo schemeText;
58
59
	private Text authorText;
60
61
	private Combo combo;
62
63
	private DateTime dateTime;
64
65
	/**
66
	 * Create the wizard.
67
	 * 
68
	 * @wbp.parser.constructor
69
	 */
70
	public MainPage() {
71
		super("wizardPage");
72
		setMessage("Define properties for the resulting EPUB file.");
73
		setImageDescriptor(EPUBUIPlugin.imageDescriptorFromPlugin("org.eclipse.mylyn.docs.epub.ui",
74
				"icons/wizard-banner.png"));
75
		setTitle("EPUB Properties");
76
	}
77
78
	public MainPage(EPUB2Bean bean) {
79
		this();
80
		this.bean = bean;
81
	}
82
83
	/**
84
	 * Create contents of the wizard.
85
	 * @param parent
86
	 */
87
	public void createControl(Composite parent) {
88
		Composite container = new Composite(parent, SWT.NULL);
89
90
		setControl(container);
91
		container.setLayout(new GridLayout(1, true));
92
93
		Group grpRequiredDetails = new Group(container, SWT.NONE);
94
		grpRequiredDetails.setLayout(new GridLayout(4, false));
95
		GridData gd_grpRequiredDetails = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
96
		gd_grpRequiredDetails.heightHint = 187;
97
		grpRequiredDetails.setLayoutData(gd_grpRequiredDetails);
98
		grpRequiredDetails.setText("Header:");
99
100
		Label lblTitle = new Label(grpRequiredDetails, SWT.NONE);
101
		lblTitle.setText("Title:");
102
103
		titleText = new Text(grpRequiredDetails, SWT.BORDER);
104
		titleText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
105
106
		Label lblAuthor = new Label(grpRequiredDetails, SWT.NONE);
107
		lblAuthor.setText("Author:");
108
109
		authorText = new Text(grpRequiredDetails, SWT.BORDER);
110
		authorText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
111
112
		Label lblNewLabel_1 = new Label(grpRequiredDetails, SWT.NONE);
113
		lblNewLabel_1.setText("Date:");
114
115
		dateTime = new DateTime(grpRequiredDetails, SWT.BORDER | SWT.LONG);
116
117
		Label lblIdentifier = new Label(grpRequiredDetails, SWT.NONE);
118
		lblIdentifier.setText("Identifier:");
119
120
		identifierText = new Text(grpRequiredDetails, SWT.BORDER);
121
		identifierText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
122
123
		Label lblScheme = new Label(grpRequiredDetails, SWT.NONE);
124
		lblScheme.setText("Scheme:");
125
126
		schemeText = new Combo(grpRequiredDetails, SWT.BORDER);
127
		schemeText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
128
		schemeText.add("UUID");
129
130
		Label lblCopyright = new Label(grpRequiredDetails, SWT.NONE);
131
		lblCopyright.setText("Copyright:");
132
133
		copyrightText = new Text(grpRequiredDetails, SWT.BORDER);
134
		copyrightText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
135
136
		Label lblLanguage = new Label(grpRequiredDetails, SWT.NONE);
137
		lblLanguage.setText("Language:");
138
139
		combo = new Combo(grpRequiredDetails, SWT.READ_ONLY);
140
		combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
141
		Set<String> locales = bean.getLocales().keySet();
142
		for (String name : locales) {
143
			combo.add(name);
144
		}
145
146
		Label lblDescription = new Label(grpRequiredDetails, SWT.NONE);
147
		lblDescription.setText("Subject:");
148
149
		subjectText = new Text(grpRequiredDetails, SWT.BORDER);
150
		subjectText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
151
152
		Group grpCoverAndStyling = new Group(container, SWT.NONE);
153
		grpCoverAndStyling.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
154
		grpCoverAndStyling.setText("Cover and styling:");
155
		grpCoverAndStyling.setLayout(new GridLayout(3, false));
156
		Label lblNewLabel = new Label(grpCoverAndStyling, SWT.NONE);
157
		lblNewLabel.setText("Cover image:");
158
159
		coverText = new Text(grpCoverAndStyling, SWT.BORDER);
160
		coverText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
161
162
		Button button = new Button(grpCoverAndStyling, SWT.NONE);
163
		button.setText("...");
164
		button.addSelectionListener(new SelectionAdapter() {
165
			@Override
166
			public void widgetSelected(SelectionEvent e) {
167
				// XXX: Replace with ResourceSelectionDialog?
168
				FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.OPEN);
169
				dialog.setFilterNames(new String[] { "Supported Image Formats" });
170
				dialog.setFilterExtensions(new String[] { "*.png;*.gif;*.jpg;*.svg" });
171
				dialog.setFilterPath(bean.getMarkupFile().getAbsolutePath());
172
				String s = dialog.open();
173
				if (s != null) {
174
					coverText.setText(s);
175
				}
176
			}
177
		});
178
		Label lblStyleSheet = new Label(grpCoverAndStyling, SWT.NONE);
179
		lblStyleSheet.setBounds(0, 0, 59, 14);
180
		lblStyleSheet.setText("Style Sheet:");
181
182
		styleSheetText = new Text(grpCoverAndStyling, SWT.BORDER);
183
		styleSheetText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
184
185
		Button button_1 = new Button(grpCoverAndStyling, SWT.NONE);
186
		button_1.setText("...");
187
		button_1.addSelectionListener(new SelectionAdapter() {
188
			@Override
189
			public void widgetSelected(SelectionEvent e) {
190
				// XXX: Replace with ResourceSelectionDialog?
191
				FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.OPEN);
192
				dialog.setFilterNames(new String[] { "Cascading Style Sheets" });
193
				dialog.setFilterExtensions(new String[] { "*.css" });
194
				dialog.setFilterPath(bean.getMarkupFile().getAbsolutePath());
195
				String s = dialog.open();
196
				if (s != null) {
197
					styleSheetText.setText(s);
198
				}
199
200
			}
201
		});
202
		m_bindingContext = initDataBindings();
203
	}
204
	protected DataBindingContext initDataBindings() {
205
		DataBindingContext bindingContext = new DataBindingContext();
206
		//
207
		IObservableValue beanCoverObserveValue = PojoObservables.observeValue(bean, "cover");
208
		IObservableValue coverTextTextObserveValue = PojoObservables.observeValue(coverText, "text");
209
		bindingContext.bindValue(beanCoverObserveValue, coverTextTextObserveValue, null, null);
210
		//
211
		IObservableValue textObserveTextObserveWidget = SWTObservables.observeText(titleText, SWT.Modify);
212
		IObservableValue beanTitleObserveValue = PojoObservables.observeValue(bean, "title");
213
		bindingContext.bindValue(textObserveTextObserveWidget, beanTitleObserveValue, null, null);
214
		//
215
		IObservableValue subjectTextObserveTextObserveWidget = SWTObservables.observeText(subjectText, SWT.Modify);
216
		IObservableValue beanSubjectObserveValue = PojoObservables.observeValue(bean, "subject");
217
		bindingContext.bindValue(subjectTextObserveTextObserveWidget, beanSubjectObserveValue, null, null);
218
		//
219
		IObservableValue text_4ObserveTextObserveWidget = SWTObservables.observeText(identifierText, SWT.Modify);
220
		IObservableValue beanIdentifierObserveValue = PojoObservables.observeValue(bean, "identifier");
221
		bindingContext.bindValue(text_4ObserveTextObserveWidget, beanIdentifierObserveValue, null, null);
222
		//
223
		IObservableValue text_1ObserveTextObserveWidget = SWTObservables.observeText(copyrightText, SWT.Modify);
224
		IObservableValue beanRightsObserveValue = PojoObservables.observeValue(bean, "rights");
225
		bindingContext.bindValue(text_1ObserveTextObserveWidget, beanRightsObserveValue, null, null);
226
		//
227
		IObservableValue text_3ObserveTextObserveWidget = SWTObservables.observeText(authorText, SWT.Modify);
228
		IObservableValue beanCreatorObserveValue = PojoObservables.observeValue(bean, "creator");
229
		bindingContext.bindValue(text_3ObserveTextObserveWidget, beanCreatorObserveValue, null, null);
230
		//
231
		IObservableValue schemeTextObserveTextObserveWidget = SWTObservables.observeText(schemeText);
232
		IObservableValue beanIdSchemeObserveValue = PojoObservables.observeValue(bean, "idScheme");
233
		bindingContext.bindValue(schemeTextObserveTextObserveWidget, beanIdSchemeObserveValue, null, null);
234
		//
235
		IObservableValue comboObserveTextObserveWidget = SWTObservables.observeText(combo);
236
		IObservableValue beanLanguageObserveValue = PojoObservables.observeValue(bean, "language");
237
		bindingContext.bindValue(comboObserveTextObserveWidget, beanLanguageObserveValue, null, null);
238
		//
239
		IObservableValue coverTextObserveTextObserveWidget = SWTObservables.observeText(coverText, SWT.Modify);
240
		bindingContext.bindValue(coverTextObserveTextObserveWidget, beanCoverObserveValue, null, null);
241
		//
242
		IObservableValue styleSheetTextObserveTextObserveWidget = SWTObservables
243
				.observeText(styleSheetText, SWT.Modify);
244
		IObservableValue beanStyleSheetObserveValue = PojoObservables.observeValue(bean, "styleSheet");
245
		bindingContext.bindValue(styleSheetTextObserveTextObserveWidget, beanStyleSheetObserveValue, null, null);
246
		//
247
		IObservableValue dateTimeObserveSelectionObserveWidget = SWTObservables.observeSelection(dateTime);
248
		IObservableValue beanPublicationDateObserveValue = PojoObservables.observeValue(bean, "publicationDate");
249
		bindingContext.bindValue(dateTimeObserveSelectionObserveWidget, beanPublicationDateObserveValue, null, null);
250
		//
251
		return bindingContext;
252
	}
253
}
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/Messages.java (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.internal.docs.epub.ui;
13
14
import org.eclipse.osgi.util.NLS;
15
16
/**
17
 * @author Torkild U. Resheim
18
 */
19
class Messages extends NLS {
20
	private static final String BUNDLE_NAME = "org.eclipse.mylyn.docs.epub.ui.messages"; //$NON-NLS-1$
21
22
	public static String AbstractMarkupResourceHandler_markupLanguageMappingFailed;
23
24
	public static String AbstractMarkupResourceHandler_unexpectedError;
25
26
	public static String ConvertMarkupToEPUB_cannotCompleteOperation;
27
28
	public static String ConvertMarkupToEPUB_cannotConvert;
29
30
	public static String ConvertMarkupToEPUB_detailsFollow;
31
32
	static {
33
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
34
	}
35
36
	private Messages() {
37
	}
38
}
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/commands/ConvertMarkupToEPUB.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.internal.docs.epub.ui.commands;
12
13
import org.eclipse.core.commands.ExecutionException;
14
import org.eclipse.core.resources.IFile;
15
import org.eclipse.core.runtime.Path;
16
import org.eclipse.jface.dialogs.MessageDialog;
17
import org.eclipse.jface.wizard.WizardDialog;
18
import org.eclipse.mylyn.internal.docs.epub.ui.ConvertFromMarkupWizard;
19
import org.eclipse.mylyn.wikitext.ui.commands.AbstractMarkupResourceHandler;
20
import org.eclipse.osgi.util.NLS;
21
import org.eclipse.swt.widgets.Display;
22
import org.eclipse.ui.PlatformUI;
23
24
public class ConvertMarkupToEPUB extends AbstractMarkupResourceHandler {
25
26
	@Override
27
	protected void handleFile(final IFile file, String name)
28
			throws ExecutionException {
29
		final IFile newFile = file.getParent()
30
				.getFile(new Path(name + ".epub")); //$NON-NLS-1$
31
		if (newFile.exists()) {
32
			if (!MessageDialog.openQuestion(PlatformUI.getWorkbench()
33
					.getActiveWorkbenchWindow().getShell(),
34
					Messages.ConvertMarkupToEPUB_overwrite, NLS.bind(
35
							Messages.ConvertMarkupToEPUB_fileExistsOverwrite,
36
							new Object[] { newFile.getFullPath() }))) {
37
				return;
38
			}
39
		}
40
41
		ConvertFromMarkupWizard wizard = new ConvertFromMarkupWizard();
42
		wizard.init(file, newFile, markupLanguage);
43
		// Instantiates the wizard container with the wizard and opens it
44
		WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
45
		dialog.create();
46
		dialog.open();
47
48
	}
49
}
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/commands/Messages.java (+32 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 Torkild U. Resheim.
3
 * 
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0 which
6
 * accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors: Torkild U. Resheim - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.internal.docs.epub.ui.commands;
13
14
import org.eclipse.osgi.util.NLS;
15
16
/**
17
 * @author Torkild U. Resheim
18
 */
19
class Messages extends NLS {
20
	private static final String BUNDLE_NAME = "org.eclipse.mylyn.docs.epub.ui.commands.messages"; //$NON-NLS-1$
21
22
	public static String ConvertMarkupToEPUB_fileExistsOverwrite;
23
24
	public static String ConvertMarkupToEPUB_overwrite;
25
26
	static {
27
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
28
	}
29
30
	private Messages() {
31
	}
32
}
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/commands/messages.properties (+12 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2011 Torkild U. Resheim and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     Torkild U. Resheim - initial API and implementation
10
###############################################################################
11
ConvertMarkupToEPUB_fileExistsOverwrite=File ''{0}'' exists: overwrite?
12
ConvertMarkupToEPUB_overwrite=Overwrite?
(-)a/org.eclipse.mylyn.docs.epub.ui/src/org/eclipse/mylyn/internal/docs/epub/ui/messages.properties (+15 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2011 Torkild U. Resheim and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     Torkild U. Resheim - initial API and implementation
10
###############################################################################
11
AbstractMarkupResourceHandler_markupLanguageMappingFailed=Cannot determine markup language for file ''{0}''
12
AbstractMarkupResourceHandler_unexpectedError=Unexpected Error
13
ConvertMarkupToEPUB_cannotCompleteOperation=Cannot complete operation
14
ConvertMarkupToEPUB_cannotConvert=Cannot convert to EPUB: 
15
ConvertMarkupToEPUB_detailsFollow=Details follow:
(-)a/org.eclipse.mylyn.wikitext-feature/feature.xml (-2 / +2 lines)
Lines 29-36 Link Here
29
   </license>
29
   </license>
30
30
31
   <requires>
31
   <requires>
32
      <import feature="org.eclipse.mylyn_feature" version="3.6.0" match="compatible"/>
32
      <import feature="org.eclipse.mylyn_feature" version="3.7.0" match="compatible"/>
33
      <import plugin="org.eclipse.mylyn.commons.ui" version="3.6.0" match="compatible"/>
33
      <import plugin="org.eclipse.mylyn.commons.ui" version="3.7.0" match="compatible"/>
34
   </requires>
34
   </requires>
35
35
36
   <plugin
36
   <plugin
(-)a/pom.xml (-1 / +8 lines)
Lines 68-73 Link Here
68
	</profile>
68
	</profile>
69
  </profiles>
69
  </profiles>
70
  <modules>
70
  <modules>
71
    <!-- EPUB support -->
72
    <module>org.eclipse.mylyn.docs.epub.core</module> 
73
    <module>org.eclipse.mylyn.docs.epub.ant.core</module>
74
    <module>org.eclipse.mylyn.docs.epub.ui</module>
75
    <module>org.eclipse.mylyn.docs.epub.help</module>
76
    <module>org.eclipse.mylyn.docs.epub.tests</module>
77
    <module>org.eclipse.mylyn.docs.epub-feature</module>
71
    <module>org.eclipse.mylyn.docs-site</module>
78
    <module>org.eclipse.mylyn.docs-site</module>
72
    <module>org.eclipse.mylyn.docs.sdk-feature</module>
79
    <module>org.eclipse.mylyn.docs.sdk-feature</module>
73
    <module>org.eclipse.mylyn.htmltext-feature</module>
80
    <module>org.eclipse.mylyn.htmltext-feature</module>
Lines 93-99 Link Here
93
    <module>org.eclipse.mylyn.wikitext.twiki.core</module>
100
    <module>org.eclipse.mylyn.wikitext.twiki.core</module>
94
    <module>org.eclipse.mylyn.wikitext.twiki.ui</module>
101
    <module>org.eclipse.mylyn.wikitext.twiki.ui</module>
95
    <module>org.eclipse.mylyn.wikitext.ui</module>
102
    <module>org.eclipse.mylyn.wikitext.ui</module>
96
	<!-- needs to be last -->
103
    <!-- needs to be last -->
97
    <module>org.eclipse.mylyn.wikitext-standalone</module>
104
    <module>org.eclipse.mylyn.wikitext-standalone</module>
98
  </modules>
105
  </modules>
99
</project>
106
</project>

Return to bug 332122