mcMultiTag
Mark — Sat, 12/24/2005 - 19:29

This plugin can wrap multiple html tags around selected lines of text based on the number of blank lines between them as defined in the Preferences, as well as include ID and Class values.
Here's screenshot showing an example of mcMultiTag output.

Let's look at the Preferences window to see what is there, then we'll talk about what mcMultiTag can do.

First, notice that there are no < or > used on the html tags. If you do accidentally put them in it's not a problem. They will be removed when you close the Preferences window.
Let's say you have some lines of text. Some lines need to be header tags and others lines will be paragraphs. In this case you'd define your header tag in Tag 1 and the paragraph tags in Tag 2. mcMultiTag will determine which lines are to be header tags by the number of blank lines above and below them as defined for Tag 1 Blank Line Settings in Preferences. The default is 2 blank lines above and one below. Note that Tag 1 will always be applied to the first line(s) of text, that's why it's called Tag 1.
It's important to note that the Tag 1 Blank Line Settings are minimum settings. For example, if the lines above setting is "2", then as long as there are 2 or more blank lines above that section the condition is met, and the tag is applied. The same is true for the lines below setting.
All other lines that don't meet the Tag 1 Blank Line Settings criteria will be wrapped with the html tag defined for Tag 2 in Preferences. Unless of course Tag 2 is turned Off. We'll talk more about turning Tag 2 off later.
Look at this sample text:
CAPUT 1 (blank line) Magnus es, domine, et laudabilis valde: magna virtus tua, et sapientiae tuae non est numerus. et laudare te vult homo, (blank line) (blank line) aliqua (blank line) portio creaturae tuae, et homo circumferens mortalitem suam, circumferens testimonium peccati sui et testimonium, quia superbis
Here is the result with the default settings applied:
<h1>CAPUT 1</h1> <p>Magnus es, domine, et laudabilis valde: magna virtus tua, et sapientiae tuae non est numerus. et laudare te vult homo,</p> (blank line) <h1>aliqua</h1> <p>portio creaturae tuae, et homo circumferens mortalitem suam, circumferens testimonium peccati sui et testimonium, quia superbis</p>
<!-- Wrapper Tag -->
Wrapper Tag
You want all of this inside <div> tags you say? No problem, that's what the Wrapper Tag does. When turned On, all of the selected lines of text will be placed inside the html tag defined as the Wrapper Tag. Here's what our sample text looks like with the Wrapper Tag turned On:
<div> (blank line) <h1>CAPUT 1</h1> <p>Magnus es, domine, et laudabilis valde: magna virtus tua, et sapientiae tuae non est numerus. et laudare te vult homo,</p> (blank line) <h1>aliqua</h1> <p>portio creaturae tuae, et homo circumferens mortalitem suam, circumferens testimonium peccati sui et testimonium, quia superbis</p> (blank line) </div>
When you no longer want to use the Wrapper Tag, simply turn it Off in the Preferences.
<!-- Apply single html tag -->
Applying Single Html Tag
Applying multiple tags is wonderful, but what if you only want to apply a single html tag, not multiple ones? In Preferences turn Tag 2 Off. Tag 1 will be applied to all blocks of text separated by one or more blank lines. You can still use the Wrapper Tag when doing this.
<!-- ID's and Classes -->
ID's and Classes
As you probably noticed you can also assign ID's and Class values. These are included when there is a value defined in Preferences. Simply blank them out to discontinue their use.
Note that tags, and their ID's and Class values when defined, are repeated with mcMultiTag and we all know that ID's must be unique. To avoid duplicate ID values, all ID's will have a number added to the end of the user defined ID value, starting with the number 1, and will increment up by 1 for each instance of the tag. So for example, if the ID value in Preferences for Tag 1 is set to "MyID" then it will applied as "MyID1" for the first instance of Tag 1 and will be incremented up by 1 for the following instances (e.g. "MyID2", "MyID3", etc.). So, the same ID value can be used through out the Preferences settings because a number value is automatically assigned. We'll see this in action in the next section about making Lists.
<!-- making lists -->
Making Lists
Let's explore another possibility. Let's say you have some lines of text and you want to make a definition list. We'll also add ID and Class values to our tags. We'll use our sample text from above to demonstrate, here is our original text:
CAPUT 1 (blank line) Magnus es, domine, et laudabilis valde: magna virtus tua, et sapientiae tuae non est numerus. et laudare te vult homo, (blank line) (blank line) aliqua (blank line) portio creaturae tuae, et homo circumferens mortalitem suam, circumferens testimonium peccati sui et testimonium, quia superbis
Now we'll change our Preferences settings to the following:

