-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
202 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# | ||
# SessionAuthoring.R | ||
# | ||
# Copyright (C) 2009-11 by RStudio, Inc. | ||
# | ||
# This program is licensed to you under the terms of version 3 of the | ||
# GNU Affero General Public License. This program is distributed WITHOUT | ||
# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, | ||
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the | ||
# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. | ||
# | ||
# | ||
|
||
.rs.addFunction( "knitrChunkOptions", function() | ||
{ | ||
knitrOptions <- knitr:::opts_chunk$get() | ||
knitrOptions <- as.list(sapply(knitrOptions, class)) | ||
knitrOptions[knitrOptions == "NULL"] <- "character" | ||
knitrOptions$results <- list("markup", "asis", "hide") | ||
knitrOptions$fig.show <- list("asis", "hold", "animate") | ||
knitrOptions$fig.keep <- list("high", "none", "all", "first", "last") | ||
knitrOptions$fig.align <- list("left", "right", "center") | ||
if (packageVersion("knitr") >= "0.4") | ||
knitrOptions$dev <- as.list(names(knitr:::auto_exts)) | ||
|
||
return (knitrOptions) | ||
}) | ||
|
||
.rs.addFunction( "sweaveChunkOptions", function() | ||
{ | ||
sweaveOptions <- list() | ||
|
||
sweaveOptions$label <- "character" | ||
sweaveOptions$engine <- list("R", "S") | ||
sweaveOptions$echo <- "logical" | ||
sweaveOptions$keep.source <- "logical" | ||
sweaveOptions$eval <- "logical" | ||
sweaveOptions$results <- list("verbatim", "tex", "hide") | ||
sweaveOptions$print <- "logical" | ||
sweaveOptions$term <- "logical" | ||
sweaveOptions$split <- "logical" | ||
sweaveOptions$strip.white <- list("true", "all", "false") | ||
sweaveOptions$prefix <- "logical" | ||
sweaveOptions$prefix.string <- "character" | ||
sweaveOptions$include <- "logical" | ||
sweaveOptions$fig <- "logical" | ||
sweaveOptions$eps <- "logical" | ||
sweaveOptions$pdf <- "logical" | ||
sweaveOptions$pdf.version <- "character" | ||
sweaveOptions$pdf.encoding <- "character" | ||
sweaveOptions$pdf.compress <-"logical" | ||
if (getRversion() >= "2.13.0") { | ||
sweaveOptions$png <- "logical" | ||
sweaveOptions$jpeg <- "logical" | ||
sweaveOptions$grdevice <- "character" | ||
} | ||
sweaveOptions$width <- "numeric" | ||
sweaveOptions$height <- "numeric" | ||
sweaveOptions$resolution <- "numeric" | ||
sweaveOptions$figs.only <- "logical" | ||
|
||
return (sweaveOptions) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/gwt/src/org/rstudio/studio/client/workbench/views/source/model/RnwChunkOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* RnwChunkOptions.java | ||
* | ||
* Copyright (C) 2009-11 by RStudio, Inc. | ||
* | ||
* This program is licensed to you under the terms of version 3 of the | ||
* GNU Affero General Public License. This program is distributed WITHOUT | ||
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the | ||
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. | ||
* | ||
*/ | ||
package org.rstudio.studio.client.workbench.views.source.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
|
||
import com.google.gwt.core.client.JavaScriptObject; | ||
import com.google.gwt.json.client.JSONArray; | ||
import com.google.gwt.json.client.JSONObject; | ||
|
||
public class RnwChunkOptions extends JavaScriptObject | ||
{ | ||
protected RnwChunkOptions() | ||
{ | ||
} | ||
|
||
public final ArrayList<String> getOptions() | ||
{ | ||
ArrayList<String> options = new ArrayList<String>( | ||
new JSONObject(this).keySet()); | ||
Collections.sort(options); | ||
return options; | ||
} | ||
|
||
// types: "numeric", "character", "logical", "list" | ||
public final String getOptionType(String name) | ||
{ | ||
JSONArray arr = new JSONArray(getOptionTypeNative(name));; | ||
if (arr.size() == 1) | ||
return arr.get(0).isString().stringValue(); | ||
else | ||
return "list"; | ||
} | ||
|
||
public final ArrayList<String> getOptionValues(String name) | ||
{ | ||
JSONArray arr = new JSONArray(getOptionTypeNative(name)); | ||
ArrayList<String> values = new ArrayList<String>(); | ||
for (int i=0; i<arr.size(); i++) | ||
values.add(arr.get(i).isArray().get(0).isString().stringValue()); | ||
return values; | ||
} | ||
|
||
private native final JavaScriptObject getOptionTypeNative(String name) /*-{ | ||
return this[name]; | ||
}-*/; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters