first sentence: ? or . followed by space, or two consecutive linefeeds

This commit is contained in:
steve donovan 2011-08-22 13:26:27 +02:00
parent 094852da4c
commit 8a5261424d
2 changed files with 10 additions and 4 deletions

View File

@ -124,8 +124,7 @@ return [==[
<strong>$(display_name(item))</strong> <strong>$(display_name(item))</strong>
</dt> </dt>
<dd> <dd>
$(M(item.summary)) $(M(item.summary..' '..(item.description or '')))
$(M(item.description))
# if show_parms and item.params and #item.params > 0 then # if show_parms and item.params and #item.params > 0 then
<h3>$(module.kinds:type_of(item).subnames):</h3> <h3>$(module.kinds:type_of(item).subnames):</h3>

View File

@ -41,8 +41,15 @@ local function extract_tags (s)
if s:match '^%s*$' then return {} end if s:match '^%s*$' then return {} end
local preamble,tag_items = parse_tags(s) local preamble,tag_items = parse_tags(s)
local strip = tools.strip local strip = tools.strip
local summary,description = preamble:match('^(.-[%.?])(.+)') local summary, description = preamble:match('^(.-[%.?])(%s.+)')
if not summary then summary = preamble end -- and strip(description) ? if not summary then
-- perhaps the first sentence did not have a . or ? terminating it.
-- Then try split at linefeed
summary, description = preamble:match('^(.-\n\n)(.+)')
if not summary then
summary = preamble
end
end -- and strip(description) ?
local tags = {summary=summary and strip(summary),description=description} local tags = {summary=summary and strip(summary),description=description}
for _,item in ipairs(tag_items) do for _,item in ipairs(tag_items) do
local tag,value = item[1],item[2] local tag,value = item[1],item[2]