New code, fixed bugs.

master
AardCrowley 2 years ago committed by GitHub
parent b987c5b04f
commit 8fe60eaaa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,23 +6,13 @@
<!-- Plugin "Note_Write_Helper" generated by Plugin Wizard --> <!-- Plugin "Note_Write_Helper" generated by Plugin Wizard -->
<muclient> <muclient>
<plugin <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="2.0">
name="Note_Write_Helper" <description trim="y">
author="Arcidayne" <![CDATA[
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="2.1"
>
<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! 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. 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. nwi <char><text> Same as above, except it takes an indent character.
nnw <reply|new> Opens up an editor box so you can just type the whole note at once. nnw <reply|new> Opens up an editor box so you can just type the whole note at once.
##Examples## ##Examples##
@ -41,55 +31,32 @@ returns
>This is a long line of text that would be formatted to break at 79 characters with >This is a long line of text that would be formatted to break at 79 characters with
>respect to the word boundaries. >respect to the word boundaries.
As a side note, in order to post blank lines, you will need to use @w for each blank line. I may or may not fix it in the future.
]]> ]]>
</description> </description>
</plugin> </plugin>
<!-- Aliases --> <!-- Aliases -->
<aliases> <aliases>
<alias <alias match="^nw (.*)$" enabled="y" group="NoteHelper" regexp="y" send_to="12" sequence="100">
match="^nw (.*)$"
enabled="y"
group="NoteHelper"
regexp="y"
send_to="12"
sequence="100"
>
<send>Send(note_wrap("%1"))</send> <send>Send(note_wrap("%1"))</send>
</alias> </alias>
<alias <alias match="^nwi\s(.*?)\s(.*)$" enabled="y" group="NoteHelper" regexp="y" send_to="12" sequence="100">
match="^nwi\s(.*?)\s(.*)$"
enabled="y"
group="NoteHelper"
regexp="y"
send_to="12"
sequence="100"
>
<send>Send(note_wrap("%2", 79, "%1"))</send> <send>Send(note_wrap("%2", 79, "%1"))</send>
</alias> </alias>
<alias <alias match="^nnw (new|reply)$" enabled="y" group="NoteHelper" regexp="y" send_to="12" sequence="100">
match="^nnw (new|reply)$"
enabled="y"
group="NoteHelper"
regexp="y"
send_to="12"
sequence="100"
>
<send>noteeditor("%1")</send> <send>noteeditor("%1")</send>
</alias> </alias>
</aliases> </aliases>
<!-- Script --> <!-- Script -->
<script> <script>
<![CDATA[ <![CDATA[
function note_wrap(str, limit, indent, indent1) function note_wrap(str, limit, indent, indent1)
indent = indent or "" indent = indent or ""
indent1 = indent1 or indent indent1 = indent1 or indent
@ -199,9 +166,13 @@ function noteeditor(str)
note = utils.editbox("Write your note.", "Note Writer Box") note = utils.editbox("Write your note.", "Note Writer Box")
if note then if note then
for line in note:gmatch("[^%c]+[%c+]?") do local lines = note:split("\n")
for _, line in ipairs(lines) do
if line:match("^%c") then
Send("@")
else
Send(note_wrap(line)) Send(note_wrap(line))
--Send(" ") end
end end
Send(".s") Send(".s")
else else
@ -210,26 +181,22 @@ function noteeditor(str)
end end
end end
]]> ]]>
</script> </script>
<!-- Plugin help --> <!-- Plugin help -->
<aliases> <aliases>
<alias <alias script="OnHelp" match="nw:help" enabled="y">
script="OnHelp"
match="nw:help"
enabled="y"
>
</alias> </alias>
</aliases> </aliases>
<script> <script>
<![CDATA[ <![CDATA[
function OnHelp () function OnHelp ()
world.Note (world.GetPluginInfo (world.GetPluginID (), 3)) world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end end
]]> ]]>
</script> </script>
</muclient> </muclient>

Loading…
Cancel
Save