[Sciviews-commits] r507 - komodo/SciViews-K/udl pkg/svSweave pkg/svSweave/R pkg/svSweave/inst pkg/svSweave/inst/examples pkg/svSweave/inst/www pkg/svSweave/inst/www/jquery pkg/svSweave/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 6 23:26:19 CET 2013


Author: phgrosjean
Date: 2013-01-06 23:26:18 +0100 (Sun, 06 Jan 2013)
New Revision: 507

Added:
   pkg/svSweave/LICENSE
   pkg/svSweave/R/RdocHeader.R
   pkg/svSweave/TODO
   pkg/svSweave/inst/examples/
   pkg/svSweave/inst/examples/Dynamic01.R
   pkg/svSweave/inst/examples/Dynamic02.R
   pkg/svSweave/inst/examples/Dynamic03.R
   pkg/svSweave/inst/examples/Dynamic04.R
   pkg/svSweave/inst/examples/Dynamic05.R
   pkg/svSweave/inst/examples/Dynamic06.R
   pkg/svSweave/inst/examples/Dynamic07.R
   pkg/svSweave/inst/examples/Dynamic08.R
   pkg/svSweave/inst/examples/Dynamic09.R
   pkg/svSweave/inst/examples/Dynamic10.R
   pkg/svSweave/inst/www/
   pkg/svSweave/inst/www/jquery/
   pkg/svSweave/inst/www/jquery/.DS_Store
   pkg/svSweave/inst/www/jquery/README
   pkg/svSweave/inst/www/jquery/jquery.easytabs.min.css
   pkg/svSweave/inst/www/jquery/jquery.easytabs.min.js
   pkg/svSweave/inst/www/jquery/jquery.hashchange.min.js
   pkg/svSweave/inst/www/jquery/jquery.slider.min.css
   pkg/svSweave/inst/www/jquery/jquery.slider.min.js
   pkg/svSweave/man/RdocHeader.Rd
Removed:
   pkg/svSweave/man/Rdoc.Rd
Modified:
   komodo/SciViews-K/udl/Rlex.udl
   pkg/svSweave/DESCRIPTION
   pkg/svSweave/NAMESPACE
   pkg/svSweave/NEWS
   pkg/svSweave/R/asciidoc.R
   pkg/svSweave/man/asciidoc.Rd
Log:
Many change to further integrate shiny into sweave/Asciidoc in svSweave

Modified: komodo/SciViews-K/udl/Rlex.udl
===================================================================
--- komodo/SciViews-K/udl/Rlex.udl	2013-01-03 22:57:27 UTC (rev 506)
+++ komodo/SciViews-K/udl/Rlex.udl	2013-01-06 22:26:18 UTC (rev 507)
@@ -2666,9 +2666,9 @@
 # assignations with '='). That is: arg/var = (but not var ==)
 /[$NMSTART](?=[$CS]*[$WS]*\=[^\=])/ : paint(upto, SSL_DEFAULT), => IN_SSL_ARGUMENT
 
-# Special case of svSweave::Rdoc("Main title") or Rdoc("Main title")
+# Special case of svSweave::RdocHeader("Main title")
 # where we want to colorize main title as a Rdoc M_PI element
-"svSweave::Rdoc" : paint(upto, SSL_DEFAULT), paint(include, SSL_REGEX), => IN_SSL_DOCHEADER
+"svSweave::RdocHeader" : paint(upto, SSL_DEFAULT), paint(include, SSL_REGEX), => IN_SSL_DOCHEADER
 
 # SSL_VARIABLE also colorizes namespaces ns in ns::fun() or ns:::fun()
 # So the SSL_VARIABLE style highlight essentially various pieces of

Modified: pkg/svSweave/DESCRIPTION
===================================================================
--- pkg/svSweave/DESCRIPTION	2013-01-03 22:57:27 UTC (rev 506)
+++ pkg/svSweave/DESCRIPTION	2013-01-06 22:26:18 UTC (rev 507)
@@ -7,10 +7,10 @@
   email = "phgrosjean at sciviews.org"))
 Author: Philippe Grosjean
 Maintainer: Philippe Grosjean <phgrosjean at sciviews.org>
