|
From: | Dmitri A. Sergatskov |
Subject: | Re: first help sentence truncated |
Date: | Mon, 27 Aug 2018 13:14:51 -0500 |
Assuming moving to a two-space convention to end sentences, this regular _expression_ will work
regexp (help_text, '\.(?:\s\s|\n|$)', 'once')
--Rik
On 08/27/2018 10:11 AM, Rik wrote:
This is likely to be caused by get_first_help_sentence.m in Octave core.
With the following file b.m
--- File: b.m ---
## This plots x vs. y on a green background.
function b (x)
disp ('hello');
endfunction
--- End File ---
get_first_help_sentence ("b.m") returns
ans = This plots x vs.
The code is
## Extract first line by searching for a period followed by a space class
## character (to support periods in numbers or words) ...
period_idx = regexp (help_text, '\.\s', "once");
One way to resolve this is to have a list of abbreviations as Oliver suggests. This could get cumbersome though as we would probably not recognize a new abbreviation in the first sentence of help until somebody reported an error. Another solution would be to require the convention (used in Octave core) that a sentence-ending period is followed by *two* spaces. Then the regular _expression_ above could be modified to support this case. This would work on all in-sentence abbreviations, and on phrases like "Plot Y vs. X on a semilog background. The second help sentence". A third possibility would be to re-write the documentation--either to expand the abbreviation like vs. to versus if length is not a problem, or to remove the abbreviation entirely. For example, the existing semilogy documentation avoids using "vs." entirely and says "Produce a 2-D plot using a logarithmic scale for the y-axis."
--Rik
On 08/27/2018 09:00 AM, address@hidden wrote:
Subject:Re: Octave-Forge: Redesign with responsive layout From:Oliver Heimlich <address@hidden> Date:08/26/2018 10:58 PM
To:"Dmitri A. Sergatskov" <address@hidden> CC:octave-maintainers <address@hidden>
List-Post:<mailto:address@hidden> Content-Transfer-Encoding:7bit Precedence:list MIME-Version:1.0 References:<address@hidden> <address@hidden> <address@hidden> <address@hidden> In-Reply-To:<address@hidden> Message-ID:<address@hidden> Content-Type:multipart/alternative; boundary="----CE397N214E2FVBBD2PO7S01V9MZ9W7" Message:1
Hi Dmitri,
thank you for the observation. Please create a bug report in the category 'Octave Forge Package'. The extraction of the first help sentence happens in the package generate_html.
Fortunately, it doesn't happen very often. Maybe we can simply scan for common abbreviations to prevent it from happening.
Oliver
Am 27. August 2018 04:44:16 MESZ schrieb "Dmitri A. Sergatskov" <address@hidden>:Looking at the Octave-Forge website I noticed that the description text of individual functions often gets trancated.
One of the most obvious examples is https://octave.sourceforge.io/data-smoothing/overview.html
yet the problem is widespread. (I assume the code that extract 1st sentence from the help gets tricked by the period in misc abbreviations.)
I could file a bug report but I do not see a proper Category.
Dmitri.
--
[Prev in Thread] | Current Thread | [Next in Thread] |