Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user-defined postProcessor option #130

Merged
merged 8 commits into from Jun 6, 2020
Merged

Conversation

mengwong
Copy link

@mengwong mengwong commented Jun 3, 2020

I needed to remove a watermark containing the string "DRAFT". Unfortunately, watermarks are not amenable to the usual template controls.

I propose a user-definable postProcessor function which transforms the filled templates immediately prior to XML stringification.

Included is a dtcli.ts script which demonstrates use of this function, callable at the command line, and a test .docx which can be used to show the removal of my watermark using this mechanism.

The dtcli script recursively deepcopies the tree of Nodes, excluding certain elements from the copy. But the postProcessor could perform other transformations besides.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 92.617% when pulling 742217f on legalese:postProcessor into 3a65b49 on guigrpa:master.

@jjhbw
Copy link
Collaborator

jjhbw commented Jun 3, 2020

Awesome, thanks for your contribution! Will study it this weekend.

@jjhbw jjhbw changed the base branch from master to next June 6, 2020 13:24
@jjhbw jjhbw merged commit ac82cfd into guigrpa:next Jun 6, 2020
jjhbw pushed a commit that referenced this pull request Jun 6, 2020
* introduce postProcessor user option

* document and demo postProcessor option.

* dtcli is a command-line interface to the docx-templates system.

thanks to Job Chong for essential contributions
jjhbw added a commit that referenced this pull request Jun 6, 2020
jjhbw added a commit that referenced this pull request Jun 7, 2020
jjhbw pushed a commit that referenced this pull request Jun 15, 2020
* introduce postProcessor user option

* document and demo postProcessor option.

* dtcli is a command-line interface to the docx-templates system.

thanks to Job Chong for essential contributions
jjhbw added a commit that referenced this pull request Jun 15, 2020
jjhbw pushed a commit that referenced this pull request Jun 15, 2020
* introduce postProcessor user option

* document and demo postProcessor option.

* dtcli is a command-line interface to the docx-templates system.

thanks to Job Chong for essential contributions
jjhbw added a commit that referenced this pull request Jun 15, 2020
jjhbw pushed a commit that referenced this pull request Jun 15, 2020
* introduce postProcessor user option

* document and demo postProcessor option.

* dtcli is a command-line interface to the docx-templates system.

thanks to Job Chong for essential contributions
jjhbw added a commit that referenced this pull request Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants