aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2014-04-30 16:07:16 -0400
committerJeff Johnston2014-04-30 18:33:27 -0400
commitd22057bec9b9f4714b2218ca75d9cf0b82af94bc (patch)
treeec615737aa51d721944481132590139451f9b498 /libhover
parent64d9e6b3b0f9090ae793875504953d6ae9b54cb1 (diff)
downloadorg.eclipse.linuxtools-d22057bec9b9f4714b2218ca75d9cf0b82af94bc.zip
org.eclipse.linuxtools-d22057bec9b9f4714b2218ca75d9cf0b82af94bc.tar.gz
org.eclipse.linuxtools-d22057bec9b9f4714b2218ca75d9cf0b82af94bc.tar.xz
Bug 433507 - parsing latest gtk-doc devhelp docs not correct
- Fix devhelp parsing to do proper checking for div markers and to properly parse a refsect2 function reference - also add fix for the new usage of non-breaking spaces in the devhelp generated html pages which String trim() method cannot remove - add new devhelp test to generate libhover for a sample project Change-Id: Ic09d25b8009c087c7f8f44a501196af5c5c2dd2a Reviewed-on: https://git.eclipse.org/r/25823 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
Diffstat (limited to 'libhover')
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.devhelp214
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.html149
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp2.html53
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/style.css461
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/src/org/eclipse/linuxtools/cdt/libhover/devhelp/test/CheckDevhelp.java127
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java24
-rw-r--r--libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/LibHoverPreferencePage.java4
7 files changed, 797 insertions, 35 deletions
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.devhelp2 b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.devhelp2
new file mode 100644
index 0000000..50b8dda
--- /dev/null
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.devhelp2
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE book PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
+<book xmlns="http://www.devhelp.net/book" title="MyApp 1.0 Reference Manual" link="index.html" author="" name="myapp-1.0" version="2" language="c">
+ <chapters>
+ <sub name="My App Overview" link="myapp.html">
+ </sub>
+ </chapters>
+ <functions>
+ <keyword type="macro" name="MY_APP_MACRO" link="myapp.html#MY_APP_MACRO:CAPS"/>
+ <keyword type="function" name="myapp_init ()" link="myapp.html#myapp-init"/>
+ <keyword type="function" name="myapp_init_check ()" link="myapp.html#myapp-init-check"/>
+ <keyword type="enum" name="enum MyAppEnum" link="myapp.html#MyAppEnum"/>
+ </functions>
+</book>
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.html b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.html
new file mode 100644
index 0000000..69ec8bd
--- /dev/null
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp.html
@@ -0,0 +1,149 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>MyApp 1.0 Reference Manual: MyApp</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<meta name="generator" content="GTK-Doc V1.20 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="refentry">
+<a name="myApp"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="myApp-myapp.top_of_page"></a>MyApp</span></h2>
+<p>MyApp — My App - devhelp test.</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="myapp-myapp.functions"></a><h2>Functions</h2>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="functions_return">
+<col class="functions_name">
+</colgroup>
+<tbody>
+<tr>
+<td class="function_type">
+<span class="returnvalue">void</span>
+</td>
+<td class="function_name">
+<a class="link" href="myapp.html#myapp-init" title="myapp_init ()">myapp_init</a> <span class="c_punctuation">()</span>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect1">
+<a name="myapp-functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="myapp-init"></a><h3>myapp_init ()</h3>
+<pre class="programlisting"><span class="returnvalue">void</span>
+myapp_init (<em class="parameter"><code><span class="type">int</span> *argc</code></em>,
+ <em class="parameter"><code><span class="type">char</span> **argv[]</code></em>);</pre>
+<p>Initializes the MyApp application, setting up internal path lists,
+registering built-in elements, and loading standard plugins.</p>
+<p>Unless the plugin registry is disabled at compile time, the registry will be
+loaded. By default this will also check if the registry cache needs to be
+updated and rescan all plugins if needed.
+</p>
+See "Running MyApp Applications</a><p>for how to disable automatic updates.</p>
+<div class="note"><p>
+This function will terminate your program if it was unable to initialize
+myApp for some reason. If you want your program to fall back,
+use <code class="function">myapp_init_check()</code> instead.
+</p></div>
+<p>WARNING: This function does not work in the same way as corresponding
+functions in other libraries, such as <code class="function">otherapp_init()</code></a>. In
+particular, unknown command line options cause this function to
+abort program execution.</p>
+<div class="refsect3">
+<a name="id-1.3.3.7.2.10"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>argc</p></td>
+<td class="parameter_description"><p> pointer to application's argc. </p></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>argv</p></td>
+<td class="parameter_description"><p> pointer to application's argv. </p></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<hr>
+<div class="refsect2">
+<a name="myapp-init-check"></a><h3>myapp_init_check ()</h3>
+<pre class="programlisting"><a href="myapp2.html#mboolean"><span class="returnvalue">mboolean</span></a>
+myapp_init_check (<em class="parameter"><code><span class="type">int</span> *argc</code></em>,
+ <em class="parameter"><code><span class="type">char</span> **argv[]</code></em>,
+ <em class="parameter"><code><a href="myapp2.html#MError"><span class="type">MError</span></a> **err</code></em>);</pre>
+<p>Initializes the MyApp application and performs a check.
+<p>This function will return <a href="myapp2.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if MyApp could not be initialized
+for some reason. If you want your program to fail fatally,
+use <a class="link" href="myapp.html#myapp-init" title="myapp_init ()"><code class="function">myapp_init()</code></a> instead.</p>
+<div class="refsect3">
+<a name="id-1.3.3.7.3.6"></a><h4>Parameters</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="150px" class="parameters_name">
+<col class="parameters_description">
+</colgroup>
+<tbody>
+<tr>
+<td class="parameter_name"><p>argc</p></td>
+<td class="parameter_description"><p> pointer to application's argc. </p></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>argv</p></td>
+<td class="parameter_description"><p> pointer to application's argv. </p></td>
+</tr>
+<tr>
+<td class="parameter_name"><p>err</p></td>
+<td class="parameter_description"><p>pointer to a <a href="myapp2.html#MError"><span class="type">MError</span></a> to which a message will be posted on error</p></td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="refsect3">
+<a name="id-1.3.3.7.3.7"></a><h4>Returns</h4>
+<p> <a href="myapp2.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if MyApp could be initialized.</p>
+<p></p>
+</div>
+</div>
+<div class="refsect2">
+<a name="Flags"></a><h3>enum MyAppEnum</h3>
+<p>Flags for myapp.</p>
+<div class="refsect3">
+<a name="id-1.3.4.9.3.4"></a><h4>Members</h4>
+<div class="informaltable"><table width="100%" border="0">
+<colgroup>
+<col width="300px" class="enum_members_name">
+<col class="enum_members_description">
+</colgroup>
+<tbody>
+<tr>
+<td class="enum_member_name"><p><a name="MY_APP_MACRO:CAPS"></a>MY_APP_MACRO</p></td>
+<td class="enum_member_description">
+<p>Special flag.</p>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+
+<hr>
+<div class="footer">
+<hr>
+ Modified for libhover devhelp testing</div>
+</body>
+</html>
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp2.html b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp2.html
new file mode 100644
index 0000000..d752feb
--- /dev/null
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/myapp2.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>MyApp 1.0 Reference Manual: MyApp</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
+<meta name="generator" content="GTK-Doc V1.20 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="refentry">
+<a name="myApp"></a><div class="titlepage"></div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle"><a name="myApp2-myapp2.top_of_page"></a>MyApp</span></h2>
+<p>MyApp2 — My App2 - devhelp test.</p>
+</td>
+<td class="gallery_image" valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsect1">
+<a name="myapp2-functions_details"></a><h2>Functions</h2>
+<div class="refsect2">
+<a name="mboolean"></a><h3>mboolean</h3>
+<pre class="programlisting">#define mboolean int
+</pre>
+<p>Boolean value.</p>
+</div>
+<div class="refsect2">
+<a name="MError"></a><h3>MError</h3>
+<pre class="programlisting">#define MError 1
+</pre>
+<p>My app error.</p>
+</div>
+<div class="refsect2">
+<a name="TRUE"></a><h3>TRUE</h3>
+<pre class="programlisting">#define TRUE 1
+</pre>
+<p>True value.</p>
+</div>
+<div class="refsect2">
+<a name="FALSE"></a><h3>FALSE</h3>
+<pre class="programlisting">#define FALSE 0
+</pre>
+<p>False value.</p>
+</div>
+</div>
+
+<hr>
+<div class="footer">
+<hr>
+ Modified for libhover devhelp testing</div>
+</body>
+</html>
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/style.css b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/style.css
new file mode 100644
index 0000000..705a5c9
--- /dev/null
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/devhelp/html2/myapp/style.css
@@ -0,0 +1,461 @@
+body
+{
+ font-family: cantarell, sans-serif;
+}
+.synopsis, .classsynopsis
+{
+ /* tango:aluminium 1/2 */
+ background: #eeeeec;
+ background: rgba(238, 238, 236, 0.5);
+ border: solid 1px rgb(238, 238, 236);
+ padding: 0.5em;
+}
+.programlisting
+{
+ /* tango:sky blue 0/1 */
+ /* fallback for no rgba support */
+ background: #e6f3ff;
+ border: solid 1px #729fcf;
+ background: rgba(114, 159, 207, 0.1);
+ border: solid 1px rgba(114, 159, 207, 0.2);
+ padding: 0.5em;
+}
+.variablelist
+{
+ padding: 4px;
+ margin-left: 3em;
+}
+.variablelist td:first-child
+{
+ vertical-align: top;
+}
+
+@media screen {
+ sup a.footnote
+ {
+ position: relative;
+ top: 0em ! important;
+ }
+ /* this is needed so that the local anchors are displayed below the naviagtion */
+ div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name]
+ {
+ display: inline-block;
+ position: relative;
+ top:-5em;
+ }
+ /* this seems to be a bug in the xsl style sheets when generating indexes */
+ div.index div.index
+ {
+ top: 0em;
+ }
+ /* make space for the fixed navigation bar and add space at the bottom so that
+ * link targets appear somewhat close to top
+ */
+ body
+ {
+ padding-top: 5em;
+ padding-bottom: 500px;
+ max-width: 60em;
+ }
+ p
+ {
+ max-width: 60em;
+ }
+ /* style and size the navigation bar */
+ table.navigation#top
+ {
+ position: fixed;
+ background: #e2e2e2;
+ border-bottom: solid 1px #babdb6;
+ margin-top: 0;
+ margin-bottom: 0;
+ top: 0;
+ left: 0;
+ height: 3em;
+ z-index: 10;
+ }
+ .navigation a, .navigation a:visited
+ {
+ /* tango:sky blue 3 */
+ color: #204a87;
+ }
+ .navigation a:hover
+ {
+ /* tango:sky blue 2 */
+ color: #3465a4;
+ }
+ td.shortcuts
+ {
+ /* tango:sky blue 2 */
+ color: #3465a4;
+ font-size: 80%;
+ white-space: nowrap;
+ }
+ td.shortcuts .dim
+ {
+ color: #babdb6;
+ }
+}
+@media screen and (min-width: 60em) {
+ /* screen larger than 60em */
+ body { margin: auto; }
+}
+@media screen and (max-width: 60em) {
+ /* screen less than 60em */
+ #nav_hierarchy { display: none; }
+ #nav_interfaces { display: none; }
+ #nav_prerequisites { display: none; }
+ #nav_derived_interfaces { display: none; }
+ #nav_implementations { display: none; }
+ #nav_child_properties { display: none; }
+ #nav_style_properties { display: none; }
+ #nav_index { display: none; }
+ #nav_glossary { display: none; }
+ .gallery_image { display: none; }
+ .property_flags { display: none; }
+ .signal_flags { display: none; }
+ .parameter_annotations { display: none; }
+ .enum_member_annotations { display: none; }
+ .struct_member_annotations { display: none; }
+ .union_member_annotations { display: none; }
+ /* now that a column is hidden, optimize space */
+ col.parameters_name { width: auto; }
+ col.parameters_description { width: auto; }
+ col.struct_members_name { width: auto; }
+ col.struct_members_description { width: auto; }
+ col.enum_members_name { width: auto; }
+ col.enum_members_description { width: auto; }
+ col.union_members_name { width: auto; }
+ col.union_members_description { width: auto; }
+}
+@media print {
+ table.navigation {
+ visibility: collapse;
+ display: none;
+ }
+ div.titlepage table.navigation {
+ visibility: visible;
+ display: table;
+ background: #e2e2e2;
+ border: solid 1px #babdb6;
+ margin-top: 0;
+ margin-bottom: 0;
+ top: 0;
+ left: 0;
+ height: 3em;
+ }
+}
+
+.navigation .title
+{
+ font-size: 120%;
+}
+
+div.gallery-float
+{
+ float: left;
+ padding: 10px;
+}
+div.gallery-float img
+{
+ border-style: none;
+}
+div.gallery-spacer
+{
+ clear: both;
+}
+
+a, a:visited
+{
+ text-decoration: none;
+ /* tango:sky blue 2 */
+ color: #3465a4;
+}
+a:hover
+{
+ text-decoration: underline;
+ /* tango:sky blue 1 */
+ color: #729fcf;
+}
+
+div.informaltable table
+{
+ border-collapse: separate;
+ border-spacing: 20px 3px;
+ border: none;
+}
+
+div.informaltable table td, div.informaltable table th
+{
+ vertical-align: top;
+}
+
+.function_type,
+.variable_type,
+.property_type,
+.signal_type,
+.parameter_name,
+.struct_member_name,
+.union_member_name,
+.define_keyword,
+.datatype_keyword,
+.typedef_keyword
+{
+ text-align: right;
+}
+
+/* dim non-primary columns */
+.c_punctuation,
+.function_type,
+.variable_type,
+.property_type,
+.signal_type,
+.define_keyword,
+.datatype_keyword,
+.typedef_keyword,
+.property_flags,
+.signal_flags,
+.parameter_annotations,
+.enum_member_annotations,
+.struct_member_annotations,
+.union_member_annotations
+{
+ color: #888a85;
+}
+
+.function_type a,
+.function_type a:visited,
+.function_type a:hover,
+.property_type a,
+.property_type a:visited,
+.property_type a:hover,
+.signal_type a,
+.signal_type a:visited,
+.signal_type a:hover,
+.signal_flags a,
+.signal_flags a:visited,
+.signal_flags a:hover
+{
+ color: #729fcf;
+}
+
+div.table table
+{
+ border-collapse: collapse;
+ border-spacing: 0px;
+ /* tango:aluminium 3 */
+ border: solid 1px #babdb6;
+}
+
+div.table table td, div.table table th
+{
+ /* tango:aluminium 3 */
+ border: solid 1px #babdb6;
+ padding: 3px;
+ vertical-align: top;
+}
+
+div.table table th
+{
+ /* tango:aluminium 2 */
+ background-color: #d3d7cf;
+}
+
+h4
+{
+ color: #555753;
+}
+
+hr
+{
+ /* tango:aluminium 1 */
+ color: #d3d7cf;
+ background: #d3d7cf;
+ border: none 0px;
+ height: 1px;
+ clear: both;
+ margin: 2.0em 0em 2.0em 0em;
+}
+
+dl.toc dt
+{
+ padding-bottom: 0.25em;
+}
+
+dl.toc > dd > dl > dt
+{
+ padding-top: 0.25em;
+ padding-bottom: 0.25em;
+}
+
+dl.toc > dt
+{
+ padding-top: 1em;
+ padding-bottom: 0.5em;
+ font-weight: bold;
+}
+
+.parameter
+{
+ font-style: normal;
+}
+
+.footer
+{
+ padding-top: 3.5em;
+ /* tango:aluminium 3 */
+ color: #babdb6;
+ text-align: center;
+ font-size: 80%;
+}
+
+.informalfigure,
+.figure
+{
+ margin: 1em;
+}
+
+.informalexample,
+.example
+{
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.warning
+{
+ /* tango:orange 0/1 */
+ background: #ffeed9;
+ background: rgba(252, 175, 62, 0.1);
+ border-color: #ffb04f;
+ border-color: rgba(252, 175, 62, 0.2);
+}
+.note
+{
+ /* tango:chameleon 0/0.5 */
+ background: #d8ffb2;
+ background: rgba(138, 226, 52, 0.1);
+ border-color: #abf562;
+ border-color: rgba(138, 226, 52, 0.2);
+}
+div.blockquote
+{
+ border-color: #eeeeec;
+}
+.note, .warning, div.blockquote
+{
+ padding: 0.5em;
+ border-width: 1px;
+ border-style: solid;
+ margin: 2em;
+}
+.note p, .warning p
+{
+ margin: 0;
+}
+
+div.warning h3.title,
+div.note h3.title
+{
+ display: none;
+}
+
+p + div.section
+{
+ margin-top: 1em;
+}
+
+div.refnamediv,
+div.refsynopsisdiv,
+div.refsect1,
+div.refsect2,
+div.toc,
+div.section
+{
+ margin-bottom: 1em;
+}
+
+/* blob links */
+h2 .extralinks, h3 .extralinks
+{
+ float: right;
+ /* tango:aluminium 3 */
+ color: #babdb6;
+ font-size: 80%;
+ font-weight: normal;
+}
+
+.lineart
+{
+ color: #d3d7cf;
+ font-weight: normal;
+}
+
+.annotation
+{
+ /* tango:aluminium 5 */
+ color: #555753;
+ font-weight: normal;
+}
+
+.structfield
+{
+ font-style: normal;
+ font-weight: normal;
+}
+
+/* code listings */
+
+.listing_code .programlisting .cbracket { color: #a40000; } /* tango: scarlet red 3 */
+.listing_code .programlisting .comment { color: #a1a39d; } /* tango: aluminium 4 */
+.listing_code .programlisting .function { color: #000000; font-weight: bold; }
+.listing_code .programlisting .function a { color: #11326b; font-weight: bold; } /* tango: sky blue 4 */
+.listing_code .programlisting .keyword { color: #4e9a06; } /* tango: chameleon 3 */
+.listing_code .programlisting .linenum { color: #babdb6; } /* tango: aluminium 3 */
+.listing_code .programlisting .normal { color: #000000; }
+.listing_code .programlisting .number { color: #75507b; } /* tango: plum 2 */
+.listing_code .programlisting .preproc { color: #204a87; } /* tango: sky blue 3 */
+.listing_code .programlisting .string { color: #c17d11; } /* tango: chocolate 2 */
+.listing_code .programlisting .type { color: #000000; }
+.listing_code .programlisting .type a { color: #11326b; } /* tango: sky blue 4 */
+.listing_code .programlisting .symbol { color: #ce5c00; } /* tango: orange 3 */
+
+.listing_frame {
+ /* tango:sky blue 1 */
+ border: solid 1px #729fcf;
+ border: solid 1px rgba(114, 159, 207, 0.2);
+ padding: 0px;
+}
+
+.listing_lines, .listing_code {
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0.5em;
+}
+.listing_lines {
+ /* this just adds visual clutter and
+ takes precious room from small screens */
+ display: none;
+}
+.listing_lines {
+ /* tango:sky blue 0.5 */
+ background: #a6c5e3;
+ background: rgba(114, 159, 207, 0.2);
+ /* tango:aluminium 6 */
+ color: #2e3436;
+}
+.listing_code {
+ /* tango:sky blue 0 */
+ background: #e6f3ff;
+ background: rgba(114, 159, 207, 0.1);
+}
+.listing_code .programlisting {
+ /* override from previous */
+ border: none 0px;
+ padding: 0px;
+ background: none;
+}
+.listing_lines pre, .listing_code pre {
+ margin: 0px;
+}
+
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/src/org/eclipse/linuxtools/cdt/libhover/devhelp/test/CheckDevhelp.java b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/src/org/eclipse/linuxtools/cdt/libhover/devhelp/test/CheckDevhelp.java
index 6d36981..e9ce94f 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/src/org/eclipse/linuxtools/cdt/libhover/devhelp/test/CheckDevhelp.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp.tests/src/org/eclipse/linuxtools/cdt/libhover/devhelp/test/CheckDevhelp.java
@@ -59,38 +59,101 @@ public class CheckDevhelp {
f.delete();
}
- @Test
- public void testParse() throws IOException {
- ParseDevHelp.DevHelpParser p = new ParseDevHelp.DevHelpParser(
- "/usr/share/gtk-doc/html"); //$NON-NLS-1$
- LibHoverInfo hover = p.parse(new NullProgressMonitor());
- assertNotNull(hover);
- Map<String, FunctionInfo> functions = hover.functions;
- assertNotNull(functions);
- assertFalse(functions.isEmpty());
- // Now, output the LibHoverInfo for caching later
- IPath location = LibhoverPlugin.getDefault().getStateLocation()
- .append("C"); //$NON-NLS-1$
- File ldir = new File(location.toOSString());
- ldir.mkdir();
- location = location.append("devhelp.libhover"); //$NON-NLS-1$
- try (FileOutputStream f = new FileOutputStream(location.toOSString());
- ObjectOutputStream out = new ObjectOutputStream(f)) {
- out.writeObject(hover);
- }
- IPreferenceStore ps = LibhoverPlugin.getDefault().getPreferenceStore();
- ps.setValue(CACHE_EXT_LIBHOVER, true);
- LibHover.getLibHoverDocs();
- Collection<LibHoverLibrary> c = LibHover.getLibraries();
- assertFalse(c.isEmpty());
- boolean found = false;
- for (LibHoverLibrary l : c) {
- if (l.getName().equals("devhelp")) { //$NON-NLS-1$
- found = true;
- }
- }
- assertTrue(found);
- }
+ @Test
+ public void testParse() throws IOException {
+ ParseDevHelp.DevHelpParser p = new ParseDevHelp.DevHelpParser(
+ "/usr/share/gtk-doc/html"); //$NON-NLS-1$
+ LibHoverInfo hover = p.parse(new NullProgressMonitor());
+ assertNotNull(hover);
+ Map<String, FunctionInfo> functions = hover.functions;
+ assertNotNull(functions);
+ assertFalse(functions.isEmpty());
+ // Now, output the LibHoverInfo for caching later
+ IPath location = LibhoverPlugin.getDefault().getStateLocation()
+ .append("C"); //$NON-NLS-1$
+ File ldir = new File(location.toOSString());
+ ldir.mkdir();
+ location = location.append("devhelp.libhover"); //$NON-NLS-1$
+ try (FileOutputStream f = new FileOutputStream(location.toOSString());
+ ObjectOutputStream out = new ObjectOutputStream(f)) {
+ out.writeObject(hover);
+ }
+ IPreferenceStore ps = LibhoverPlugin.getDefault().getPreferenceStore();
+ ps.setValue(CACHE_EXT_LIBHOVER, true);
+ LibHover.getLibHoverDocs();
+ Collection<LibHoverLibrary> c = LibHover.getLibraries();
+ assertFalse(c.isEmpty());
+ boolean found = false;
+ for (LibHoverLibrary l : c) {
+ if (l.getName().equals("devhelp")) { //$NON-NLS-1$
+ found = true;
+ }
+ }
+ assertTrue(found);
+ }
+
+ @Test
+ public void testParseMyApp() throws IOException {
+ // We need to have a devhelp directory with contents to test.
+ // Copy over the needed devhelp/html2 contents in this test plug-in
+ // to the workspace. This test verifies: bug 433507 and also
+ // tests non-breaking spaces used in latest gtk-doc devhelp generation.
+ ClassLoader cl = getClass().getClassLoader();
+ Bundle bundle = null;
+ if (cl instanceof BundleReference) {
+ bundle = ((BundleReference) cl).getBundle();
+ }
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+ IPath wslocpath = ws.getRoot().getLocation();
+
+ IPath outfilepath = wslocpath.append("devhelp/html2/myapp"); //$NON-NLS-1$
+ File outfiledir = outfilepath.toFile();
+ assertTrue(outfiledir.mkdirs());
+ outfilepath = outfilepath.append("myapp.devhelp2"); //$NON-NLS-1$
+ File outfile = outfilepath.toFile();
+ IPath outfilepath2 = wslocpath.append("devhelp/html2/myapp/myapp.html"); //$NON-NLS-1$
+ File outfile2 = outfilepath2.toFile();
+ IPath outfilepath3 = wslocpath.append("devhelp/html2/myapp/myapp2.html"); //$NON-NLS-1$
+ File outfile3 = outfilepath3.toFile();
+ IPath outfilepath4 = wslocpath.append("devhelp/html2/myapp/style.css"); //$NON-NLS-1$
+ File outfile4 = outfilepath4.toFile();
+ outfile.createNewFile();
+ outfile2.createNewFile();
+ outfile3.createNewFile();
+ outfile4.createNewFile();
+ try (InputStream in = FileLocator.openStream(bundle, new Path(
+ "devhelp/html2/myapp/myapp.devhelp2"), false)) { //$NON-NLS-1$
+ Files.copy(in, Paths.get(outfile.toURI()), StandardCopyOption.REPLACE_EXISTING);
+ }
+ try (InputStream in2 = FileLocator.openStream(bundle, new Path(
+ "devhelp/html2/myapp/myapp.html"), false)) { //$NON-NLS-1$
+ Files.copy(in2, Paths.get(outfile2.toURI()), StandardCopyOption.REPLACE_EXISTING);
+ }
+ try (InputStream in3 = FileLocator.openStream(bundle, new Path(
+ "devhelp/html2/myapp/myapp2.html"), false)) { //$NON-NLS-1$
+ Files.copy(in3, Paths.get(outfile3.toURI()), StandardCopyOption.REPLACE_EXISTING);
+ }
+ try (InputStream in4 = FileLocator.openStream(bundle, new Path(
+ "devhelp/html2/myapp/myapp2.html"), false)) { //$NON-NLS-1$
+ Files.copy(in4, Paths.get(outfile4.toURI()), StandardCopyOption.REPLACE_EXISTING);
+ }
+
+ IPath x = wslocpath.append("devhelp/html2"); //$NON-NLS-1$
+ ParseDevHelp.DevHelpParser p = new ParseDevHelp.DevHelpParser(x.toOSString());
+ LibHoverInfo hover = p.parse(new NullProgressMonitor());
+ assertNotNull(hover);
+ Map<String, FunctionInfo> functions = hover.functions;
+ assertNotNull(functions);
+ assertFalse(functions.isEmpty());
+ FunctionInfo f = functions.get("myapp_init"); //$NON-NLS-1$
+ assertNotNull(f);
+ String desc = f.getDescription();
+ assertFalse(desc.isEmpty());
+ String endOfDesc = desc.substring(desc.length() - 50);
+ assertEquals("pointer to application's argv. </p></dd>\n\n\n</dl>\n\n", endOfDesc); //$NON-NLS-1$
+ FunctionInfo g = functions.get("myapp_init_check"); //$NON-NLS-1$
+ assertNotNull(g);
+ }
@Test
public void testTocProvider() {
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java
index c2843ac..fd25387 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/ParseDevHelp.java
@@ -58,6 +58,7 @@ public class ParseDevHelp {
private String func;
private boolean begin;
+ private boolean refsect2;
private boolean returnType;
private boolean protoStart;
private boolean parmStart;
@@ -77,7 +78,9 @@ public class ParseDevHelp {
this.func = func;
this.funcName = funcName.trim();
if (this.funcName.endsWith("()")) { //$NON-NLS-1$
- this.funcName = this.funcName.replaceAll("\\(\\)", "").trim(); //$NON-NLS-1$ //$NON-NLS-2$
+ // Remove () at end of function name and remove all space chars which might be
+ // non-breaking space chars which unfortunately do not get caught by the trim() method.
+ this.funcName = this.funcName.replaceAll("\\(\\)", "").replaceAll("\\p{javaSpaceChar}",""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
@@ -87,6 +90,8 @@ public class ParseDevHelp {
String fname = a.getValue("name"); //$NON-NLS-1$
if (func.equals(fname)) {
begin = true;
+ divCounter = refsect2 ? 1 : 0;
+ refsect2 = false;
}
}
if (begin) {
@@ -133,8 +138,19 @@ public class ParseDevHelp {
}
description.append(rowTag);
}
+ } else if ("H4".equals(name.rawname)) { //$NON-NLS-1$
+ description.append("<br><br>"); //$NON-NLS-1$
}
}
+ } else {
+ if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
+ String className = a.getValue("class"); //$NON-NLS-1$
+ if ("refsect2".equals(className)) { //$NON-NLS-1$
+ refsect2 = true;
+ } else {
+ refsect2 = false;
+ }
+ }
}
}
@@ -143,9 +159,11 @@ public class ParseDevHelp {
if (begin) {
if ("DIV".equals(name.rawname)) { //$NON-NLS-1$
--divCounter;
-// System.out.println("divCounter is " + divCounter);
if (divCounter <= 0) {
begin = false;
+ descStart = false;
+ parmStart = false;
+ protoStart = false;
}
}
if (descStart) {
@@ -164,6 +182,8 @@ public class ParseDevHelp {
}
}
rowIgnore = false;
+ } else if ("H4".equals(name.rawname)) { //$NON-NLS-1$
+ description.append("</br></br>"); //$NON-NLS-1$
}
}
}
diff --git a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/LibHoverPreferencePage.java b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/LibHoverPreferencePage.java
index c68dae5..11d4b34 100644
--- a/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/LibHoverPreferencePage.java
+++ b/libhover/org.eclipse.linuxtools.cdt.libhover.devhelp/src/org/eclipse/linuxtools/internal/cdt/libhover/devhelp/preferences/LibHoverPreferencePage.java
@@ -131,7 +131,8 @@ public class LibHoverPreferencePage extends FieldEditorPreferencePage implements
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- generateButton.setEnabled(true);
+ if (generateButton != null)
+ generateButton.setEnabled(true);
}
});
}
@@ -158,6 +159,7 @@ public class LibHoverPreferencePage extends FieldEditorPreferencePage implements
}
});
GridData gd = new GridData();
+
gd.horizontalAlignment = GridData.FILL;
int widthHint = convertHorizontalDLUsToPixels(
IDialogConstants.BUTTON_WIDTH);