[Sciviews-commits] r505 - komodo/SciViews-K/udl komodo/SciViews-K-dev/.komodotools/Project pkg/svSweave/R pkg/svSweave/inst/asciidoc pkg/svSweave/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 2 19:54:24 CET 2013


Author: phgrosjean
Date: 2013-01-02 19:54:24 +0100 (Wed, 02 Jan 2013)
New Revision: 505

Removed:
   komodo/SciViews-K-dev/.komodotools/Project/R_2-way_communication_test.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/R_test_for_connection_with_R.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/R_toggle_status.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/Restart_Komodo.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/Smart_highlight.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/Test_R_completion.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/restartSocketServer.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/startSocketServer.komodotool
   komodo/SciViews-K-dev/.komodotools/Project/stopSocketServer.komodotool
Modified:
   komodo/SciViews-K/udl/wiki2R.udl
   komodo/SciViews-K/udl/wikilex.udl
   pkg/svSweave/R/asciidoc.R
   pkg/svSweave/inst/asciidoc/asciidoc.conf
   pkg/svSweave/man/Rdoc.Rd
Log:
Further work on the Rdoc process in svSweave and on wiki chunks highlighters in SciViews-K

Modified: komodo/SciViews-K/udl/wiki2R.udl
===================================================================
--- komodo/SciViews-K/udl/wiki2R.udl	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K/udl/wiki2R.udl	2013-01-02 18:54:24 UTC (rev 505)
@@ -36,7 +36,7 @@
 family markup
 
 state in_wiki_default_start_of_line:
-/[!]<<.*>>="/ : paint(upto, M_CDATA), paint(include, M_TAGNAME), => IN_M_WIKI_STOP
+/<<.*>>="/ : paint(upto, M_CDATA), paint(include, M_TAGNAME), => IN_M_WIKI_STOP
 
 state IN_M_WIKI_STOP:
 /^/ : paint(upto, M_CDATA), => IN_SSL_DEFAULT

Modified: komodo/SciViews-K/udl/wikilex.udl
===================================================================
--- komodo/SciViews-K/udl/wikilex.udl	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K/udl/wikilex.udl	2013-01-02 18:54:24 UTC (rev 505)
@@ -42,7 +42,27 @@
 
 state in_wiki_default_start_of_line:
 #'{{{' : paint(upto, M_DEFAULT), paint(include, M_TAGNAME), => in_wiki_triple_brace_start
-'#': paint(upto, M_CDATA), paint(include, M_COMMENT), => in_wiki_have_comment
+'##': paint(upto, M_CDATA), paint(include, M_COMMENT), => in_wiki_have_comment
+
+# This is for the item list
+'* ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'*** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'**** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'***** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+
+# This is for the numbered list
+'. ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'.. ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'... ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'.... ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'..... ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+/[1-9]\. /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+/[a-z]\. /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+/[A-Z]\. /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+/[ivx]+\) /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+/[IVX]+\) /: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+
 '===== ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
 '==== ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
 '=== ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
@@ -50,32 +70,40 @@
 '= ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
 '.': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_finish_header
 
-# This is for the item list
-'* ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
-'** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
-'*** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
-'**** ': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+# This is for special paragraphs
+'NOTE:': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'IMPORTANT:': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'WARNING:': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'CAUTION:': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
+'TIP:': paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_on_line
 
+# Everything between [] on the beginning of a line, or with name:: is tag
+/\[.*\]$/: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_start_of_line
+/[a-zA-Z][a-zA-Z _0-9]+::$/: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_start_of_line
+
 /./: redo, => in_wiki_default_on_line
 
 state in_wiki_finish_header:
 /$/ : paint(upto, M_PI), paint(include, M_PI), => in_wiki_default_start_of_line
 #/\s+/ : #stay
-'#': paint(upto, M_PI), paint(include, M_COMMENT), => in_wiki_have_comment
+'##': paint(upto, M_PI), paint(include, M_COMMENT), => in_wiki_have_comment
 #/./: redo, => in_wiki_default_on_line
 
 state in_wiki_default_on_line:
-'#': paint(upto, M_CDATA), paint(include, M_COMMENT), => in_wiki_have_comment
+'##': paint(upto, M_CDATA), paint(include, M_COMMENT), => in_wiki_have_comment
+# Line break with +
+/ \+$/: paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_default_start_of_line
 /$/: => in_wiki_default_start_of_line
 "//" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_italic
 "**" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_bold
