[Libreoffice-commits] dev-tools.git: help3/html
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Jan 12 11:33:10 UTC 2019
help3/html/index.html | 64 +++++++++++++++++++++++++++++--------------------
help3/html/snippets.js | 11 ++++++--
help3/html/xhp2html.js | 16 ++++++------
3 files changed, 55 insertions(+), 36 deletions(-)
New commits:
commit 0dc81dd300ec53a21eaec8e2a97ecd44d08f7483
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Sat Jan 12 08:29:56 2019 -0200
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Sat Jan 12 12:32:52 2019 +0100
Some tweaks in the editor UI
simplify snippets too
Change-Id: I0a8a76a25aa570b7f862d84b0d4ae16431bf39bc
Reviewed-on: https://gerrit.libreoffice.org/66211
Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>
diff --git a/help3/html/index.html b/help3/html/index.html
index b762ac5..9be92ca 100644
--- a/help3/html/index.html
+++ b/help3/html/index.html
@@ -14,11 +14,16 @@
<link rel="stylesheet" href="xhpeditor.css">
<link rel="stylesheet" href="lib/codemirror.css">
<link rel="stylesheet" href="addon/hint/show-hint.css">
- <script type="text/javascript" src="xhp2html.js"></script>
+ <link rel="stylesheet" href="/help_editor/hc2/help3xsl/normalize.css">
+ <link rel="stylesheet" href="/help_editor/hc2/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="/help_editor/hc2/help3xsl/help2.js"></script>
+ <script type="text/javascript" src="/help_editor/hc2/help3xsl/prism.js"></script>
</head>
<body style="font-family:sans-serif;">
@@ -27,68 +32,74 @@
<form class="form_area">
<textarea id="xhpeditor"></textarea>
</form>
-
<br />
-
- <div><div class="snip_div">Actions:</div>
+ <div class="snip_heading"><div class="snip_div">Actions: </div>
+ <p>File name: source/text/<input type="text" id="01" name="filename" value=""/><button onclick="loadText('source/text/'+document.getElementById('01').value);">Open File</button></p>
+ <p>File name: <input type="text" id="02" name="filename" value=""/><button onclick="alert('Not yet implemented, but you can copy the text to the clipboard!');">Save Changes</button>
+ <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>
- <button onclick="alert('Not yet implemented...')">Save changes</button>
- <button onclick="displayResult()">Render page</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Document:</div>
+ <div class="snip_heading"><div class="snip_div">Document:</div>
<button onclick="startNewXHPDoc()" class="snip_buttons">Start new XHP document</button>
<button onclick="docHeading()" class="snip_buttons">DocHeading</button>
<button onclick="snippet7()" class="snip_buttons">ahelp</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Bookmarks:</div>
- <button onclick="bookmarkValue()" class="snip_buttons">bookmark-value</button>
- <button onclick="bookmarkBranch()" class="snip_buttons">bookmark-hid</button>
- <button onclick="bookmarkIndex()" class="snip_buttons">bookmark-index</button>
- <button onclick="bookmarkNoWidget()" class="snip_buttons">bookmark-nowidget</button>
+ <div class="snip_heading"><div class="snip_div">Bookmarks: </div>
+ <button onclick="bookmarkValue()" class="snip_buttons">bk-value</button>
+ <button onclick="bookmarkBranch()" class="snip_buttons">bk-hid</button>
+ <button onclick="bookmarkIndex()" class="snip_buttons">bk-index</button>
+ <button onclick="bookmarkNoWidget()" class="snip_buttons">bk-nowidget</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Sections:</div>
+ <div class="snip_heading"><div class="snip_div">Sections: </div>
+ <button onclick="section_div()" class="snip_buttons">Section</button>
<button onclick="related_topics()" class="snip_buttons">Related Topics</button>
<button onclick="howtoget()" class="snip_buttons">How to get</button>
<button onclick="bascode_div()" class="snip_buttons">bascode div</button>
+ <button onclick="pycode_div()" class="snip_buttons">pycode div</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Tables:</div>
+ <div class="snip_heading"><div class="snip_div">Tables: </div>
<button onclick="table2R3C()" class="snip_buttons">Table Full</button>
<button onclick="tableRow()" class="snip_buttons">TableRow</button>
<button onclick="tableCell()" class="snip_buttons">Table Cell</button>
<button onclick="iconTable()" class="snip_buttons">Icon Table</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Paragraph:</div>
+ <div class="snip_heading"><div class="snip_div">Paragraph: </div>
<button onclick="paragraph('paragraph')" class="snip_buttons">paragraph</button>
- <button onclick="paragraph('note')" class="snip_buttons">note</button>
- <button onclick="paragraph('warning')" class="snip_buttons">warning</button>
- <button onclick="paragraph('tip')" class="snip_buttons">tip</button>
+ <button onclick="note()" class="snip_buttons">note</button>
+ <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 style="margin-top:10px;"><div class="snip_div">Characters:</div>
+ <div class="snip_heading"><div class="snip_div">Characters: </div>
<button onclick="emph()" class="snip_buttons">emph</button>
- <button onclick="item('menuitem')" class="snip_buttons">item menuitem</button>
- <button onclick="item('input')" class="snip_buttons">item input</button>
- <button onclick="item('literal')" class="snip_buttons">item literal</button>
+ <button onclick="c_menuitem()" class="snip_buttons">menuitem</button>
+ <button onclick="_input()" class="snip_buttons">input</button>
+ <button onclick="_literal()" class="snip_buttons">literal</button>
+ <button onclick="_keystroke()" class="snip_buttons">keystroke</button>
+ <button onclick="_widget()" class="snip_buttons">widget</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Headings:</div>
+ <div class="snip_heading"><div class="snip_div">Headings: </div>
<button onclick="heading('1')" class="snip_buttons">H1</button>
<button onclick="heading('2')" class="snip_buttons">H2</button>
<button onclick="heading('3')" class="snip_buttons">H3</button>
<button onclick="heading('4')" class="snip_buttons">H4</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Switches:</div>
+ <div class="snip_heading"><div class="snip_div">Switches: </div>
<button onclick="switchXHP('appl')" class="snip_buttons">Switch appl</button>
<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>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Lists:</div>
+ <div class="snip_heading"><div class="snip_div">Lists: </div>
<button onclick="tList('unordered')" class="snip_buttons">UL</button>
<button onclick="tList('ordered')" class="snip_buttons">OL</button>
<button onclick="listItem()" class="snip_buttons">List Item</button>
</div>
- <div style="margin-top:10px;"><div class="snip_div">Links:</div>
+ <div class="snip_heading"><div class="snip_div">Links: </div>
<button onclick="tVariable()" class="snip_buttons">Variable</button>
<button onclick="tEmbed()" class="snip_buttons">Embed</button>
<button onclick="tEmbedvar()" class="snip_buttons">Embedvar</button>
@@ -100,6 +111,7 @@
<div id="renderedpage"></div>
</div>
</body>
+<script type="text/javascript" src="/help_editor/hc2/help3xsl/help.js"></script>
<script type="text/javascript" src="autocomplete.js"></script>
<script type="text/javascript" src="snippets.js"></script>
</html>
diff --git a/help3/html/snippets.js b/help3/html/snippets.js
index c8d5309..e19de9a 100644
--- a/help3/html/snippets.js
+++ b/help3/html/snippets.js
@@ -20,8 +20,8 @@ function startNewXHPDoc() {
}
function docHeading() {
var a1 = '<section id="CHANGE ME">\n <bookmark id="' + random('bm') + '" xml-lang="en-US" branch="hid/CHANGE ME" localize="false"/>\n';
- var a2 = ' <paragraph id="' + random('hd') + '" role="heading" level="1" xml-lang="en-US"><link href="HELP FILE URL" name="CHANGE ME">CHANGE ME</link></paragraph>\n';
- var a3 = ' <paragraph id="' + random('par') + '" role="paragraph" xml-lang="en-US"><variable id="CHANGE ME"><ahelp hid="CHANGE ME">CHANGE ME</ahelp></variable></paragraph>\n\n</section>\n';
+ var a2 = ' <h1 id="' + random('hd') + '><link href="HELP FILE URL" name="CHANGE ME">CHANGE ME</link></h1>\n';
+ var a3 = ' <paragraph id="' + random('par') + '" role="paragraph"><variable id="CHANGE ME"><ahelp hid="CHANGE ME">CHANGE ME</ahelp></variable></paragraph>\n\n</section>\n';
editor.replaceRange(a1 + a2 + a3 , editor.doc.getCursor());
}
@@ -61,6 +61,11 @@ function bascode_par() {
var a2 = '</paragraph>\n';
editor.replaceSelection(a1 + editor.doc.getSelection() + a2,'');
}
+function pycode_par() {
+ var a1 = '<paragraph role="pycode" id="' + random('bas') + '">';
+ var a2 = '</paragraph>\n';
+ editor.replaceSelection(a1 + editor.doc.getSelection() + a2,'');
+}
// Tables
// simple table cell
@@ -188,7 +193,7 @@ function tList(mode){
}
function listItem(){
- var a1 = ' <listitem>\n <paragraph id="' + random('par') + '" role="listitem" xml-lang="en-US">';
+ var a1 = ' <listitem>\n <paragraph id="' + random('par') + '" role="listitem">';
var a2 = '</paragraph>\n </listitem>\n';
editor.replaceSelection(a1+ editor.doc.getSelection() + a2,'');
}
diff --git a/help3/html/xhp2html.js b/help3/html/xhp2html.js
index 6d21dff..d50c51e 100644
--- a/help3/html/xhp2html.js
+++ b/help3/html/xhp2html.js
@@ -9,11 +9,11 @@
/* change these parameters to fit your installation */
-var prefixURL="http://localhost/ed/"
-var helpcontent2 = "/hc2/";
+var prefixURL="/help_editor/"
+var helpcontent2 = "hc2/";
var productname = "LibreOffice";
var productversion = "6.3";
-var root = helpcontent2 + "source/";
+var root = prefixURL + helpcontent2 + "source/";
var language = "en-US";
var local = "no";
var xhttp;
@@ -34,13 +34,11 @@ function loadDoc(filename, isXML)
// // Typical action to be performed when the document is ready:
// }
// };
-
xhttp.open("GET", prefixURL + filename, false);
try {xhttp.responseType = "msxml-document"} catch(err) {} // Helping IE11
// if isXML=true return XML otherwise return a text string
xhttp.send(null);
var response = (isXML) ? xhttp.responseXML : xhttp.responseText;
- delete xhttp;
return response
}
@@ -52,8 +50,12 @@ function displayResult()
editor.changeGeneration();
// create a DOM parser for textarea contents
var oParser = new DOMParser();
- // Parse XML contents
- var xml = oParser.parseFromString( editor.doc.getValue(), "application/xml");
+ // Parse XML contents, check if XML error.
+ var xml = oParser.parseFromString( editor.doc.getValue(), "text/xml");
+ if (xml.documentElement.nodeName == "parsererror")
+ {
+ alert ("Error while parsing XHP");
+ }
// Load XSLT as TXT because XML it has issues
var xsl1 = loadDoc("ed_transform.xsl", false);
var oParser2 = new DOMParser();
More information about the Libreoffice-commits
mailing list