Skip to content

Commit 1b7efba

Browse files
authored
Merge branch 'master' into master
2 parents 9f2f99d + 14651cc commit 1b7efba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1042
-408
lines changed

.circleci/config.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [tarleb, jgm]

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '**/README.md'
9+
- CONTRIBUTING.md
10+
- LICENSE
11+
- .editorconfig
12+
push:
13+
branches:
14+
- master
15+
paths-ignore:
16+
- '**/README.md'
17+
- CONTRIBUTING.md
18+
- LICENSE
19+
- .editorconfig
20+
schedule:
21+
# At 4:17am each Monday
22+
- cron: '17 4 * * 1'
23+
24+
jobs:
25+
test:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v2
31+
32+
- name: Build Docker image
33+
run: make docker-test-image
34+
35+
- name: Run tests in Docker image
36+
run: make docker-test

.github/workflows/collection.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch: {}
5+
schedule:
6+
# At 4:17am each day
7+
# If this is changed, also change the 'yesterday' variable below.
8+
- cron: '17 4 * * *'
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-18.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Configure
19+
id: config
20+
run: |
21+
last="$(date --date='4:17am yesterday' '+%s')"
22+
commitdate="$(git log -1 --format='%cd' --date=unix)"
23+
authordate="$(git log -1 --format='%ad' --date=unix)"
24+
release_date=""
25+
if [ "$commitdate" -gt "$last" ] || [ "$authordate" -gt "$last" ]; then
26+
release_date="$(date '+%F')"
27+
fi
28+
printf "release_date=%s\n" "$release_date"
29+
printf "::set-output name=release-date::%s\n" "$release_date"
30+
31+
- name: Build collection
32+
run: make archives
33+
34+
- name: Create release
35+
if: ${{ steps.config.outputs.release-date != '' }}
36+
id: create_release
37+
uses: actions/create-release@v1
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
RELEASE_DATE: ${{ steps.config.outputs.release-date }}
41+
with:
42+
tag_name: v${{ env.RELEASE_DATE }}
43+
release_name: Lua Filters v${{ env.RELEASE_DATE }}
44+
draft: false
45+
prerelease: false
46+
47+
- name: Add zip archive to release
48+
uses: actions/upload-release-asset@v1
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
upload_url: ${{ steps.create_release.outputs.upload_url }}
53+
asset_path: ./.build/lua-filters.zip
54+
asset_name: lua-filters.zip
55+
asset_content_type: application/zip
56+
57+
- name: Add tar archive to release
58+
uses: actions/upload-release-asset@v1
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
with:
62+
upload_url: ${{ steps.create_release.outputs.upload_url }}
63+
asset_path: ./.build/lua-filters.tar.gz
64+
asset_name: lua-filters.tar.gz
65+
asset_content_type: application/x-gtar