-Depends: R (>= 2.6.0), ascii, knitr
-Imports: utils
+Depends: R (>= 2.6.0), svMisc
+Imports: utils, ascii, knitr
 SystemRequirements: Python (>= 2.4) to run Asciidoc (http://www.python.org/)
 Description: Supporting functions for the GUI API (Sweave functions)
-License: GPL-2
+License: file LICENSE
 URL: http://www.sciviews.org/SciViews-R
 BugReports: https://r-forge.r-project.org/tracker/?group_id=194

Added: pkg/svSweave/LICENSE
===================================================================
--- pkg/svSweave/LICENSE	                        (rev 0)
+++ pkg/svSweave/LICENSE	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,66 @@
+The svSweave package is licensed underg GPL-2 license.
+However, it includes other open source software components with the following
+licenses:
+
+- jQuery
+- jslider
+- easytabs
+
+
+jQuery License
+----------------------------------------------------------------------   
+
+Copyright (c) 2012 jQuery Foundation and other contributors, 
+http://jquery.com/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+jslider License
+----------------------------------------------------------------------   
+
+The MIT License (MIT)
+Copyright (c) 2012 Egor Khmelev
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
+easytabs License
+----------------------------------------------------------------------
+
+By Steve Schwartz](https://github.com/JangoSteve - http://www.alfajango.com)
+Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+and GPL (http://www.gnu.org/licenses/gpl.html) licenses.

Modified: pkg/svSweave/NAMESPACE
===================================================================
--- pkg/svSweave/NAMESPACE	2013-01-03 22:57:27 UTC (rev 506)
+++ pkg/svSweave/NAMESPACE	2013-01-06 22:26:18 UTC (rev 507)
@@ -1,11 +1,12 @@
 import(utils, knitr, ascii)
+importFrom(svMisc, existsTemp)
 
 export(cleanLyxRnw,
        knitLyxRnw,
        purlLyxRnw,
        tangleLyxRnw,
        weaveLyxRnw,
-       Rdoc,
+       RdocHeader,
        RdocToRnw,
        RdocConvert,
        RdocThemes,

Modified: pkg/svSweave/NEWS
===================================================================
--- pkg/svSweave/NEWS	2013-01-03 22:57:27 UTC (rev 506)
+++ pkg/svSweave/NEWS	2013-01-06 22:26:18 UTC (rev 507)
@@ -5,9 +5,13 @@
 * Slight reworking of the Asciidoc-related function RdocXXX(). svBuild() is
   renamed makeRdoc() to be more explicit.
 
-* Addition of Rdoc() function that creates an Asciidoc header.
+* Addition of RdocHeader() function that creates an Asciidoc header.
 
+* Addition of dynamic R document features, using a customized shiny engine.
 
+* Ten examples of dynamic documents added. They are adapted from shiny examples.examples
+
+
 == Changes in svSweave 0.9-5
 
 * Now knitr can also be used to weave your documents (knitLyxRnw/purlLyxRnw).

Added: pkg/svSweave/R/RdocHeader.R
===================================================================
--- pkg/svSweave/R/RdocHeader.R	                        (rev 0)
+++ pkg/svSweave/R/RdocHeader.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,110 @@
+## Create an Asciidoc header according to these items
+
+RdocHeader <- function (title, author = NULL, email = NULL, revnumber = NULL,
+revdate = NULL, revremark = NULL, copyright = "cc-by", encoding = "UTF-8",
+lang = "en", pagetitle = NULL, description = "SciViews Rdoc", keywords = NULL,
+theme = "SciViews", max.width = 640, width = NULL,
+toc = c("top", "side", "manual", "none"), toc.title = NULL, toclevels = 2,
+numbered = TRUE, data.uri = TRUE, frame = "topbot", grid = "rows",
+align = "center", halign = "center", pygments = FALSE, slidefontsizeadjust = 0,
+SweaveInit = { options(width = 80); options(SweaveHooks = list(fig = function()
+par(col.lab = "#434366", col.main = "#434366"))) }
+)
+{
+	## Format AsciiDocsciidoc attributes
+	asciiAttr <- function (header = NULL, name, value) {
+		if (!length(value)) return(header)
+		paste0(header, ":", name, ": ", paste(value, collapse = ","), "\n")
+	}
+	
+	## Create the Asciidoc header
+	header <- character(0)
+	
+	## Title must be a single string
+	if (length(title)) header <- paste0("= ", as.character(title)[1], "\n")
+	
+	## Idem for author, but allow several names
+	if (length(author)) {
+		author <- paste(author, collapse = ", ")
+	
+		## Check also email
+		if (length(email)) {
+			email <- as.character(email)[1]
+			if (!grepl("^.+ at .+$", email))
+				stop("You must provide a correct email address for your Rdoc")
+			header <- paste0(header, author, " <", email, ">\n")
+		} else {
+			header <- paste0(header, author, "\n")	
+		}
+	}
+	
+	## Compute revision field: [revnumber], [revdate]:\n[revremark]
+	## TODO: check all this in function of all possible missing items
+	if (length(revnumber) || length(revdate) || length(revremark)) {
+		if (length(revnumber))
+			revfield <- paste0("v", revnumber, ", ") else revfield <- ""
+		if (!length(revdate)) revdate <- format(Sys.Date(), format = "%B %Y")
+		revfield <- paste0(revfield, revdate)
+		if (length(revremark))
+			revfield <- paste0(revfield, ":\n", paste(revremark, collapse = "\n"))
+		header <- paste0(header, revfield, "\n")
+	}
+	
+	## Rework copyright
+	if (length(copyright)) {
+		if (!grepl("^[^,]+,[^,]+,[ \t]*[0-9]{4}$", copyright)) {
+			if (length(revdate)) {
+				year <- substring(revdate, nchar(revdate) - 3)
+			} else year <- format(Sys.Date(), format = "%Y")
+			if (!length(author)) {
+				copyright <- paste0(copyright, ", ", year)	
+			} else {
+				copyright <- paste0(copyright, ", ", author, ", ", year)
+			}
+		}
+		header <- asciiAttr(header, "copyright", copyright)
+	}
+	
+	## Add more attributes
+	header <- asciiAttr(header, "encoding", encoding)
+	header <- asciiAttr(header, "lang", lang)
+	header <- asciiAttr(header, "title", pagetitle)
+	header <- asciiAttr(header, "description", description)
+	header <- asciiAttr(header, "keywords", keywords)
+	header <- asciiAttr(header, "theme", theme)
+	header <- asciiAttr(header, "max-width", max.width)
+	header <- asciiAttr(header, "width", width)
+	
+	## How to format the toc?
+	toc <- switch(as.character(toc)[1],
+		top = ":toc:\n",
+		side = ":toc2:\n",
+		manual = ":toc:\n:toc-placement: manual\n",
+		none = ":toc!:\n",
+		stop("'toc' must be 'top', 'side', 'manual' or ''none'"))
+	header <- paste0(header, toc)
+	header <- asciiAttr(header, "toc-title", toc.title)
+	header <- asciiAttr(header, "toclevels", toclevels)
+	if (isTRUE(numbered)) header <- paste0(header, ":numbered:\n")
+	if (isTRUE(data.uri)) header <- paste0(header, ":data-uri:\n")
+	header <- asciiAttr(header, "frame", frame)
+	header <- asciiAttr(header, "grid", grid)
+	header <- asciiAttr(header, "align", align)
+	header <- asciiAttr(header, "halign", halign)
+	if (isTRUE(pygments)) header <- paste0(header, ":pygments:\n")
+	header <- asciiAttr(header, "slidefontsizeadjust", slidefontsizeadjust)
+	## Are we currently building a dynamic document?
+	if (svMisc::existsTemp(".build__dynamic__Rdoc__"))
+		header <- paste0(header, ":dynamic:\n")
+	header <- paste0(header, "\n") # End of header section
+	
+	## Run SweaveInit now
+	SweaveInit
+	## More initialization (make sure svSweave is attached)
+	req <- base::require
+	req("svSweave", quietly = TRUE, warn.conflicts = FALSE)
+	
+	## Print the header and return it invisibly
+	cat(header)
+	invisible(header)
+}

Modified: pkg/svSweave/R/asciidoc.R
===================================================================
--- pkg/svSweave/R/asciidoc.R	2013-01-03 22:57:27 UTC (rev 506)
+++ pkg/svSweave/R/asciidoc.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -4,109 +4,13 @@
 ## otherwise it produces an error... So, you have to place require(SciViews)
 ## in the initialisation block (second line) of the SciViews Rdoc!
 
-Rdoc <- function (title, author, email, revnumber = NULL, revdate = NULL,
-revremark = NULL, copyright = "cc-by", encoding = "UTF-8", lang = "en",
-pagetitle = NULL, description = "SciViews Rdoc", keywords = NULL,
-theme = "SciViews", max.width = 640, width = NULL,
-toc = c("top", "side", "manual", "none"), toc.title = NULL, toclevels = 2,
-numbered = TRUE, data.uri = TRUE, frame = "topbot", grid = "rows",
-align = "center", halign = "center", pygments = FALSE, slidefontsizeadjust = 0,
-SweaveInit = { options(width = 80); options(SweaveHooks = list(fig = function()
-par(col.lab = "#434366", col.main = "#434366"))) }
-)
-{
-	## Format AsciiDocsciidoc attributes
-	asciiAttr <- function (header = NULL, name, value) {
-		if (!length(value)) return(header)
-		paste0(header, ":", name, ": ", paste(value, collapse = ","), "\n")
-	}
-	
-	## Title must be a single string
-	title <- as.character(title)[1]
-	if (!length(title))
-		stop("You must provide a title for your Rdoc")
-	
-	## Idem for author, but allow several names
-	author <- paste(author, collapse = ", ")
-	if (!length(author))
-		stop("You must provide at least one author for your Rdoc")
-	
-	## Check email
-	email <- as.character(email)[1]
-	if (!length(email) || !grepl("^.+ at .+$", email))
-		stop("You must provide a correct email address for your Rdoc")
-	
-	## Compute revision field: [revnumber], [revdate]:\n[revremark]
-	if (length(revnumber))
-		revfield <- paste0("v", revnumber, ", ") else revfield <- ""
-	if (!length(revdate)) revdate <- format(Sys.Date(), format = "%B %Y")
-	revfield <- paste0(revfield, revdate)
-	if (length(revremark))
-		revfield <- paste0(revfield, ":\n", paste(revremark, collapse = "\n"))
-		
-	## Create the Asciidoc header
-	header <- paste0(
-		"= ", title, "\n",
-		author, " <", email, ">\n",
-		revfield, "\n"
-	)
-	
-	## Rework copyright
-	if (length(copyright)) {
-		if (!grepl("^[^,]+,[^,]+,[ \t]*[0-9]{4}$", copyright)) {
-			year <- substring(revdate, nchar(revdate) - 3)
-			copyright <- paste0(copyright, ", ", author, ", ", year)
-		}
-		header <- asciiAttr(header, "copyright", copyright)
-	}
-	
-	## Add more attributes
-	header <- asciiAttr(header, "encoding", encoding)
-	header <- asciiAttr(header, "lang", lang)
-	header <- asciiAttr(header, "title", pagetitle)
-	header <- asciiAttr(header, "description", description)
-	header <- asciiAttr(header, "keywords", keywords)
-	header <- asciiAttr(header, "theme", theme)
-	header <- asciiAttr(header, "max-width", max.width)
-	header <- asciiAttr(header, "width", width)
-	
-	## How to format the toc?
-	toc <- switch(as.character(toc)[1],
-		top = ":toc:\n",
-		side = ":toc2:\n",
-		manual = ":toc:\n:toc-placement: manual\n",
-		none = ":toc!:\n",
-		stop("'toc' must be 'top', 'side', 'manual' or ''none'"))
-	header <- paste0(header, toc)
-	header <- asciiAttr(header, "toc-title", toc.title)
-	header <- asciiAttr(header, "toclevels", toclevels)
-	if (isTRUE(numbered)) header <- paste0(header, ":numbered:\n")
-	if (isTRUE(data.uri)) header <- paste0(header, ":data-uri:\n")
-	header <- asciiAttr(header, "frame", frame)
-	header <- asciiAttr(header, "grid", grid)
-	header <- asciiAttr(header, "align", align)
-	header <- asciiAttr(header, "halign", halign)
-	if (isTRUE(pygments)) header <- paste0(header, ":pygments:\n")
-	header <- asciiAttr(header, "slidefontsizeadjust", slidefontsizeadjust)
-	header <- paste0(header, "\n") # End of header section
-	
-	## Run SweaveInit now
-	SweaveInit
-	## More initialization
-	req <- base::require
-	req("SciViews", quietly = TRUE, warn.conflicts = FALSE)
-	
-	## Print the header and return it invisibly
-	if (!interactive()) cat(header)
-	invisible(header)
-}
-
 RdocToRnw <- function (RdocFile, RnwFile, encoding)
 {
 	## Converts a SciViews Rdoc into an sweave document (.Rnw)
 	
 	## If RdocFile is missing, try to get it from option or the command line
 	if (missing(RdocFile)) RdocFile <- .RdocFile()
+	RdocFile <- normalizePath(RdocFile)
 	
 	## Get RnwFile
 	if (missing(RnwFile)) RnwFile <- getOption("Rnw.file",
@@ -146,7 +50,7 @@
 	if (!grepl("^#!", Rscript[1]))
 		stop("Incorrect SciViews Rdoc (it must start with #!)")
 	## Change this line into an init code chunk
-	Rscript[1] <- "<<init, echo=FALSE, results=ascii>>="
+	Rscript[1] <- "<<init, echo=FALSE, results=ascii, strip.white=false>>="
 	
 	## Doc chunks are lines where cstart > cend
 	inDoc <- cstart > cend
@@ -192,11 +96,13 @@
 	return(invisible(Rscript))
 }
 
+## TODO: use figs.dir!!!
 RdocConvert <- function (RdocFile, theme, format, show.it, figs.dir,
 keep.RnwFile, keep.TxtFile, encoding, asciidoc)
 {
 	## If RdocFile is missing, try to get it from option or the command line
 	if (missing(RdocFile)) RdocFile <- .RdocFile()
+	RdocFile <- normalizePath(RdocFile)
 	
 	## RnwFile is either same place, same name as RdocFile, or option Rnw.file
 	RnwFile <- getOption("Rnw.file", .fileExt(RdocFile, "Rnw"))
@@ -213,8 +119,12 @@
 	
 	## If figs.dir is defined (default to 'figures'), make sure it exists
 	if (missing(figs.dir)) figs.dir <- getOption("Rdoc.figs.dir", "figures")
-	if (length(figs.dir)) dir.create(file.path(dirname(TxtFile), figs.dir),
-		showWarnings = FALSE, recursive = TRUE)
+	if (length(figs.dir)) {
+		figs.dir <- file.path(dirname(TxtFile), figs.dir)
+		if (!file.exists(figs.dir)) {
+			dir.create(figs.dir, showWarnings = FALSE, recursive = TRUE)
+		} else figs.dir <- NULL # Avoid eliminating a dir that already exists!
+	}
 	
 	## If format is missing, try getting it from options(), or assume "html"
 	if (missing(format)) format <- getOption("Rdoc.format", "html")
@@ -288,25 +198,33 @@
 	## Copy it to where the Txt file must be created...
 	if (dirname(TxtFile) != dirname(RnwFile)) {
 		RnwFile2 <- file.path(dirname(TxtFile), basename(RnwFile))
-		file.copy(RnwFile, RnwFile2)
-		if (!file.exists(RnwFile))
+		file.copy(RnwFile, RnwFile2, overwrite = TRUE)
+		if (!file.exists(RnwFile2))
 			stop("Problems while copying the R noweb file(", RnwFile, " to ",
 				dirname(TxtFile), ")")
+		unlink(RnwFile)
 	} else RnwFile2 <- RnwFile
 	
 	## Sweave that document to .txt file
-	## Note that the ascii package must be loaded first!
-	require(ascii, quietly = TRUE, warn.conflicts = FALSE)
+# No, we just import its namespace now
+#	## Note that the ascii package must be loaded first!
+#	require(ascii, quietly = TRUE, warn.conflicts = FALSE)
 	odir <- setwd(dirname(RnwFile2)) # Work now relative to destination file
+	## Also display warnings immediately
+	owarn <- options(warn = 1)
 	
 	## Make sure intermediary filles will be deleted on exit
 	on.exit({
 		setwd(odir)
-		unlink(RnwFile2)
 		## Possibly delete intermediary files
-		if (!isTRUE(keep.RnwFile)) unlink(RnwFile)
-		if (!isTRUE(keep.TxtFile)) unlink(TxtFile)	
-	})
+		if (!isTRUE(keep.RnwFile)) unlink(RnwFile2)
+		if (!isTRUE(keep.TxtFile)) unlink(TxtFile)
+		## If figs.dir is empty, delete it
+		if (length(figs.dir) && !length(dir(figs.dir, include.dirs = TRUE)))
+			unlink(figs.dir, recursive = TRUE)
+		## Restore warn option
+		options(owarn)
+	}, add = TRUE)
 	
 	## Sweave this document... (creating the TxtFile)
 	## Note: we change some default options here!
@@ -331,12 +249,17 @@
 	## If there is a finalize code for this theme, run it now
 	## TODO...
 
+	## Check that the final file exists!
+	if (!file.exists(EndFile))
+		stop("Asciidoc was unable to format your document")
+	
 	## Do we view the resulting .html file?
 	if (isTRUE(show.it) && EndExt == "html") {
 		cat("Opening the formatted document", basename(EndFile),
 			"in the Web browser\n")
 		browseURL(normalizePath(EndFile))
 	} else cat("Formatted document available at ", EndFile, "\n", sep = "")
+	invisible(EndFile)
 }
 
 RdocThemes <- function ()

Added: pkg/svSweave/TODO
===================================================================
--- pkg/svSweave/TODO	                        (rev 0)
+++ pkg/svSweave/TODO	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,49 @@
+= svSweave - To do list
+
+* Package svShiny code here + runExample()/runGist()
+
+* Use more sensible values for toc: if missing and no author/revfield => no toc.
+
+* A better management of theme: define one form html and one for slidy/slidy2.
+
+* With the shiny jslider, I would like to be able to move left cursor and keep
+  interval between left and right cursor constant... or, better, be able to drag
+  the interval between the two cursors.
+  
+* Make a better default_shiny.R page that lists all existing pages on the server
+
+* Rename xxx_shiny.R as xxx.Rdoc, simply?!
+
+* Make interface for writing SciViews R documents in Komodo/SciViews-K.
+
+* ascii() => view() + aware if ascii or latex and results=ascii/tex accordingly
+
+* Clean up the latex export filter and make a LyX export filter
+
+* Also allow to convert from LyX/LaTeX to Asciidoc
+
+* Enable timer events on the page server and daemonize it on Windows
+  (using Tcl loop)?
+  
+* A better logic for startPageServer() call, e.g., if the server does not run
+  and a page is created
+  
+* In non interactive mode, detect when the last client exit and quit then
+  also automatically, unles differently specified
+  
+* Allow for several author names
+
+* Numbered items for figures, tables, equations and listings using Asciidoc
+  replacement macros
+  
+* Save/reload pages installed on a server with R code
+
+* Eliminate footer for slidy2 (interferes with dynamic documents)
+
+* Allow to specify two themes: one for html, one for slidy/slidy2
+
+* A better uiSideBySide() system
+
+* Something similar to runExample() & runGist() in shiny
+
+* Move the definition of `!` here from SciViews? Or put in svMisc?
\ No newline at end of file

Added: pkg/svSweave/inst/examples/Dynamic01.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic01.R	                        (rev 0)
+++ pkg/svSweave/inst/examples/Dynamic01.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,36 @@
+#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
+svSweave::RdocHeader("Dynamic R document - Hello Shiny!")
+!"
+<<server, eval = FALSE, echo = FALSE>>="
+## The code to generate our dynamic elements on the page
+dynamicServer({
+	## Function that generates a plot of the distribution. The function
+	## is wrapped in a call to dynamicPlot() to indicate that:
+	##
+	##  1) It is "dynamic" and therefore should be automatically 
+	##     re-executed when inputs change
+	##  2) Its output type is a plot
+	##
+	output$distPlot <- dynamicPlot({
+        ## Generate an rnorm distribution and plot it
+		dist <- rnorm(input$obs)
+		hist(dist, col = "cornsilk")
+	})  
+})
+!"
+<<ui, echo = FALSE, results = ascii>>="
+## What to display in dynamic mode?
+asciiDynamic({
+	## A simple slider
+	uiInput(wiSlider("obs", "Number of observations:",
+		min = 0, max = 1000, value = 500))
+  
+	## Show a plot of the generated distribution
+	uiP(woPlot("distPlot"))
+})
+## What to display in static mode?
+asciiStatic(uiP(strong(
+	"This application works only in dynamic mode through the shiny server!")))
+!"
+NOTE: //This is a reimplementation of **`01_hello'** shiny example as a **SciViews R script**.//
+<<>>="

Added: pkg/svSweave/inst/examples/Dynamic02.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic02.R	                        (rev 0)
+++ pkg/svSweave/inst/examples/Dynamic02.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,56 @@
+#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
+svSweave::RdocHeader("Dynamic R document - Shiny Text")
+!"
+<<server, eval = FALSE, echo = FALSE>>="
+require(datasets)
+
+## Define server logic required to summarize and view the selected dataset
+dynamicServer({
+	## Return the requested dataset
+	datasetInput <- dynamic({
+		switch(input$dataset,
+			"rock" = rock,
+			"pressure" = pressure,
+			"cars" = cars)
+	})
+  
+	## Generate a summary of the dataset
+	output$summary <- dynamicPrint({
+		dataset <- datasetInput()
+		summary(dataset)
+	})
+  
+	## Show the first "n" observations
+	output$view <- dynamicTable({
+		head(datasetInput(), n = input$obs)
+	})
+})
+!"
+<<ui, echo = FALSE, results = ascii>>="
+## What to display in dynamic mode?
+asciiDynamic({
+	uiInput(
+		## A selection box
+		wiSelect("dataset", "Choose a dataset:",
+			choices = c("rock", "pressure", "cars")),
+		
+		## Goto next line
+		br(),
+		
+		## A numeric input box
+		wiNumeric("obs", "Number of observations to view:", 10)
+	)
+  
+	uiDiv(
+		## Show a summary of the dataset and an HTML table with the requested
+		## number of observations
+		woVerbatim("summary"),
+		woTable("view")
+	)
+})
+## What to display in static mode?
+asciiStatic(uiP(strong(
+	"This application works only in dynamic mode through the shiny server!")))
+!"
+NOTE: //This is a reimplementation of **`02_text'** shiny example as a **SciViews R script**.//
+<<>>="

Added: pkg/svSweave/inst/examples/Dynamic03.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic03.R	                        (rev 0)
+++ pkg/svSweave/inst/examples/Dynamic03.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,84 @@
+#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
+svSweave::RdocHeader("Dynamic R document - Reactivity", toc = "none")
+!"
+<<server, eval = FALSE, echo = FALSE>>="
+## Define server logic required to summarize and view the selected dataset
+dynamicServer({
+	## By declaring databaseInput as a dynamic function we ensure that:
+	##
+	##  1) It is only called when the inputs it depends on changes
+	##  2) The computation and result are shared by all the callers (it 
+	##     only executes a single time)
+	##  3) When the inputs change and the function is re-executed, the
+	##     new result is compared to the previous result; if the two are
+	##     identical, then the callers are not notified
+	##
+	datasetInput <- dynamic({
+		switch(input$dataset,
+			"rock" = rock,
+			"pressure" = pressure,
+			"cars" = cars)
+	})
+  
+	## The output$caption is computed based on a dynamic function that
+	## returns input$caption. When the user changes the "caption" field:
+	##
+	##  1) This function is automatically called to recompute the output 
+	##  2) The new caption is pushed back to the browser for re-display
+	## 
+	## Note that because the data-oriented reactive functions below don't 
+	## depend on input$caption, those functions are NOT called when 
+	## input$caption changes.
+	output$caption <- dynamicText({
+		input$caption
+	})
+  
+	## The output$summary depends on the datasetInput dynamic function, 
+	## so will be re-executed whenever datasetInput is re-executed 
+	## (i.e. whenever the input$dataset changes)
+	output$summary <- dynamicPrint({
+		dataset <- datasetInput()
+		summary(dataset)
+	})
+  
+	## The output$view depends on both the databaseInput dynamic function
+	## and input$obs, so will be re-executed whenever input$dataset or 
+	## input$obs is changed. 
+	output$view <- dynamicTable({
+		head(datasetInput(), n = input$obs)
+	})
+})
+!"
+<<ui, echo = FALSE, results = ascii>>="
+## What to display in dynamic mode?
+asciiDynamic({
+	uiInput(
+		## A text input
+		wiText("caption", "Caption:", "Data Summary"),
+	
+		br(),
+		
+		## A selection box and numeric input box
+		wiSelect("dataset", "Choose a dataset:", 
+			choices = c("rock", "pressure", "cars")),
+		
+		br(),
+		
+		## A numeric input box
+		wiNumeric("obs", "Number of observations to view:", 10)			 
+	)
+    
+	uiDiv(
+		## Show the caption, a summary of the dataset and an HTML table with
+		## the requested number of observations
+		h3(woText("caption")),
+		woVerbatim("summary"),
+		woTable("view")
+	)
+})
+## What to display in static mode
+asciiStatic(uiP(strong(
+	"This application works only in dynamic mode through the shiny server!")))
+!"
+NOTE: //This is a reimplementation of **`03_reactivity'** shiny example as a **SciViews R script**.//
+<<>>="

Added: pkg/svSweave/inst/examples/Dynamic04.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic04.R	                        (rev 0)
+++ pkg/svSweave/inst/examples/Dynamic04.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,57 @@
+#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
+svSweave::RdocHeader("Dynamic R document - Miles Per Gallon", toc = "none")
+!"
+<<server, eval = FALSE, echo = FALSE>>="
+require(datasets)
+
+## We tweak the "am" field to have nicer factor labels. Since this doesn't
+## rely on any user inputs we can do this once at startup and then use the
+## value throughout the lifetime of the application
+mpgData <- mtcars
+mpgData$am <- factor(mpgData$am, labels = c("Automatic", "Manual"))
+
+## Define server logic required to plot various variables against mpg
+dynamicServer({
+  
+	## Compute the forumla text in a dynamic function since it is 
+	## shared by the output$caption and output$mpgPlot functions
+	formulaText <- dynamic({
+		paste("mpg ~", input$variable)
+	})
+   
+	## Return the formula text for printing as a caption
+	output$caption <- dynamicText({
+		formulaText()
+	})
+  
+	## Generate a plot of the requested variable against mpg and only 
+	## include outliers if requested
+	output$mpgPlot <- dynamicPlot({
+		boxplot(as.formula(formulaText()), data = mpgData,
+            outline = input$outliers, col = "cornsilk")
+	})
+})
+!"
+<<ui, echo = FALSE, results = ascii>>="
+## What to display in dynamic mode?
+asciiDynamic({
+	## A text input and a checkbox
+	uiInput(
+		wiSelect("variable", "Variable:",
+			c("Cylinders" = "cyl", "Transmission" = "am", "Gears" = "gear")),
+
+		wiCheckbox("outliers", "Show outliers", FALSE)
+	)
+	
+	uiDiv(
+		## Show the caption and plot of the requested variable against mpg
+		h3(woText("caption")), 
+		woPlot("mpgPlot")
+	)
+})
+## What to display in static mode?
+asciiStatic(uiP(strong(
+	"This application works only in dynamic mode through the shiny server!")))
+!"
+NOTE: //This is a reimplementation of **`04_mpg'** shiny example as a **SciViews R script**.//
+<<>>="

Added: pkg/svSweave/inst/examples/Dynamic05.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic05.R	                        (rev 0)
+++ pkg/svSweave/inst/examples/Dynamic05.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,60 @@
+#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
+svSweave::RdocHeader("Dynamic R document - Sliders", toc = "none")
+!"
+<<server, eval = FALSE, echo = FALSE>>="
+## Define server logic for slider examples
+dynamicServer({
+  
+	## Dynamic function to compose a data frame containing all of the values
+	sliderValues <- dynamic({
+		## Compose data frame
+		data.frame(
+			Name = c("Integer", "Decimal", "Range", "Custom Format", "Animation"),
+			Value = as.character(c(input$integer, input$decimal,
+                paste(input$range, collapse=' '), input$format, input$animation)), 
+		stringsAsFactors = FALSE)
+	}) 
+  
+	## Show the values using an HTML table
+	output$values <- dynamicTable({
+		sliderValues()
+	})
+})
+!"
+<<ui, echo = FALSE, results = ascii>>="
+## What to display in dynamic mode?
+asciiDynamic({
+	## Sliders that demonstrate various available options
+	uiInput(
+		## Simple integer interval
+		sliderInput("integer", "Integer:",
+			min = 0, max = 1000, value = 500),
+    
+		## Decimal interval with step value
+		sliderInput("decimal", "Decimal:",
+			min = 0, max = 1, value = 0.5, step= 0.1),
+   
+		## Specification of range within an interval
+		sliderInput("range", "Range:",
+			min = 1, max = 1000, value = c(200,500)),
+    
+		## Provide a custom currency format for value display, with basic animation
+		sliderInput("format", "Custom Format:",
+			min = 0, max = 10000, value = 0, step = 2500,
+			format = "$#,##0", locale = "us", animate = TRUE),
+    
+		## Animation with custom interval (in ms) to control speed, plus looping
+		sliderInput("animation",
+			"Looping Animation (not in SciViews R document):", 1, 2000, 1,
+			step = 10, animate = animationOptions(interval = 300, loop = TRUE))
+	)
+	
+	## Show a table summarizing the values entered 
+    uiDiv(woTable("values"))
+})
+## What to display in static mode?
+asciiStatic(uiP(strong(
+	"This application works only in dynamic mode through the shiny server!")))
+!"
+NOTE: //This is a reimplementation of **`05_sliders'** shiny example as a **SciViews R script**.//
+<<>>="

Added: pkg/svSweave/inst/examples/Dynamic06.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic06.R	                        (rev 0)
+++ pkg/svSweave/inst/examples/Dynamic06.R	2013-01-06 22:26:18 UTC (rev 507)
@@ -0,0 +1,68 @@
+#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
+svSweave::RdocHeader("Dynamic R document - Tabsets", toc = "none")
+!"
+<<server, eval = FALSE, echo = FALSE>>="
+## Define server logic for random distribution application
+dynamicServer({
+  
+	## Dynamic function to generate the requested distribution. This is 
+	## called whenever the inputs change. The output functions defined 
+	## below then all use the value computed from this function
+	data <- dynamic({  
+		dist <- switch(input$dist, norm = rnorm, unif = runif,
+            lnorm = rlnorm, exp = rexp, rnorm)
+    
+		dist(input$n)
+	})
+  
+	## Generate a plot of the data. Also uses the inputs to build the 
+	## plot label. Note that the dependencies on both the inputs and
+	## the data reactive function are both tracked, and all functions 
+	## are called in the sequence implied by the dependency graph
+	output$plot <- dynamicPlot({
+		dist <- input$dist
+		n <- input$n
+		hist(data(), main = paste("r", dist, "(", n, ")", sep = ""),
+			col = "cornsilk")
+	})
+  
+	## Generate a summary of the data
+	output$summary <- dynamicPrint({
+		summary(data())
+	})
+  
+	## Generate an HTML table view of the data
+	output$table <- dynamicTable({
+		data.frame(x = data())
+	})  
+})
+!"
+<<ui, echo = FALSE, results = ascii>>="
+## What to display in dynamic mode?
+asciiDynamic({
+	## Sidebar with controls to select the random distribution type
+	## and number of observations to generate. Note the use of the br()
+	## element to introduce extra vertical spacing
+	uiInput(
+		wiRadioButtons("dist", "Distribution type:",
+			c("Normal" = "norm", "Uniform" = "unif",
+			"Log-normal" = "lnorm", "Exponential" = "exp")),
+		br(),
+		wiSlider("n", "Number of observations:",
+			value = 500, min = 1, max = 1000)
+	)
+	
+	## # Show a tabset that includes a plot, summary, and table view
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/sciviews -r 507


More information about the Sciviews-commits mailing list