Skip to content

Commit d86c16e

Browse files
committed
RELEASE-checklist: keep javadoc links current
This adds a script that updates javadoc links in markdown docs.
1 parent c5c7a93 commit d86c16e

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extensive test suite, and has undergone
1818
how to get started with or without Maven.
1919

2020
You can use
21-
[prepackaged policies](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/Sanitizers.html):
21+
[prepackaged policies](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/Sanitizers.html):
2222

2323
```Java
2424
PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);
@@ -28,7 +28,7 @@ String safeHTML = policy.sanitize(untrustedHTML);
2828
or the
2929
[tests](https://github.com/OWASP/java-html-sanitizer/blob/master/src/test/java/org/owasp/html/HtmlPolicyBuilderTest.java)
3030
show how to configure your own
31-
[policy](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlPolicyBuilder.html):
31+
[policy](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlPolicyBuilder.html):
3232

3333
```Java
3434
PolicyFactory policy = new HtmlPolicyBuilder()
@@ -41,7 +41,7 @@ String safeHTML = policy.sanitize(untrustedHTML);
4141
```
4242

4343
or you can write
44-
[custom policies](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/ElementPolicy.html)
44+
[custom policies](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/ElementPolicy.html)
4545
to do things like changing `h1`s to `div`s with a certain class:
4646

4747
```Java

RELEASE-checklist.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ find . -name pom.xml \
5858
# Make sure there's no snapshots left in any poms.
5959
find . -name pom.xml | xargs grep -- -SNAPSHOT
6060

61+
./scripts/fix_javadoc_links.sh "$NEW_VERSION"
62+
6163
# Make sure the change log is up-to-date.
6264
perl -i.bak \
6365
-pe 'if (m/^ [*] / && !$added) { $_ = qq( * Release $ENV{"NEW_VERSION"}\n$_); $added = 1; }' \

docs/getting_started.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ it to HTML.
3030
The
3131
[javadoc](http://javadoc.io/doc/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/latest/)
3232
covers more detailed topics, including
33-
[customization](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlPolicyBuilder.html).
33+
[customization](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlPolicyBuilder.html).
3434

3535
Important classes are:
3636

37-
* [Sanitizers](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/Sanitizers.html) contains combinable pre-packaged policies.
38-
* [HtmlPolicyBuilder](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlPolicyBuilder.html) lets you easily build custom policies.
37+
* [Sanitizers](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/Sanitizers.html) contains combinable pre-packaged policies.
38+
* [HtmlPolicyBuilder](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlPolicyBuilder.html) lets you easily build custom policies.
3939

4040
For advanced use, see:
41-
* [AttributePolicy](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/AttributePolicy.html) and [ElementPolicy](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/ElementPolicy.html) allow complex customization.
42-
* [HtmlStreamEventReceiver](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlStreamEventReceiver.html) if you don't just want a `String` as output.
41+
* [AttributePolicy](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/AttributePolicy.html) and [ElementPolicy](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/ElementPolicy.html) allow complex customization.
42+
* [HtmlStreamEventReceiver](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/org/owasp/html/HtmlStreamEventReceiver.html) if you don't just want a `String` as output.
4343

4444
## Asking Questions
4545

docs/maven.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Bigger numbers are more recent and the [change log](../change_log.md)
2323
can shed light on the salient differences.
2424

2525
You should be able to build with the HTML sanitizer. You can read the
26-
[javadoc](http://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/latest/index.html),
26+
[javadoc](https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/20180219.1/index.html),
2727
and if you have questions that aren't answered by these wiki pages,
2828
you can ask on the
2929
[mailing list](http://groups.google.com/group/owasp-java-html-sanitizer-support).

scripts/fix_javadoc_links.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
export VERSION="$1"
6+
7+
if [ -z "$VERSION" ]; then
8+
echo "Usage: $0 <maven-version>"
9+
exit 1
10+
fi
11+
12+
find docs README.md -name \*.md | \
13+
xargs perl -i~ -pe \
14+
's@\bhttps?://static[.]javadoc[.]io/com[.]googlecode[.]owasp-java-html-sanitizer/owasp-java-html-sanitizer/(?:[\w.\-]+)/(\w+)@https://static.javadoc.io/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer/'"$VERSION"'/$1@'

0 commit comments

Comments
 (0)