CONTRIBUTING.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
Contributing to lua-filters
2+
===========================
3+
4+
Happy to have you here! Below you can find guidance on the
5+
best way to contribute to this collection of Lua filters.
6+
Contributions are welcome!
7+
8+
Bugs reports and feature requests
9+
---------------------------------
10+
11+
We are happy to receive feature request or bug reports on the
12+
GitHub [issue tracker].
13+
14+
Please note that all filters *usually* target the latest pandoc
15+
version, although we may lag behind sometimes. It is considered a
16+
bug if a filter produces wrong results for the latest pandoc
17+
version; older pandoc versions are not necessarily supported,
18+
although we usually strive to do so.
19+
20+
A bug report is most useful if it gives detailed, *reproducible*
21+
instructions. Additionally, it should include
22+
23+
* the pandoc version,
24+
* the exact command line used,
25+
* the exact input used,
26+
* the output received, and
27+
* the output you expected instead.
28+
29+
This will allow us to help you more quickly.
30+
31+
Pull requests
32+
-------------
33+
34+
Whether a small patch or a full new filters, we love getting pull
35+
requests. Consistency is important, especially for a project with
36+
multiple parts written by many contributors. That's why PRs should
37+
follow the filter structure outlined below.
38+
39+
Filter Structure
40+
----------------
41+
42+
The filters come with these components:
43+
44+
- `README.md` describing the filter; if the filter depends on
45+
additional programs, the document should list those requirements
46+
and describe how they can be installed.
47+
48+
Please keep in mind that a key design goal of Markdown was
49+
readability. The README should be pleasant to read even as plain
50+
text. This includes keeping lines below 80 chars or, better yet,
51+
below 66 chars.
52+
53+
- The main Lua filter script; besides the code, it should also
54+
contain a small header with author, copyright, and licensing
55+
information. All filters must be licensed under the MIT license.
56+
57+
Lua code should follow the HsLua [Lua style guide]. The
58+
tl;dr is: use snake_case for most names and keep lines below 80
59+
chars.
60+
61+
- `Makefile` to run the tests. The only hard requirement is the
62+
existence of a `.PHONY` target named `test` which can be used to
63+
test correctness.
64+
65+
- `sample.md` or a similar file demonstrating how the filter can
66+
be used. The sample file doubles as test input.
67+
68+
- A file containing the expected output when using the filter on
69+
the sample input. Multiple such files can be provided if
70+
different filter configurations are to be tested.
71+
72+
All components should be bundled in a single directory.
73+
74+
Text and source files should always be terminated by a final
75+
newline character. The repository comes with a `.editorconfig`
76+
file which helps to adhere to this and similar conventions. Please
77+
consider installing [editorconfig](https://editorconfig.org) if
78+
you editor supports it.
79+
80+
### Configuration
81+
82+
Filters are expected to be readily usable by a wide range of
83+
users. It should not be necessary to edit any source files, so it
84+
often makes sense to keep a filter configurable.
85+
86+
There are two main methods to configure a filter: environment
87+
variables and special metadata values. The `diagram-generator`
88+
filter supports both and can serve as a good reference.
89+
90+
Tests
91+
-----
92+
93+
We currently test filters under two aspects on different CI
94+
systems:
95+
96+
- *Travis CI*: filters are tested against the latest pandoc
97+
version as available from pandoc's download page. The build is
98+
configured via `.travis.yml`.
99+
- *Circle CI*: tests are run in the latest pandoc/ubuntu Docker
100+
image. The config is in `.circleci/config.yml`.
101+
102+
Both systems contain all software necessary to run the tests. Some
103+
filters require additional software to be installed. Please make
104+
sure that all requirements are satisfied in both build
105+
environments and that the builds finish successfully.
106+
107+
Commits
108+
-------
109+
110+
Please follow the usual guidelines for git commits: keep commits
111+
atomic, self-contained, and add a brief but clear commit message.
112+
This [guide](https://chris.beams.io/posts/git-commit/) by Chris
113+
Beams is a good resource if you'd like to learn more.
114+
115+
However, don't fret over this too much. You can also just
116+
accumulate commits without much thought for this rule. We can
117+
squash all commits in a PR into a single commit upon merging. But
118+
we still appreciate it if we don't have to rewrite the commit
119+
message.
120+
121+
122+
[issue tracker]: https://github.com/pandoc/lua-filters/issues
123+
[Lua style guide]: https://github.com/hslua/lua-style-guide

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017-2020 John MacFarlane and contributors
3+
Copyright (c) 2017-2020 pandoc Lua filters contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FILTERS=$(wildcard $(shell find * -type d | grep -v '[/\\]'))
22
FILTER_FILES=$(shell find * -name "*.lua" -type f)
3-
LUA_FILTERS_TEST_IMAGE = tarleb/lua-filters-test
3+
LUA_FILTERS_TEST_IMAGE = pandoc/lua-filters-test
44

55
.PHONY: test show-args docker-test docker-test-image archive
66

@@ -9,6 +9,8 @@ test:
99

1010
archive: .build/lua-filters.tar.gz
1111

12+
archives: .build/lua-filters.tar.gz .build/lua-filters.zip
13+
1214
show-vars:
1315
@printf "FILTERS: %s\n" $(FILTERS)
1416
@printf "FILTER_FILES: %s\n" $(FILTER_FILES)
@@ -27,16 +29,30 @@ docker-test-image: .tools/Dockerfile
2729
.PHONY: collection
2830
collection: .build/lua-filters
2931

30-
.build/lua-filters: $(FILTER_FILES)
31-
mkdir -p .build/lua-filters
32-
cp -a $(FILTER_FILES) .build/lua-filters
33-
cp -a LICENSE .build/lua-filters
32+
.PHONY: docs
33+
docs:
34+
35+
.build/lua-filters: $(FILTER_FILES) docs \
36+
CONTRIBUTING.md LICENSE README.md
37+
mkdir -p $@
38+
mkdir -p $@/filters
39+
mkdir -p $@/docs
40+
cp -a CONTRIBUTING.md LICENSE README.md $@
41+
cp -a $(FILTER_FILES) $@/filters
42+
for filter in $(FILTERS); do \
43+
cp $$filter/README.md $@/docs/$$filter.md; \
44+
done
3445
@printf "Filters collected in '%s'\n" "$@"
3546

3647
.build/lua-filters.tar.gz: .build/lua-filters
3748
tar -czf $@ -C .build lua-filters
3849
@printf "Archive written to '%s'\n" "$@"
3950

51+
.build/lua-filters.zip: .build/lua-filters
52+
rm -f $@
53+
(cd .build && zip -r -9 lua-filters.zip lua-filters)
54+
@printf "Archive written to '%s'\n" "$@"
55+
4056
clean:
4157
rm -rf .build
4258
$(foreach f,$(FILTERS),make -C $(f) clean;)

0 commit comments

Comments
 (0)