From 895a5b18080d4c1922f6b53ebe3a13d359b1ba58 Mon Sep 17 00:00:00 2001 From: heathermiller Date: Wed, 7 Sep 2011 05:18:37 +0000 Subject: [PATCH] Added footer command line option to ScalaDoc so ScalaDoc users aren't forced to have the EPFL/Typesafe copyright notice in their API docs. Now comes with the ability for users to add their own footer. Review by ureche. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25616 5e8d7ff9-d8ef-0310-90f0-a4852d11357a --- build.xml | 1 + src/compiler/scala/tools/ant/Scaladoc.scala | 12 ++++++++++++ src/compiler/scala/tools/nsc/doc/Settings.scala | 9 ++++++++- .../scala/tools/nsc/doc/html/page/Template.scala | 9 ++++++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index b2b102f7f..b4a3e02fe 100644 --- a/build.xml +++ b/build.xml @@ -1409,6 +1409,7 @@ DOCUMENTATION destdir="${build-docs.dir}/library" doctitle="Scala Standard Library" docversion="${version.number}" + docfooter="epfl" docsourceurl="https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/€{FILE_PATH}.scala#L1" docUncompilable="${src.dir}/library-aux" sourcepath="${src.dir}" diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala index a3a1292d7..8ffcb8cec 100644 --- a/src/compiler/scala/tools/ant/Scaladoc.scala +++ b/src/compiler/scala/tools/ant/Scaladoc.scala @@ -106,6 +106,9 @@ class Scaladoc extends ScalaMatchingTask { /** The document title of the generated HTML documentation. */ private var doctitle: Option[String] = None + /** The document footer of the generated HTML documentation. */ + private var docfooter: Option[String] = None + /** The document version, to be added to the title. */ private var docversion: Option[String] = None @@ -304,6 +307,14 @@ class Scaladoc extends ScalaMatchingTask { doctitle = Some(input) } + /** Sets the docfooter attribute. + * + * @param input The value of docfooter. + */ + def setDocfooter(input: String) { + docfooter = Some(input) + } + /** Set the addparams info attribute. * * @param input The value for addparams. @@ -523,6 +534,7 @@ class Scaladoc extends ScalaMatchingTask { if (!extdirs.isEmpty) docSettings.extdirs.value = asString(getExtdirs) if (!encoding.isEmpty) docSettings.encoding.value = encoding.get if (!doctitle.isEmpty) docSettings.doctitle.value = decodeEscapes(doctitle.get) + if (!docfooter.isEmpty) docSettings.docfooter.value = decodeEscapes(docfooter.get) if (!docversion.isEmpty) docSettings.docversion.value = decodeEscapes(docversion.get) if (!docsourceurl.isEmpty) docSettings.docsourceurl.value =decodeEscapes(docsourceurl.get) if (!docUncompilable.isEmpty) docSettings.docUncompilable.value = decodeEscapes(docUncompilable.get) diff --git a/src/compiler/scala/tools/nsc/doc/Settings.scala b/src/compiler/scala/tools/nsc/doc/Settings.scala index 9615b506c..cfd6635a7 100644 --- a/src/compiler/scala/tools/nsc/doc/Settings.scala +++ b/src/compiler/scala/tools/nsc/doc/Settings.scala @@ -41,6 +41,13 @@ class Settings(error: String => Unit) extends scala.tools.nsc.Settings(error) { "" ) + val docfooter = StringSetting ( + "-doc-footer", + "footer", + "A footer on every ScalaDoc page, by default the EPFL/Typesafe copyright notice. Can be overridden with a custom footer.", + "" + ) + val docUncompilable = StringSetting ( "-doc-no-compile", "path", @@ -81,7 +88,7 @@ class Settings(error: String => Unit) extends scala.tools.nsc.Settings(error) { // For improved help output. def scaladocSpecific = Set[Settings#Setting]( - docformat, doctitle, docversion, docUncompilable, docsourceurl, docgenerator + docformat, doctitle, docfooter, docversion, docUncompilable, docsourceurl, docgenerator ) val isScaladocSpecific: String => Boolean = scaladocSpecific map (_.name) } diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala index eab61bc5c..f1e911a62 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala @@ -168,7 +168,14 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage {
- + + { + if (Set("epfl", "EPFL").contains(tpl.universe.settings.docfooter.value)) + + else + + } + }