Coder Social home page Coder Social logo

rmd2conf's Introduction

rmd2conf.py

This python 3 script allows uploading of markdown or Rmarkdown files to the Genomics England Confluence site. It was expanded from a similar application on Github.

Usage

python rmd2conf.py <markdown or rmarkdownfile> -u <username> -p <password> ...

Arguments

  • -u --username : user's Confluence username
  • -p --password : user's Confluence password (if this contains any special characters then this will need to be within quotes)
  • -s --spacekey : the Confluence spacekey where the page will be uploaded, defaults to CDT (clinical data team)
  • -t --pagetitle : optional title for the new page upload, default is the page title specified in the Rmd or md document
  • -a --ancestor : the ancestor page's title under which the new page will be created
  • -m --attachment : paths to any attachments to upload to the page
  • -c --contents : generate a table of contents on the resulting page
  • -g --nogo : don't open up the confluence page after generating (default is to open the page after creation)
  • -d --delete : use this page to delete the page rather than create it
  • -n --nossl : use this option to use http instead of https
  • -b --makebackup : use this option to keep the markdown created from the Rmd and associated files (default is to delete)

The title in the (R)markdown document (or as specified in the optional argument) will determine the name of the page on the Confluence site. If a page with that title already exists in the space, then the page will be updated with the content of the markdown document, if it doesn't a new page will be created at the site's root (or under the ancestor if that is specified).

For Rmarkdown files, the first line underneath the YAML header will become the page title (unless one is specified with the -t flag) since the title specified in the header doesn't actually get added to the rendered document.

Requirements

It requires the following python packages be installed:

sys, os, subprocess, markdown, mimetypes, codecs, re, collections, requrest, json, argparse, urllib.parse, webbrowser, datetime, shutil

It also requires R be installed and have the rmarkdown library installed with pandoc v1.12.3 or above, this is more recent than the version available in the repositories. More information on how to get the newer version can be found here.

Obviously you need to have a confluence username and password and have permission to create pages in the space to which you're attempting to write.

File format

The script will determine whether the file is an Rmarkdown (.Rmd) or Markdown (.md) file based on the file extension. If converting from Rmd to md, then the output format in the Rmd header will be ignored and a markdown document will be generated with a current date and time stamp (this will be deleted unless -b flag is specified).

Best results

  • Usage of kable(<data.frame>) gets nicely formatted tables.
  • Plot file names come from the chunk description (and give the hover over description) so if there are chunk descriptions they need to not have any spaces in them.

rmd2conf's People

Contributors

simonthompson99 avatar williamfitzpatrick avatar

Stargazers

Dimitris Polychronopoulos avatar

Watchers

James Cloos avatar Kevin Savage avatar  avatar Punal Chotrani avatar Chris Boustred avatar Neil Goodgame avatar  avatar Augusto Rendon avatar Saif Ur-Rehman avatar  avatar  avatar  avatar Matt Welland avatar Daniel Perez-Gil avatar MagdalenaZZ avatar Patricia Peters avatar Michael Mueller avatar  avatar Luca Venturini avatar Nicholas Dentandt avatar Emanuil avatar Alex Stuckey avatar Louise C Daugherty avatar Matt Brown avatar  avatar Jamie avatar  avatar

rmd2conf's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.