[Libreoffice-commits] dev-tools.git: help3/xhpeditor
Olivier Hallot (via logerrit)
logerrit at kemper.freedesktop.org
Sun Dec 8 01:35:25 UTC 2019
help3/xhpeditor/index.php | 8
help3/xhpeditor/old-index.html | 196 ---------------------
help3/xhpeditor/old.html | 375 -----------------------------------------
help3/xhpeditor/xhp2html.js | 29 +++
4 files changed, 34 insertions(+), 574 deletions(-)
New commits:
commit 2e100bac16e6513c2e170ebb4b2deee68ce6f3cd
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Sat Dec 7 22:33:02 2019 -0300
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Sun Dec 8 02:35:08 2019 +0100
Add Save command in XHP editor
Change-Id: Idee319110ca2613dc33dcd220fc50b9f91923906
Reviewed-on: https://gerrit.libreoffice.org/84704
Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>
diff --git a/help3/xhpeditor/index.php b/help3/xhpeditor/index.php
index 780dcbc..295b948 100644
--- a/help3/xhpeditor/index.php
+++ b/help3/xhpeditor/index.php
@@ -57,8 +57,9 @@ echo $xhp;
?>
</textarea></br>
</form>
- <div class="snip_heading"><div class="snip_div">Open local file:</div>
- <input type="file" id="file-input" accept=".xhp"/>
+ <div class="snip_heading">
+ <div class="snip_div">Open:</div><input type="file" id="file-input" accept=".xhp"/>
+ <div class="snip_div">Save:</div><button onclick="download(editor.getValue(),getFileNameFromXML(),'text/xml')" class="snip_buttons">Save local file</button>
</div>
<div class="snip_heading"><div class="snip_div">Edit:</div>
<button onclick="editor.undo()">Undo</button>
@@ -93,6 +94,7 @@ echo $xhp;
<button onclick="warning()" class="snip_buttons">warning</button>
<button onclick="tip()" class="snip_buttons">tip</button>
<button onclick="bascode_par()" class="snip_buttons">bascode-par</button>
+ <button onclick="pycode_par()" class="snip_buttons">pycode-par</button>
</div>
<div class="snip_heading"><div class="snip_div">Characters:</div>
<button onclick="emph()" class="snip_buttons">emph</button>
@@ -113,6 +115,8 @@ echo $xhp;
<button onclick="switchXHP('sys')" class="snip_buttons">Switch sys</button>
<button onclick="switchInline('appl')" class="snip_buttons">Switchinline appl</button>
<button onclick="switchInline('sys')" class="snip_buttons">Switchinline sys</button>
+ <button onclick="MenuPrefMAC()" class="snip_buttons">Menu MAC</button>
+ <button onclick="KeyMAC()" class="snip_buttons">Key MAC</button>
</div>
<div class="snip_heading"><div class="snip_div">Lists:</div>
<button onclick="tList('unordered')" class="snip_buttons">UL</button>
diff --git a/help3/xhpeditor/old-index.html b/help3/xhpeditor/old-index.html
deleted file mode 100644
index 5bb0048..0000000
--- a/help3/xhpeditor/old-index.html
+++ /dev/null
@@ -1,196 +0,0 @@
-<!doctype html>
-
-<title>CodeMirror</title>
-<meta charset="utf-8"/>
-
-<link rel=stylesheet href="lib/codemirror.css">
-<link rel=stylesheet href="doc/docs.css">
-<script src="lib/codemirror.js"></script>
-<script src="mode/xml/xml.js"></script>
-<script src="mode/javascript/javascript.js"></script>
-<script src="mode/css/css.js"></script>
-<script src="mode/htmlmixed/htmlmixed.js"></script>
-<script src="addon/edit/matchbrackets.js"></script>
-
-<script src="doc/activebookmark.js"></script>
-
-<style>
- .CodeMirror { height: auto; border: 1px solid #ddd; }
- .CodeMirror-scroll { max-height: 200px; }
- .CodeMirror pre { padding-left: 7px; line-height: 1.25; }
-</style>
-
-<div id=nav>
- <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="doc/logo.png"></a>
-
- <ul>
- <li><a class=active data-default="true" href="#description">Home</a>
- <li><a href="doc/manual.html">Manual</a>
- <li><a href="https://github.com/codemirror/codemirror">Code</a>
- </ul>
- <ul>
- <li><a href="#features">Features</a>
- <li><a href="#community">Community</a>
- <li><a href="#browsersupport">Browser support</a>
- </ul>
-</div>
-
-<article>
-
-<section id=description class=first>
- <p><strong>CodeMirror</strong> is a versatile text editor
- implemented in JavaScript for the browser. It is specialized for
- editing code, and comes with a number of <a href="mode/index.html">language modes</a> and <a href="doc/manual.html#addons">addons</a>
- that implement more advanced editing functionality.</p>
-
- <p>A rich <a href="doc/manual.html#api">programming API</a> and a
- CSS <a href="doc/manual.html#styling">theming</a> system are
- available for customizing CodeMirror to fit your application, and
- extending it with new functionality.</p>
-</section>
-
-<section id=demo>
- <h2>This is CodeMirror</h2>
- <form style="position: relative; margin-top: .5em;"><textarea id=demotext>
-<!-- Create a simple CodeMirror instance -->
-<link rel="stylesheet" href="lib/codemirror.css">
-<script src="lib/codemirror.js"></script>
-<script>
- var editor = CodeMirror.fromTextArea(myTextarea, {
- lineNumbers: true
- });
-</script></textarea>
- <select id="demolist" onchange="document.location = this.options[this.selectedIndex].value;">
- <option value="#">Other demos...</option>
- <option value="demo/complete.html">Autocompletion</option>
- <option value="demo/folding.html">Code folding</option>
- <option value="demo/theme.html">Themes</option>
- <option value="mode/htmlmixed/index.html">Mixed language modes</option>
- <option value="demo/bidi.html">Bi-directional text</option>
- <option value="demo/variableheight.html">Variable font sizes</option>
- <option value="demo/search.html">Search interface</option>
- <option value="demo/vim.html">Vim bindings</option>
- <option value="demo/emacs.html">Emacs bindings</option>
- <option value="demo/sublime.html">Sublime Text bindings</option>
- <option value="demo/tern.html">Tern integration</option>
- <option value="demo/merge.html">Merge/diff interface</option>
- <option value="demo/fullscreen.html">Full-screen editor</option>
- <option value="demo/simplescrollbars.html">Custom scrollbars</option>
- </select></form>
- <script>
- var editor = CodeMirror.fromTextArea(document.getElementById("demotext"), {
- lineNumbers: true,
- mode: "text/html",
- matchBrackets: true
- });
- </script>
-
- <div class=actions>
- <div class=actionspicture>
- <img src="doc/yinyang.png" class=yinyang>
- <div class="actionlink download">
- <a href="http://codemirror.net/codemirror.zip">DOWNLOAD</a>
- </div>
- <div class="actionlink fund">
- <a href="https://marijnhaverbeke.nl/fund/">FUND</a>
- </div>
- </div>
- <div class=actionsleft>
- Get the current version: <a href="http://codemirror.net/codemirror.zip">5.38.0</a>.<br>
- You can see the <a href="https://github.com/codemirror/codemirror" title="Github repository">code</a>,<br>
- read the <a href="doc/releases.html">release notes</a>,<br>
- or study the <a href="doc/manual.html">user manual</a>.
- </div>
- <div class=actionsright>
- Software needs maintenance,<br>
- maintainers need to subsist.<br>
- Current funding status = <img src="https://marijnhaverbeke.nl/fund/status_s.png" title="Current maintainer happiness" style="vertical-align: middle; height: 16px; width: 16px"><br>
- You can help <a href="https://marijnhaverbeke.nl/fund/" title="Set up a monthly contribution">per month</a> or
- <a title="Donate with PayPal" href="https://www.paypal.me/marijnhaverbeke">once</a>.
- </div>
- </div>
-
-</section>
-
-<section id=features>
- <h2>Features</h2>
- <ul>
- <li>Support for <a href="mode/index.html">over 100 languages</a> out of the box
- <li>A powerful, <a href="mode/htmlmixed/index.html">composable</a> language mode <a href="doc/manual.html#modeapi">system</a>
- <li><a href="doc/manual.html#addon_show-hint">Autocompletion</a> (<a href="demo/xmlcomplete.html">XML</a>)
- <li><a href="doc/manual.html#addon_foldcode">Code folding</a>
- <li><a href="doc/manual.html#option_extraKeys">Configurable</a> keybindings
- <li><a href="demo/vim.html">Vim</a>, <a href="demo/emacs.html">Emacs</a>, and <a href="demo/sublime.html">Sublime Text</a> bindings
- <li><a href="doc/manual.html#addon_search">Search and replace</a> interface
- <li><a href="doc/manual.html#addon_matchbrackets">Bracket</a> and <a href="doc/manual.html#addon_matchtags">tag</a> matching
- <li>Support for <a href="demo/buffers.html">split views</a>
- <li><a href="doc/manual.html#addon_lint">Linter integration</a>
- <li><a href="demo/variableheight.html">Mixing font sizes and styles</a>
- <li><a href="demo/theme.html">Various themes</a>
- <li>Able to <a href="demo/resize.html">resize to fit content</a>
- <li><a href="doc/manual.html#mark_replacedWith">Inline</a> and <a href="doc/manual.html#addLineWidget">block</a> widgets
- <li>Programmable <a href="demo/marker.html">gutters</a>
- <li>Making ranges of text <a href="doc/manual.html#markText">styled, read-only, or atomic</a>
- <li><a href="demo/bidi.html">Bi-directional text</a> support
- <li>Many other <a href="doc/manual.html#api">methods</a> and <a href="doc/manual.html#addons">addons</a>...
- </ul>
-</section>
-
-<section id=community>
- <h2>Community</h2>
-
- <p>CodeMirror is an open-source project shared under
- an <a href="LICENSE">MIT license</a>. It is the editor used in the
- dev tools for
- <a href="https://hacks.mozilla.org/2013/11/firefox-developer-tools-episode-27-edit-as-html-codemirror-more/">Firefox</a>,
- <a href="https://developers.google.com/chrome-developer-tools/">Chrome</a>,
- and <a href="https://developer.apple.com/safari/tools/">Safari</a>, in <a href="http://www.lighttable.com/">Light
- Table</a>, <a href="http://brackets.io/">Adobe
- Brackets</a>, <a href="http://blog.bitbucket.org/2013/05/14/edit-your-code-in-the-cloud-with-bitbucket/">Bitbucket</a>,
- and <a href="doc/realworld.html">many other projects</a>.</p>
-
- <p>Development and bug tracking happens
- on <a href="https://github.com/codemirror/CodeMirror/">github</a>
- (<a href="http://marijnhaverbeke.nl/git/codemirror">alternate git
- repository</a>).
- Please <a href="http://codemirror.net/doc/reporting.html">read these
- pointers</a> before submitting a bug. Use pull requests to submit
- patches. All contributions must be released under the same MIT
- license that CodeMirror uses.</p>
-
- <p>Discussion around the project is done on
- a <a href="https://discuss.codemirror.net">discussion forum</a>.
- Announcements related to the project, such as new versions, are
- posted in the
- forum's <a href="https://discuss.codemirror.net/c/announce">"announce"</a>
- category. If needed, you can
- contact <a href="mailto:marijnh at gmail.com">the maintainer</a>
- directly. We aim to be an inclusive, welcoming community. To make
- that explicit, we have
- a <a href="http://contributor-covenant.org/version/1/1/0/">code of
- conduct</a> that applies to communication around the project.</p>
-
- <p>A list of CodeMirror-related software that is not part of the
- main distribution is maintained
- on <a href="https://github.com/codemirror/CodeMirror/wiki/CodeMirror-addons">our
- wiki</a>. Feel free to add your project.</p>
-</section>
-
-<section id=browsersupport>
- <h2>Browser support</h2>
- <p>The <em>desktop</em> versions of the following browsers,
- in <em>standards mode</em> (HTML5 <code><!doctype html></code>
- recommended) are supported:</p>
- <table style="margin-bottom: 1em">
- <tr><th>Firefox</th><td>version 4 and up</td></tr>
- <tr><th>Chrome</th><td>any version</td></tr>
- <tr><th>Safari</th><td>version 5.2 and up</td></tr>
- <tr><th style="padding-right: 1em;">Internet Explorer/Edge</th><td>version 8 and up</td></tr>
- <tr><th>Opera</th><td>version 9 and up</td></tr>
- </table>
- <p>Support for modern mobile browsers is experimental. Recent
- versions of the iOS browser and Chrome on Android should work
- pretty well.</p>
-</section>
-
-</article>
diff --git a/help3/xhpeditor/old.html b/help3/xhpeditor/old.html
deleted file mode 100644
index 96ed444..0000000
--- a/help3/xhpeditor/old.html
+++ /dev/null
@@ -1,375 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <!--
- Modified from the Debian original for Ubuntu
- Last updated: 2016-11-16
- See: https://launchpad.net/bugs/1288690
- -->
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Apache2 Ubuntu Default Page: It works</title>
- <style type="text/css" media="screen">
- * {
- margin: 0px 0px 0px 0px;
- padding: 0px 0px 0px 0px;
- }
-
- body, html {
- padding: 3px 3px 3px 3px;
-
- background-color: #D8DBE2;
-
- font-family: Verdana, sans-serif;
- font-size: 11pt;
- text-align: center;
- }
-
- div.main_page {
- position: relative;
- display: table;
-
- width: 800px;
-
- margin-bottom: 3px;
- margin-left: auto;
- margin-right: auto;
- padding: 0px 0px 0px 0px;
-
- border-width: 2px;
- border-color: #212738;
- border-style: solid;
-
- background-color: #FFFFFF;
-
- text-align: center;
- }
-
- div.page_header {
- height: 99px;
- width: 100%;
-
- background-color: #F5F6F7;
- }
-
- div.page_header span {
- margin: 15px 0px 0px 50px;
-
- font-size: 180%;
- font-weight: bold;
- }
-
- div.page_header img {
- margin: 3px 0px 0px 40px;
-
- border: 0px 0px 0px;
- }
-
- div.table_of_contents {
- clear: left;
-
- min-width: 200px;
-
- margin: 3px 3px 3px 3px;
-
- background-color: #FFFFFF;
-
- text-align: left;
- }
-
- div.table_of_contents_item {
- clear: left;
-
- width: 100%;
-
- margin: 4px 0px 0px 0px;
-
- background-color: #FFFFFF;
-
- color: #000000;
- text-align: left;
- }
-
- div.table_of_contents_item a {
- margin: 6px 0px 0px 6px;
- }
-
- div.content_section {
- margin: 3px 3px 3px 3px;
-
- background-color: #FFFFFF;
-
- text-align: left;
- }
-
- div.content_section_text {
- padding: 4px 8px 4px 8px;
-
- color: #000000;
- font-size: 100%;
- }
-
- div.content_section_text pre {
- margin: 8px 0px 8px 0px;
- padding: 8px 8px 8px 8px;
-
- border-width: 1px;
- border-style: dotted;
- border-color: #000000;
-
- background-color: #F5F6F7;
-
- font-style: italic;
- }
-
- div.content_section_text p {
- margin-bottom: 6px;
- }
-
- div.content_section_text ul, div.content_section_text li {
- padding: 4px 8px 4px 16px;
- }
-
- div.section_header {
- padding: 3px 6px 3px 6px;
-
- background-color: #8E9CB2;
-
- color: #FFFFFF;
- font-weight: bold;
- font-size: 112%;
- text-align: center;
- }
-
- div.section_header_red {
- background-color: #CD214F;
- }
-
- div.section_header_grey {
- background-color: #9F9386;
- }
-
- .floating_element {
- position: relative;
- float: left;
- }
-
- div.table_of_contents_item a,
- div.content_section_text a {
- text-decoration: none;
- font-weight: bold;
- }
-
- div.table_of_contents_item a:link,
- div.table_of_contents_item a:visited,
- div.table_of_contents_item a:active {
- color: #000000;
- }
-
- div.table_of_contents_item a:hover {
- background-color: #000000;
-
- color: #FFFFFF;
- }
-
- div.content_section_text a:link,
- div.content_section_text a:visited,
- div.content_section_text a:active {
- background-color: #DCDFE6;
-
- color: #000000;
- }
-
- div.content_section_text a:hover {
- background-color: #000000;
-
- color: #DCDFE6;
- }
-
- div.validator {
- }
- </style>
- </head>
- <body>
- <div class="main_page">
- <div class="page_header floating_element">
- <img src="/icons/ubuntu-logo.png" alt="Ubuntu Logo" class="floating_element"/>
- <span class="floating_element">
- Apache2 Ubuntu Default Page
- </span>
- </div>
-<!-- <div class="table_of_contents floating_element">
- <div class="section_header section_header_grey">
- TABLE OF CONTENTS
- </div>
- <div class="table_of_contents_item floating_element">
- <a href="#about">About</a>
- </div>
- <div class="table_of_contents_item floating_element">
- <a href="#changes">Changes</a>
- </div>
- <div class="table_of_contents_item floating_element">
- <a href="#scope">Scope</a>
- </div>
- <div class="table_of_contents_item floating_element">
- <a href="#files">Config files</a>
- </div>
- </div>
--->
- <div class="content_section floating_element">
-
-
- <div class="section_header section_header_red">
- <div id="about"></div>
- It works!
- </div>
- <div class="content_section_text">
- <p>
- This is the default welcome page used to test the correct
- operation of the Apache2 server after installation on Ubuntu systems.
- It is based on the equivalent page on Debian, from which the Ubuntu Apache
- packaging is derived.
- If you can read this page, it means that the Apache HTTP server installed at
- this site is working properly. You should <b>replace this file</b> (located at
- <tt>/var/www/html/index.html</tt>) before continuing to operate your HTTP server.
- </p>
-
-
- <p>
- If you are a normal user of this web site and don't know what this page is
- about, this probably means that the site is currently unavailable due to
- maintenance.
- If the problem persists, please contact the site's administrator.
- </p>
-
- </div>
- <div class="section_header">
- <div id="changes"></div>
- Configuration Overview
- </div>
- <div class="content_section_text">
- <p>
- Ubuntu's Apache2 default configuration is different from the
- upstream default configuration, and split into several files optimized for
- interaction with Ubuntu tools. The configuration system is
- <b>fully documented in
- /usr/share/doc/apache2/README.Debian.gz</b>. Refer to this for the full
- documentation. Documentation for the web server itself can be
- found by accessing the <a href="/manual">manual</a> if the <tt>apache2-doc</tt>
- package was installed on this server.
-
- </p>
- <p>
- The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows:
- </p>
- <pre>
-/etc/apache2/
-|-- apache2.conf
-| `-- ports.conf
-|-- mods-enabled
-| |-- *.load
-| `-- *.conf
-|-- conf-enabled
-| `-- *.conf
-|-- sites-enabled
-| `-- *.conf
- </pre>
- <ul>
- <li>
- <tt>apache2.conf</tt> is the main configuration
- file. It puts the pieces together by including all remaining configuration
- files when starting up the web server.
- </li>
-
- <li>
- <tt>ports.conf</tt> is always included from the
- main configuration file. It is used to determine the listening ports for
- incoming connections, and this file can be customized anytime.
- </li>
-
- <li>
- Configuration files in the <tt>mods-enabled/</tt>,
- <tt>conf-enabled/</tt> and <tt>sites-enabled/</tt> directories contain
- particular configuration snippets which manage modules, global configuration
- fragments, or virtual host configurations, respectively.
- </li>
-
- <li>
- They are activated by symlinking available
- configuration files from their respective
- *-available/ counterparts. These should be managed
- by using our helpers
- <tt>
- a2enmod,
- a2dismod,
- </tt>
- <tt>
- a2ensite,
- a2dissite,
- </tt>
- and
- <tt>
- a2enconf,
- a2disconf
- </tt>. See their respective man pages for detailed information.
- </li>
-
- <li>
- The binary is called apache2. Due to the use of
- environment variables, in the default configuration, apache2 needs to be
- started/stopped with <tt>/etc/init.d/apache2</tt> or <tt>apache2ctl</tt>.
- <b>Calling <tt>/usr/bin/apache2</tt> directly will not work</b> with the
- default configuration.
- </li>
- </ul>
- </div>
-
- <div class="section_header">
- <div id="docroot"></div>
- Document Roots
- </div>
-
- <div class="content_section_text">
- <p>
- By default, Ubuntu does not allow access through the web browser to
- <em>any</em> file apart of those located in <tt>/var/www</tt>,
- <a href="http://httpd.apache.org/docs/2.4/mod/mod_userdir.html" rel="nofollow">public_html</a>
- directories (when enabled) and <tt>/usr/share</tt> (for web
- applications). If your site is using a web document root
- located elsewhere (such as in <tt>/srv</tt>) you may need to whitelist your
- document root directory in <tt>/etc/apache2/apache2.conf</tt>.
- </p>
- <p>
- The default Ubuntu document root is <tt>/var/www/html</tt>. You
- can make your own virtual hosts under /var/www. This is different
- to previous releases which provides better security out of the box.
- </p>
- </div>
-
- <div class="section_header">
- <div id="bugs"></div>
- Reporting Problems
- </div>
- <div class="content_section_text">
- <p>
- Please use the <tt>ubuntu-bug</tt> tool to report bugs in the
- Apache2 package with Ubuntu. However, check <a
- href="https://bugs.launchpad.net/ubuntu/+source/apache2"
- rel="nofollow">existing bug reports</a> before reporting a new bug.
- </p>
- <p>
- Please report bugs specific to modules (such as PHP and others)
- to respective packages, not to the web server itself.
- </p>
- </div>
-
-
-
-
- </div>
- </div>
- <div class="validator">
- </div>
- </body>
-</html>
-
diff --git a/help3/xhpeditor/xhp2html.js b/help3/xhpeditor/xhp2html.js
index 1543b01..8b57cb9 100644
--- a/help3/xhpeditor/xhp2html.js
+++ b/help3/xhpeditor/xhp2html.js
@@ -11,7 +11,6 @@
var xhttp;
-
function loadDoc(filename, isXML)
{
if (window.ActiveXObject)
@@ -51,3 +50,31 @@ function readSingleFile(e) {
document.getElementById('file-input').addEventListener('change', readSingleFile, false);
+// XML parser of the poor...
+function getFileNameFromXML(){
+ var textXML = editor.doc.getValue();
+ var p1=textXML.lastIndexOf('<filename>');
+ var p2=textXML.lastIndexOf('</filename>');
+ return textXML.substring(p1+10,p2).split('/').pop();
+}
+
+
+// Function to download data to a file
+// source: https://stackoverflow.com/questions/13405129/javascript-create-and-save-file
+function download(data, filename, type) {
+ var file = new Blob([data], {type: type});
+ if (window.navigator.msSaveOrOpenBlob) // IE10+
+ window.navigator.msSaveOrOpenBlob(file, filename);
+ else { // Others
+ var a = document.createElement("a"),
+ url = URL.createObjectURL(file);
+ a.href = url;
+ a.download = filename;
+ document.body.appendChild(a);
+ a.click();
+ setTimeout(function() {
+ document.body.removeChild(a);
+ window.URL.revokeObjectURL(url);
+ }, 0);
+ }
+}
More information about the Libreoffice-commits
mailing list