Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
O
odfhistory
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
odfplugfest
odfhistory
Commits
bda99a2b
Commit
bda99a2b
authored
Aug 22, 2015
by
Jos van den Oever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also put rng files in the history.
parent
bd95e278
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
301 additions
and
173 deletions
+301
-173
history.ods
history.ods
+235
-134
src/odf/OdfHistory.java
src/odf/OdfHistory.java
+14
-6
src/odf/OdfHistoryParser.java
src/odf/OdfHistoryParser.java
+15
-6
src/odf/OdfInfo.java
src/odf/OdfInfo.java
+1
-1
src/odf/PrettyPrinter.java
src/odf/PrettyPrinter.java
+0
-1
src/rng/OpenDocument-schema-v1.1-errata01-complete.rng
src/rng/OpenDocument-schema-v1.1-errata01-complete.rng
+22
-16
src/rng/OpenDocument-strict-schema-v1.1-errata01-complete.rng
...rng/OpenDocument-strict-schema-v1.1-errata01-complete.rng
+14
-9
No files found.
history.ods
View file @
bda99a2b
This diff is collapsed.
Click to expand it.
src/odf/OdfHistory.java
View file @
bda99a2b
...
...
@@ -2,8 +2,10 @@ package odf;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.file.CopyOption
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.StandardCopyOption
;
import
java.util.HashSet
;
import
java.util.LinkedList
;
import
java.util.Queue
;
...
...
@@ -54,13 +56,19 @@ public class OdfHistory {
}
for
(
OdfHistoryEntry
file
:
files
)
{
Path
zip
=
repoDir
.
resolve
(
"odt"
).
resolve
(
file
.
path
);
Path
dir
=
repoDir
.
resolve
(
file
.
dir
);
// remove files from a previous commit
if
(
Files
.
exists
(
dir
))
{
Utils
.
removeRecursive
(
dir
);
final
Path
odtpath
=
repoDir
.
resolve
(
"odt"
).
resolve
(
file
.
path
);
if
(
file
.
dir
!=
null
)
{
Path
dir
=
repoDir
.
resolve
(
file
.
dir
);
// remove files from a previous commit if there
if
(
Files
.
exists
(
dir
))
{
Utils
.
removeRecursive
(
dir
);
}
Unzip
.
unzip
(
odtpath
,
dir
);
}
else
{
final
Path
target
=
repoDir
.
resolve
(
file
.
target
);
Files
.
createDirectories
(
target
.
getParent
());
Files
.
copy
(
odtpath
,
target
,
StandardCopyOption
.
REPLACE_EXISTING
);
}
Unzip
.
unzip
(
zip
,
dir
);
Utils
.
cmd
(
repoDir
,
"git"
,
"add"
,
"-A"
);
Utils
.
cmd
(
repoDir
,
"git"
,
"commit"
,
"-m"
,
file
.
path
+
" "
...
...
src/odf/OdfHistoryParser.java
View file @
bda99a2b
...
...
@@ -9,6 +9,7 @@ import java.util.Set;
import
javax.xml.transform.TransformerException
;
import
org.eclipse.jdt.annotation.Nullable
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Element
;
import
org.xml.sax.SAXException
;
...
...
@@ -33,17 +34,20 @@ public class OdfHistoryParser {
.
elementIterator
(
doc
,
"/office:document/office:body/office:spreadsheet/table:table/table:table-row"
);
for
(
Element
row
:
rows
)
{
String
path
=
getCellText
(
row
,
1
);
String
dir
=
getCellText
(
row
,
2
);
String
date
=
getCellText
(
row
,
3
);
if
(
""
.
equals
(
path
)
||
""
.
equals
(
dir
)
||
""
.
equals
(
date
))
{
final
String
path
=
getCellText
(
row
,
1
);
final
String
dir
=
getCellText
(
row
,
2
);
final
String
date
=
getCellText
(
row
,
3
);
final
String
target
=
getCellText
(
row
,
4
);
if
(
""
.
equals
(
path
)
||
(
""
.
equals
(
dir
)
&&
""
.
equals
(
target
))
||
""
.
equals
(
date
))
{
continue
;
}
if
(
paths
.
contains
(
path
))
{
throw
new
IOException
(
"The path "
+
path
+
" occurs twice."
);
}
paths
.
add
(
path
);
files
.
add
(
new
OdfHistoryEntry
(
path
,
dir
,
date
));
files
.
add
(
new
OdfHistoryEntry
(
path
,
dir
.
length
()
==
0
?
null
:
dir
,
date
,
target
.
length
()
==
0
?
null
:
target
));
}
return
files
;
}
...
...
@@ -57,12 +61,17 @@ public class OdfHistoryParser {
class
OdfHistoryEntry
{
final
String
path
;
@Nullable
final
String
dir
;
@Nullable
final
String
target
;
final
String
date
;
OdfHistoryEntry
(
String
path
,
String
dir
,
String
date
)
{
OdfHistoryEntry
(
String
path
,
@Nullable
String
dir
,
String
date
,
@Nullable
String
target
)
{
this
.
path
=
path
;
this
.
dir
=
dir
;
this
.
date
=
date
;
this
.
target
=
target
;
}
}
\ No newline at end of file
src/odf/OdfInfo.java
View file @
bda99a2b
...
...
@@ -95,7 +95,7 @@ public class OdfInfo {
errorHandler
);
return
driver11
;
}
else
{
driver11
=
load
(
"src/rng/OpenDocument-schema-v1.1.rng"
,
driver11
=
load
(
"src/rng/OpenDocument-schema-v1.1
-errata01-complete
.rng"
,
errorHandler
);
return
driver11
;
}
...
...
src/odf/PrettyPrinter.java
View file @
bda99a2b
...
...
@@ -17,7 +17,6 @@ class PrettyPrinter implements XMLStreamWriter {
final
private
HashSet
<
QName
>
elementsWithNoText
;
PrettyPrinter
(
XMLStreamWriter
out
,
HashSet
<
QName
>
elementsWithNoText
)
{
System
.
err
.
println
(
elementsWithNoText
.
size
());
this
.
out
=
out
;
this
.
elementsWithNoText
=
elementsWithNoText
;
}
...
...
src/rng/OpenDocument-schema-v1.1.rng
→
src/rng/OpenDocument-schema-v1.1
-errata01-complete
.rng
View file @
bda99a2b
<?xml version="1.0" encoding="UTF-8"?>
<!--
OASIS OpenDocument v1.1
OASIS Standard, 1 Feb 2007
Relax-NG Schema
$Id$
© 2002-2007 OASIS Open
© 1999-2007 Sun Microsystems, Inc.
-->
Open Document Format for Office Applications (OpenDocument) v1.1
OASIS Standard incorporating Approved Errata 01
22 July 2013
Copyright (c) OASIS Open 2013. All Rights Reserved.
Source: http://docs.oasis-open.org/office/v1.1/errata01/os/
-->
<!--
This is an adaptation of OpenDocument-schema-v1.1.rng that reflects the changes
made to the schema in accordance with OpenDocument v1.1 Errata 01.
The original is retained in the package for comparison purposes.
-->
<grammar
xmlns="http://relaxng.org/ns/structure/1.0"
...
...
@@ -789,22 +795,22 @@
</attribute>
</optional>
<optional>
<attribute name="frame-count">
<attribute name="
meta:
frame-count">
<ref name="nonNegativeInteger"/>
</attribute>
</optional>
<optional>
<attribute name="sentence-count">
<attribute name="
meta:
sentence-count">
<ref name="nonNegativeInteger"/>
</attribute>
</optional>
<optional>
<attribute name="syllable-count">
<attribute name="
meta:
syllable-count">
<ref name="nonNegativeInteger"/>
</attribute>
</optional>
<optional>
<attribute name="non-whitespace-character-count">
<attribute name="
meta:
non-whitespace-character-count">
<ref name="nonNegativeInteger"/>
</attribute>
</optional>
...
...
@@ -11516,11 +11522,11 @@
<attribute name="text:style-name">
<ref name="styleNameRef"/>
</attribute>
<
attribute name="text:paragraph-style-name">
<optional
>
<
optional>
<attribute name="text:paragraph-style-name"
>
<ref name="styleNameRef"/>
</optional
>
</
attribute
>
</attribute
>
</
optional
>
</define>
<define name="style-font-face">
<element name="style:font-face">
...
...
src/rng/OpenDocument-strict-schema-v1.1.rng
→
src/rng/OpenDocument-strict-schema-v1.1
-errata01-complete
.rng
View file @
bda99a2b
<?xml version="1.0" encoding="UTF-8"?>
<!--
OASIS OpenDocument v1.1
OASIS Standard, 1 Feb 2007
Strict Relax-NG Schema
$Id$
© 2002-2007 OASIS Open
© 1999-2007 Sun Microsystems, Inc.
Open Document Format for Office Applications (OpenDocument) v1.1
OASIS Standard incorporating Approved Errata 01
22 July 2013
Copyright (c) OASIS Open 2013. All Rights Reserved.
Source: http://docs.oasis-open.org/office/v1.1/errata01/os/
-->
<!--
This is a modification of OpenDocument-strict-schema-v1.1.rng that links to
OpenDocument-schema-v1.1-errata01-complete.rng instead of the file
OpenDocument-schema-v1.1.rng. The original is retained in the package
for comparison purposes.
-->
<grammar
xmlns=
"http://relaxng.org/ns/structure/1.0"
>
<include
href=
"OpenDocument-schema-v1.1.rng"
>
<include
href=
"OpenDocument-schema-v1.1
-errata01-complete
.rng"
>
<define
name=
"office-meta-content"
>
<ref
name=
"office-meta-content-strict"
/>
</define>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment