[Libreoffice-commits] dev-tools.git: 6 commits - helpauthoring/description.xml helpauthoring/filter helpauthoring/HelpAuthoring helpauthoring/README

Jan Holesovsky kendy at collabora.com
Fri Jul 24 13:48:49 PDT 2015


 helpauthoring/HelpAuthoring/_Main.xba    |    2 
 helpauthoring/README                     |   46 ++++++++
 helpauthoring/description.xml            |   12 +-
 helpauthoring/filter/soffice2xmlhelp.xsl |  175 ++++++++++++++++++-------------
 4 files changed, 155 insertions(+), 80 deletions(-)

New commits:
commit eb58f6ba5de1f34a988f0f2e022e62f7b5d11cdb
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jul 24 20:13:51 2015 +0200

    helpauthoring: New release (3.1.0).
    
    This release fixes few critical bugs, like concatenating words (that should
    not be concatenated), or emphasizing new strings.

diff --git a/helpauthoring/HelpAuthoring/_Main.xba b/helpauthoring/HelpAuthoring/_Main.xba
index 84182e1..11c95de 100644
--- a/helpauthoring/HelpAuthoring/_Main.xba
+++ b/helpauthoring/HelpAuthoring/_Main.xba
@@ -24,7 +24,7 @@
 ' #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 ' #
 
-Global Const Version = "v3.20150703"
+Global Const Version = "v3.1.0"
 
 Global Const strErr_NoHelpFile = "Not a Help File"
 
diff --git a/helpauthoring/description.xml b/helpauthoring/description.xml
index 9e6e9be..56e61c3 100644
--- a/helpauthoring/description.xml
+++ b/helpauthoring/description.xml
@@ -19,15 +19,15 @@
 <description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006"
              xmlns:xlink="http://www.w3.org/1999/xlink">
 
-        <identifier value="org.openoffice.helpauthoring"/>
+    <identifier value="org.openoffice.helpauthoring"/>
 
-        <version value="3.0.20150703"/>
-        <display-name>
-            <name lang="en">Help authoring extension tool</name>
-        </display-name>
+    <version value="3.1.0"/>
+    <display-name>
+        <name lang="en">Help authoring extension tool</name>
+    </display-name>
 
     <dependencies>
-                <OpenOffice.org-minimal-version value="3.0" d:name="OpenOffice.org 3.0"/>
+        <OpenOffice.org-minimal-version value="3.0" d:name="OpenOffice.org 3.0"/>
     </dependencies>
 
     <update-information>
commit bb94fc6223b5783316d86fa4dd0cb4e8f6569f64
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jul 24 20:09:20 2015 +0200

    helpauthoring: Add README, explain how to use & how to develop it.

diff --git a/helpauthoring/README b/helpauthoring/README
new file mode 100644
index 0000000..00dac06
--- /dev/null
+++ b/helpauthoring/README
@@ -0,0 +1,46 @@
+Help Authoring Extension
+
+This extension adds a new menu to the Writer's menubar, and allows easy
+editing of the LibreOffice Help.  Usage info is here:
+
+  https://wiki.documentfoundation.org/Documentation/Help
+
+== Hacking it ==
+
+If you want to improve the extension itself, get the sources here:
+
+  $ git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools dev-tools
+
+and start hacking it.  Most probably you'll want to do improvements to the
+.xhp export filter:
+
+  helpauthoring/filter/soffice2xmlhelp.xsl
+
+To do that the most effectively, choose a reasonably complicated .xhp file,
+like:
+
+  help/source/text/schart/01/type_stock.xhp
+
+convert it to .fodt (Save As... in Writer), and then use:
+
+  xsltproc helpauthoring/filter/soffice2xmlhelp.xsl help/source/text/schart/01/type_stock.fodt > out
+
+When you are happy with the improved output in 'out', commit & push the
+improved soffice2xmlhelp.xsl via gerrit.
+
+== Releasing it ==
+
+Increase the version number both in:
+
+  helpauthoring/HelpAuthoring/_Main.xba
+  helpauthoring/description.xml
+
+and then:
+
+  cd helpauthoring && zip -r ~/HelpAuthoring-3.x.y.oxt .
+
+and upload to:
+
+  http://dev-www.libreoffice.org/helpauthoring/
+
+and announce.
commit 632fbc0a8118e10d468aa8fd8ad84a2bc1ec406a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jul 24 19:50:56 2015 +0200

    helpauthoring: Don't concat words in some corner cases.

