summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
diff options
context:
space:
mode:
authorVlad Ureche <vlad.ureche@gmail.com>2012-03-20 14:38:50 +0100
committerVlad Ureche <vlad.ureche@gmail.com>2012-03-20 14:41:58 +0100
commiteb8afde6882a945caa029a2ea9daeb43c590f5ca (patch)
tree7d55af08c8a6722a3915707c17ef00cd36ef6797 /src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
parentfb44bb28b8b3e7861b96c874dc79072f89fec10b (diff)
downloadscala-eb8afde6882a945caa029a2ea9daeb43c590f5ca.tar.gz
scala-eb8afde6882a945caa029a2ea9daeb43c590f5ca.tar.bz2
scala-eb8afde6882a945caa029a2ea9daeb43c590f5ca.zip
Fixes SI-5248
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
index b58c71eaa9..1544dafc69 100644
--- a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
@@ -22,6 +22,16 @@ abstract class HtmlPage extends Page { thisPage =>
/** The title of this page. */
protected def title: String
+ /** The page description */
+ protected def description: String =
+ // unless overwritten, will display the title in a spaced format, keeping - and .
+ title.replaceAll("[^a-zA-Z0-9\\.\\-]+", " ").replaceAll("\\-+", " - ").replaceAll(" +", " ")
+
+ /** The page keywords */
+ protected def keywords: String =
+ // unless overwritten, same as description, minus the " - "
+ description.replaceAll(" - ", " ")
+
/** Additional header elements (links, scripts, meta tags, etc.) required for this page. */
protected def headers: NodeSeq
@@ -35,6 +45,8 @@ abstract class HtmlPage extends Page { thisPage =>
<html>
<head>
<title>{ title }</title>
+ <meta name="description" content={ description }/>
+ <meta name="keywords" content={ keywords }/>
<meta http-equiv="content-type" content={ "text/html; charset=" + site.encoding }/>
{ headers }
</head>