parent
68c00a02df
commit
bd92a1bae1
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!DOCTYPE muclient>
|
||||||
|
<!-- Saved on Sunday, August 16, 2015, 9:00 AM -->
|
||||||
|
<!-- MuClient version 4.98 -->
|
||||||
|
|
||||||
|
<!-- Plugin "Note_Write_Helper" generated by Plugin Wizard -->
|
||||||
|
|
||||||
|
<muclient>
|
||||||
|
<plugin
|
||||||
|
name="Note_Write_Helper"
|
||||||
|
author="Arcidayne"
|
||||||
|
id="291e6a78b7457b70ebf24375"
|
||||||
|
language="Lua"
|
||||||
|
purpose="Preformats long lines to break at 79 characters with respect to full words."
|
||||||
|
save_state="y"
|
||||||
|
date_written="2015-08-16 08:56:28"
|
||||||
|
requires="4.00"
|
||||||
|
version="1.0"
|
||||||
|
>
|
||||||
|
<description trim="y">
|
||||||
|
<![CDATA[
|
||||||
|
Instead of using the note formatter tool, or figuring out how long your line of text is, this plugin will do it for you!
|
||||||
|
|
||||||
|
nw <text> No indent character; takes a long line and formats linewraps it.
|
||||||
|
nwi <char> <text> Same as above, except it takes an indent character.
|
||||||
|
|
||||||
|
##Examples##
|
||||||
|
|
||||||
|
nw This is a long line of text that would be formatted to break at 79 characters with respect to the word boundaries.
|
||||||
|
|
||||||
|
returns
|
||||||
|
|
||||||
|
This is a long line of text that would be formatted to break at 79 characters with
|
||||||
|
respect to the word boundaries.
|
||||||
|
|
||||||
|
nwi > This is a long line of text that would be formatted to break at 79 characters with respect to the word boundaries.
|
||||||
|
|
||||||
|
returns
|
||||||
|
|
||||||
|
>This is a long line of text that would be formatted to break at 79 characters with
|
||||||
|
>respect to the word boundaries.
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</description>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Aliases -->
|
||||||
|
|
||||||
|
<aliases>
|
||||||
|
<alias
|
||||||
|
match="^nw (.*)$"
|
||||||
|
enabled="y"
|
||||||
|
group="NoteHelper"
|
||||||
|
regexp="y"
|
||||||
|
send_to="12"
|
||||||
|
sequence="100"
|
||||||
|
>
|
||||||
|
<send>Send(note_wrap("%1"))</send>
|
||||||
|
</alias>
|
||||||
|
<alias
|
||||||
|
match="^nwi\s(.*?)\s(.*)$"
|
||||||
|
enabled="y"
|
||||||
|
group="NoteHelper"
|
||||||
|
regexp="y"
|
||||||
|
send_to="12"
|
||||||
|
sequence="100"
|
||||||
|
>
|
||||||
|
<send>Send(note_wrap("%2", 79, "%1"))</send>
|
||||||
|
</alias>
|
||||||
|
</aliases>
|
||||||
|
|
||||||
|
<!-- Script -->
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
<![CDATA[
|
||||||
|
function note_wrap(str, limit, indent, indent1)
|
||||||
|
indent = indent or ""
|
||||||
|
indent1 = indent1 or indent
|
||||||
|
limit = limit or 79
|
||||||
|
local here = 1-#indent1
|
||||||
|
return indent1..str:gsub("(%s+)()(%S+)()",
|
||||||
|
function(sp, st, word, fi)
|
||||||
|
local delta = 0
|
||||||
|
word:gsub('@([@%a])',
|
||||||
|
function(c)
|
||||||
|
if c == '@' then delta = delta + 1
|
||||||
|
elseif c == 'x' then delta = delta + 5
|
||||||
|
else delta = delta + 2
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
here = here + delta
|
||||||
|
if fi-here > limit then
|
||||||
|
here = st - #indent + delta
|
||||||
|
return "\n"..indent..word
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Plugin help -->
|
||||||
|
|
||||||
|
<aliases>
|
||||||
|
<alias
|
||||||
|
script="OnHelp"
|
||||||
|
match="nw:help"
|
||||||
|
enabled="y"
|
||||||
|
>
|
||||||
|
</alias>
|
||||||
|
</aliases>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
<![CDATA[
|
||||||
|
function OnHelp ()
|
||||||
|
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
|
||||||
|
end
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</muclient>
|
Loading…
Reference in new issue