From 050d6568fa935cc4664876a69c8662449986550f Mon Sep 17 00:00:00 2001 From: mpeterv Date: Thu, 26 Mar 2015 13:30:04 +0300 Subject: Fix summary detection in long paragraphs * `if summary then` branch was never taken as `summary` isn't assigned by then * Removing newlines in summary is useless since they have been replced with space already * `detect_description()` doesn't use rockspec argument any more --- src/luarocks/write_rockspec.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua index 0a333123..68942e07 100644 --- a/src/luarocks/write_rockspec.lua +++ b/src/luarocks/write_rockspec.lua @@ -76,7 +76,7 @@ local function configure_lua_version(rockspec, luaver) end end -local function detect_description(rockspec) +local function detect_description() local fd = open_file("README.md") or open_file("README") if not fd then return end local data = fd:read("*a") @@ -85,15 +85,12 @@ local function detect_description(rockspec) if not paragraph then paragraph = data:match("\n\n(.*)") end local summary, detailed if paragraph then + detailed = paragraph + if #paragraph < 80 then summary = paragraph:gsub("\n", "") - detailed = paragraph else - local found_summary = paragraph:gsub("\n", " "):match("([^.]*%.) ") - if summary then - summary = found_summary:gsub("\n", "") - end - detailed = paragraph + summary = paragraph:gsub("\n", " "):match("([^.]*%.) ") end end return summary, detailed @@ -315,7 +312,7 @@ function write_rockspec.run(...) if not ok then return nil, "Failed reaching files from project - error entering directory "..local_dir end if (not flags["summary"]) or (not flags["detailed"]) then - local summary, detailed = detect_description(rockspec) + local summary, detailed = detect_description() rockspec.description.summary = flags["summary"] or summary rockspec.description.detailed = flags["detailed"] or detailed end -- cgit v1.2.3-55-g6feb