net.sf.statcvs.pages
Class HTML

java.lang.Object
  extended by net.sf.statcvs.pages.HTML

public final class HTML
extends java.lang.Object

TODO: Can we turn this into an abstract base class of MarkupHTML and MarkupXDoc?

Version:
$Id: HTML.java,v 1.12 2008/04/14 18:32:59 benoitx Exp $
Author:
Anja Jentzsch, Richard Cyganiak (richard@cyganiak.de)

Method Summary
static java.lang.String escape(java.lang.String text)
          Escapes HTML meta characters "&", "<", ">" and turns "\n" line breaks into HTML line breaks ("
");
static java.lang.String escapeAuthorName(java.lang.String authorName)
           Escapes evil characters in author's names.
static java.lang.String escapeDirectoryName(java.lang.String directoryName)
           
static java.lang.String escapeUrl(java.lang.String text)
          Escapes HTML as well as " as it is not valid in URL.
static java.lang.String getAffectedFilesCount(java.util.Set files)
          Returns HTML code for number of affected files
static java.lang.String getAuthorIdLink(Author author)
          Returns HTML code for a link to an author Id page
static java.lang.String getAuthorLink(Author author)
          Returns HTML code for a link to an author page
static java.lang.String getDate(java.util.Date date)
          Returns HTML code for a date
static java.lang.String getDateAndTime(java.util.Date date)
          Returns HTML code for a date, including time
static java.lang.String getDirectoryLink(Directory directory)
          Returns HTML code for a directory page link
static java.lang.String getIcon(java.lang.String iconFilename)
          Generates HTML for an icon
static java.lang.String getIcon(java.lang.String iconFilename, java.lang.String title)
          Generates HTML for an icon
static java.lang.String getLink(java.lang.String link, java.lang.String linkName)
          Creates a HTML representation of a hyperlink
static java.lang.String getLink(java.lang.String link, java.lang.String linkName, java.lang.String prefix, java.lang.String suffix)
          Creates a HTML representation of a hyperlink
static java.lang.String getRevisionNumber(java.lang.String revisionNumber)
          Returns HTML code for a revision number
static java.lang.String webifyLinksFromPlainText(java.lang.String plainText)
          From a plain text comment identify the http: and https links and create a link for them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLink

public static java.lang.String getLink(java.lang.String link,
                                       java.lang.String linkName)
Creates a HTML representation of a hyperlink

Parameters:
link - URL
linkName - Name of the Link
Returns:
String HTML code of the hyperlink

getLink

public static java.lang.String getLink(java.lang.String link,
                                       java.lang.String linkName,
                                       java.lang.String prefix,
                                       java.lang.String suffix)
Creates a HTML representation of a hyperlink

Parameters:
link - URL
linkName - Name of the Link
prefix - A prefix to be inserted before the link label; no HTML escaping is performed
prefix - A suffix to be inserted after the link label; no HTML escaping is performed
Returns:
String HTML code of the hyperlink

getAuthorLink

public static java.lang.String getAuthorLink(Author author)
Returns HTML code for a link to an author page

Parameters:
author - the author
Returns:
HTML code for the link

getAuthorIdLink

public static java.lang.String getAuthorIdLink(Author author)
Returns HTML code for a link to an author Id page

Parameters:
author - the author
Returns:
HTML code for the link

getDate

public static java.lang.String getDate(java.util.Date date)
Returns HTML code for a date

Parameters:
date - the date
Returns:
HTML code for the date

getAffectedFilesCount

public static java.lang.String getAffectedFilesCount(java.util.Set files)
Returns HTML code for number of affected files

Parameters:
files - affected files
Returns:
HTML code for number of affected files

getDateAndTime

public static java.lang.String getDateAndTime(java.util.Date date)
Returns HTML code for a date, including time

Parameters:
date - the date
Returns:
HTML code for the date

getRevisionNumber

public static java.lang.String getRevisionNumber(java.lang.String revisionNumber)
Returns HTML code for a revision number

Parameters:
revisionNumber - a revision number
Returns:
HTML code for a revision number

getDirectoryLink

public static java.lang.String getDirectoryLink(Directory directory)
Returns HTML code for a directory page link

Parameters:
directory - a directory
Returns:
HTML code for the link

getIcon

public static java.lang.String getIcon(java.lang.String iconFilename)
Generates HTML for an icon

Parameters:
iconFilename - an icon filename (HTMLOutput.XXXX_ICON constants)
Returns:
HTML string

getIcon

public static java.lang.String getIcon(java.lang.String iconFilename,
                                       java.lang.String title)
Generates HTML for an icon

Parameters:
iconFilename - an icon filename (HTMLOutput.XXXX_ICON constants)
title - the title for the icon.
Returns:
HTML string

escapeAuthorName

public static java.lang.String escapeAuthorName(java.lang.String authorName)

Escapes evil characters in author's names. E.g. "#" must be escaped because for an author "my#name" a page "author_my#name.html" will be created, and you can't link to that in HTML

TODO: Replace everything *but* known good characters, instead of just evil ones

Parameters:
authorName - an author's name
Returns:
a version safe for creation of files and URLs

escapeDirectoryName

public static java.lang.String escapeDirectoryName(java.lang.String directoryName)

escape

public static java.lang.String escape(java.lang.String text)
Escapes HTML meta characters "&", "<", ">" and turns "\n" line breaks into HTML line breaks ("
");

Parameters:
text - some string, for example "x > 0 && y < 100"
Returns:
HTML-escaped string, for example "x > 0 && y < 100"

escapeUrl

public static java.lang.String escapeUrl(java.lang.String text)
Escapes HTML as well as " as it is not valid in URL.

Parameters:
text - some string, for example "x > 0 && y < 100"
Returns:
HTML-escaped string, for example "x > 0 && y < 100"

webifyLinksFromPlainText

public static java.lang.String webifyLinksFromPlainText(java.lang.String plainText)
From a plain text comment identify the http: and https links and create a link for them.

Parameters:
plainText -


Copyright © 2008. All Rights Reserved.