Implemented anchors in ELCode

SVN revision: 1856
This commit is contained in:
Stefan Ritt 2007-04-27 11:04:19 +00:00
parent 0c6bf63c18
commit 2848a9a8be
7 changed files with 19 additions and 3 deletions

View File

@ -163,7 +163,8 @@ For the quality of the information committed to the logbook, you need understand
<p>
<li>in addition to the above URLs, one can enter a tag <b>elog:&lt;id&gt;</b> which references another logbook entry. The tag <b>elog:&lt;logbook&gt;/&lt;id&gt;</b> references a message in another logbook on the same server.
The tag <b>elog:&lt;id&gt;/&lt;n&gt;</b> references attachment number <b>n</b> in a logbook entry. To reference
an attachment in the current message, one uses <b>elog:/&lt;n&gt;</b>.
an attachment in the current message, one uses <b>elog:/&lt;n&gt;</b>. An anchor inside an entry can be referenced
with <b>elog:&lt;id&gt;#&lt;anchor&gt;</b>.
<p>
<li>the Text multi-line field, if present, may be pre-filled with a template if entries need to have a common, consistent format across the logbook (especially for HTML). There may also be a comment inserted before it to explain local rules and conventions, upload rules, etc.
<p>

View File

@ -133,6 +133,16 @@ for example. In order to avoid interpretation of tags, one puts a backslash "\"
in front of the tag, like \[b] instead of [b].<br><br>
</td></tr>
<tr><td bgcolor=#486090><h2>Anchor</h2></td></tr>
<tr><td bgcolor=#FFFFFF><br>An anchor can be put into an entry with
<b>[anchor]</b><i>anchor_name</i><b>[/anchor]</b>. This is equivalent to a HTML anchor like
<b>&lt;a name="</b><i>anchor_name</i><b>"&gt;&lt;/a&gt;</b>.
Such anchors can be referenced inside an entry with
<b>elog:&lt;id&gt;#<i>anchor_name</i></b> where <b>&lt;id&gt;</b> is the ID number of
the entry (the number from the left column in the list display). <br><br>
</td></tr>
<tr><td bgcolor=#486090><h2>Smileys</h2></td></tr>
<tr><td bgcolor=#FFFFFF><br>Smileys, or Emoticons, are small graphical images which can be used to

View File

@ -5770,6 +5770,9 @@ PATTERN_LIST pattern_list[] = {
/* horizontal line */
{"[line]", "<hr />"},
/* anchor */
{"[anchor]", "<a name=\"%#\">"},
{"[/anchor]", "</a>"},
{"", ""}
};
@ -5861,7 +5864,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
if (!isdigit(tmp[m]))
break;
if (m < (int) strlen(tmp)) {
if (m < (int) strlen(tmp) && tmp[m] != '#') {
/* if link contains reference to other logbook, put logbook explicitly */
if (email_notify)
compose_base_url(NULL, base_url, sizeof(base_url));
@ -6050,7 +6053,8 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
/* add http:// if missing */
else if (!strnieq(attrib, "http://", 7) &&
strstr(pattern_list[l].subst, "mailto") == NULL &&
strstr(pattern_list[l].subst, "img") == NULL)
strstr(pattern_list[l].subst, "img") == NULL &&
strncmp(pattern_list[l].subst, "<a", 2) != 0)
sprintf(hattrib, "http://%s", attrib);
strlcpy(subst, pattern_list[l].subst, sizeof(subst));
*strchr(subst, '#') = 's';
@ -10018,6 +10022,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
ricon("table", loc("Insert table"), "elcode(document.form1.Text, 'TABLE','')");
ricon("heading", loc("Insert heading CTRL+H"), "queryHeading(document.form1.Text)");
ricon("line", loc("Insert horizontal line"), "elcode(document.form1.Text, 'LINE','')");
ricon("anchor", loc("Insert anchor point"), "elcode(document.form1.Text, 'ANCHOR','')");
rsprintf(" ");
ricon("code", loc("Insert code CTRL+O"), "elcode(document.form1.Text, 'CODE','')");

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B