diff --git a/helpauthoring/filter/soffice2xmlhelp.xsl b/helpauthoring/filter/soffice2xmlhelp.xsl
index a166b2a..4d4e557 100644
--- a/helpauthoring/filter/soffice2xmlhelp.xsl
+++ b/helpauthoring/filter/soffice2xmlhelp.xsl
@@ -33,11 +33,11 @@
         exclude-result-prefixes="office meta table number dc fo xlink chart math script xsl draw svg dr3d form text style xsi xsd xforms dom oooc ooow ooo">
 
 <xsl:output method="xml" indent="no" omit-xml-declaration="no" encoding="UTF-8"/>
-<!--
-<xsl:output doctype-public="-//OpenOffice.org//Help Document//EN" />
-<xsl:output doctype-system="http://documentation.openoffice.org/xmlhelp.dtd" />
-//-->
-<xsl:strip-space elements="*" />
+
+<!-- Strip the whitespace, but not inside paragraphs -->
+<xsl:strip-space elements="*"/>
+<xsl:preserve-space elements="text:h text:p"/>
+
 <xsl:param name="imgroot" select="'default_images/'"/>
 
 <!--
commit 984af46ed6e06c03a7f2a6fb5480e30cba811bda
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jul 24 19:36:25 2015 +0200

    helpauthoring: Indent also the paragraphs inside table cells or list items.

diff --git a/helpauthoring/filter/soffice2xmlhelp.xsl b/helpauthoring/filter/soffice2xmlhelp.xsl
index b066609..a166b2a 100644
--- a/helpauthoring/filter/soffice2xmlhelp.xsl
+++ b/helpauthoring/filter/soffice2xmlhelp.xsl
@@ -705,7 +705,7 @@ LISTITEM
     <xsl:call-template name="newline-indent-1"/>
 
     <listitem>
-        <xsl:apply-templates />
+        <xsl:apply-templates><xsl:with-param name="paragraph_indent" select="2"/></xsl:apply-templates>
 	<xsl:call-template name="newline-indent-1"/>
     </listitem>
 </xsl:template>
@@ -766,6 +766,7 @@ PARAGRAPH
 -->
 
 <xsl:template match="text:h | text:p">
+    <xsl:param name="paragraph_indent"/>
 
     <xsl:variable name="masterstyle">
         <xsl:call-template name="getmasterstyle">
@@ -804,7 +805,6 @@ PARAGRAPH
     <xsl:when test="not(starts-with($masterstyle,'hlp_'))"/>
     <xsl:when test="not(starts-with($masterstyle,'hlp_aux_') or ancestor::office:annotation or . = '')">
 
-
         <xsl:variable name="id">
             <xsl:choose>
                 <xsl:when test="(descendant::text:variable-set[@text:name='ID']/@text:display='none')">
@@ -859,7 +859,16 @@ PARAGRAPH
 
     //-->
 
-        <xsl:call-template name="newline"/>
+        <!-- Empty line before the headings -->
+        <xsl:if test="$role='heading'"><xsl:call-template name="newline"/></xsl:if>
+
+        <!-- Indent inside table cells or listitems. -->
+        <xsl:choose>
+            <xsl:when test="$paragraph_indent=1"><xsl:call-template name="newline-indent-1"/></xsl:when>
+            <xsl:when test="$paragraph_indent=2"><xsl:call-template name="newline-indent-2"/></xsl:when>
+            <xsl:when test="$paragraph_indent=3"><xsl:call-template name="newline-indent-3"/></xsl:when>
+            <xsl:otherwise><xsl:call-template name="newline"/></xsl:otherwise>
+        </xsl:choose>
 
         <paragraph id="{$real_id}" role="{$role}" xml-lang="en-US"><xsl:if test="$localize='FALSE'">
                 <xsl:attribute name="localize"><xsl:value-of select="'false'"/></xsl:attribute>
@@ -1045,7 +1054,7 @@ TABLECELL
     <tablecell>
         <xsl:if test="not($colspan='')"><xsl:attribute name="colspan"><xsl:value-of select="$colspan"/></xsl:attribute></xsl:if>
         <xsl:if test="not($rowspan='')"><xsl:attribute name="rowspan"><xsl:value-of select="$rowspan"/></xsl:attribute></xsl:if>