+"++" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_monospaced
 
 "'''''" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_q5
 "'''" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_q3
 "''" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_q2
 
 "~~" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_tilde2
-"^" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_caret
+"^^" : paint(upto, M_CDATA), paint(include, M_TAGNAME), => in_wiki_caret
 
 '{{{' : paint(upto, M_CDATA), => in_wiki_brace_3
 /!'+/: #stay
@@ -134,6 +162,10 @@
 /!\*+/: #stay
 "**" : paint(upto, M_TAGNAME), paint(include, M_TAGNAME), => in_wiki_default_on_line
 
+state in_wiki_monospaced:
+/!\++/: #stay
+"++" : paint(upto, CSL_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
+
 state in_wiki_q5:
 /!'+/: #stay
 "'''''" : paint(upto, M_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
@@ -148,8 +180,8 @@
 /!~+/: #stay
 "~~" : paint(upto, M_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
 state in_wiki_caret:
-/!^/: #stay
-"^" : paint(upto, M_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
+/!^+/: #stay
+"^^" : paint(upto, M_STRING), paint(include, M_TAGNAME), => in_wiki_default_on_line
 #}}}
 
 ################ End of State Handling ################

Deleted: komodo/SciViews-K-dev/.komodotools/Project/R_2-way_communication_test.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/R_2-way_communication_test.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/R_2-way_communication_test.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,19 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "R: 2-way communication test", 
-  "language": "JavaScript", 
-  "trigger_enabled": false, 
-  "value": [
-    "sv.cmdout.clear();", 
-    "sv.cmdout.append(sv.rconn.evalAtOnce(\"cat('R<-Komodo : OK', '\\n')\").trim());", 
-    "sv.rconn.eval(\"cat(koCmd('\\\"R->Komodo : OK\\\"', type='j'))\", function(res) {", 
-    "\tsv.cmdout.append(res.trim());", 
-    "}, \"h\");"
-  ], 
-  "trigger": "trigger_postopen", 
-  "rank": 100, 
-  "version": "1.0.7", 
-  "async": false, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/disconnect.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/R_test_for_connection_with_R.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/R_test_for_connection_with_R.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/R_test_for_connection_with_R.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,22 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "R: test for connection with R", 
-  "language": "JavaScript", 
-  "trigger_enabled": false, 
-  "value": [
-    "var RConnectionSuccess = sv.rconn.testRAvailability();", 
-    "sv.command.updateRStatus(RConnectionSuccess);", 
-    "", 
-    "var ltb = document.getElementById(\"leftTabBox\");", 
-    "var rotp = document.getElementById(\"sciviews_robjects_tabpanel\");", 
-    "var rot = document.getElementById(\"sciviews_robjects_tab\");", 
-    "rotp.disabled = rot.disabled = !RConnectionSuccess;", 
-    ""
-  ], 
-  "trigger": "trigger_postopen", 
-  "rank": 100, 
-  "version": "1.0.7", 
-  "async": false, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/connect.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/R_toggle_status.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/R_toggle_status.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/R_toggle_status.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,15 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "R: toggle status", 
-  "language": "JavaScript", 
-  "trigger_enabled": 0, 
-  "rank": 100, 
-  "trigger": "trigger_postopen", 
-  "value": [
-    "sv.command.updateRStatus()"
-  ], 
-  "version": "1.0.7", 
-  "async": 0, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/bug_go.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/Restart_Komodo.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/Restart_Komodo.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/Restart_Komodo.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,35 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "Restart Komodo", 
-  "language": "JavaScript", 
-  "trigger_enabled": false, 
-  "value": [
-    "const Cc = Components.classes;", 
-    "const Ci = Components.interfaces;", 
-    "", 
-    "function restartApp() {", 
-    "  // Notify all windows that an application quit has been requested.", 
-    "  var os = Cc[\"@mozilla.org/observer-service;1\"].", 
-    "           getService(Ci.nsIObserverService);", 
-    "  var cancelQuit = Cc[\"@mozilla.org/supports-PRBool;1\"].", 
-    "                   createInstance(Ci.nsISupportsPRBool);", 
-    "  os.notifyObservers(cancelQuit, \"quit-application-requested\", null);", 
-    "", 
-    "  // Something aborted the quit process.", 
-    "  if (cancelQuit.data)", 
-    "    return;", 
-    "", 
-    "  var as = Cc[\"@mozilla.org/toolkit/app-startup;1\"].", 
-    "           getService(Ci.nsIAppStartup);", 
-    "  as.quit(Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);", 
-    "}", 
-    "", 
-    "restartApp();"
-  ], 
-  "trigger": "trigger_postopen", 
-  "rank": 100, 
-  "version": "1.0.7", 
-  "async": false, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/application_lightning.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/Smart_highlight.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/Smart_highlight.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/Smart_highlight.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,27 +0,0 @@
-{
-  "keyboard_shortcut": "Ctrl+1", 
-  "name": "Smart highlight", 
-  "language": "JavaScript", 
-  "trigger_enabled": 0, 
-  "rank": 100, 
-  "trigger": "trigger_postopen", 
-  "value": [
-    "var findSvc = Components.classes[\"@activestate.com/koFindService;1\"]", 
-    "    .getService(Components.interfaces.koIFindService);", 
-    "", 
-    "findSvc.options.patternType = findSvc.options.FOT_SIMPLE;", 
-    "", 
-    "var context = Components.classes[\"@activestate.com/koFindContext;1\"]", 
-    "     .createInstance(Components.interfaces.koIFindContext);", 
-    "context.type = context.FCT_CURRENT_DOC;", 
-    "", 
-    "findSvc.options.matchWord = true;", 
-    "findSvc.options.displayInFindResults2 = true;", 
-    "Find_FindAll(self, context, ko.interpolate.getWordUnderCursor(), null,", 
-    "\t\t\t function() {});"
-  ], 
-  "version": "1.0.7", 
-  "async": 1, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/rainbow.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/Test_R_completion.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/Test_R_completion.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/Test_R_completion.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,20 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "Test: R completion", 
-  "language": "JavaScript", 
-  "trigger_enabled": false, 
-  "value": [
-    "var svuSvc = Components.classes[\"@sciviews.org/svUtils;1\"].getService(Components.interfaces.svIUtils);", 
-    "try {", 
-    "    svuSvc.complete(\"\")", 
-    "} catch(e) {", 
-    "    sv.cmdout.append(e)", 
-    "}"
-  ], 
-  "trigger": "trigger_postopen", 
-  "rank": 100, 
-  "version": "1.0.7", 
-  "async": false, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/bug.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/restartSocketServer.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/restartSocketServer.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/restartSocketServer.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,16 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "restartSocketServer", 
-  "language": "JavaScript", 
-  "trigger_enabled": false, 
-  "value": [
-    "sv.rconn.restartSocketServer();", 
-    ""
-  ], 
-  "trigger": "trigger_postopen", 
-  "rank": 100, 
-  "version": "1.0.7", 
-  "async": false, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/server_lightning.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/startSocketServer.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/startSocketServer.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/startSocketServer.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,16 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "startSocketServer", 
-  "language": "JavaScript", 
-  "trigger_enabled": false, 
-  "value": [
-    "sv.cmdout.append(sv.rconn.startSocketServer());", 
-    ""
-  ], 
-  "trigger": "trigger_postopen", 
-  "rank": 100, 
-  "version": "1.0.7", 
-  "async": false, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/server_go.png"
-}
\ No newline at end of file

Deleted: komodo/SciViews-K-dev/.komodotools/Project/stopSocketServer.komodotool
===================================================================
--- komodo/SciViews-K-dev/.komodotools/Project/stopSocketServer.komodotool	2013-01-02 11:34:43 UTC (rev 504)
+++ komodo/SciViews-K-dev/.komodotools/Project/stopSocketServer.komodotool	2013-01-02 18:54:24 UTC (rev 505)
@@ -1,15 +0,0 @@
-{
-  "keyboard_shortcut": "", 
-  "name": "stopSocketServer", 
-  "language": "JavaScript", 
-  "trigger_enabled": false, 
-  "value": [
-    "sv.rconn.stopSocketServer();"
-  ], 
-  "trigger": "trigger_postopen", 
-  "rank": 100, 
-  "version": "1.0.7", 
-  "async": false, 
-  "type": "macro", 
-  "icon": "chrome://famfamfamsilk/skin/icons/server_delete.png"
-}
\ No newline at end of file

Modified: pkg/svSweave/R/asciidoc.R
===================================================================
--- pkg/svSweave/R/asciidoc.R	2013-01-02 11:34:43 UTC (rev 504)
+++ pkg/svSweave/R/asciidoc.R	2013-01-02 18:54:24 UTC (rev 505)
@@ -5,15 +5,14 @@
 ## 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",
+revremark = NULL, copyright = "cc-by", encoding = "UTF-8", lang = "en",
 pagetitle = NULL, description = "SciViews Rdoc", keywords = NULL,
-format = "html", theme = "SciViews", max.width = 720, width = "100%",
-toc = c("top", "side", "manual", "none"), toc.title = NULL, toclevels = 3,
+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,
-SweaveOpts = list(prefix.string = "figures/fig", width = 7.2, height = 7.2, pdf = TRUE),
-SweaveInit = { options(width = 90); options(SweaveHooks = list(fig = function()
-par(col.lab = "#434366", col.main = "#434366")))}
+SweaveInit = { options(width = 80); options(SweaveHooks = list(fig = function()
+par(col.lab = "#434366", col.main = "#434366"))) }
 )
 {
 	## Format AsciiDocsciidoc attributes
@@ -28,7 +27,6 @@
 		stop("You must provide a title for your Rdoc")
 	
 	## Idem for author, but allow several names
-	## TODO: Allows for first middle last and must replace space inside items by _
 	author <- paste(author, collapse = ", ")
 	if (!length(author))
 		stop("You must provide at least one author for your Rdoc")
@@ -40,14 +38,14 @@
 	
 	## Compute revision field: [revnumber], [revdate]:\n[revremark]
 	if (length(revnumber))
-		revfield <- paste0(revfield, ", ") else revfield <- ""
+		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("!\"\n",
+	header <- paste0(
 		"= ", title, "\n",
 		author, " <", email, ">\n",
 		revfield, "\n"
@@ -68,7 +66,6 @@
 	header <- asciiAttr(header, "title", pagetitle)
 	header <- asciiAttr(header, "description", description)
 	header <- asciiAttr(header, "keywords", keywords)
-	header <- asciiAttr(header, "format", format)
 	header <- asciiAttr(header, "theme", theme)
 	header <- asciiAttr(header, "max-width", max.width)
 	header <- asciiAttr(header, "width", width)
@@ -91,31 +88,16 @@
 	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
 	
-	## Rework SweaveOpts
-	if (length(SweaveOpts)) {
-		if (!is.list(SweaveOpts))
-			stop("'SweaveOpts' must be a named list or NULL")
-		SweaveOpts <- paste(names(SweaveOpts), SweaveOpts, sep = " = ",
-			collapse = ", ")
-		header <- paste0(header,
-			"\n//////////\n",
-			"\\SweaveOpts{", SweaveOpts, "}\n",
-			"//////////\n"				 
-		)
-	} else header <- paste0(header, "\n") # End of header section
-		
-	## Add SweaveInit chunk here... or !<<>>="
-	## TODO: allow for either require(SciViews), or a def of `!`
-	if (is.null(SweaveInit)) SweaveInit <- "" else
-		SweaveInit <- paste(deparse(substitute(SweaveInit)), collapse = "\n")
-	header <- paste0(header,
-		"!<<init, echo = FALSE, results = hide>>=\"\n",
-		"## SweaveInit code\n",
-		SweaveInit,
-		"\n## More initialization\n",
-		"require(\"SciViews\")\n"
-	)
+	## 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)
 }
 
@@ -163,11 +145,9 @@
 	## Check that the SciViews Rdoc file starts with #!
 	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>>="
 	
-	## TODO: change this into a header constructor from svSweave::Rdoc()
-	## Locate the header, which is one or several lines of initialization R code
-	inHeader <- 2:(lstart[1] - 1)
-	
 	## Doc chunks are lines where cstart > cend
 	inDoc <- cstart > cend
 	
@@ -180,15 +160,14 @@
 	## Convert comments blocks using four or more #### by ////
 	Rscript[inDoc] <- gsub("^####+$", "////", Rscript[inDoc])
 	
-	## Convert line comments using ## by //
-	Rscript[inDoc] <- gsub("^##", "//", Rscript[inDoc])
+	## Convert line comments using ## by __
+	Rscript[inDoc] <- gsub("^##", "__", Rscript[inDoc])
 	
 	## Replace all doc chunk starters (!") by @
 	Rscript[start] <- "@"
 	
-	## Replace all doc chunk ends (!<<.*>>=") by the same without leading !
-	## and trailing "
-	Rscript[end] <- sub('!^(.*>>=)"[ \t]*$', "\\1", Rscript[end])
+	## Replace all doc chunk ends (<<.*>>=") by the same without trailing "
+	Rscript[end] <- sub('^(.*>>=)"[ \t]*$', "\\1", Rscript[end])
 	
 	## Polish the end of the document...
 	lastDoc <- lend[length(lend)]
@@ -202,16 +181,6 @@
 		Rscript <- c(Rscript, "@")
 	}
 	
-	## Now, rework the header lines to be compatible with a .Rnw file
-	## Place initialization R code in a 'echo = FALSE' code chunk just before
-	## the first current code chunck
-	firstChunk <- lend[1]
-	header <- paste(Rscript[inHeader], collapse = "\n")
-	Rscript[firstChunk] <- paste("<<echo = FALSE>>=\n", header,
-		"\n@\n\n", Rscript[firstChunk], sep = "")
-	## Now eliminate the header from the script
-	Rscript <- Rscript[-c(1, inHeader, max(inHeader) + 1)]
-
 	## Write result to the RnwFile
 	## TODO: check encoding of .Rnw file on all platforms
 #	utf8conv <- function(x) gsub("<U\\+([0-9A-F]{4})>","\\\\u\\1", x)
@@ -274,7 +243,7 @@
 		
 	## Do we show the resulting Html file in the current browser at the end?
 	## By default YES, unless in non-interactive mode
-	if (missing(show.it)) show.it <- getOption("Rdoc.showIt", interactive())
+	if (missing(show.it)) show.it <- getOption("Rdoc.show.it", interactive())
 	
 	## Do we keep intermediary .Rnw and .txt files? Default to FALSE
 	if (missing(keep.RnwFile))
@@ -339,8 +308,10 @@
 		if (!isTRUE(keep.TxtFile)) unlink(TxtFile)	
 	})
 	
-	## Sweave this document...
-	Asciidoc(RnwFile2, encoding = encoding) # This should create the TxtFile
+	## Sweave this document... (creating the TxtFile)
+	## Note: we change some default options here!
+	Asciidoc(RnwFile2, encoding = encoding, prefix.string = "figures/fig",
+		width = 7.2, height = 7.2, png = TRUE, jpeg = FALSE, format = "png")
 	
 	if (!file.exists(TxtFile))
 		stop("Problems while creating the Asciidoc file (", TxtFile, ")")
@@ -380,6 +351,9 @@
 	## A function to run an a SciViews Rdoc file, and that looks at the #!
 	## line to determine what function to run for compiling the final document
 
+	## If RdocFile is missing, try to get it from option or the command line
+	if (missing(RdocFile)) RdocFile <- .RdocFile()
+	
 	## Check RdocFile
 	if (missing(RdocFile) || !length(RdocFile)) stop("No file provided")
 	if (!file.exists(RdocFile)) stop("RdocFile not found (", RdocFile, ")")

Modified: pkg/svSweave/inst/asciidoc/asciidoc.conf
===================================================================
--- pkg/svSweave/inst/asciidoc/asciidoc.conf	2013-01-02 11:34:43 UTC (rev 504)
+++ pkg/svSweave/inst/asciidoc/asciidoc.conf	2013-01-02 18:54:24 UTC (rev 505)
@@ -73,7 +73,7 @@
 [quotes]
 # The order is important, quotes are processed in conf file order.
 **=#strong
-*=strong
+**=strong
 ``|''=doublequoted
 '=emphasis
 `|'=singlequoted
@@ -86,13 +86,13 @@
 +++=#unquoted
 $$=#unquoted
 ++=#monospaced
-+=monospaced
-__=#emphasis
-_=emphasis
+++=monospaced
+//=#emphasis
+//=emphasis
 \##=#unquoted
 \#=unquoted
-^=#superscript
-~=#subscript
+^^=#superscript
+~~=#subscript
 
 [specialwords]
 emphasizedwords=
@@ -276,7 +276,7 @@
 endif::no-inline-literal[]
 
 # Inline comment.
-(?mu)^[\\]?//(?P<passtext>[^/].*|)$=comment[specialcharacters]
+(?mu)^[\\]?__(?P<passtext>[^/].*|)$=comment[specialcharacters]
 
 # Default (catchall) inline macro is not implemented so there is no ambiguity
 # with previous definition that could result in double substitution of escaped
@@ -294,7 +294,7 @@
 
 ^'{3,}$=#ruler
 ^<{3,}$=#pagebreak
-^//(?P<passtext>[^/].*|)$=#comment[specialcharacters]
+^__(?P<passtext>[^/].*|)$=#comment[specialcharacters]
 
 # Implemented in HTML backends.
 [unfloat-blockmacro]

Modified: pkg/svSweave/man/Rdoc.Rd
===================================================================
--- pkg/svSweave/man/Rdoc.Rd	2013-01-02 11:34:43 UTC (rev 504)
+++ pkg/svSweave/man/Rdoc.Rd	2013-01-02 18:54:24 UTC (rev 505)
@@ -14,15 +14,14 @@
 
 \usage{
 Rdoc(title, author, email, revnumber = NULL, revdate = NULL,
-revremark = NULL, copyright = "cc-by", encoding = "utf-8", lang = "en",
-pagetitle = NULL, description = "SciViews Rdoc", keywords = NULL,
-format = "html", theme = "SciViews", max.width = 720, width = "100\%",
-toc = c("top", "side", "manual", "none"), toc.title = NULL, toclevels = 3,
-numbered = TRUE, data.uri = TRUE, frame = "topbot", grid = "rows",
-align = "center", halign = "center", pygments = FALSE, slidefontsizeadjust = 0,
-SweaveOpts = list(prefix.string = "figures/fig", width = 7.2, height = 7.2,
-    pdf = TRUE), SweaveInit = { options(width = 90); options(SweaveHooks =
-    list(fig = function() par(col.lab = "#434366", col.main = "#434366")))}
+    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"))) }
 )
 }
 
@@ -44,7 +43,7 @@
     cc-by, John Does, 2013, or just the first part (cc-by) and the author and
     year will be appended automatically. If \code{NULL}, it is omitted. }
   \item{encoding}{ a character string with the encoding of your SciViews Rdoc.
-    It is not advised to change from the default, utf-8. Make sure you save
+    It is not advised to change from the default, UTF-8. Make sure you save
     your document in UTF-8 encoding before you process it! }
   \item{lang}{ the (main) language used in your SciViews Rdoc. By default, it is
     English (en), but Asciidoc can also use de, el, es, fr, hu, it, nl, pt, ru
@@ -55,11 +54,7 @@
     to use in the head section of the HTML document. If \code{NULL}, it is
     omitted. }
   \item{keywords}{ a character string with one or more keywords to use in the
-    head section of the HTML document. If \code{NULL}, it is omitted. }
-  \item{format}{ a character string with the format into which the Rdoc should
-    be converted. By default (\code{"html"}), an HTML document is compiled. Valid
-    formats are: html, html4, html5, slidy, slidy2, wordpress, docbook,
-    docbook45 and latex (see the AsciiDoc man page). } 
+    head section of the HTML document. If \code{NULL}, it is omitted. } 
   \item{theme}{ the theme to use with the Asciidoc HTML file. By default, it is
     \code{"SciViews"}. }
   \item{max.width}{ the maximum width of the page, in pixels or in percent.
@@ -76,7 +71,7 @@
     default (Table of Contents, or its translation in the main language of the
     SciViews Rdoc) is used. }
   \item{toclevels}{ how deep in title levels should the table of contents be
-    generated (1, 2, 3 or 4)? By default, it is 3. }
+    generated (1, 2, 3 or 4)? By default, it is 2. }
   \item{numbered}{ should the titles be numbered (\code{TRUE}, by default), or
     not (\code{FALSE})? }
   \item{data.uri}{ should figures, scripts and styles be embedded in the main
@@ -93,8 +88,6 @@
     \code{FALSE} by default. }
   \item{slidefontsizeadjust}{ adjustment of font size in slidy and slidy2
     documents. }
-  \item{SweaveOpts}{ options for Sweave. A reasonable default is provided.
-    See ?sweave. }
   \item{SweaveInit}{ code to be run in the init code chunk, related to sweave.
     Reasonable defaults are provided. See ?sweave. }
 }



More information about the Sciviews-commits mailing list