{% set version = "2.29" %}
{% set posix = 'm2-' if win else '' %}

package:
  name: r-rmarkdown
  version: {{ version|replace("-", "_") }}

source:
  url:
    - {{ cran_mirror }}/src/contrib/rmarkdown_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/rmarkdown/rmarkdown_{{ version }}.tar.gz
  sha256: 6662ac85316c869caad6e3b95468cad97f6eef106d47b066db8d40c05a490928

build:
  number: 0
  noarch: generic
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ posix }}zip               # [win]
    - cross-r-base {{ r_base }}    # [build_platform != target_platform]
  host:
    - r-base
    - r-bslib >=0.2.5.1
    - r-evaluate >=0.13
    - r-fontawesome >=0.5.0
    - r-htmltools >=0.5.1
    - r-jquerylib
    - r-jsonlite
    - r-knitr >=1.43
    - r-tinytex >=0.31
    - r-xfun >=0.36
    - r-yaml >=2.1.19
  run:
    - r-base
    - r-bslib >=0.2.5.1
    - r-evaluate >=0.13
    - r-fontawesome >=0.5.0
    - r-htmltools >=0.5.1
    - r-jquerylib
    - r-jsonlite
    - r-knitr >=1.43
    - r-tinytex >=0.31
    - r-xfun >=0.36
    - r-yaml >=2.1.19
    - pandoc >=1.14

test:
  requires:
    - r-testthat
    - r-shiny
    - perl
    - xorg-libxt                             # [not win]
    - xorg-libsm                             # [not win]
  source_files:
    - tests/
  commands:
    - $R -e "library('rmarkdown')"           # [not win]
    - "\"%R%\" -e \"library('rmarkdown')\""  # [win]
    - $R -e "capabilities()" || true         # [not win]
    - $R -e "grSoftVersion()" || true        # [not win]
    - $R -e "x <- tempfile(fileext = '.Rmd'); file.create(x); rmarkdown::render(x)"           # [not win]
    - "\"%R%\" -e \"x <- tempfile(fileext = '.Rmd'); file.create(x); rmarkdown::render(x)\""  # [win]
    - $R -e "tinytex::install_tinytex();testthat::test_dir('tests/testthat/', package='rmarkdown', load_package='installed')"           # [not win]
    - "\"%R%\" -e \"tinytex::install_tinytex();testthat::test_dir('tests/testthat/', package='rmarkdown', load_package='installed')\""  # [win]

about:
  home: https://pkgs.rstudio.com/rmarkdown/
  dev_url: https://github.com/rstudio/rmarkdown
  license: GPL-3.0-only
  summary: Convert R Markdown documents into a variety of formats.
  license_family: GPL3
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3

extra:
  recipe-maintainers:
    - conda-forge/r
    - mdehollander
    - bsennblad
    - philip-khor
    - jdblischak
