AllLangHelp_scalc.mk                |    2 +
 helpers/calc_text_func.pl           |   26 ++++++++++++++++++++++
 helpers/calc_text_func.xsl          |    2 -
 helpers/calc_text_func0.xsl         |   28 ++++++++++++++++++++++++
 source/text/scalc/01/04060110.xhp   |   41 ++----------------------------------
 source/text/scalc/01/func_char.xhp  |   38 +++++++++++++++++++++++++++++++++
 source/text/scalc/01/func_clean.xhp |   38 +++++++++++++++++++++++++++++++++
 7 files changed, 136 insertions(+), 39 deletions(-)

New commits:
commit e60bf0a677ddf64ba4d5bda78399f9991c5a665e
Author:     Pierre F <f...@bger.ch>
AuthorDate: Wed Oct 9 16:45:49 2024 +0200
Commit:     Olivier Hallot <olivier.hal...@libreoffice.org>
CommitDate: Thu Oct 24 14:01:25 2024 +0200

    tdf#143846 split CHAR + CLEAN. + helper
    
    to extract xhp files, run :
       perl helpers/calc_text_func.pl CHAR CLEAN
    ouput :
    TODO. add to git and  AllLangHelp_scalc.mk :
        helpcontent2/source/text/scalc/01/func_char \
        helpcontent2/source/text/scalc/01/func_clean \
    
    
    Change-Id: I986cb038748586c12bd09441070cf272de2d4106
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/174677
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org>

diff --git a/AllLangHelp_scalc.mk b/AllLangHelp_scalc.mk
index c1b44cdbc4..66933637e7 100644
--- a/AllLangHelp_scalc.mk
+++ b/AllLangHelp_scalc.mk
@@ -202,6 +202,8 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,scalc,\
     helpcontent2/source/text/scalc/01/func_averageifs \
     helpcontent2/source/text/scalc/01/func_base \
     helpcontent2/source/text/scalc/01/func_bahttext \
+    helpcontent2/source/text/scalc/01/func_char \
+    helpcontent2/source/text/scalc/01/func_clean \
     helpcontent2/source/text/scalc/01/func_ceiling \
     helpcontent2/source/text/scalc/01/func_countifs \
     helpcontent2/source/text/scalc/01/func_color \
diff --git a/helpers/calc_text_func.pl b/helpers/calc_text_func.pl
new file mode 100644
index 0000000000..4fb5b72578
--- /dev/null
+++ b/helpers/calc_text_func.pl
@@ -0,0 +1,26 @@
+
+use 5.010;
+
+$hlp='helpers/calc_text_func.xsl';    #extract section
+$hlp0='helpers/calc_text_func0.xsl';  #replace section
+
+$source= 'source/text/scalc/01/04060110.xhp';
+$tmp = $source . '.tmp';
+
+@todo = qw/ CHAR CLEAN CODE CONCATENATE DECIMAL DOLLAR EXACT FIND FIXED LEFT 
LEFTB LEN LENB LOWER MID MIDB PROPER REPLACE REPT RIGHT RIGHTB SEARCH 
SUBSTITUTE T TEXT TRIM UNICHAR UNICODE UPPER /;
+
+
+for $F ( @ARGV) {
+  $f=lc $F;
+  say $F
+
+  system qq( xsltproc --stringparam func $F  $hlp  $source > 
source/text/scalc/01/func_$f.xhp );
+
+  system qq( xsltproc --stringparam func $f  $hlp0 $source > $tmp );
+  rename $tmp, $source;
+
+  $mk .= qq(    helpcontent2/source/text/scalc/01/func_$f \
);
+}
+
+say qq(TODO. add to git and  AllLangHelp_scalc.mk :
+$mk);
diff --git a/helpers/calc_text_func.xsl b/helpers/calc_text_func.xsl
index e2d379d9e7..c2a491c41a 100644
--- a/helpers/calc_text_func.xsl
+++ b/helpers/calc_text_func.xsl
@@ -5,7 +5,7 @@
 <xsl:param name="func" select="BASE"/>
 
 <xsl:template match="/">
-  <xsl:for-each select="//section/h2[contains(text(), $func)]">
+  <xsl:for-each select="//section/h2[text() = $func ]">
        
        <xsl:call-template name="section"/>
   </xsl:for-each>
