Code Monkey home page Code Monkey logo

pandoc-templates's People

Contributors

calliecameron avatar ceruulean avatar davidlday avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pandoc-templates's Issues

Add a filter so em dashes don't appear at the beginning of lines

By default, pandoc will convert a markdown em dash (---) into a an em dash that allows line breaks before and after it, leading to potential sections of text like this in the docx:

he looked through the door
--the old, wooden door--and saw...

I would like to contribute a filter that prevents this by inserting a non-breaking zero-space separator before the em dash, so you end up with

he looked through the door--
the old, wooden door--and saw...

or

he looked through the
door--the old, wooden door--and saw...

depending on the line lengths.

If you're interested, I can open a pull request, or otherwise you can feel free to use the filter, which is straightforward enough to paste below.

return {
   {
	  Str = function(elem)
		 if string.find(elem.text, "—") then
			return pandoc.Str(string.gsub(elem.text, "—", "\u{2060}—"))
		 else
			return elem
		 end
	  end,
   }
}

Thank you for this project--I was about to start working on something similar for my own needs, and this saved me a lot of time.

Add option to compile without postal address

Discussed in #26

Originally posted by andrzejstepien February 25, 2024
Most publications do not require a postal address these days, and some request that this data not be shared! It would be very useful to have an option to compile without this metadata therefore

Filters not working under pandoc 2.13

Looks like the fix for #12 broke the filters on pandoc 2.13:

$ cd test
$ bash run.sh

        ================== Bash Tests ==================

        1. [Short] Single input
        ----------------------------------------
Creating temporary directory.
Directory created: /tmp/tmp.sPGFL1y3uF
Extracting /home/callie/pandoc-templates/shunn/short/template.docx to temporary directory.
Files extracted.
Running Pandoc.
Error running filter /home/callie/pandoc-templates/shunn/short/shunnshort.lua:
/home/callie/pandoc-templates/filters/meta.lua:5: attempt to call a nil value (field 'type')
stack traceback:
        /home/callie/pandoc-templates/filters/meta.lua:5: in function 'Meta'
Pandoc completed successfully.
Removing /tmp/tmp.sPGFL1y3uF
Done.
        2. [Long] Wildcard
        ----------------------------------------
Creating temporary directory.
Directory created: /tmp/tmp.06CaCk20OO
Extracting /home/callie/pandoc-templates/shunn/long/template.docx to temporary directory.
Files extracted.
Running Pandoc.
Error running filter /home/callie/pandoc-templates/shunn/long/shunnlong.lua:
/home/callie/pandoc-templates/filters/meta.lua:5: attempt to call a nil value (field 'type')
stack traceback:
        /home/callie/pandoc-templates/filters/meta.lua:5: in function 'Meta'
Pandoc completed successfully.
Removing /tmp/tmp.06CaCk20OO
Done.

        =============== Powershell Tests ===============

        1. [Short] Single input
        ----------------------------------------
run.sh: line 24: pwsh: command not found
        2. [Short] Various line break conventions
        ----------------------------------------
run.sh: line 27: pwsh: command not found
        3. [Long] Multiple wildcard inputs
        ----------------------------------------
run.sh: line 31: pwsh: command not found

Expected behavior

As seen on the previous commit:

$ cd test
$ bash run.sh


        ================== Bash Tests ==================

        1. [Short] Single input
        ----------------------------------------
Creating temporary directory.
Directory created: /tmp/tmp.GkNGDAdrsT
Extracting /home/callie/pandoc-templates/shunn/short/template.docx to temporary directory.
Files extracted.
Running Pandoc.
Zipping reference.docx using UNIX zip.
Pandoc completed successfully.
Removing /tmp/tmp.GkNGDAdrsT
Done.
        2. [Long] Wildcard
        ----------------------------------------
Creating temporary directory.
Directory created: /tmp/tmp.7YK7sU6O0a
Extracting /home/callie/pandoc-templates/shunn/long/template.docx to temporary directory.
Files extracted.
Running Pandoc.
Zipping reference.docx using UNIX zip.
Pandoc completed successfully.
Removing /tmp/tmp.7YK7sU6O0a
Done.

        =============== Powershell Tests ===============

        1. [Short] Single input
        ----------------------------------------
run.sh: line 24: pwsh: command not found
        2. [Short] Various line break conventions
        ----------------------------------------
run.sh: line 27: pwsh: command not found
        3. [Long] Multiple wildcard inputs
        ----------------------------------------
run.sh: line 31: pwsh: command not found

Environment (please complete the following information):

  • OS: Linux Mint 20.1 Cinnamon
  • Pandoc Version: 2.13
  • Version: commit e28b04f

Automation

Add GH Actions for running tests on PRs.

Add -f flag to overwrite existing output file

How would you feel about a -f flag that overwrote existing output without asking for confirmation?

I run this from a makefile and this would make it simpler for those kinds of workflows.

Again, if you're agreeable, I'm happy to put up a PR.

Add a -q flag to suppress output

How would you feel about a -q flag that doesn't print any non-error output (e.g. unzipping the file to a temp file, etc.)?

I kick off the conversion from a makefile and it's nice to have the silence in that context.

Again, if you're agreeable, I'm happy to put up the PR.

Powershell script has missing LUA value

I entered,

.\bin\md2short.ps1 -overwrite -modern -output $env:USERPROFILE/Documents/short-out-ps.docx './test/short/guidelines.md'

The output was this.

Mode LastWriteTime Length Name

---- ------------- ------ ----

------ 3/12/2022 5:34 PM 55161 guidelines-modern.pdf

------ 3/12/2022 5:34 PM 9839 guidelines.md

------ 3/12/2022 5:34 PM 48943 guidelines.pdf

------ 3/12/2022 5:34 PM 1505 shunnshort.lua

------ 3/12/2022 5:34 PM 22883 template-modern.docx

------ 3/12/2022 5:34 PM 22891 template.docx

Creating temporary directory.

Directory created: XXX\XXXAppData\Local\Temp\07c480ce-a9f2-4ef4-a16c-041182d9fc74

Running Pandoc.

Error running filter XXX/XXX/pandoc-templates-0.4.0\shunn\short/shunnshort.lua:

...t\Downloads\pandoc-templates-0.4.0/filters\wordcount.lua:26: bad argument #2 to 'format'

(number expected, got nil)

stack traceback:

...t\Downloads\pandoc-templates-0.4.0/filters\wordcount.lua:26: in function 'format_word_count'

...nloads\pandoc-templates-0.4.0\shunn\short/shunnshort.lua:15: in function 'Pandoc'

ERROR: exit 83

PS XXX/XXX/pandoc-templates-0.4.0>

Filters not working under Pandoc v2.17?

Describe the bug
On Mac (OS 12.2.1 and 10.15.7) it appears that filters don't run correctly under Pandoc v2.17 (latest)

To Reproduce
Steps to reproduce the behavior:

  1. run test/run.sh with Pandoc 2.17 (latest) installed on macOS (12.2.1 and 10.15.7 tested)

Expected behavior
contact_name, contact_address, etc. substitutions do not happen. Earlier version of Pandoc (v2.14) works as expected (see screenshots). Haven't tested 2.15, 2.16.

Screenshots
Pandoc v2.17
v2 17
Pandoc v2.14
v2 14

Environment (please complete the following information):

  • OS: macOS 12.2.1 and 10.15.7
  • Pandoc Version: 2.17 vs 2.14
  • Version: Pandoc-templates commit de287cf

Additional context
Add any other context about the problem here.

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.