2026-07-24 20:57:43 +02:00
|
|
|
local util = require('util')
|
2026-07-30 20:53:12 +02:00
|
|
|
local markdown = require("markdown")
|
2026-07-24 20:57:43 +02:00
|
|
|
|
|
|
|
|
app.on('scan_experience', function(exp)
|
|
|
|
|
--print_r(exp)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
app.on('scan_experience_file', function(exp)
|
2026-07-30 20:53:12 +02:00
|
|
|
local me = app.plugin.markdown
|
|
|
|
|
local patterns = util.split(app.opts.plugin_markdown_files," ")
|
|
|
|
|
foreach( patterns, function(k,v)
|
|
|
|
|
if exp.path:match(v) then
|
2026-07-30 22:54:44 +02:00
|
|
|
print("✅ └─ plugin/markdown: detected " .. v)
|
2026-07-30 20:53:12 +02:00
|
|
|
exp.parent.info = '<div id="info">' .. markdown( util.readfile(exp.path) ) .. '</div>'
|
|
|
|
|
end
|
|
|
|
|
end)
|
2026-07-24 20:57:43 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
app.on('set', function(k,v)
|
|
|
|
|
print("content was updated")
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- this registers the plugin UI
|
|
|
|
|
local plugin = {
|
|
|
|
|
name = 'Markdown <b class="tag">disabled</b>',
|
2026-07-24 21:45:33 +02:00
|
|
|
info = 'extract experience title and description from markdown file',
|
2026-07-24 20:57:43 +02:00
|
|
|
opts = {
|
|
|
|
|
{
|
|
|
|
|
key='app.opts.plugin_markdown_files',
|
|
|
|
|
title='Markdown files',
|
|
|
|
|
info='Space-separated, <a href="http://lua-users.org/wiki/PatternsTutorial" target="_blank">lua patterns</a> are allowed',
|
2026-07-30 20:53:12 +02:00
|
|
|
default="README.md",
|
2026-07-24 20:57:43 +02:00
|
|
|
values=''
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key='app.opts.plugin_markdown_strategy',
|
|
|
|
|
title='Markdown strategy',
|
|
|
|
|
info='',
|
|
|
|
|
default="README.md",
|
|
|
|
|
values={headerparagraph='title is first header + 1st paragraph is description',disabled='disabled'}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return plugin
|