diff --git a/helpers/calc_text_func0.xsl b/helpers/calc_text_func0.xsl
new file mode 100644
index 0000000000..eebdd12ecc
--- /dev/null
+++ b/helpers/calc_text_func0.xsl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+<xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+
+<xsl:param name="func" select="base"/>
+
+<xsl:template match="@* | node()">
+    <xsl:copy>
+        <xsl:apply-templates select="@* | node()"/>
+    </xsl:copy>
+</xsl:template>
+
+<xsl:template match="//section">
+
+  <xsl:choose>
+    <xsl:when test="current()[@id = $func]">
+               <section id="{./@id}">
+                 <embed href="text/scalc/01/func_{@id}.xhp#func_{@id}"/>
+               </section>
+    </xsl:when>
+    <xsl:otherwise>
+               <xsl:copy-of select="."/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+</xsl:template> 
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/source/text/scalc/01/04060110.xhp 
b/source/text/scalc/01/04060110.xhp
index 9b56a621df..71276ba4b8 100644
--- a/source/text/scalc/01/04060110.xhp
+++ b/source/text/scalc/01/04060110.xhp
@@ -98,44 +98,9 @@
   <embed href="text/scalc/01/func_base.xhp#func_base"/>
 </section>
 
-<section id="char">
-<bookmark branch="index" id="bm_id3149321">
-  <bookmark_value>CHAR function</bookmark_value>
-</bookmark>
-
-<bookmark branch="hid/SC_HID_FUNC_ZEICHEN" id="bm_id3159128" localize="false"/>
-
-<h2 id="hd_id3149321">CHAR</h2>
-<paragraph id="par_id3149150" role="paragraph"><ahelp 
hid="HID_FUNC_ZEICHEN">Converts a number into a character according to the 
current code table.</ahelp> The number can be a two-digit or three-digit 
integer number.</paragraph>
-<embed href="text/scalc/00/00000004.xhp#codes"/>
-
-<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
-<paragraph id="par_id3145634" role="code">CHAR(Number)</paragraph>
-<paragraph id="par_id3155906" role="paragraph"> <emph>Number</emph> is a 
number between 1 and 255 representing the code value for the 
character.</paragraph>
-
-<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
-<paragraph id="par_id3149890" role="paragraph"> <item 
type="input">=CHAR(100)</item> returns the character d.</paragraph>
-<paragraph id="par_id0907200910283297" role="paragraph">="abc" &amp; CHAR(10) 
&amp; "def" inserts a newline character into the string.</paragraph>
-</section>
+<section id="char"><embed 
href="text/scalc/01/func_char.xhp#func_char"/></section>
 
-<section id="clean">
-<bookmark branch="index" id="bm_id3149009">
-  <bookmark_value>CLEAN function</bookmark_value>
-</bookmark>
-
-<bookmark branch="hid/SC_HID_FUNC_SAEUBERN" id="bm_id3148729" 
localize="false"/>
-
-<h2 id="hd_id3149009">CLEAN</h2>
-<paragraph id="par_id3150482" role="paragraph"><ahelp 
hid="HID_FUNC_SAEUBERN">All non-printing characters are removed from the 
string.</ahelp></paragraph>
-
-<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
-<paragraph id="par_id3147472" role="code">CLEAN("Text")</paragraph>
-<paragraph id="par_id3150695" role="paragraph"> <emph>Text</emph> refers to 
the text from which to remove all non-printable characters.</paragraph>
-
-<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
-<paragraph role="paragraph" 
id="par_id581621538151600"><input>=LEN(CLEAN(CHAR(7) &amp; "LibreOffice Calc" 
&amp; CHAR(8)))</input> returns 16, showing that the CLEAN function removes the 
non-printable Unicode U+0007 ("BEL") and U+0008 ("BS") characters at the 
beginning and end of the string argument. CLEAN does not remove 
spaces.</paragraph>
-
-</section>
+<section id="clean"><embed 
href="text/scalc/01/func_clean.xhp#func_clean"/></section>
 
 <section id="code">
 <bookmark branch="index" id="bm_id3155498">
@@ -723,4 +688,4 @@
 </section>
 </body>
 
