[Libreoffice-commits] dev-tools.git: help3/xhpeditor

Olivier Hallot (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 2 19:47:40 UTC 2019


 help3/xhpeditor/config.php       |   17 +++++++++++++++++
 help3/xhpeditor/ed_transform.xsl |   33 +++++++--------------------------
 help3/xhpeditor/index.php        |    7 ++++++-
 3 files changed, 30 insertions(+), 27 deletions(-)

New commits:
commit 17cd90a485cf0efa05311923ab7413fb316040f3
Author:     Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Mon Dec 2 15:29:32 2019 -0300
Commit:     Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Mon Dec 2 20:47:23 2019 +0100

    Move editor to php (3) (WIP)
    
    add a config file
    remove cruft in XSLT
    
    Change-Id: I820895cf646844235192cbf7eb0e739716142039
    Reviewed-on: https://gerrit.libreoffice.org/84262
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3/xhpeditor/config.php b/help3/xhpeditor/config.php
new file mode 100644
index 0000000..cf51506
--- /dev/null
+++ b/help3/xhpeditor/config.php
@@ -0,0 +1,17 @@
+<?php
+/*
+ * 
+ *  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/.
+ */
+
+$CONFIG = array (
+'help_path' => 'helpcontent2/source/',
+'icon_path' => 'icon-themes',
+'productname' => 'LibreOffice',
+);
+
+?>
diff --git a/help3/xhpeditor/ed_transform.xsl b/help3/xhpeditor/ed_transform.xsl
index 1e5b09d..f37121a 100644
--- a/help3/xhpeditor/ed_transform.xsl
+++ b/help3/xhpeditor/ed_transform.xsl
@@ -21,18 +21,18 @@
 
 <xsl:output indent="yes" method="html" doctype-system= "about:legacy-compat"/>
 
-<!-- <xsl:include href="hc2/help3xsl/links.txt.xsl"/> -->
+<xsl:include href="links.txt.xsl"/>
 <!--
 ############################
 # Variables and Parameters #
 ############################
 //-->
 
-<xsl:param name="local" />
 <xsl:param name="root"/>
 <xsl:param name="Language"/>
 <xsl:param name="productname"/>
 <xsl:param name="productversion"/>
+<xsl:param name="iconpath"/>
 
 <xsl:param name="System" select="'WIN'"/>
 <xsl:param name="imgtheme" select="'colibre_svg'"/>
@@ -55,9 +55,8 @@
 <xsl:variable name="brand4" select="'%PRODUCTVERSION'"/>
 
 <!-- Installation -->
-<xsl:variable name="online" select="$local!='yes'"/>
 <xsl:variable name="target" select="'/help_editor/'"/>
-<xsl:variable name="source" select="'/hc2/'"/>
+<xsl:variable name="source" select="$root"/>
 
 <!-- meta data variables from the help file -->
 <xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
@@ -89,25 +88,12 @@
 <xsl:variable name="linkpostfix" select="''"/>
 
 <!-- images for notes, tips and warnings -->
-<xsl:variable name="note_img" select="concat($img_url_prefix,'help/note.svg')"/>
-<xsl:variable name="tip_img" select="concat($img_url_prefix,'help/tip.svg')"/>
-<xsl:variable name="warning_img" select="concat($img_url_prefix,'help/warning.svg')"/>
+<xsl:variable name="note_img" select="concat($iconpath,'/help/note.svg')"/>
+<xsl:variable name="tip_img" select="concat($iconpath,'/help/tip.svg')"/>
+<xsl:variable name="warning_img" select="concat($iconpath,'/help/warning.svg')"/>
 
 <!-- Strings for the help UI page -->
-<xsl:variable name="tmp_href_ui"><xsl:value-of select="concat($urlpre,'text/shared/help/browserhelp.xhp')"/></xsl:variable>
-<xsl:variable name="tmp_doc_ui" select="document($tmp_href_ui)"/>
-<xsl:variable name ="ui_contents"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='contents']"/></xsl:variable>
-<xsl:variable name ="ui_index"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='index']"/></xsl:variable>
-<xsl:variable name ="ui_pholderall"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='pholderall']"/></xsl:variable>
-<xsl:variable name ="ui_pholderchosen"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='pholderchosen']"/></xsl:variable>
-<xsl:variable name ="ui_module"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='module']"/></xsl:variable>
-<xsl:variable name ="ui_language"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='language']"/></xsl:variable>
-<xsl:variable name ="ui_donate"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='donate']"/></xsl:variable>
-<xsl:variable name ="ui_logo"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='LibreOfficeHelp']"/></xsl:variable>
-<xsl:variable name ="ui_selectmodule"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='selectmodule']"/></xsl:variable>
-<xsl:variable name ="ui_selectlang"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='selectlanguage']"/></xsl:variable>
-<xsl:variable name ="ui_search"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='searchhelpcontents']"/></xsl:variable>
-<xsl:variable name ="ui_copyclip"><xsl:apply-templates select="$tmp_doc_ui//variable[@id='copyclip']"/></xsl:variable>
+
 <!--
 #############
 # Templates #
@@ -139,11 +125,6 @@
 <!-- ALT -->
 <xsl:template match="alt"/>
 
-<!-- MATHML -->
-<xsl:template match="math">
-<div class="mathml"><xsl:apply-templates /></div>
-</xsl:template>
-
 <!-- BOOKMARK -->
 <xsl:template match="bookmark">
 	<a name="{@id}"></a>
diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php
index ced9ca7..2e2b084 100644
--- a/help3/xhpeditor/index.php
+++ b/help3/xhpeditor/index.php
@@ -7,6 +7,8 @@
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 -->
 <?php 
+require_once './class.Diff.php';
+require_once './config.php';
 $xhp = $_POST["xhpdoc"];
 ?>
 <html>
@@ -38,6 +40,7 @@ $xhp = $_POST["xhpdoc"];
         <textarea id="xhpeditor" name="xhpdoc" form="CMtextarea"><?php echo $xhp; ?></textarea></br>
         <input type="submit" name="render_page" value="Render page"/>
         <input type="submit" name="get_patch" value="Generate patch"/>
+        <input type="submit" name="check_xhp" value="Check XHP"/>
     </form>
     <br />
     <div class="snip_heading">
@@ -45,7 +48,6 @@ $xhp = $_POST["xhpdoc"];
         <p>File name: <input type="text" id="01" name="filename" value="test.xhp"/><button onclick="loadText(document.getElementById('01').value);">Open File</button></p>
         <p>File name: <input type="text" id="02" name="filename" value="test.xhp"/>
         <button onclick="alert('Not yet implemented');">Save Changes</button>
-        <!--<button onclick="displayResult()">Render page</button>-->
         </p>
 </div>
     
@@ -125,6 +127,9 @@ $xhp = $_POST["xhpdoc"];
             $xsl = new DOMDocument;
             $xsl->load('ed_transform.xsl');
             $proc = new XSLTProcessor();
+            $proc->setParameter("","root",$CONFIG["help_path"]);
+            $proc->setParameter("","productname",$CONFIG["productname"]);
+            $proc->setParameter("","iconpath",$CONFIG["icon_path"]);
             $proc->importStyleSheet($xsl);
             echo $proc->transformToXml($xml);
             echo'</div>';


More information about the Libreoffice-commits mailing list