Skip to content

Commit

Permalink
Minor comment changes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheiss committed Jun 3, 2024
1 parent 235e3f8 commit 851a31d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions _extensions/wordcount/wordcount.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function count_words(blks)
return count
end

-- Ignore content in `no-count` divs
function is_no_count_div (blk)
if (blk and blk.t=="Div" and blk.classes and #blk.classes > 0) then
for _, class in pairs(blk.classes) do
Expand Down Expand Up @@ -85,9 +86,8 @@ function is_ref_div (blk)
end

function get_all_notes (blks)
-- Get all notes
local all_notes = {}
-- try and get notes

pandoc.walk_block(pandoc.Div(blks),
{
Note = function(el)
Expand Down Expand Up @@ -236,7 +236,6 @@ ref_count = {
-- Count words in the appendix
appendix_count = {
Str = function(el)
-- we don't count a word if it's entirely punctuation:
if is_word(el.text) then
appendix_words = appendix_words + 1
end
Expand All @@ -261,12 +260,12 @@ function Pandoc(el)

-- Get all notes
local all_notes = get_all_notes(el.blocks)
-- count words in notes
-- Count words in notes
pandoc.walk_block(pandoc.Div(all_notes), note_count)

-- Remove Tables, Images, and {.no-count} contents
-- Remove tables, images, and {.no-count} contents
local untabled = remove_all_tables_images(el.blocks)
-- Next remove notes
-- Next, remove notes
local unnote = remove_all_notes(untabled)

refs_title = el.meta["reference-section-title"]
Expand All @@ -292,7 +291,7 @@ function Pandoc(el)
-- Show counts in terminal
print_word_counts()

-- modify meta data for words.lua
-- Modify metadata for words.lua
el.meta = set_meta(el.meta)

return el
Expand Down

0 comments on commit 851a31d

Please sign in to comment.