-        <xsl:apply-templates/>
+        <xsl:apply-templates><xsl:with-param name="paragraph_indent" select="3"/></xsl:apply-templates>
 
 	<xsl:call-template name="newline-indent-2"/>
     </tablecell>
@@ -1326,4 +1335,10 @@ LICENSE HEADER
     </xsl:text>
 </xsl:template>
 
+<!-- Output a newline, and indent the next element (3rd level) -->
+<xsl:template name="newline-indent-3">
+<xsl:text disable-output-escaping="yes">
+      </xsl:text>
+</xsl:template>
+
 </xsl:stylesheet>
commit 2452696835d5f8f6c6b4478f0a5de8421ef1271a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jul 24 19:11:45 2015 +0200

    helpauthoring: Improve indentation of the output .xhp's.
    
    [Still some improvements needed though.]

diff --git a/helpauthoring/filter/soffice2xmlhelp.xsl b/helpauthoring/filter/soffice2xmlhelp.xsl
index 0dc7fc7..b066609 100644
--- a/helpauthoring/filter/soffice2xmlhelp.xsl
+++ b/helpauthoring/filter/soffice2xmlhelp.xsl
@@ -32,7 +32,7 @@
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"
         exclude-result-prefixes="office meta table number dc fo xlink chart math script xsl draw svg dr3d form text style xsi xsd xforms dom oooc ooow ooo">
 
-<xsl:output method="xml" indent="no" omit-xml-declaration="no"  />
+<xsl:output method="xml" indent="no" omit-xml-declaration="no" encoding="UTF-8"/>
 <!--
 <xsl:output doctype-public="-//OpenOffice.org//Help Document//EN" />
 <xsl:output doctype-system="http://documentation.openoffice.org/xmlhelp.dtd" />
@@ -93,38 +93,35 @@ DOCUMENT SKELETON
 <xsl:template match="/">
 
     <helpdocument version="1.0">
-    <xsl:call-template name="lf"/>
+    <xsl:call-template name="newline"/>
     <xsl:call-template name="licheader"/> <!-- inserts the license header -->
-    <xsl:call-template name="lf"/>
+    <xsl:call-template name="newline"/>
     <meta>
-    <xsl:call-template name="lf"/>
-            <topic id="{$topic_id}">
-                <xsl:if test="not($topic_indexer = '')">
-                    <xsl:attribute name="indexer"><xsl:value-of select="$topic_indexer"/></xsl:attribute>
-                </xsl:if>
-                <xsl:if test="not($topic_status = '')">
-                    <xsl:attribute name="status"><xsl:value-of select="$topic_status"/></xsl:attribute>
-                </xsl:if>
-                <xsl:call-template name="lf"/>
-                <title xml-lang="en-US" id="tit"><xsl:value-of select="$title"/></title>
-                <xsl:call-template name="lf"/>
-                <filename><xsl:value-of select="$filename"/></filename>
-            <xsl:call-template name="lf"/>
-            </topic>
-            <!-- REMOVED DUE TO PROBLEMS WITH CVS MERGE CONFLICTS
-            <history>
-                <created date="{$history_created_date}"><xsl:value-of select="$history_created"/></created>
-                <lastedited date="{$history_lastedited_date}"><xsl:value-of select="$history_lastedited"/></lastedited>
-            </history>
-            //-->
-        <xsl:call-template name="lf"/>
-        </meta>
-        <xsl:call-template name="lf"/>
-        <body>
-            <xsl:apply-templates select="/office:document/office:body/office:text" />
-        <xsl:call-template name="lf"/>
-        </body>
-    <xsl:call-template name="lf"/>
+        <xsl:call-template name="newline-indent-1"/>
+        <topic id="{$topic_id}">
+            <xsl:if test="not($topic_indexer = '')">
+                <xsl:attribute name="indexer"><xsl:value-of select="$topic_indexer"/></xsl:attribute>
+            </xsl:if>
+            <xsl:if test="not($topic_status = '')">
+                <xsl:attribute name="status"><xsl:value-of select="$topic_status"/></xsl:attribute>
+            </xsl:if>
+            <xsl:call-template name="newline-indent-2"/>
+            <title xml-lang="en-US" id="tit"><xsl:value-of select="$title"/></title>
+            <xsl:call-template name="newline-indent-2"/>
+            <filename><xsl:value-of select="$filename"/></filename>
+            <xsl:call-template name="newline-indent-1"/>
+        </topic>
+        <xsl:call-template name="newline"/>
+    </meta>
+    <xsl:call-template name="newline"/>
+    <xsl:call-template name="newline"/>
+    <body>
+        <xsl:call-template name="newline"/>
+        <xsl:apply-templates select="/office:document/office:body/office:text" />
+        <xsl:call-template name="newline"/>
+    </body>
+    <xsl:call-template name="newline"/>
+    <xsl:call-template name="newline"/>
     </helpdocument>
 </xsl:template>
 
