marten created this revision.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.

REVISION SUMMARY
  Viewing the clang(1) man page shows spurious floating point numbers, either 
"0.0", "3.5" or "7.0", scattered throughout the page:
  
  F3910985: clang-manpage-DX.png <https://phabricator.kde.org/F3910985>
  
  These appear to be generated by the ".RS" line within a macro, as in the 
decompressed clang.1.bz2 man page source:
  
  .de1 INDENT
  .\" .rstReportMargin pre:
  . RS \\$1
  . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
  . nr rst2man-indent-level +1
  .\" .rstReportMargin post:
  ..
  
  where the macro parameter to .INDENT is the spurious floating point number 
that appears.
  
  When the .RS is seen in the REQ_RS case in scan_request(), if there are 
arguments scan_expression() is called to read the first argument.  
Unfortunately, scan_expression() simply sees the "\\$1" text and does not 
attempt to expand it as a macro argument.  Since this string does not match any 
of the syntax known to scan_expression() the argument is ignored, the scan 
pointer is not advanced and the argument is output as if it were normal text.
  
  This change recognises the "\\$1" syntax in scan_expression() and uses 
scan_escape_direct() to parse it.  The string value is then converted to a 
number.  It is only possible to return an integer (rounded) because 
scan_expression() only handles integers, but at least something approximate is 
returned and the argument is skipped and not output.

TEST PLAN
  Built kio_man with this change, verified correct output of this man page and 
others.

REPOSITORY
  R320 KIO Extras

REVISION DETAIL
  https://phabricator.kde.org/D7820

AFFECTED FILES
  man/man2html.cpp

To: marten, #plasma
Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, 
abetts, sebas, apol, mart

Reply via email to