-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow extension to be used as a filter instead of format
- Loading branch information
1 parent
3236fc7
commit 316bfcc
Showing
6 changed files
with
170 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
test_that("using the extension as a filter works", { | ||
test_file <- test_file_parts(here::here("tests/testthat/test-use-as-filter.qmd")) | ||
|
||
create_local_quarto_project(test_file = test_file) | ||
|
||
quarto::quarto_render(input = test_file$qmd, quiet = TRUE) | ||
|
||
counts <- get_wordcounts(test_file$md) | ||
|
||
expect_equal(counts$wordcount_appendix_words, 5) | ||
expect_equal(counts$wordcount_body_words, 6) | ||
expect_equal(counts$wordcount_note_words, 2) | ||
expect_equal(counts$wordcount_ref_words, 34) | ||
expect_equal(counts$wordcount_total_words, 47) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: Use as filter instead of output format | ||
|
||
format: | ||
markdown: | ||
filters: | ||
- at: pre-quarto | ||
path: _extensions/wordcount/citeproc.lua | ||
- at: pre-quarto | ||
path: _extensions/wordcount/wordcount.lua | ||
citeproc: false | ||
|
||
references: | ||
- id: Lovelace1842 | ||
author: | ||
- family: Lovelace | ||
given: Ada Augusta | ||
citation-key: Lovelace1842 | ||
container-title: Taylor's Scientific Memoirs | ||
issued: | ||
- year: 1842 | ||
language: en-GB | ||
page: 666–731 | ||
title: >- | ||
Sketch of the analytical engine invented by Charles Babbage, by LF Menabrea, | ||
officer of the military engineers, with notes upon the memoir by the | ||
translator | ||
type: article-journal | ||
volume: 3 | ||
--- | ||
|
||
Here are four words [@Lovelace1842].^[A note] | ||
|
||
::: {#appendix-count} | ||
|
||
There are five words here. | ||
|
||
::: |