netudima commented on code in PR #4870: URL: https://github.com/apache/cassandra/pull/4870#discussion_r3369581762
########## doc/scripts/cqlprotodoc.py: ########## @@ -0,0 +1,316 @@ +#!/usr/bin/env python3 + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse, sys, re, html, io +from pathlib import Path +from typing import List + +_comment_re = re.compile(r'^#\s?(.*)$') +_empty_re = re.compile(r'^\s*$') +_title_re = re.compile(r'^\s+(.*)\s*$') +_heading_re = re.compile(r'^(?P<indent>\s*)(?P<number>\d+(?:\.\d+)*)\.?\s+(?P<title>[A-Za-z_].+)$') +_toc_entry_re = re.compile(r'^(?P<number>\d+(?:\.\d+)*)\.?\s+(?P<title>.+)$') +_url_re = re.compile(r'(https?://[^\s\)]+)') Review Comment: a comment from Claude code: URL regex captures trailing punctuation _url_re = re.compile(r'(https?://[^\s\)]+)') Confirmed on examples: 'see http://example.com/foo. ' → 'http://example.com/foo.' (extra '.') 'see http://example.com/foo, also' → 'http://example.com/foo,' (extra ',') The comment in format_body notes "Transcode entity names to byte-match the previous (go) tool's output" — but if the Go tool stripped trailing .,;: (a common pattern), the output won't be byte-identical. Worth confirming by diffing against the current published output for v3/v4/v5. Suggest: _url_re = re.compile(r'(https?://[^\s\)]+?)(?=[\s\)\.,;:!?]*(?:\s|$|\)))') # or strip trailing punctuation in the replacement ########## doc/scripts/cqlprotodoc.py: ########## @@ -0,0 +1,316 @@ +#!/usr/bin/env python3 + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse, sys, re, html, io +from pathlib import Path +from typing import List + +_comment_re = re.compile(r'^#\s?(.*)$') +_empty_re = re.compile(r'^\s*$') +_title_re = re.compile(r'^\s+(.*)\s*$') +_heading_re = re.compile(r'^(?P<indent>\s*)(?P<number>\d+(?:\.\d+)*)\.?\s+(?P<title>[A-Za-z_].+)$') +_toc_entry_re = re.compile(r'^(?P<number>\d+(?:\.\d+)*)\.?\s+(?P<title>.+)$') +_url_re = re.compile(r'(https?://[^\s\)]+)') Review Comment: a comment from Claude code: ``` URL regex captures trailing punctuation _url_re = re.compile(r'(https?://[^\s\)]+)') Confirmed on examples: 'see http://example.com/foo. ' → 'http://example.com/foo.' (extra '.') 'see http://example.com/foo, also' → 'http://example.com/foo,' (extra ',') The comment in format_body notes "Transcode entity names to byte-match the previous (go) tool's output" — but if the Go tool stripped trailing .,;: (a common pattern), the output won't be byte-identical. Worth confirming by diffing against the current published output for v3/v4/v5. Suggest: _url_re = re.compile(r'(https?://[^\s\)]+?)(?=[\s\)\.,;:!?]*(?:\s|$|\)))') # or strip trailing punctuation in the replacement ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

