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
a775aa57
Kaydet (Commit)
a775aa57
authored
Şub 13, 2013
tarafından
Andras Timar
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
compact help xml files with xslt which removes the cruft
Change-Id: Iee923174169d6ba9961a9cee14115c9a4bf7ba09
üst
4552bd5a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
6 deletions
+89
-6
HelpCompiler.hxx
helpcompiler/inc/HelpCompiler.hxx
+3
-0
HelpLinker.hxx
helpcompiler/inc/HelpLinker.hxx
+1
-0
HelpCompiler.cxx
helpcompiler/source/HelpCompiler.cxx
+24
-5
HelpLinker.cxx
helpcompiler/source/HelpLinker.cxx
+13
-1
Package_xsl.mk
xmlhelp/Package_xsl.mk
+1
-0
compact.xsl
xmlhelp/util/compact.xsl
+47
-0
No files found.
helpcompiler/inc/HelpCompiler.hxx
Dosyayı görüntüle @
a775aa57
...
...
@@ -230,6 +230,7 @@ public:
const
fs
::
path
&
in_inputFile
,
const
fs
::
path
&
in_src
,
const
fs
::
path
&
in_zipdir
,
const
fs
::
path
&
in_resCompactStylesheet
,
const
fs
::
path
&
in_resEmbStylesheet
,
const
std
::
string
&
in_module
,
const
std
::
string
&
in_lang
,
...
...
@@ -246,11 +247,13 @@ public:
private
:
xmlDocPtr
getSourceDocument
(
const
fs
::
path
&
filePath
);
void
tagBasicCodeExamples
(
xmlDocPtr
doc
);
xmlDocPtr
compactXhpForJar
(
xmlDocPtr
doc
);
void
saveXhpForJar
(
xmlDocPtr
doc
,
const
fs
::
path
&
filePath
);
xmlNodePtr
clone
(
xmlNodePtr
node
,
const
std
::
string
&
appl
);
StreamTable
&
streamTable
;
const
fs
::
path
inputFile
,
src
,
zipdir
;
const
std
::
string
module
,
lang
;
const
fs
::
path
resCompactStylesheet
;
const
fs
::
path
resEmbStylesheet
;
bool
bExtensionMode
;
std
::
string
gui
;
...
...
helpcompiler/inc/HelpLinker.hxx
Dosyayı görüntüle @
a775aa57
...
...
@@ -66,6 +66,7 @@ private:
Stringtable
additionalFiles
;
HashSet
helpFiles
;
fs
::
path
sourceRoot
;
fs
::
path
compactStylesheet
;
fs
::
path
embeddStylesheet
;
fs
::
path
idxCaptionStylesheet
;
fs
::
path
idxContentStylesheet
;
...
...
helpcompiler/source/HelpCompiler.cxx
Dosyayı görüntüle @
a775aa57
...
...
@@ -38,11 +38,12 @@ static void impl_sleep( sal_uInt32 nSec )
osl
::
Thread
::
wait
(
aTime
);
}
HelpCompiler
::
HelpCompiler
(
StreamTable
&
in_streamTable
,
const
fs
::
path
&
in_inputFile
,
const
fs
::
path
&
in_src
,
const
fs
::
path
&
in_zipdir
,
const
fs
::
path
&
in_resEmbStylesheet
,
const
std
::
string
&
in_module
,
const
std
::
string
&
in_lang
,
bool
in_bExtensionMode
)
const
fs
::
path
&
in_src
,
const
fs
::
path
&
in_zipdir
,
const
fs
::
path
&
in_resCompactStylesheet
,
const
fs
::
path
&
in_resEmbStylesheet
,
const
std
::
string
&
in_module
,
const
std
::
string
&
in_lang
,
bool
in_bExtensionMode
)
:
streamTable
(
in_streamTable
),
inputFile
(
in_inputFile
),
src
(
in_src
),
zipdir
(
in_zipdir
),
module
(
in_module
),
lang
(
in_lang
),
res
EmbStylesheet
(
in_resEmb
Stylesheet
),
bExtensionMode
(
in_bExtensionMode
)
src
(
in_src
),
zipdir
(
in_zipdir
),
module
(
in_module
),
lang
(
in_lang
),
res
CompactStylesheet
(
in_resCompact
Stylesheet
),
resEmbStylesheet
(
in_resEmbStylesheet
),
bExtensionMode
(
in_bExtensionMode
)
{
xmlKeepBlanksDefaultValue
=
0
;
char
*
guitmp
=
getenv
(
"GUI"
);
...
...
@@ -68,6 +69,22 @@ void HelpCompiler::tagBasicCodeExamples( xmlDocPtr doc )
}
}
xmlDocPtr
HelpCompiler
::
compactXhpForJar
(
xmlDocPtr
doc
)
{
static
xsltStylesheetPtr
compact
=
NULL
;
static
const
char
*
params
[
2
+
1
];
params
[
0
]
=
NULL
;
xmlDocPtr
compacted
;
if
(
!
compact
)
{
compact
=
xsltParseStylesheetFile
((
const
xmlChar
*
)
resCompactStylesheet
.
native_file_string
().
c_str
());
}
compacted
=
xsltApplyStylesheet
(
compact
,
doc
,
params
);
return
compacted
;
}
void
HelpCompiler
::
saveXhpForJar
(
xmlDocPtr
doc
,
const
fs
::
path
&
filePath
)
{
//save processed xhp document in ziptmp<module>_<lang>/text directory
...
...
@@ -90,9 +107,11 @@ void HelpCompiler::saveXhpForJar( xmlDocPtr doc, const fs::path &filePath )
size_t
pos
=
zipdirPath
.
find
(
"ziptmp"
)
+
6
;
zipdirPath
.
replace
(
pos
,
module
.
length
(),
"shared"
);
}
xmlDocPtr
compacted
=
compactXhpForJar
(
doc
);
fs
::
create_directory
(
fs
::
path
(
zipdirPath
+
jarXhpPath
,
fs
::
native
)
);
if
(
-
1
==
xmlSaveFormatFileEnc
(
(
zipdirPath
+
jarXhpPath
+
pathSep
+
xhpFileName
).
c_str
(),
doc
,
"utf-8"
,
0
)
)
if
(
-
1
==
xmlSaveFormatFileEnc
(
(
zipdirPath
+
jarXhpPath
+
pathSep
+
xhpFileName
).
c_str
(),
compacted
,
"utf-8"
,
0
)
)
std
::
cerr
<<
"Error saving file to "
<<
(
zipdirPath
+
jarXhpPath
+
pathSep
+
xhpFileName
).
c_str
()
<<
std
::
endl
;
xmlFreeDoc
(
compacted
);
}
...
...
helpcompiler/source/HelpLinker.cxx
Dosyayı görüntüle @
a775aa57
...
...
@@ -378,7 +378,7 @@ void HelpLinker::link() throw( HelpProcessingException )
}
HelpCompiler
hc
(
streamTable
,
xhpFile
,
langsourceRoot
,
zipdir
,
embeddStylesheet
,
module
,
lang
,
bExtensionMode
);
compactStylesheet
,
embeddStylesheet
,
module
,
lang
,
bExtensionMode
);
HCDBG
(
std
::
cerr
<<
"before compile of "
<<
xhpFileName
<<
std
::
endl
);
bool
success
=
hc
.
compile
();
...
...
@@ -608,6 +608,18 @@ void HelpLinker::main( std::vector<std::string> &args,
bSrcOption
=
true
;
sourceRoot
=
fs
::
path
(
args
[
i
],
fs
::
native
);
}
else
if
(
args
[
i
].
compare
(
"-compact"
)
==
0
)
{
++
i
;
if
(
i
>=
args
.
size
())
{
std
::
stringstream
aStrStream
;
aStrStream
<<
"compactStylesheet missing"
<<
std
::
endl
;
throw
HelpProcessingException
(
HELPPROCESSING_GENERAL_ERROR
,
aStrStream
.
str
()
);
}
compactStylesheet
=
fs
::
path
(
args
[
i
],
fs
::
native
);
}
else
if
(
args
[
i
].
compare
(
"-sty"
)
==
0
)
{
++
i
;
...
...
xmlhelp/Package_xsl.mk
Dosyayı görüntüle @
a775aa57
...
...
@@ -27,6 +27,7 @@
$(eval $(call gb_Package_Package,xmlhelp_xsl,$(SRCDIR)/xmlhelp/util))
$(eval $(call gb_Package_add_file,xmlhelp_xsl,bin/compact.xsl,compact.xsl))
$(eval $(call gb_Package_add_file,xmlhelp_xsl,bin/embed.xsl,embed.xsl))
$(eval $(call gb_Package_add_file,xmlhelp_xsl,bin/idxcaption.xsl,idxcaption.xsl))
$(eval $(call gb_Package_add_file,xmlhelp_xsl,bin/idxcontent.xsl,idxcontent.xsl))
...
...
xmlhelp/util/compact.xsl
0 → 100644
Dosyayı görüntüle @
a775aa57
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<!-- Remove unwanted attributes or/and nodes -->
<xsl:stylesheet
version=
"1.0"
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
>
<xsl:output
method=
"xml"
encoding=
"UTF-8"
/>
<xsl:strip-space
elements=
"*"
/>
<xsl:preserve-space
elements=
"paragraph"
/>
<!-- Copy everything -->
<xsl:template
match=
"@*|node()|text()"
>
<xsl:copy>
<xsl:apply-templates
select=
"@*[normalize-space()]|node()|text()"
/>
</xsl:copy>
</xsl:template>
<!-- To remove attributes or nodes,
simply write a matching template that doesn't do anything.
Therefore, it is removed -->
<xsl:template
match=
"@localize"
/>
<xsl:template
match=
"@xml-lang"
/>
<xsl:template
match=
"alt"
/>
<xsl:template
match=
"bookmark_value"
/>
<xsl:template
match=
"comment()"
/>
<!-- Remove all XML comments -->
<xsl:template
match=
"comment"
/>
<xsl:template
match=
"history"
/>
<xsl:template
match=
"image/@id"
/>
<xsl:template
match=
"image/@width"
/>
<xsl:template
match=
"image/@height"
/>
<xsl:template
match=
"link/@name"
/>
<xsl:template
match=
"paragraph/@id"
/>
<xsl:template
match=
"paragraph/@l10n"
/>
<xsl:template
match=
"paragraph/@oldref"
/>
<xsl:template
match=
"table/@id"
/>
<xsl:template
match=
"title/@id"
/>
<xsl:template
match=
"topic/@id"
/>
<xsl:template
match=
"topic/@indexer"
/>
<xsl:template
match=
"topic/@status"
/>
</xsl:stylesheet>
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