diff options
-rw-r--r-- | src/luarocks/write_rockspec.lua | 13 |
1 files changed, 5 insertions, 8 deletions
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) | |||
76 | end | 76 | end |
77 | end | 77 | end |
78 | 78 | ||
79 | local function detect_description(rockspec) | 79 | local function detect_description() |
80 | local fd = open_file("README.md") or open_file("README") | 80 | local fd = open_file("README.md") or open_file("README") |
81 | if not fd then return end | 81 | if not fd then return end |
82 | local data = fd:read("*a") | 82 | local data = fd:read("*a") |
@@ -85,15 +85,12 @@ local function detect_description(rockspec) | |||
85 | if not paragraph then paragraph = data:match("\n\n(.*)") end | 85 | if not paragraph then paragraph = data:match("\n\n(.*)") end |
86 | local summary, detailed | 86 | local summary, detailed |
87 | if paragraph then | 87 | if paragraph then |
88 | detailed = paragraph | ||
89 | |||
88 | if #paragraph < 80 then | 90 | if #paragraph < 80 then |
89 | summary = paragraph:gsub("\n", "") | 91 | summary = paragraph:gsub("\n", "") |
90 | detailed = paragraph | ||
91 | else | 92 | else |
92 | local found_summary = paragraph:gsub("\n", " "):match("([^.]*%.) ") | 93 | summary = paragraph:gsub("\n", " "):match("([^.]*%.) ") |
93 | if summary then | ||
94 | summary = found_summary:gsub("\n", "") | ||
95 | end | ||
96 | detailed = paragraph | ||
97 | end | 94 | end |
98 | end | 95 | end |
99 | return summary, detailed | 96 | return summary, detailed |
@@ -315,7 +312,7 @@ function write_rockspec.run(...) | |||
315 | if not ok then return nil, "Failed reaching files from project - error entering directory "..local_dir end | 312 | if not ok then return nil, "Failed reaching files from project - error entering directory "..local_dir end |
316 | 313 | ||
317 | if (not flags["summary"]) or (not flags["detailed"]) then | 314 | if (not flags["summary"]) or (not flags["detailed"]) then |
318 | local summary, detailed = detect_description(rockspec) | 315 | local summary, detailed = detect_description() |
319 | rockspec.description.summary = flags["summary"] or summary | 316 | rockspec.description.summary = flags["summary"] or summary |
320 | rockspec.description.detailed = flags["detailed"] or detailed | 317 | rockspec.description.detailed = flags["detailed"] or detailed |
321 | end | 318 | end |