Coverage for gramex\transforms\rmarkdown.py: 33%

# Coverage for gramex\transforms\rmarkdown.py : 33%

## 9 statements 3 run 6 missing 0 excluded 0 partial

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 import tornado.gen

2

3

4@tornado.gen.coroutine

5 def rmarkdown(content, handler=None, **kwargs):

6 '''

7 A transform that converts Rmarkdown files to HTML.

8

9 HTML file is placed at path: $YAMLPATH location.

10 '''

11 import gramex.ml

12 import gramex.cache

13 import gramex.services

14

15 rmdfilepath = str(handler.file)

16 htmlpath = yield gramex.services.info.threadpool.submit(

17 gramex.ml.r,

18 '''

19 library(rmarkdown)

20 rmarkdown::render("{}", output_format="html_document", quiet=TRUE)

21 '''.format(rmdfilepath.replace('\\', '/'))

22 )

23 raise tornado.gen.Return(

24 gramex.cache.open(htmlpath[0], 'bin').decode('utf-8'))