You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2.8 KiB

---
output:
rmarkdown::github_document:
df_print: kable
---
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
```

```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges(repo_status = "Concept")
```

```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```

## SOME IMPORTANT DETAILS

Threw this together for [\@clauswilke](https://github.com/clauswilke) & [{ggtext}](https://github.com/clauswilke/ggtext) based on [this Twitter convo](https://twitter.com/hrbrmstr/status/1159920814801731586). I am unlikely to work on this more w/o serious prodding. It only handles CSS style rules and need 7 other enums covered from [`katana`](https://github.com/hackers-painters/katana-parser/blob/master/src/katana.h#L38-L48), plus the core cpp code need to be refactored into functions. Claus is more than capable of riffing off of the `katana` source (and I'll gladly PR into that if needed), plus I've no desire to spend time building a massively general purpose R pacakge that has a chance of being steamrolled over by corporate-backed package development.

You need to install the [`katana`](https://github.com/hackers-painters/katana-parser) C99 parser as a system library that is reachable by the R source package compilation defaults. It looks to be pretty straightforward to embed the `katana` source into a C[++]-backed R package but that wasn't the point of this exercise.

In `src/` there are some header files copied from the `katana` src which enable use of the same utility functions they use.

## What's Inside The Tin

The following functions are implemented:

```{r ingredients, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::describe_ingredients()
```

## Installation

```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
```
## Usage

```{r lib-ex}
library(tsuka)

# current version
packageVersion("tsuka")

```

```{r ex1}
"
/* Applies to the entire body of the HTML document (except where overridden by more specific
selectors). */
body {
margin: 25px;
background-color: rgb(240,240,240);
font-family: arial, sans-serif;
font-size: 14px;
}

/* Applies to all <h1>...</h1> elements. */
h1 {
font-size: 35px;
font-weight: normal;
margin-top: 5px;
}

/* Applies to all elements with <... class='someclass'> specified. */
.someclass { color: red; }

/* Applies to the element with <... id='someid'> specified. */
#someid { color: green; }
" -> css_ex

parse_css_text(css_ex)
```

```{r ex2}
parse_css_file(system.file("extdat/sample.css", package = "tsuka"))
```

## tsuka Metrics

```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
```

## Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.