Here is the result (notice how the ID values ended up):
<dl id="dlid" class="dlclass"> (blank line) <dt id="dtid1" class="dtclass">CAPUT 1</dt> <dd id="ddid1" class="ddclass">Magnus es, domine, et laudabilis valde: magna virtus tua, et sapientiae tuae non est numerus. et laudare te vult homo,</dd> (blank line) <dt id="dtid2" class="dtclass">aliqua</dt> <dd id="ddid2" class="ddclass">portio creaturae tuae, et homo circumferens mortalitem suam, circumferens testimonium peccati sui et testimonium, quia superbis</dd> (blank line) </dl>
See how the ID values end up if the same ID is used in Preferences for Tag 1 and Tag 2:
<dl id="dlid" class="dlclass"> (blank line) <dt id="dtid1" class="dtclass">CAPUT 1</dt> <dd id="dtid2" class="ddclass">Magnus es, domine, et laudabilis valde: magna virtus tua, et sapientiae tuae non est numerus. et laudare te vult homo,</dd> (blank line) <dt id="dtid3" class="dtclass">aliqua</dt> <dd id="dtid4" class="ddclass">portio creaturae tuae, et homo circumferens mortalitem suam, circumferens testimonium peccati sui et testimonium, quia superbis</dd> (blank line) </dl>
This same technique can be used for other things such as ordered and unordered lists.
<!-- blank lines in results -->
Blank Lines in Results
By default blank lines are inserted in the plugin results between the lines of text where html tags are inserted. This is done to assist in quickly spotting unexpected results. This can be turned off in Preferences by changing the related setting to No, so that no blank lines are inserted. I personally recommend leaving this feature turned on (set to Yes), at least until you are comfortable with using this plugin.
I found that at times I wasn't consistent with how I used the spacing of blank lines in my code. This resulted in the html tags not being applied as I expected, especially with things like definition lists. And without any break in the resulting code I would miss any "errors" when reviewing the output.
But once I was sure I had things like I wanted them, I didn't like have to deal with all of those blank lines. So I went back and added the option to remove them.
<!-- Convert Char to Entities -->
Convert Char to Entities
When turned On, this option will convert certain characters to their HTML entities. The characters that will be converted are:
' = ' " = " < = < > = > & = &
<!-- Required fields -->
Required Preferences Values
All fields except for ID and Class must have a value. If they are blank when the Preferences window is closed you will be presented with a warning message informing you that key fields were left blank and that the default values will be inserted in those fields.
<!-- resetting to defaults -->
Resetting Default Values
You can restore the default values in Preferences by clicking the Reset button. This will clear all the values in Preferences. This basically has the same affect as manually clearing the fields. And just like manually clearing them, when you close the Preferences window a message will be displayed letting you know that the default values will be applied.
<!-- watch for unexpect results -->
Watch Out For Unexpected Results
Pay special attention to the blank line settings in Preferences and the actual blank lines in your text selection. The number of blank lines separtating the blocks of text in your selection and the Tag 1 Blank Line Settings is critical to this plugin producing the results you want. Also, if Tag 2 is turned On, be sure that you do not accidentally include blank lines before and/or after your text selection. It is easy to end up with something like this:
... <dt>CAPUT 2 </dt> <dd>Et quomodo invocabo deum meum, deum</dd> <dd>et dominum </dd> ...
By default the output is presented in Split View. It is highly recommended that you review the results before putting it in your web page.
<!-- insert results into editor code -->
Insert Results Into Your Html Code
The easiest way to replace your highlighted text (IMHO) is to right-click on Output side of the Split View screen and select "Paste to Editor" from the pop-up menu.
I can't stress it enough...
The critical part to this plugin functioning properly is the settings regarding the number of blank line separating the lines of text. You may need to play around with the settings and the number of actual blank lines separating the lines of text. Once you've established your normal pattern, you shouldn't have to change this specific Preferences setting very often.
I hope this plugin is of value to you and helps you out. And even more so, I hope it returns something useful to the HTML-Kit community that has given so much to me. Have fun!
You can download this plugin on the HTML-Kit web site. Installation instructions, etc. are also provided.