@@ -228,6 +225,7 @@ BOOKMARK
 <xsl:template match="text:variable-set[@text:name='_BOOKMARK']">
     <xsl:text disable-output-escaping="yes">
 </bookmark></xsl:text>
+    <xsl:call-template name="newline"/>
 </xsl:template>
 
 <!--
@@ -236,8 +234,8 @@ BOOKMARK_VALUE
 ######################################################
 -->
 <xsl:template match="text:variable-set[@text:name='BOOKMARKVALUE']">
-    <xsl:call-template name="lf" />
-    <bookmark_value><xsl:apply-templates />    </bookmark_value>
+    <xsl:call-template name="newline-indent-1"/>
+    <bookmark_value><xsl:apply-templates /></bookmark_value>
 </xsl:template>
 
 <!--
@@ -615,8 +613,10 @@ LIST
     <xsl:choose>
     <!-- ORDERED LISTS -->
     <xsl:when test="//text:list-style[@style:name=$stylename]/text:list-level-style-number[@text:level='1']"> <!-- fixed list bug -->
-    <xsl:text>
-</xsl:text>
+
+    <xsl:call-template name="newline"/>
+    <xsl:call-template name="newline"/>
+
     <list type="ordered">
 
         <xsl:variable name="liststyle">
@@ -658,8 +658,9 @@ LIST
         </xsl:if>
 
         <xsl:apply-templates />
-    <xsl:text>
-</xsl:text>
+
+    <xsl:call-template name="newline"/>
+
     </list>
 
     </xsl:when>
@@ -667,7 +668,9 @@ LIST
     <!-- UNORDERED LISTS -->
     <xsl:when test="//text:list-style[@style:name=$stylename]/text:list-level-style-bullet[@text:level='1']"> <!-- fixed list bug -->
 
-    <xsl:call-template name="lf"/>
+    <xsl:call-template name="newline"/>
+    <xsl:call-template name="newline"/>
+
     <list type="unordered">
         <xsl:variable name="masterstyle">
             <xsl:call-template name="getmasterstyle">
@@ -699,12 +702,11 @@ LISTITEM
 ######################################################
 -->
 <xsl:template match="text:list-item">
-    <xsl:text>
-</xsl:text>
+    <xsl:call-template name="newline-indent-1"/>
+
     <listitem>
         <xsl:apply-templates />
-    <xsl:text>
-</xsl:text>
+	<xsl:call-template name="newline-indent-1"/>
     </listitem>
 </xsl:template>
 
@@ -857,8 +859,8 @@ PARAGRAPH
 
     //-->
 
-        <xsl:text>
-</xsl:text>
+        <xsl:call-template name="newline"/>
+
         <paragraph id="{$real_id}" role="{$role}" xml-lang="en-US"><xsl:if test="$localize='FALSE'">
                 <xsl:attribute name="localize"><xsl:value-of select="'false'"/></xsl:attribute>
             </xsl:if>
@@ -895,8 +897,10 @@ SECTION
             <xsl:value-of select="'false'"/>
         </xsl:if>
     </xsl:variable>
-    <xsl:text>
-</xsl:text>
+
+    <xsl:call-template name="newline"/>
+    <xsl:call-template name="newline"/>
+
     <section id="{$id}">
         <xsl:if test="not($localize='')">
             <xsl:attribute name="localize">
@@ -904,8 +908,8 @@ SECTION
             </xsl:attribute>
         </xsl:if>
         <xsl:apply-templates />
-        <xsl:text>
-</xsl:text>
+
+	<xsl:call-template name="newline"/>
     </section>
 
 </xsl:template>
@@ -996,8 +1000,9 @@ TABLE
     <xsl:variable name="id">
         <xsl:value-of select="@table:name"/>
     </xsl:variable>
