]> git.lyx.org Git - features.git/commitdiff
backport r39509 and r39510 to branch (see bug #7555)
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 8 Sep 2011 10:44:44 +0000 (10:44 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 8 Sep 2011 10:44:44 +0000 (10:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39644 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/scons_manifest.py
lib/Makefile.am
lib/configure.py
lib/scripts/lyxstangle.R [new file with mode: 0644]
status.20x

index 99b369880f22805e93a0affb3ac6505689897dbd..4e8d418c3f73df15f8a34597964333d920efa702 100644 (file)
@@ -2991,6 +2991,7 @@ lib_scripts_files = Split('''
     lyxpreview-lytex2bitmap.py
     lyxpreview-platex2bitmap.py
     lyxpreview_tools.py
+    lyxstangle.R
     lyxsweave.R
     prefs2prefs.py
     prefs2prefs_lfuns.py
index 9c3d46ce0948b91cd00e579be938c525d4a65b71..e60624a09015485b40a947d8aec866ef722b8b65 100644 (file)
@@ -1486,6 +1486,7 @@ dist_layouts_DATA =\
 scriptsdir = $(pkgdatadir)/scripts
 dist_scripts_DATA = \
        scripts/bash_completion \
+       scripts/lyxstangle.R \
        scripts/lyxsweave.R
 # Note that we "chmod 755" manually these files in install-data-hook.
 dist_scripts_PYTHON = \
index c159fbdd599e126df450288a84c82cf27861fc79..0b51dedb25ad1abb88b74bf4449da20846fabba9 100644 (file)
@@ -556,6 +556,7 @@ def checkFormatEntries(dtl_tools):
 \Format platex     tex    "LaTeX (pLaTeX)"        "" "" "%%"    "document,menu=export"
 \Format literate   nw      NoWeb                  N  ""        "%%"    "document,menu=export"
 \Format sweave     Rnw    "Sweave"                S  "" "%%"    "document,menu=export"
+\Format r          R      "R/S code"              "" "" "%%"    "document,menu=export"
 \Format lilypond   ly     "LilyPond music"        "" ""        "%%"    "vector"
 \Format lilypond-book    lytex "LilyPond book (LaTeX)"   "" "" "%%"    "document,menu=export"
 \Format latex      tex    "LaTeX (plain)"         L  ""        "%%"    "document,menu=export"
@@ -681,6 +682,9 @@ def checkConverterEntries():
 \converter sweave   xetex      "%%"    ""
 \converter sweave   luatex     "%%"    ""'''])
     #
+    checkProg('a Sweave -> R/S code converter', ['Rscript --verbose --no-save --no-restore $$s/scripts/lyxstangle.R $$i $$e $$r'], 
+        rc_entry = [ r'\converter sweave      r      "%%"    ""' ])
+    #
     checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex $$i', \
         'htmltolatex -input $$i -output $$o', 'java -jar htmltolatex.jar -input $$i -output $$o'],
         rc_entry = [ r'\converter html       latex      "%%"   ""' ])
diff --git a/lib/scripts/lyxstangle.R b/lib/scripts/lyxstangle.R
new file mode 100644 (file)
index 0000000..93fb611
--- /dev/null
@@ -0,0 +1,16 @@
+## file lyxstangle.R
+## This file is part of LyX, the document processor.
+## Licence details can be found in the file COPYING.
+
+## author Yihui Xie
+
+## Full author contact details are available in file CREDITS
+
+## Rscript $$s/scripts/lyxstangle.R $$i $$e $$r
+
+.cmdargs = commandArgs(TRUE)
+
+options(encoding = .cmdargs[2])
+
+## run Stangle to extract R code
+Stangle(.cmdargs[1])
index 947932667db850c9b7d486565332634ea89d4334..3d84b75021d593c044b5e060c9c8c468fab94410 100644 (file)
@@ -24,6 +24,8 @@ What's new
 
 * DOCUMENT INPUT/OUTPUT
 
+- Add possibility to export the R code from a sweave-enabled document
+  (part of bug 7555).
 
 * USER INTERFACE