From 7c4cc47475a5eef1dc30be04ee4f752882fd0cce Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Thu, 17 Mar 2016 16:25:39 -0300 Subject: New help system with browser and XSL transform See README.txt for initial information Change-Id: Iccb36975207db55c49bbfc8385bf78b948b77c2e Reviewed-on: https://gerrit.libreoffice.org/23343 Reviewed-by: Olivier Hallot Tested-by: Olivier Hallot --- help3xsl/README.txt | 115 +++++ help3xsl/addxsl2xhp.sh | 2 + help3xsl/default.css | 123 ++++++ help3xsl/index.html | 32 ++ help3xsl/online_transform.xsl | 972 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 1244 insertions(+) create mode 100644 help3xsl/README.txt create mode 100755 help3xsl/addxsl2xhp.sh create mode 100644 help3xsl/default.css create mode 100644 help3xsl/index.html create mode 100644 help3xsl/online_transform.xsl (limited to 'help3xsl') diff --git a/help3xsl/README.txt b/help3xsl/README.txt new file mode 100644 index 0000000000..2d7b87af2a --- /dev/null +++ b/help3xsl/README.txt @@ -0,0 +1,115 @@ +----------------------------------------------------------------- +Helpcontent displayed in a browser directly from XML +----------------------------------------------------------------- + +This folder contains components for displaying the Helpcontent2 XML +pages (XHP) from a webserver and also directly rendered in a modern +browser. + +----------------------------------------------------------------- +Background +----------------------------------------------------------------- + +The XML files must be transformed into HTML files with the help of +a style sheet file (XSL). + +In the current helpcontent2, the processing is done in xmlhelp/ +module, an ancient XSLT processor developed circa 2005 +(OpenOffice.org 1.5) + +Modern browsers such as Firefox, Chrome and Rekonq are capable to +execute the transformation direcly in the client, by getting an URL +that returns a XML file that contains the reference of the necessary +XSL style sheet. + +This is the objective of this exercise. + +----------------------------------------------------------------- +File descriptions +----------------------------------------------------------------- + +default.css: +------------- +the cascading style sheet for HTML formatting. + +index.html: +----------- +A dummy entry web page in the root folder of the server. + +online_transform.xsl: +-------------------- +the XSL transform file. This file is a modification of +xmlhelper/util/main_transform.xsl, which was designed for xmlhelp +XSL processor. + +The XSLT online_transform.xsl is highly parametrizable and has params +and variables ready to handle the proper paths and URLs of the server. + +----------------------------------------------------------------- +How to build the help website +----------------------------------------------------------------- + +Each XHP file of helpcontent2/ must have a reference to the XSL file +online_transform.xsl, placed in the root folder of the help website. + +Therefore it is necessary to copy all XHP files in a temporary folder +and change the first line, through the script in addxsl2xhp.sh + +Media files: Media files in helpcontent2 are located in module +icons-themes/ . It is necessary to create a media/ folder in the +webserver and copy the icon-themes folders and files in the right place. + +But media in XHP files also depends on the icon theme defined in the +LibreOffice View options. This issue is not addressed at the moment. + +XHP file modified by addxsl2xml.sh script must exist in text/ folder +in the root folder of the webserver. + +----------------------------------------------------------------- +Folder layout. +----------------------------------------------------------------- + +Root folder + / + default.css + online_transform.xsl + index.html + media/ + text/ + + +Notes: +1) The folder text/ is exactly the same as in helpcontent2/ minus the +first line. The first line has the declaration followed by the + declaration. NOTHING MORE. + +2) the online_transform.xsl is main_transform.xsl of HC2 modified to +accomodate the layout of the screen, It has 4
hooked in each of +the 4 corners of the browser screen to allow resizing. + +3) the lower-right
displays the help content + +4) the upper-left
has entries to change help books/modules + +5) the upper right
is available to place a search mechanism + +6) the lower-left
is available to inser a index with javascript + +7) index.html is just a top landing page. + +8) default.css is the css used in helpconten2/languages + +9) plenty of simplification/tweak is possible in the XSLT. + +10) The whole HC can be tranformed in html with XSLTPROC or any other +XSL processor, provided the reference to the XSL file is fixed, and +the xsl file be aware of the specifics of the XSL processor. + +11) Help pages can be acessed by +http:///help_file.xhp# + +12) Works with Firefox, Chrome, Rekonq. MS Edge does not understand +xml+xsl at first glance, likely to need some config, I guess. + +13) References to media are incomplete. That will require a change +in the urls of the media inside the help pages, thus forking from HC2 diff --git a/help3xsl/addxsl2xhp.sh b/help3xsl/addxsl2xhp.sh new file mode 100755 index 0000000000..da7d75bede --- /dev/null +++ b/help3xsl/addxsl2xhp.sh @@ -0,0 +1,2 @@ +#/bin/bash +find . -type f -name "*.xhp" -exec sed -i 's/UTF-8"?>/UTF-8"?>/g' {} + diff --git a/help3xsl/default.css b/help3xsl/default.css new file mode 100644 index 0000000000..e4ba6d58e2 --- /dev/null +++ b/help3xsl/default.css @@ -0,0 +1,123 @@ +/* + * 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ OPENOFFICE.ORG 2.0 HELP + ++ DEFAULT STYLESHEET + ++ WESTERN LANGUAGES + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ LAST CHANGES: 15-NOV-2004 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*/ + + +body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable + { font-family: "Albany AMT",Albany,Arial,"Nimbus Sans L","Bitstream Vera Sans",Helvetica,Lucida,Geneva,Helmet,"Andale Sans UI","Arial Unicode MS","Lucida Sans Unicode",Tahoma,sans-serif; } + +pre, .code, .codeintable, .example, .exampleintable, .literal, .literalintable, .path, .pathintable + { font-family: "Cumberland AMT",Cumberland,"Courier New","Nimbus Mono L","Bitstream Vera Sans Mono",Courier,"Lucida Sans Typewriter","Lucida Typewriter",Monaco,Monospaced; margin-top: 1pt; margin-bottom: 1pt;} + +.acronym + { font-weight: bold; } + +.related + { font-weight: bold; margin-top:20pt; border-top: 1px solid black;} + +.emph, .menuitem, .keycode + { font-weight: bold; } + +.tablehead, .tableheadintable + { font-weight: bold; margin-top: 0px;} + +.howtogetheader + { font-weight: bold; border: 1px solid #999999; background: #FFFFFF; padding: 3px;} + +h1, h2, h3, h4, h5, h6 + { margin-bottom: 5pt; } + +p, td + { font-size: 10pt; margin-top: 2px; margin-bottom: 2px;} + +h1 + { font-size: 18pt; border-bottom: 1px solid black; padding-bottom: 6px; margin-bottom: 6px;} + +h2 + { font-size: 14pt; } + +h3 + { font-size: 12pt; } + +h4, h5, h6 + { font-size: 10pt; } + +.relatedtopics + { font-weight: normal; } + +.relatedbody + { margin-top: 2px; margin-bottom: 2px; margin-left: 5px; } + +.howtoget + { background:#EEEEEE;} + +.howtogetbody + { background:#EEEEEE; margin: 0px;} + +.wide + { width: 100%; } + +.topalign + { vertical-align: top; border: 1px;} + +.bug + { color: red; border: 1px solid red;} + +.debug + { border: 1px solid black; padding: 3px; display: none;} + +/* Basic code syntax highlight */ +.identifier, .unknown + { color: green;} + +.keyword + { color: blue;} + +.comment + { color: gray;} + +.number, .string + { color: red;} + +.operator, .parameter + { color: black;} + +.hotlink + { color:blue;} + +.infopage + { color:green; + font-size:16pt; + font-weight:bold; + } +.topmenu{ + color:yellow; + background-color:cyan; + font-size:16pt; + font-weight:bold; +} + diff --git a/help3xsl/index.html b/help3xsl/index.html new file mode 100644 index 0000000000..bf3cbb737a --- /dev/null +++ b/help3xsl/index.html @@ -0,0 +1,32 @@ + + + + + + +
+

Display

+ +
+
+

Index

+
+ +
+

Top Right

+
+
+ + + + + + + + + + +
CalcWriterImpressDrawChartMathBase
+
+ + diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl new file mode 100644 index 0000000000..80f3ea3b7b --- /dev/null +++ b/help3xsl/online_transform.xsl @@ -0,0 +1,972 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <xsl:value-of select="$title"/> + + + + +
+ +
+
+

Index will be put here

+
+
+

Top Right Area

+
+
+ + + + + + + + + + + +
CalcWriterImpressDrawChartBasicMathBase
+

This page is:

+
+ + +
+ + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + +
+
+ +
+
+
+
+ + + + +
    + + + + +
+
+ +
+
+
+
+ + + +
  • +
    + + +
  • +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + +
    +
    +
    + + + + + + + + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +
    + + + +
    +
    + + + +
    +
    + + + + + + + + + + + + +
    +

    +
    + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    image source:

    +
    + + + + + +
    {$alt}
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    + +

    +
    + +

    + +

    +
    + +

    D'oh! You found a bug ( not found).

    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +

    Image:

    + + + + + {$alt} + + + +
    + + + + + + + + + + + + +
    +
    + + + + +
    +
    + + + + +
    +
    + + + + +
    +
    + + + + +
    +
    +
    + +
    +
    + + +
    + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + [ not found]. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -- cgit