-    <xsl:text>
-</xsl:text>
+
+    <xsl:call-template name="newline"/>
+    <xsl:call-template name="newline"/>
 
     <table id="{$id}">
 
@@ -1015,12 +1020,10 @@ TABLE
         </xsl:if>
 
         <xsl:apply-templates />
-    <xsl:text>
-</xsl:text>
-    </table>
 
-    <xsl:text>
-</xsl:text>
+    <xsl:call-template name="newline"/>
+    </table>
+    <xsl:call-template name="newline"/>
 </xsl:template>
 
 <!--
@@ -1037,14 +1040,14 @@ TABLECELL
 <xsl:template match="table:table-cell">
     <xsl:variable name="colspan"><xsl:value-of select="@table:number-columns-spanned"/></xsl:variable>
     <xsl:variable name="rowspan"><xsl:value-of select="@table:number-rows-spanned"/></xsl:variable>
-    <xsl:text>
-</xsl:text>
+
+    <xsl:call-template name="newline-indent-2"/>
     <tablecell>
         <xsl:if test="not($colspan='')"><xsl:attribute name="colspan"><xsl:value-of select="$colspan"/></xsl:attribute></xsl:if>
         <xsl:if test="not($rowspan='')"><xsl:attribute name="rowspan"><xsl:value-of select="$rowspan"/></xsl:attribute></xsl:if>
-        <xsl:apply-templates />
-        <xsl:text>
-</xsl:text>
+        <xsl:apply-templates/>
+
+	<xsl:call-template name="newline-indent-2"/>
     </tablecell>
 </xsl:template>
 
@@ -1058,12 +1061,10 @@ TABLEROW
 ######################################################
 -->
 <xsl:template match="table:table-row">
-    <xsl:text>
-</xsl:text>
+    <xsl:call-template name="newline-indent-1"/>
     <tablerow>
         <xsl:apply-templates />
-    <xsl:text>
-</xsl:text>
+	<xsl:call-template name="newline-indent-1"/>
     </tablerow>
 </xsl:template>
 
@@ -1307,9 +1308,22 @@ LICENSE HEADER
 
 </xsl:template>
 
-<xsl:template name="lf">
+<!-- Output a newline -->
+<xsl:template name="newline">
 <xsl:text disable-output-escaping="yes">
 </xsl:text>
 </xsl:template>
 
+<!-- Output a newline, and indent the next element (1st level). -->
+<xsl:template name="newline-indent-1">
+<xsl:text disable-output-escaping="yes">
+  </xsl:text>
+</xsl:template>
+
+<!-- Output a newline, and indent the next element (2nd level) -->
+<xsl:template name="newline-indent-2">
+<xsl:text disable-output-escaping="yes">
+    </xsl:text>
+</xsl:template>
+
 </xsl:stylesheet>
commit fcd06dc680aa5acdd94d510076fa66266362ba0a
Author: Regina Henschel <rb.henschel at t-online.de>
Date:   Wed Jul 22 18:46:29 2015 +0200

    helpauthoring: Don't add <emph> tags at random places.

diff --git a/helpauthoring/filter/soffice2xmlhelp.xsl b/helpauthoring/filter/soffice2xmlhelp.xsl
index 0b53e5c..0dc7fc7 100644
--- a/helpauthoring/filter/soffice2xmlhelp.xsl
+++ b/helpauthoring/filter/soffice2xmlhelp.xsl
@@ -1141,7 +1141,7 @@ text:span, covers EMPH and ITEM
             <xsl:when test="starts-with($masterstyle,'hlp_aux_')">
                 <xsl:apply-templates />
             </xsl:when>
-            <xsl:when test="not(starts-with($masterstyle,'hlp_'))"><emph><xsl:apply-templates/></emph></xsl:when>
+            <xsl:when test="not(starts-with($masterstyle,'hlp_'))"><xsl:apply-templates/></xsl:when>
             <xsl:when test="$masterstyle = 'hlp_emph'"><emph><xsl:apply-templates/></emph></xsl:when>
             <xsl:otherwise>
                 <xsl:variable name="spanstyle"><xsl:value-of select="substring-after($masterstyle,'hlp_')"/></xsl:variable><item type="{$spanstyle}"><xsl:apply-templates /></item></xsl:otherwise>


More information about the Libreoffice-commits mailing list