-</helpdocument>
+</helpdocument>
\ No newline at end of file
diff --git a/source/text/scalc/01/func_char.xhp 
b/source/text/scalc/01/func_char.xhp
new file mode 100644
index 0000000000..5b2db08ace
--- /dev/null
+++ b/source/text/scalc/01/func_char.xhp
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpdocument version="1.0">
+  <!--
+    * 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/.
+    *
+  -->
+  <meta>
+    <topic id="calcfunc_char" indexer="include" status="PUBLISH">
+      <title id="tit">CHAR Function</title>
+      <filename>/text/scalc/01/func_char.xhp</filename>
+    </topic>
+  </meta>
+  <body>
+    <bookmark branch="index" id="bm_id3149321">
+  <bookmark_value>CHAR function</bookmark_value>
+</bookmark>
+    <bookmark branch="hid/SC_HID_FUNC_ZEICHEN" id="bm_id3159128" 
localize="false"/>
+    <section id="func_char">
+      <h1 id="hd_id3149321">
+        <variable id="char_h1">
+          <link href="text/scalc/01/func_char.xhp">CHAR</link>
+        </variable>
+      </h1>
+      <paragraph id="par_id3149150" role="paragraph"><ahelp 
hid="HID_FUNC_ZEICHEN">Converts a number into a character according to the 
current code table.</ahelp> The number can be a two-digit or three-digit 
integer number.</paragraph>
+    </section>
+    <embed href="text/scalc/00/00000004.xhp#codes"/>
+    <embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
+    <paragraph id="par_id3145634" role="code">CHAR(Number)</paragraph>
+    <paragraph id="par_id3155906" role="paragraph"> <emph>Number</emph> is a 
number between 1 and 255 representing the code value for the 
character.</paragraph>
+    <embed href="text/scalc/01/common_func.xhp#sectionexample"/>
+    <paragraph id="par_id3149890" role="paragraph"> <item 
type="input">=CHAR(100)</item> returns the character d.</paragraph>
+    <paragraph id="par_id0907200910283297" role="paragraph">="abc" &amp; 
CHAR(10) &amp; "def" inserts a newline character into the string.</paragraph>
+  </body>
+</helpdocument>
\ No newline at end of file
diff --git a/source/text/scalc/01/func_clean.xhp 
b/source/text/scalc/01/func_clean.xhp
new file mode 100644
index 0000000000..9897db361c
--- /dev/null
+++ b/source/text/scalc/01/func_clean.xhp
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpdocument version="1.0">
+  <!--
+    * 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/.
+    *
+  -->
+  <meta>
+    <topic id="calcfunc_clean" indexer="include" status="PUBLISH">
+      <title id="tit">CLEAN Function</title>
+      <filename>/text/scalc/01/func_clean.xhp</filename>
+    </topic>
+  </meta>
+  <body>
+    <bookmark branch="index" id="bm_id3149009">
+  <bookmark_value>CLEAN function</bookmark_value>
+</bookmark>
+    <bookmark branch="hid/SC_HID_FUNC_SAEUBERN" id="bm_id3148729" 
localize="false"/>
+    <section id="func_clean">
+      <h1 id="hd_id3149009">
+        <variable id="clean_h1">
+          <link href="text/scalc/01/func_clean.xhp">CLEAN</link>
+        </variable>
+      </h1>
+      <paragraph id="par_id3150482" role="paragraph">
+        <ahelp hid="HID_FUNC_SAEUBERN">All non-printing characters are removed 
from the string.</ahelp>
+      </paragraph>
+    </section>
+    <embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
+    <paragraph id="par_id3147472" role="code">CLEAN("Text")</paragraph>
+    <paragraph id="par_id3150695" role="paragraph"> <emph>Text</emph> refers 
to the text from which to remove all non-printable characters.</paragraph>
+    <embed href="text/scalc/01/common_func.xhp#sectionexample"/>
+    <paragraph role="paragraph" 
id="par_id581621538151600"><input>=LEN(CLEAN(CHAR(7) &amp; "LibreOffice Calc" 
&amp; CHAR(8)))</input> returns 16, showing that the CLEAN function removes the 
non-printable Unicode U+0007 ("BEL") and U+0008 ("BS") characters at the 
beginning and end of the string argument. CLEAN does not remove 
spaces.</paragraph>
+  </body>
+</helpdocument>
\ No newline at end of file

Reply via email to