Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ed3261a3
Kaydet (Commit)
ed3261a3
authored
Eyl 04, 2014
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
We only need to map oox URL's to aliases
Change-Id: I130a057f9d5925b9648f7f39223bb5f4ed8f33ea
üst
689742b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
26 deletions
+3
-26
modelpreprocess.py
writerfilter/source/ooxml/modelpreprocess.py
+3
-26
No files found.
writerfilter/source/ooxml/modelpreprocess.py
Dosyayı görüntüle @
ed3261a3
...
@@ -12,23 +12,9 @@ from xml.dom import minidom
...
@@ -12,23 +12,9 @@ from xml.dom import minidom
import
sys
import
sys
def
prefixFromUrl
(
url
):
if
url
in
list
(
ooxUrlAliases
.
keys
()):
return
ooxUrlAliases
[
url
]
else
:
if
url
.
startswith
(
"http://"
):
return
url
.
replace
(
'http://'
,
''
)
.
replace
(
'/'
,
'_'
)
.
replace
(
'.'
,
'_'
)
else
:
return
""
def
prefixForGrammar
(
namespace
):
def
prefixForGrammar
(
namespace
):
ns
=
namespace
.
getElementsByTagName
(
"grammar"
)[
0
]
.
getAttribute
(
"ns"
)
ns
=
namespace
.
getElementsByTagName
(
"grammar"
)[
0
]
.
getAttribute
(
"ns"
)
if
ns
in
list
(
ooxUrlAliases
.
keys
()):
return
ooxUrlAliases
[
ns
]
prefix
=
ooxUrlAliases
[
ns
]
return
prefix
else
:
return
prefixFromUrl
(
ns
)
def
parseNamespaceAliases
(
node
):
def
parseNamespaceAliases
(
node
):
...
@@ -43,9 +29,7 @@ def parseNamespaces(fro):
...
@@ -43,9 +29,7 @@ def parseNamespaces(fro):
sock
=
open
(
fro
)
sock
=
open
(
fro
)
for
i
in
sock
.
readlines
():
for
i
in
sock
.
readlines
():
line
=
i
.
strip
()
line
=
i
.
strip
()
id
,
alias
,
url
=
line
.
split
(
' '
)
alias
,
url
=
line
.
split
(
' '
)[
1
:]
ooxUrlIds
[
url
]
=
id
ooxAliasIds
[
alias
]
=
id
ooxUrlAliases
[
url
]
=
alias
ooxUrlAliases
[
url
]
=
alias
sock
.
close
()
sock
.
close
()
...
@@ -70,14 +54,11 @@ def preprocess(model):
...
@@ -70,14 +54,11 @@ def preprocess(model):
grammar
=
i
.
getElementsByTagName
(
"grammar"
)[
0
]
grammar
=
i
.
getElementsByTagName
(
"grammar"
)[
0
]
for
j
in
i
.
getElementsByTagName
(
"element"
)
+
i
.
getElementsByTagName
(
"attribute"
):
for
j
in
i
.
getElementsByTagName
(
"element"
)
+
i
.
getElementsByTagName
(
"attribute"
):
if
j
.
localName
==
"attribute"
and
not
len
(
j
.
getAttribute
(
"name"
)):
continue
# prefix
# prefix
prefix
=
""
prefix
=
""
if
":"
in
j
.
getAttribute
(
"name"
):
if
":"
in
j
.
getAttribute
(
"name"
):
nameprefix
=
j
.
getAttribute
(
"name"
)
.
split
(
':'
)[
0
]
nameprefix
=
j
.
getAttribute
(
"name"
)
.
split
(
':'
)[
0
]
prefix
=
prefixFromUrl
(
modelNamespaceAliases
[
nameprefix
])
prefix
=
ooxUrlAliases
[
modelNamespaceAliases
[
nameprefix
]]
elif
j
.
localName
==
"attribute"
:
elif
j
.
localName
==
"attribute"
:
if
grammar
.
getAttribute
(
"attributeFormDefault"
)
==
"qualified"
:
if
grammar
.
getAttribute
(
"attributeFormDefault"
)
==
"qualified"
:
prefix
=
grammarprefix
prefix
=
grammarprefix
...
@@ -98,10 +79,6 @@ def preprocess(model):
...
@@ -98,10 +79,6 @@ def preprocess(model):
namespacesPath
=
sys
.
argv
[
1
]
namespacesPath
=
sys
.
argv
[
1
]
modelPath
=
sys
.
argv
[
2
]
modelPath
=
sys
.
argv
[
2
]
# URL -> ID, from oox
ooxUrlIds
=
{}
# Alias -> ID, from oox
ooxAliasIds
=
{}
# URL -> alias, from oox
# URL -> alias, from oox
ooxUrlAliases
=
{}
ooxUrlAliases
=
{}
parseNamespaces
(
namespacesPath
)
parseNamespaces
(
namespacesPath
)
...
...
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