help3/xhpeditor/README-EDITOR.txt | 20 +++++--------- help3/xhpeditor/ed_transform.xsl | 6 ++-- help3/xhpeditor/index.php | 52 ++++++++++++++++++++++++-------------- 3 files changed, 44 insertions(+), 34 deletions(-)
New commits: commit 657bcd562c3a1614ce587978687ec8ca1ea61ac8 Author: Olivier Hallot <olivier.hal...@libreoffice.org> AuthorDate: Mon Dec 2 07:01:02 2019 -0300 Commit: Olivier Hallot <olivier.hal...@libreoffice.org> CommitDate: Mon Dec 2 15:26:16 2019 +0100 Move editor to php (WIP) Change-Id: I3a53336297bc276b5f9e5bfcf3d802dc3e891cd7 Reviewed-on: https://gerrit.libreoffice.org/84200 Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org> Tested-by: Olivier Hallot <olivier.hal...@libreoffice.org> diff --git a/help3/xhpeditor/README-EDITOR.txt b/help3/xhpeditor/README-EDITOR.txt index cedbb3f..be42086 100644 --- a/help3/xhpeditor/README-EDITOR.txt +++ b/help3/xhpeditor/README-EDITOR.txt @@ -6,7 +6,7 @@ git clone https://gerrit.libreoffice.org/dev-tools dev-tools The editor is in folder -dev-tools/help3/html/ +dev-tools/help3/xhpeditor/ To clone the HelpContents2 submodule ------------------------------------- @@ -17,20 +17,15 @@ all help files are in helpcontent2/ folder Other services -------------- A) A working apache or nginx webserver at http://localhost -b) PHP support for apache +b) PHP support for apache, include support for xslt Setup ----- 1) change to the editor folder -cd <location>/dev-tools/help3/html +cd <location>/dev-tools/help3/xhpeditor -2) Set a symbolic link to helpcontent2 - -ln -s <location>/helcontent2 hc2 - -this will make a symbolic link between hc2 -> <location>/helpcontent2 3) Set a symbolic link to the core repo @@ -41,19 +36,18 @@ Note: the core/ link is needed to get the colibre_svg/ icon theme 4) Web server -As root/admin execute a symbolic link - +As root/admin execute a symbolic link, assuming /var/www/html is your webroot cd /var/www/html -ln -s <location>/dev-tools/help3/html ed +ln -s <location>/dev-tools/help3/xhpeditor . -this will create a symbolic link /var/www/html/ed -> <location>/dev-tools/help3/html +this will create a symbolic link /var/www/html/xhpeditor -> <location>/dev-tools/help3/xhpeditor Running the editor ------------------ point the browser to -http://localhost/ed/index.php +http://localhost/xhpeditor/index.php Open XHP file ------------- diff --git a/help3/xhpeditor/ed_transform.xsl b/help3/xhpeditor/ed_transform.xsl index a31e280..f96a43d 100644 --- a/help3/xhpeditor/ed_transform.xsl +++ b/help3/xhpeditor/ed_transform.xsl @@ -21,7 +21,7 @@ <xsl:output indent="yes" method="html" doctype-system= "about:legacy-compat"/> -<xsl:include href="hc2/help3xsl/links.txt.xsl"/> +<!-- <xsl:include href="hc2/help3xsl/links.txt.xsl"/> --> <!-- ############################ # Variables and Parameters # @@ -159,7 +159,7 @@ </div> </footer> </div> - <xsl:choose> +<!-- <xsl:choose> <xsl:when test="$online"> <script type="text/javascript"> <![CDATA[ @@ -192,7 +192,7 @@ ]]> </script> </xsl:otherwise> - </xsl:choose> + </xsl:choose>--> </body> </html> </xsl:template> diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php index 7ee680d..a57e4b2 100644 --- a/help3/xhpeditor/index.php +++ b/help3/xhpeditor/index.php @@ -6,39 +6,48 @@ * 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/. --> - +<?php +$xhp = $_POST["olivier"]; +?> <html> -<meta charset="utf-8"/> <head> +<meta charset="utf-8"/> <title>LibreOffice Documentation XHP Editor</title> - <link rel="stylesheet" href="xhpeditor.css"> - <link rel="stylesheet" href="lib/codemirror.css"> - <link rel="stylesheet" href="addon/hint/show-hint.css"> - <link rel="stylesheet" href="/ed/hc2/help3xsl/normalize.css"> - <link rel="stylesheet" href="/ed/hc2/help3xsl/prism.css"> + <link type="text/css" rel="stylesheet" href="xhpeditor.css"> + <link type="text/css" rel="stylesheet" href="lib/codemirror.css"> + <link type="text/css" rel="stylesheet" href="addon/hint/show-hint.css"> + <link type="text/css" rel="stylesheet" href="helpcontent2/help3xsl/normalize.css"> + <link type="text/css" rel="stylesheet" href="helpcontent2/help3xsl/prism.css"> <script type="text/javascript" src="lib/codemirror.js"></script> <script type="text/javascript" src="addon/hint/show-hint.js"></script> <script type="text/javascript" src="addon/hint/xml-hint.js"></script> <script type="text/javascript" src="mode/xml/xml.js"></script> <script type="text/javascript" src="xhp2html.js"></script> - <script type="text/javascript" src="/ed/hc2/help3xsl/help2.js"></script> - <script type="text/javascript" src="/ed/hc2/help3xsl/prism.js"></script> + <script type="text/javascript" src="helpcontent2/help3xsl/help2.js"></script> + <script type="text/javascript" src="helpcontent2/help3xsl/prism.js"></script> + <script type="text/javascript" src="helpcontent2/help3xsl/help.js" defer=""></script> + <script type="text/javascript" src="autocomplete.js" defer=""></script> + <script type="text/javascript" src="snippets.js" defer=""></script> </head> <body style="font-family:sans-serif;"> <div class="leftside"> <h2>LibreOffice Documentation XHP Editor</h2> - <form class="form_area"> - <textarea id="xhpeditor"></textarea> + <form id="mytextarea" class="form_area" action="xhpeditor/index.php" method="post"> + <textarea id="xhpeditor" name="olivier" form="mytextarea"><?php echo $xhp; ?></textarea></br> + <input type="submit" value="Render page"/> </form> <br /> - <div class="snip_heading"><div class="snip_div">Actions:</div> + <div class="snip_heading"> + <div class="snip_div">Actions:</div> <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> + <!--<button onclick="displayResult()">Render page</button>--> + </p> +</div> + <div class="snip_heading"><div class="snip_div">Edit:</div> <button onclick="editor.undo()">Undo</button> <button onclick="editor.redo()">Redo</button> @@ -107,10 +116,17 @@ </div> <div class="rightside"> <h2>Rendered page</h2> - <div id="renderedpage"></div> + <div id="renderedpage"> + <?php + $xml = new DOMDocument(); + $xml->loadXML($xhp); + $xsl = new DOMDocument; + $xsl->load('ed_transform.xsl'); + $proc = new XSLTProcessor(); + $proc->importStyleSheet($xsl); + echo $proc->transformToXML($xml); + ?> + </div> </div> </body> -<script type="text/javascript" src="/ed/hc2/help3xsl/help.js"></script> -<script type="text/javascript" src="autocomplete.js"></script> -<script type="text/javascript" src="snippets.js"></script> </html> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits