lychee/Makefile
Matthias Endler 55797071b0
Fix nested URL extraction in verbatim elements (#988)
Skipping URLs in verbatim elements didn't take nested
elements into consideration, which were not verbatim.

For instance, the following HTML snippet would yield
`https://example.com` in non-verbatim mode, even if
it is nested inside a verbatim `<pre>` element:

```html
<pre><a href="https://example.com">link</a></pre>
```

This commit fixes the behavior for both `html5gum` and
`html5ever`.

Note that nested verbatim elements of the same kind
still are not handled correctly.

For instance,  the following HTML snippet would still yield
`https://example.com`:

```html
<pre>
  <pre></pre>
  <a href="https://example.com">link</a>
</pre>
```

The reason is that we currently only keep track of a single
verbatim element and not a stack of elements, which we
would need to unwind and resolve the situation.

Fixes https://github.com/lycheeverse/lychee/issues/986.
2023-03-11 15:18:25 +01:00

53 lines
No EOL
1.3 KiB
Makefile

# Needed SHELL since I'm using zsh
SHELL := /bin/bash
IMAGE_NAME := "lycheeverse/lychee"
.PHONY: help
help: ## This help message
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
.PHONY: docker-build
docker-build: ## Build Docker image
docker build -t $(IMAGE_NAME) .
.PHONY: docker-run
docker-run: ## Run Docker image
docker run $(IMAGE_NAME)
.PHONY: docker-push
docker-push: ## Push image to Docker Hub
docker push $(IMAGE_NAME)
.PHONY: build
build: ## Build Rust code locally
cargo build
.PHONY: install
install: ## Install project locally
cargo install --path lychee-bin --locked
.PHONY: run
run: ## Run project locally
cargo run
.PHONY: docs
docs: ## Generate and show documentation
cargo doc --open
.PHONY: lint
lint: ## Run linter
cargo clippy --all-targets --all-features -- -D warnings
.PHONY: test
test: ## Run tests
cargo nextest run --all-targets --all-features --filter-expr '!test(test_exclude_example_domains)'
cargo nextest run --filter-expr 'test(test_exclude_example_domains)'
cargo test --doc
.PHONY: doc
doc: ## Open documentation
cargo doc --open
.PHONY: screencast
screencast: ## Create a screencast for the docs
svg-term --command 'assets/screencast.sh' --out 'assets/screencast.svg' --width 100 --padding 10 --window