You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All full stops (periods) '.' occurring in comments are replaced with :: even when they don't result in a reference.
Describe how to reproduce the bug
Steps to reproduce the behavior:
Write the following documentation string:
/**
* This documentation is quite long.
*
* It needs more than once sentence to describe what is happening.
*
* FullyStopped.value is a reference, but FullyStopped.
* value is not.
*/
message FullyStopped {
required uint32 value = 1;
};
Generate documentation:
<detaileddescription>
<para>This documentation is quite long::</para>
<para>It needs more than once sentence to describe what is happening::</para>
<para>
<refrefid="structFullyStopped_1a8defeb7fb78806a0c55bfec7b89e6500"kindref="member">FullyStopped::value</ref>
is a reference, but <refrefid="structFullyStopped"kindref="compound">FullyStopped</ref>:: value is not:: </para> </detaileddescription>
Converted to markdown for readability:
This documentation is quite long::
It needs more than once sentence to describe what is happening::
FullyStopped::value is a reference, but FullyStopped:: value is not
Describe the expected behavior
'.' characters should not be replaced if they are not followed by a set of non-whitespace characters
This documentation is quite long.
It needs more than once sentence to describe what is happening.
FullyStopped::value is a reference, but FullyStopped. value is not
The (\S+) group requires the . to be followed by at least one (1) non whitespace character.
Any whitespace following a :: would be invalid syntax in C++ anyway, so I don't think this would break that many intentional references. Considering a sentence not followed by white space, like this one.I believe that would be invalid syntax in English.
diff --git a/proto2cpp.py b/proto2cpp.py
index a355aaa..6f0d80a 100644
--- a/proto2cpp.py+++ b/proto2cpp.py@@ -183,7 +183,8 @@ class proto2cpp:
isMultilineComment = False
# line = line.replace(".", "::") but not in quoted strings (Necessary for import statement)
- line = re.sub(r'\.(?=(?:[^"]*"[^"]*")*[^"]*$)',r'::',line)+ # also not if the "." was the final character in the line or was followed by whitespace (natural punctuation)+ line = re.sub(r'\.(?=(?:[^"]*"[^"]*")*[^"]*$)(\S+)',r'::\1',line)
# Search for " option ...;", remove it
line = re.sub(r'\boption\b[^;]+;', r'', line)
The text was updated successfully, but these errors were encountered:
szmoore
added
the
bug
Problems in the build system, build scripts, etc or faults in the interface.
label
Dec 30, 2020
Describe the bug
All full stops (periods)
'.'
occurring in comments are replaced with::
even when they don't result in a reference.Describe how to reproduce the bug
Steps to reproduce the behavior:
Converted to markdown for readability:
Describe the expected behavior
'.'
characters should not be replaced if they are not followed by a set of non-whitespace charactersShow some screenshots
Not Applicable
Describe the OS you are using
proto2cpp.py@3e30b94615d64cf02713b23060f985f953751bb8
(v0.8-beta)Additional context
A patch:
The
(\S+)
group requires the.
to be followed by at least one (1) non whitespace character.Any whitespace following a
::
would be invalid syntax in C++ anyway, so I don't think this would break that many intentional references. Considering a sentence not followed by white space, like this one.I believe that would be invalid syntax in English.The text was updated successfully, but these errors were encountered: