Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Wagiaalla2013-06-04 21:34:50 +0000
committerJeff Johnston2013-06-04 22:17:32 +0000
commitbbc44749038c54855ded76edb489054dda678d87 (patch)
tree340e0905a337f9bcaf130edaccc9eee9d3e1644f
parent861bbf9582b1c8f8636bde926b37427e4b4d4c30 (diff)
downloadorg.eclipse.linuxtools-bbc44749038c54855ded76edb489054dda678d87.tar.gz
org.eclipse.linuxtools-bbc44749038c54855ded76edb489054dda678d87.tar.xz
org.eclipse.linuxtools-bbc44749038c54855ded76edb489054dda678d87.zip
Remove HTML marking from manpages (for older man versions)
Fixes: https://bugs.eclipse.org/bugs/show_bug.cgi?id=409897 Change-Id: Ied9643d0175c991fe0baa0049a6282c47c7ebca2 Reviewed-on: https://git.eclipse.org/r/13570 Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> IP-Clean: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java2
2 files changed, 27 insertions, 1 deletions
diff --git a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java
index 734948e9a7..7fc74bcee7 100644
--- a/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java
+++ b/man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java
@@ -19,6 +19,7 @@ import org.eclipse.linuxtools.internal.man.parser.ManParser;
public class ManPage {
private StringBuilder rawContent;
+ private StringBuilder strippedTextPage;
/**
* Creates the man page which includes retrieving the raw content and
@@ -110,4 +111,29 @@ public class ManPage {
return sb;
}
+ /**
+ * Removes all HTML markings are returns a text only version.
+ *
+ * @return a text only version of the manpage
+ */
+ public StringBuilder getStrippedTextPage() {
+ if (this.strippedTextPage == null) {
+ this.strippedTextPage = getStrippedPage();
+ int index = strippedTextPage.indexOf("<b>"); //$NON-NLS-1$
+ while (index != -1) {
+ strippedTextPage.replace(index, index + 3, ""); //$NON-NLS-1$
+ strippedTextPage.replace(index + 1, index + 5, ""); //$NON-NLS-1$
+ index = strippedTextPage.indexOf("<b>"); //$NON-NLS-1$
+ }
+
+ index = strippedTextPage.indexOf("<u>"); //$NON-NLS-1$
+ while (index != -1) {
+ strippedTextPage.replace(index, index + 3, ""); //$NON-NLS-1$
+ strippedTextPage.replace(index + 1, index + 5, ""); //$NON-NLS-1$
+ index = strippedTextPage.indexOf("<u>"); //$NON-NLS-1$
+ }
+ }
+
+ return strippedTextPage;
+ }
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java
index 7f1e1c43be..e2e48455c9 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/structures/TapsetLibrary.java
@@ -74,7 +74,7 @@ public final class TapsetLibrary {
}
// Otherwise, get the documentation for the requested element.
- documentation = (new ManPage(element)).getStrippedPage().toString();
+ documentation = (new ManPage(element)).getStrippedTextPage().toString();
// If the requested element is a probe and a documentation page was
// found for it, parse the documentation for the variables if present.

Back to the top