Bug 17433 - print.news_db(doBrowse=TRUE) typesets nested lists incorrectly.
Summary: print.news_db(doBrowse=TRUE) typesets nested lists incorrectly.
Alias: None
Product: R
Classification: Unclassified
Component: Documentation (show other bugs)
Version: R 3.5.0
Hardware: x86_64/x64/amd64 (64-bit) Linux
: P5 minor
Assignee: R-core
Depends on:
Reported: 2018-06-11 07:25 UTC by Pavel N. Krivitsky
Modified: 2018-07-18 11:12 UTC (History)
1 user (show)

See Also:

NEWS.Rd (350 bytes, text/plain)
2018-06-11 07:25 UTC, Pavel N. Krivitsky

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel N. Krivitsky 2018-06-11 07:25:05 UTC
Created attachment 2350 [details]


1. Run
> utils::package.skeleton()
to create a dummy package.

2. Create file inst/NEWS.Rd with contents attached.

3. Install the dummy package.

4. Run
> print(news(package="anRpackage"),doBrowse=TRUE)
(the default in an interactive session).


NEWS are shown with a nested bulleted list.


The second-level list items all appear on one line, preceded by asterisks. The relevant HTML generated is as follows:

<li>First-level item 1.</li>
<li>First-level item 2, including:

  * Second-level item 1.

  * Second-level item 2.</li>


It looks like printing the news in text mode, i.e.,
> print(news(package="anRpackage"),doBrowse=FALSE)
produces the correctly nested list:

    o   First-level item 1.

    o   First-level item 2, including:
	  * Second-level item 1.
	  * Second-level item 2.
Comment 1 Kurt Hornik 2018-06-11 14:29:24 UTC
This will not be easy to fix/improve.
A news_db is really a (suitably indexed) data base of the news items 
in *plain text* format, even if it is obtained from NEWS.Rd.
(Integration into the dynamic help system happened after the original
The plain text representation is needed for the full text searches.
An obvious fix would be augmenting the news_db by parsed Rd news items
if obtained from Rd, and using that for rendering as HTML.  I may be
able to look at this over the summer: for now, patches welcome :-)
A quicker improvement would be massaging the plain text a bit more for
HTML rendering, e.g., try to split the text chunks into pars delimited
by \n\n, and then put inside <p>...</p> for the rendering.

Btw, to reproduce more easily, one can e.g. do

news <- tools:::.build_news_db_from_package_NEWS_Rd("foo.Rd")
html <- tools::toHTML(news)
writeLines(html, "foo.html")

with foo.Rd the Rd file with the news entries.
Comment 2 Kurt Hornik 2018-07-18 11:12:30 UTC
This should now be fixed in the trunk with c74972.