Skip to content

Commit

Permalink
Rewrite URLs using the https scheme to http
Browse files Browse the repository at this point in the history
We assume HSTS and/or HTTP->HTTPS redirection for resources we link, while keeping the `http` scheme as canonical.
  • Loading branch information
amn committed Sep 29, 2024
1 parent b930beb commit b0402c2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion expand/csspring/syntax/tokenizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def next(n: int) -> str:
def consume(n: int) -> None:
"""Consume the next code point from the stream.
Consuming removes a [filtered] code point from the stream. If no code points are available for consumption (the stream is "exhausted"), an empty string signifying the so-called EOF ("end of file", see https://drafts.csswg.org/css-syntax/#eof-code-point) value, is consumed instead.
Consuming removes a [filtered] code point from the stream. If no code points are available for consumption (the stream is "exhausted"), an empty string signifying the so-called EOF ("end of file", see http://drafts.csswg.org/css-syntax/#eof-code-point) value, is consumed instead.
"""
nonlocal consumed # required for the `+=` to work for mutable non-locals like lists (despite the fact that the equivalent `extend` does _not_ require the statement)
consumed += input.read(n) or [ FilteredCodePoint('', source='') ]
Expand Down
10 changes: 5 additions & 5 deletions src/csspring/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def parse(production: Production, input: TokenStream) -> Product | Token | None:

@parse.register
def _(production: AlternativesProduction, input: TokenStream) -> Product | Token | None:
"""Variant of `parse` for productions of the `|` combinator variety (see https://drafts.csswg.org/css-values-4/#component-combinators)."""
"""Variant of `parse` for productions of the `|` combinator variety (see http://drafts.csswg.org/css-values-4/#component-combinators)."""
input.mark()
for element in production.elements:
result = parse(element, input)
Expand Down Expand Up @@ -69,7 +69,7 @@ def parse_any_value(input: TokenStream) -> Product | None:

@parse.register
def _(production: CommaSeparatedRepetitionProduction, input: TokenStream) -> Product | None:
"""Variant of `parse` for productions of the `#` multiplier variety (see https://drafts.csswg.org/css-values-4/#mult-comma)."""
"""Variant of `parse` for productions of the `#` multiplier variety (see http://drafts.csswg.org/css-values-4/#mult-comma)."""
result: list[Product | Token] = []
input.mark()
while True:
Expand All @@ -92,7 +92,7 @@ def _(production: CommaSeparatedRepetitionProduction, input: TokenStream) -> Pro

@parse.register
def _(production: ConcatenationProduction, input: TokenStream) -> Product | None:
"""Variant of `parse` for productions of the ` ` combinator variety (see "juxtaposing components" at https://drafts.csswg.org/css-values-4/#component-combinators)."""
"""Variant of `parse` for productions of the ` ` combinator variety (see "juxtaposing components" at http://drafts.csswg.org/css-values-4/#component-combinators)."""
result: list[Product | Token] = []
input.mark()
for element in production.elements:
Expand All @@ -105,7 +105,7 @@ def _(production: ConcatenationProduction, input: TokenStream) -> Product | None

@parse.register
def _(production: NonEmptyProduction, input: TokenStream) -> Product | None:
"""Variant of `parse` for productions of the `!` multiplier variety (see https://drafts.csswg.org/css-values-4/#mult-req)."""
"""Variant of `parse` for productions of the `!` multiplier variety (see http://drafts.csswg.org/css-values-4/#mult-req)."""
result = cast(Product, parse(production.element, input)) # The element of a non-empty production is concatenation, and the `parse` overload for `ConcatenationProduction` never returns a `Token`, only `Product | None`
if result and any(tokens(result)):
return result
Expand Down Expand Up @@ -143,7 +143,7 @@ def _(production: RepetitionProduction, input: TokenStream) -> Product | None:
def _(production: TokenProduction, input: TokenStream) -> Token | None:
"""Variant of `parse` for token productions.
A token production can be identified in the grammar at https://drafts.csswg.org/selectors-4/#grammar with the `<...-token>` text.
A token production can be identified in the grammar at http://drafts.csswg.org/selectors-4/#grammar with the `<...-token>` text.
"""
input.mark()
if isinstance(token := input.consume_token(), production.type) and all((getattr(token, name) == value) for name, value in production.attributes.items()):
Expand Down
2 changes: 1 addition & 1 deletion src/csspring/syntax/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

from ..values import Production

# See https://drafts.csswg.org/css-syntax/#any-value
# See http://drafts.csswg.org/css-syntax/#any-value
any_value = Production()
any_value.name = 'any_value'
4 changes: 2 additions & 2 deletions src/csspring/values.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Implement the ["CSS Values and Units Module Level 4"](https://drafts.csswg.org/css-values-4) specification.
"""Implement the ["CSS Values and Units Module Level 4"](http://drafts.csswg.org/css-values-4) specification.
Only parts currently in use by the rest of the `csspring` pcakge, are implemented.
"""
Expand Down Expand Up @@ -135,7 +135,7 @@ def __init__(self, element: Production):
self.element = element

class Formatter:
"""Class of objects that offer procedures for serializing productions into streams of text formatted per the [value definition syntax](https://drafts.csswg.org/css-values-4/#value-defs)."""
"""Class of objects that offer procedures for serializing productions into streams of text formatted per the [value definition syntax](http://drafts.csswg.org/css-values-4/#value-defs)."""
grouping_strings = ('[ ', ' ]') # The kind of grouping symbol to use when a production expression must be surrounded with a pair of brace-like grouping symbols, in its serialized form
def grouping_mode(self, production: Production):
"""Determine whether a given production shall require an explicit pair of grouping symbols when featured as an _operand_ (e.g. in binary/unary operation context).
Expand Down

0 comments on commit b0402c2

Please sign in to comment.