Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/man
diff options
context:
space:
mode:
authorSami Wagiaalla2013-06-04 21:34:50 +0000
committerJeff Johnston2013-06-04 22:00:17 +0000
commit73902cfd92a0c51cb7971297492e8cd962dc1bb9 (patch)
tree7f615b05006917d60aec3c55123dff73b6fde906 /man
parentff3497766e64bef0fbfc0e2ddd1f97de14bb3db0 (diff)
downloadorg.eclipse.linuxtools-73902cfd92a0c51cb7971297492e8cd962dc1bb9.tar.gz
org.eclipse.linuxtools-73902cfd92a0c51cb7971297492e8cd962dc1bb9.tar.xz
org.eclipse.linuxtools-73902cfd92a0c51cb7971297492e8cd962dc1bb9.zip
Remove HTML marking from manpages (for older man versions)
Change-Id: Ib3a0f86895aafadb8fe13ee9541bded7ac3eb966 Reviewed-on: https://git.eclipse.org/r/13569 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> IP-Clean: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
Diffstat (limited to 'man')
-rw-r--r--man/org.eclipse.linuxtools.man.core/src/org/eclipse/linuxtools/man/parser/ManPage.java26
1 files changed, 26 insertions, 0 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;
+ }
}

Back to the top