[Sciviews-commits] r509 - komodo/SciViews-K/components komodo/SciViews-K/content komodo/SciViews-K/content/js komodo/SciViews-K/pylib komodo/SciViews-K/udl pkg/svSweave pkg/svSweave/R pkg/svSweave/inst/asciidoc/themes pkg/svSweave/inst/asciidoc/themes/compact pkg/svSweave/inst/asciidoc/themes/sciviews pkg/svSweave/inst/examples pkg/svSweave/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jan 11 15:29:49 CET 2013
Author: phgrosjean
Date: 2013-01-11 15:29:49 +0100 (Fri, 11 Jan 2013)
New Revision: 509
Added:
komodo/SciViews-K/udl/Rshebang.udl
pkg/svSweave/R/header.R
pkg/svSweave/inst/asciidoc/themes/compact/
pkg/svSweave/inst/asciidoc/themes/compact/compact.css
pkg/svSweave/man/header.Rd
Removed:
pkg/svSweave/R/RdocHeader.R
pkg/svSweave/man/RdocHeader.Rd
Modified:
komodo/SciViews-K/components/koR_UDL_Language.py
komodo/SciViews-K/content/js/pref-R.js
komodo/SciViews-K/content/js/prefs.js
komodo/SciViews-K/content/pref-R.xul
komodo/SciViews-K/pylib/langinfo_r.py
komodo/SciViews-K/udl/R-mainlex.udl
komodo/SciViews-K/udl/R2wiki.udl
komodo/SciViews-K/udl/Rlex.udl
komodo/SciViews-K/udl/wikilex.udl
pkg/svSweave/NAMESPACE
pkg/svSweave/NEWS
pkg/svSweave/TODO
pkg/svSweave/inst/asciidoc/themes/sciviews/sciviews.css
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/man/asciidoc.Rd
Log:
Further work on the svDoc format (svSweave + syntax highlighting in SciViews-K). Added the sciviews.r.page.port option in Komodo preferences; added shebang line coloring in R language
Modified: komodo/SciViews-K/components/koR_UDL_Language.py
===================================================================
--- komodo/SciViews-K/components/koR_UDL_Language.py 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/components/koR_UDL_Language.py 2013-01-11 14:29:49 UTC (rev 509)
@@ -130,14 +130,14 @@
plot(y ~ x, data = a, col = 'blue', main = "Plot of \\"a\\"\\0")
a$y <- NULL; a
-!"
+!!"
== Wiki block
* Item 1,
* Item 2.
This is a paragraph of **bold** and //italic// text.
-!"
+<<>>="
"""
## PhG: what's this??? Everything is commented for now
Modified: komodo/SciViews-K/content/js/pref-R.js
===================================================================
--- komodo/SciViews-K/content/js/pref-R.js 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/content/js/pref-R.js 2013-01-11 14:29:49 UTC (rev 509)
@@ -516,6 +516,15 @@
prefset.setDoublePref("sciviews.r.port", rPort);
}
// TODO: shouldn't we test for rPort too?
+ var rPagePort = parseInt(document
+ .getElementById('sciviews.r.page.port').value);
+ // Allow for both a long or a double for sciviews.r.page.port
+ try {
+ prefset.setLongPref("sciviews.r.page.port", rPagePort);
+ } catch (e) {
+ prefset.setDoublePref("sciviews.r.page.port", rPagePort);
+ }
+ // TODO: shouldn't we test for rPagePort too?
// Check if selected item is different from current sv.clientType
// and if R is running
if (rType != sv.clientType && sv.r.test()) {
Modified: komodo/SciViews-K/content/js/prefs.js
===================================================================
--- komodo/SciViews-K/content/js/prefs.js 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/content/js/prefs.js 2013-01-11 14:29:49 UTC (rev 509)
@@ -35,6 +35,7 @@
"sciviews.ko.port": 7052,
"sciviews.r.type": "http",
"sciviews.r.port": 8888,
+ "sciviews.r.page.port": 7680,
"sciviews.r.host": "127.0.0.1",
"sciviews.r.interpreter": "",
"sciviews.r.args": "--quiet",
Modified: komodo/SciViews-K/content/pref-R.xul
===================================================================
--- komodo/SciViews-K/content/pref-R.xul 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/content/pref-R.xul 2013-01-11 14:29:49 UTC (rev 509)
@@ -233,6 +233,12 @@
tooltip="Currently only local connection is allowed"
disabled="false"/>
</row>
+ <row align="center">
+ <label value="Page server port #:" control="sciviews.r.page.port" />
+ <textbox id="sciviews.r.page.port" pref="true" width="50" />
+ <label value=" " />
+ <label value=" " />
+ </row>
</rows>
</grid>
Modified: komodo/SciViews-K/pylib/langinfo_r.py
===================================================================
--- komodo/SciViews-K/pylib/langinfo_r.py 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/pylib/langinfo_r.py 2013-01-11 14:29:49 UTC (rev 509)
@@ -1,7 +1,9 @@
from langinfo import LangInfo
class RLangInfo(LangInfo):
+ """http://www.r-project.org"""
name = "R"
- conforms_to_bases = ["text"]
+ conforms_to_bases = ["Text"]
exts = [".R", ".Rhistory", ".Rprofile"]
filename_patterns = ["Rprofile"]
+ default_encoding = "utf-8"
Modified: komodo/SciViews-K/udl/R-mainlex.udl
===================================================================
--- komodo/SciViews-K/udl/R-mainlex.udl 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/udl/R-mainlex.udl 2013-01-11 14:29:49 UTC (rev 509)
@@ -48,10 +48,11 @@
initial IN_M_DEFAULT
# Null-transition to get into SSL state
state IN_M_DEFAULT:
-/./ : redo, => IN_SSL_DEFAULT
+/./ : redo, => IN_CSL_DEFAULT
################ Language Definition ################
+include "Rshebang.udl"
include "R2wiki.udl"
include "wiki2R.udl"
include "Rlex.udl"
Modified: komodo/SciViews-K/udl/R2wiki.udl
===================================================================
--- komodo/SciViews-K/udl/R2wiki.udl 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/udl/R2wiki.udl 2013-01-11 14:29:49 UTC (rev 509)
@@ -31,9 +31,9 @@
#
# ***** END LICENSE BLOCK *****
-# R switches to wiki block using !" at the beginning of a line
+# R switches to wiki block using !!" at the beginning of a line
family ssl
state IN_SSL_DEFAULT:
-/^[!]"/ : paint(upto, SSL_DEFAULT), paint(include, M_TAGNAME) => IN_M_WIKI_START
+/^!!"/ : paint(upto, SSL_DEFAULT), paint(include, M_TAGNAME) => IN_M_WIKI_START
Modified: komodo/SciViews-K/udl/Rlex.udl
===================================================================
--- komodo/SciViews-K/udl/Rlex.udl 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/udl/Rlex.udl 2013-01-11 14:29:49 UTC (rev 509)
@@ -2648,7 +2648,7 @@
# ----------- Entering Comments ---------- #
-# This is shebang line or the R wiki construct used for R output
+# This is the R wiki construct used for R output
/^#!/ : paint(upto, SSL_DEFAULT), paint(include, SSL_REGEX), => IN_SSL_OUTPUT
# One-line comments end at end-of-line
@@ -2666,10 +2666,12 @@
# assignations with '='). That is: arg/var = (but not var ==)
/[$NMSTART](?=[$CS]*[$WS]*\=[^\=])/ : paint(upto, SSL_DEFAULT), => IN_SSL_ARGUMENT
-# Special case of svSweave::RdocHeader("Main title")
-# where we want to colorize main title as a Rdoc M_PI element
-"svSweave::RdocHeader" : paint(upto, SSL_DEFAULT), paint(include, SSL_REGEX), => IN_SSL_DOCHEADER
+# Special case of svDoc::header("Main title", ...;)
+# where we want to colorize main title as a svDoc M_PI element
+"svDoc::header" : paint(upto, SSL_DEFAULT), paint(include, SSL_REGEX), => IN_SSL_DOCHEADER
+# TO BE ELIMINATED!/[ \t]*->[ \t\r\n]*svDoc::header/ : 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
# R code that should be separated from the rest...
@@ -2715,7 +2717,7 @@
/[$OP]/ : paint(upto, SSL_DEFAULT), redo, => IN_SSL_OP1
-#### The special SciViews::R() header ##########################################
+#### The special svDoc::header() ##########################################
state IN_SSL_DOCHEADER:
# We enter the doc header construct => must have an opening brace
/[$WS]+/ : #stay, spaces allowed here
@@ -2725,9 +2727,13 @@
state IN_SSL_DOCHEADER2:
/[$WS]+/ : #stay, spaces allowed here
# Enter string mode for main title
-/[^"]/ : paint(upto, SSL_DEFAULT), redo => IN_SSL_DEFAULT # Should never occur
-'"' : paint(upto, SSL_DEFAULT), paint(include, SSL_STRING), => IN_SSL_DOCTITLE
+/[^"]/ : paint(upto, SSL_DEFAULT), redo => IN_SSL_DEFAULT
+'"' : paint(upto, SSL_DEFAULT), paint(include, SSL_STRING), => IN_SSL_STARTDOCTITLE
+state IN_SSL_STARTDOCTITLE:
+'= ' : paint(upto, SSL_STRING), paint(include, M_TAGNAME), => IN_SSL_DOCTITLE
+/./ : paint(upto, SSL_STRING), redo => IN_SSL_DOCTITLE
+
state IN_SSL_DOCTITLE:
'"' : paint(upto, M_PI), paint(include, SSL_STRING), => IN_SSL_DEFAULT
/\\['"nrtbafv\\]/ : #stay, Don't miscount backslash at end and/or valid escape characters
@@ -2775,7 +2781,7 @@
##### Comments #################################################################
-# This is used in R Wiki to denote R output
+# This is used in svDoc to denote R output
state IN_SSL_OUTPUT: # SSL_COMMENTBLOCK not different from SSL_COMMENT
#/[\r\n]/ : paint(upto, SSL_COMMENTBLOCK), => IN_SSL_DEFAULT
/[\r\n]/ : paint(upto, SSL_REGEX), => IN_SSL_DEFAULT # Use SSL_STRING instead
Added: komodo/SciViews-K/udl/Rshebang.udl
===================================================================
--- komodo/SciViews-K/udl/Rshebang.udl (rev 0)
+++ komodo/SciViews-K/udl/Rshebang.udl 2013-01-11 14:29:49 UTC (rev 509)
@@ -0,0 +1,74 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is SciViews-K by Philippe Grosjean et al.
+#
+# Contributor(s):
+# Philippe Grosjean
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+# Special treatment for the #! (shebang) first line
+
+family csl
+initial IN_CSL_DEFAULT
+
+family csl # client-side language
+sublanguage Rshebang
+
+# We have to specify the min and max styles we'll be referring to
+# Here are the available styles (see include/Scintilla.iface):
+# Template: client-side language # Start at 30
+#SCE_UDL_CSL_DEFAULT=30
+#SCE_UDL_CSL_COMMENT=31
+#SCE_UDL_CSL_COMMENTBLOCK=32
+#SCE_UDL_CSL_NUMBER=33
+#SCE_UDL_CSL_STRING=34
+#SCE_UDL_CSL_WORD=35
+#SCE_UDL_CSL_IDENTIFIER=36
+#SCE_UDL_CSL_OPERATOR=37
+#SCE_UDL_CSL_REGEX=38
+start_style CSL_DEFAULT
+end_style CSL_REGEX
+
+# Set the basic patterns we'll be using for styling transitions.
+pattern WS = '\s\t\r\n' # inside cset, whitespace
+
+################ Transition ################
+
+state IN_CSL_DEFAULT:
+/^#!/ : paint(upto, CSL_DEFAULT), paint(include, CSL_REGEX), => IN_CSL_SHEBANG
+/./ : paint(upto, CSL_DEFAULT), redo => IN_SSL_DEFAULT
+
+# The whole line is shebang command
+state IN_CSL_SHEBANG:
+/[\r\n]/ : paint(upto, CSL_REGEX), => IN_SSL_DEFAULT
+#/[\r\n]/ : paint(upto, CSL_REGEX), => IN_CSL_SECOND_LINE
+
+## Transition to R code: about anything... except a "string" which could be svDoc title
+state IN_CSL_SECOND_LINE:
+/[$WS]+/ : #stay, spaces allowed here
+# TO BE ELIMINATED!? '"' : paint(upto, CSL_DEFAULT), paint(include, M_TAGNAME), => IN_SSL_STARTDOCTITLE
+/./ : paint(upto, CSL_DEFAULT), redo => IN_SSL_DEFAULT
Modified: komodo/SciViews-K/udl/wikilex.udl
===================================================================
--- komodo/SciViews-K/udl/wikilex.udl 2013-01-07 20:58:27 UTC (rev 508)
+++ komodo/SciViews-K/udl/wikilex.udl 2013-01-11 14:29:49 UTC (rev 509)
@@ -36,6 +36,36 @@
family markup
sublanguage Rwiki
+# Possible styles
+#SCE_UDL_M_STAGO
+# Start-tag-open character, as in "<"
+#SCE_UDL_M_TAGNAME
+# The name immediately after a tag-open character.
+#SCE_UDL_M_TAGSPACE
+# White-space in start-tags, end-tags, and empty tags.
+#SCE_UDL_M_ATTRNAME
+# Attribute names in start-tags.
+#SCE_UDL_M_OPERATOR
+# Operator characters, which is essentially just the '=' in attribute assignments in start-tags.
+#SCE_UDL_M_STAGC
+# Start-tag-close character (">")
+#SCE_UDL_M_EMP_TAGC
+# Tag-close sequence for an empty start-tag ("/>")
+#SCE_UDL_M_STRING
+# String attribute values in start-tags
+#SCE_UDL_M_ETAGO
+# End-tag-open character ("</")
+#SCE_UDL_M_ETAGC
+# End-tag-close character (">"). Distinguished from an "STAGC" only by context.
+#SCE_UDL_M_ENTITY
+# A complete entity reference, from the leading "&" through the closing ";".
+#SCE_UDL_M_PI
+# Processing instructions, including the leading XML declaration, from the leading "<?" through the closing "?>".
+#SCE_UDL_M_CDATA
+# CDATA marked sections.
+#SCE_UDL_M_COMMENT
+# SGML comments.
+
state IN_M_WIKI_START
/^/ : => in_wiki_default_start_of_line
/./: redo, => in_wiki_default_on_line
Modified: pkg/svSweave/NAMESPACE
===================================================================
--- pkg/svSweave/NAMESPACE 2013-01-07 20:58:27 UTC (rev 508)
+++ pkg/svSweave/NAMESPACE 2013-01-11 14:29:49 UTC (rev 509)
@@ -6,7 +6,7 @@
purlLyxRnw,
tangleLyxRnw,
weaveLyxRnw,
- RdocHeader,
+ header,
RdocToRnw,
RdocConvert,
RdocThemes,
Modified: pkg/svSweave/NEWS
===================================================================
--- pkg/svSweave/NEWS 2013-01-07 20:58:27 UTC (rev 508)
+++ pkg/svSweave/NEWS 2013-01-11 14:29:49 UTC (rev 509)
@@ -5,7 +5,7 @@
* Slight reworking of the Asciidoc-related function RdocXXX(). svBuild() is
renamed makeRdoc() to be more explicit.
-* Addition of RdocHeader() function that creates an Asciidoc header.
+* Addition of header() function that creates an Asciidoc header.
* Addition of dynamic R document features, using a customized shiny engine.
Deleted: pkg/svSweave/R/RdocHeader.R
===================================================================
--- pkg/svSweave/R/RdocHeader.R 2013-01-07 20:58:27 UTC (rev 508)
+++ pkg/svSweave/R/RdocHeader.R 2013-01-11 14:29:49 UTC (rev 509)
@@ -1,110 +0,0 @@
-## 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)
-}
Added: pkg/svSweave/R/header.R
===================================================================
--- pkg/svSweave/R/header.R (rev 0)
+++ pkg/svSweave/R/header.R 2013-01-11 14:29:49 UTC (rev 509)
@@ -0,0 +1,111 @@
+## Create an Asciidoc header according to these items
+
+header <- 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 and start with '= '
+ if (length(title)) header <- paste0(as.character(title)[1], "\n")
+ if (substring("= ", 1, 2) != "= ") header <- paste("=", header)
+
+ ## 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 svDoc")
+ 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 svDoc and SciViews are 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/TODO
===================================================================
--- pkg/svSweave/TODO 2013-01-07 20:58:27 UTC (rev 508)
+++ pkg/svSweave/TODO 2013-01-11 14:29:49 UTC (rev 509)
@@ -55,3 +55,6 @@
* In presentation or screencast mode: have a series of premared snippets to help
construct the SciViews Rdoc in live.
+
+* To use Ubuntu and Ubuntu mono on a HTML page, add at the beginning og head section:
+ <link href='http://fonts.googleapis.com/css?family=Ubuntu:400,400italic,700,700italic|Ubuntu+Mono:400,400italic,700,700italic&subset=latin,greek,latin-ext' rel='stylesheet' type='text/css'>
\ No newline at end of file
Added: pkg/svSweave/inst/asciidoc/themes/compact/compact.css
===================================================================
--- pkg/svSweave/inst/asciidoc/themes/compact/compact.css (rev 0)
+++ pkg/svSweave/inst/asciidoc/themes/compact/compact.css 2013-01-11 14:29:49 UTC (rev 509)
@@ -0,0 +1,197 @@
+/*
+ * compact.css, version 1.5
+ * Author: Alex Efros <powerman at powerman.name>
+ * Licence: Public Domain
+ *
+ * Usage: asciidoc -a theme=compact ...
+ */
+
+* { padding: 0; margin: 0; }
+img { border: 0; }
+
+/*** Layout ***/
+
+body { margin: 10px 20px; }
+#header br { display: none; }
+#revnumber { display: block; }
+#toc { margin: 1em 0; }
+.toclevel2 { margin-left: 1em; }
+#footer { margin-top: 2em; }
+
+#preamble .sectionbody,
+h2,
+h3,
+h4,
+h5 { margin: 1em 0 0 0; }
+
+.admonitionblock,
+.listingblock,
+.sidebarblock,
+.exampleblock,
+.tableblock,
+.literalblock { margin: 1em 0; }
+.admonitionblock td.icon { padding-right: 0.5em; }
+.admonitionblock td.content { padding-left: 0.5em; }
+.listingblock .content { padding: 0.5em; }
+.sidebarblock > .content { padding: 0.5em; }
+.exampleblock > .content { padding: 0 0.5em; }
+.tableblock caption { padding: 0 0 0.5em 0; }
+.tableblock thead th,
+.tableblock tbody td,
+.tableblock tfoot td { padding: 0 0.5em; }
+.quoteblock { padding: 0 2.0em; }
+
+.paragraph { margin: 1em 0 0 0; }
+.sidebarblock .paragraph:first-child,
+.exampleblock .paragraph:first-child,
+.admonitionblock .paragraph:first-child { margin: 0; }
+
+ .ulist, .olist, .dlist, .hdlist, .qlist { margin: 1em 0; }
+li .ulist, li .olist, li .dlist, li .hdlist, li .qlist,
+dd .ulist, dd .olist, dd .dlist, dd .hdlist, dd .qlist { margin: 0; }
+ul { margin-left: 1.5em; }
+ol { margin-left: 2em; }
+dd { margin-left: 3em; }
+td.hdlist1 { padding-right: 1em; }
+
+/*** Fonts ***/
+
+body { font-family: Verdana, sans-serif; }
+#header { font-family: Georgia, serif; }
+#header h1 { font-family: Arial, sans-serif; }
+#footer { font-family: Georgia, serif; }
+#email { font-size: 0.85em; }
+#revnumber { font-size: 0.75em; }
+#toc { font-size: 0.9em; }
+#toctitle { font-weight: bold; }
+#footer { font-size: 0.8em; }
+
+h2, h3, h4, h5, .title { font-family: Arial, sans-serif; }
+h2 { font-size: 1.5em; }
+.sectionbody { font-size: 0.85em; }
+.sectionbody .sectionbody { font-size: inherit; }
+h3 { font-size: 159%; } /* 1.35em */
+h4 { font-size: 141%; } /* 1.2em */
+h5 { font-size: 118%; } /* 1em */
+.title { font-size: 106%; /* 0.9em */
+ font-weight: bold;
+ }
+
+tt, .monospaced { font-family: monospace; font-size: 106%; } /* 0.9em */
+dt, td.hdlist1, .qlist em { font-family: Times New Roman, serif;
+ font-size: 118%; /* 1em */
+ font-style: italic;
+ }
+.tableblock tfoot td { font-weight: bold; }
+
+/*** Colors and Backgrounds ***/
+
+h1 { color: #527bbd; border-bottom: 2px solid silver; }
+#footer { border-top: 2px solid silver; }
+
+h2 { color: #527bbd; border-bottom: 2px solid silver; }
+h3 { color: #5D7EAE; border-bottom: 2px solid silver; }
+h3 { display: inline-block; }
+h4,h5 { color: #5D7EAE; }
+
+.admonitionblock td.content { border-left: 2px solid silver; }
+.listingblock .content { background: #f4f4f4; border: 1px solid silver; border-left: 5px solid #e0e0e0; }
+.sidebarblock > .content { background: #ffffee; border: 1px solid silver; border-left: 5px solid #e0e0e0; }
+.exampleblock > .content { border-left: 2px solid silver; }
+.quoteblock { border-left: 5px solid #e0e0e0; }
+.tableblock table {
+ border-collapse: collapse;
+ border-width: 3px;
+ border-color: #527bbd;
+}
+.tableblock table[frame=hsides] { border-style: solid none; }
+.tableblock table[frame=border] { border-style: solid; }
+.tableblock table[frame=void] { border-style: none; }
+.tableblock table[frame=vsides] { border-style: none solid; }
+.tableblock table[rules=all] tbody tr *,
+.tableblock table[rules=rows] tbody tr * {
+ border-top: 1px solid #527bbd;
+}
+.tableblock table[rules=all] tr *,
+.tableblock table[rules=cols] tr * {
+ border-left: 1px solid #527bbd;
+}
+.tableblock table tbody tr:first-child * {
+ border-top: 1px solid white; /* none don't work here... %-[] */
+}
+.tableblock table tr *:first-child {
+ border-left: none;
+}
+.tableblock table[frame] thead tr *,
+.tableblock table[frame] thead tr * {
+ border-top: 1px solid white;
+ border-bottom: 2px solid #527bbd;
+}
+.tableblock table tr td p.table,
+.tableblock table tr td p.table * {
+ border: 0px;
+}
+
+em { color: #3C598A; }
+tt, .monospaced { color: #3C598A; background: #F4F4F4; }
+.literalblock tt { background: inherit; }
+
+li { color: #a0a0a0; }
+li > * { color: black; }
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+
+span.underline { text-decoration: underline; }
+span.overline { text-decoration: overline; }
+span.line-through { text-decoration: line-through; }
+
+/*** Misc ***/
+
+.admonitionblock td.icon { vertical-align: top; }
+.attribution { text-align: right; }
+.unbreakable { page-break-inside: avoid; }
+
+ul { list-style-type: disc; }
+ol.arabic { list-style-type: decimal; }
+ol.loweralpha { list-style-type: lower-alpha; }
+ol.upperalpha { list-style-type: upper-alpha; }
+ol.lowerroman { list-style-type: lower-roman; }
+ol.upperroman { list-style-type: upper-roman; }
+.hdlist td { vertical-align: top; }
+
+
Modified: pkg/svSweave/inst/asciidoc/themes/sciviews/sciviews.css
===================================================================
--- pkg/svSweave/inst/asciidoc/themes/sciviews/sciviews.css 2013-01-07 20:58:27 UTC (rev 508)
+++ pkg/svSweave/inst/asciidoc/themes/sciviews/sciviews.css 2013-01-11 14:29:49 UTC (rev 509)
@@ -156,12 +156,16 @@
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid silver;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid silver;
background: #f4f4f4;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
padding: 0.5em;
}
@@ -343,7 +347,7 @@
font-family: "Ubuntu Mono", Consolas, "Andale Mono", "Courier New", monospace;
color: #004400;
max-width: 50em;
- font-size: 1.1em;
+ font-size: 1.1em !important;
line-height: 1.2em;
}
Modified: pkg/svSweave/inst/examples/Dynamic01.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic01.R 2013-01-07 20:58:27 UTC (rev 508)
+++ pkg/svSweave/inst/examples/Dynamic01.R 2013-01-11 14:29:49 UTC (rev 509)
@@ -1,6 +1,6 @@
-#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
-svSweave::RdocHeader("Dynamic R document - Hello Shiny!")
-!"
+#! /usr/bin/Rscript -e svDoc::render...
+svDoc::header("Dynamic R document - Hello Shiny!")
+!!"
<<server, eval = FALSE, echo = FALSE>>="
## The code to generate our dynamic elements on the page
dynamicServer({
@@ -14,10 +14,10 @@
output$distPlot <- dynamicPlot({
## Generate an rnorm distribution and plot it
dist <- rnorm(input$obs)
- hist(dist, col = "cornsilk")
+ hist(dist, col = "red") #"cornsilk")
})
})
-!"
+!!"
<<ui, echo = FALSE, results = ascii>>="
## What to display in dynamic mode?
asciiDynamic({
@@ -31,6 +31,6 @@
## 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**.//
<<>>="
Modified: pkg/svSweave/inst/examples/Dynamic02.R
===================================================================
--- pkg/svSweave/inst/examples/Dynamic02.R 2013-01-07 20:58:27 UTC (rev 508)
+++ pkg/svSweave/inst/examples/Dynamic02.R 2013-01-11 14:29:49 UTC (rev 509)
@@ -1,6 +1,6 @@
-#! /usr/bin/Rscript -e 'svSweave::RdocConvert()'
-svSweave::RdocHeader("Dynamic R document - Shiny Text")
-!"
+#! /usr/bin/Rscript -e svDoc::render...
+svDoc::header("Dynamic R document - Shiny Text")
+!!"
<<server, eval = FALSE, echo = FALSE>>="
require(datasets)
@@ -25,7 +25,7 @@
head(datasetInput(), n = input$obs)
})
})
-!"
+!!"
<<ui, echo = FALSE, results = ascii>>="
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/sciviews -r 509
More information about the Sciviews-commits
mailing list