mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Implemented simple tables
SVN revision: 1801
This commit is contained in:
parent
5979d3c9b5
commit
f99410d04f
@ -252,6 +252,46 @@ to produce<p>
|
|||||||
Other possibilities are <b>[list=A]</b> for capital letters and <b>[list=I]</b> for Roman numbering.<p>
|
Other possibilities are <b>[list=A]</b> for capital letters and <b>[list=I]</b> for Roman numbering.<p>
|
||||||
|
|
||||||
|
|
||||||
|
<tr><td bgcolor=#486090><h2>Tables</h2></td></tr>
|
||||||
|
|
||||||
|
<tr><td bgcolor=#FFFFFF><br>Tables can be created with the tags <b>[table][/table]</b> like<p>
|
||||||
|
|
||||||
|
<b>[table border="1"]</b><br>
|
||||||
|
One<b>|</b>Two<br>
|
||||||
|
<b>|-</b><br>
|
||||||
|
Three<b>|</b>Four<br>
|
||||||
|
<b>[/table]</b>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
to produce<p>
|
||||||
|
|
||||||
|
<table border="1">
|
||||||
|
<tr><td>One</td><td>Two</td></tr>
|
||||||
|
<tr><td>Three</td><td>Four</td></tr>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
The parameters after <b>[table ...]</b> are directly used in the HTML <table>
|
||||||
|
tag. To increase the cell padding, on can add for example<p>
|
||||||
|
|
||||||
|
<b>[table border="1" cellpadding="20"]</b><br>
|
||||||
|
One<b>|</b>Two<br>
|
||||||
|
<b>|-</b><br>
|
||||||
|
Three<b>|</b>Four<br>
|
||||||
|
<b>[/table]</b>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
to produce<p>
|
||||||
|
|
||||||
|
<table border="1" cellpadding="20">
|
||||||
|
<tr><td>One</td><td>Two</td></tr>
|
||||||
|
<tr><td>Three</td><td>Four</td></tr>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
Table headings are not supported, but can be simulated by embedding the cell
|
||||||
|
contents with a <b>[B]...[/B]</b> tag.<p>
|
||||||
|
|
||||||
<tr><td bgcolor=#486090><h2>Creating links</h2></td></tr>
|
<tr><td bgcolor=#486090><h2>Creating links</h2></td></tr>
|
||||||
|
|
||||||
<tr><td bgcolor=#FFFFFF><br>Hyperlinks or Uniform Resouce Locators (URLs) can be created in various ways:<p>
|
<tr><td bgcolor=#FFFFFF><br>Hyperlinks or Uniform Resouce Locators (URLs) can be created in various ways:<p>
|
||||||
|
|||||||
@ -57,6 +57,8 @@ function elcode1(text, tag, value, selection)
|
|||||||
str = selection + value;
|
str = selection + value;
|
||||||
else if (tag == 'LIST')
|
else if (tag == 'LIST')
|
||||||
str = '[LIST]\r\n[*] ' + selection + '\r\n[/LIST]';
|
str = '[LIST]\r\n[*] ' + selection + '\r\n[/LIST]';
|
||||||
|
else if (tag == 'TABLE')
|
||||||
|
str = '[TABLE border="1"]\r\nA|B\r\n|-\r\nC|D\r\n[/TABLE]';
|
||||||
else if (value == '')
|
else if (value == '')
|
||||||
str = '['+tag+']' + selection + '[/'+tag+']';
|
str = '['+tag+']' + selection + '[/'+tag+']';
|
||||||
else
|
else
|
||||||
|
|||||||
28
src/elogd.c
28
src/elogd.c
@ -5706,6 +5706,13 @@ PATTERN_LIST pattern_list[] = {
|
|||||||
{"[/quote]\r", "</td></tr></table><br />\r\n"},
|
{"[/quote]\r", "</td></tr></table><br />\r\n"},
|
||||||
{"[/quote]", "</td></tr></table>\r\n"},
|
{"[/quote]", "</td></tr></table>\r\n"},
|
||||||
|
|
||||||
|
/* table */
|
||||||
|
{"[table]", "<table><tr><td>"},
|
||||||
|
{"[table ", "<table %s><tr><td>"},
|
||||||
|
{"|-", "</td></tr><tr><td>"},
|
||||||
|
{"|", "</td><td>"},
|
||||||
|
{"[/table]", "</td></tr></table>"},
|
||||||
|
|
||||||
{"", ""}
|
{"", ""}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -5714,7 +5721,8 @@ char *email_quote_table =
|
|||||||
|
|
||||||
void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
||||||
{
|
{
|
||||||
int i, j, k, l, m, elcode_disabled, elcode_disabled1, escape_char, ordered_list, substituted;
|
int i, j, k, l, m, elcode_disabled, elcode_disabled1, escape_char, ordered_list, substituted,
|
||||||
|
inside_table;
|
||||||
char *p, *pd, link[1000], link_text[1000], tmp[1000], attrib[1000], hattrib[1000],
|
char *p, *pd, link[1000], link_text[1000], tmp[1000], attrib[1000], hattrib[1000],
|
||||||
value[1000], subst[1000], base_url[256], param[256], *lstr;
|
value[1000], subst[1000], base_url[256], param[256], *lstr;
|
||||||
|
|
||||||
@ -5728,6 +5736,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
|||||||
elcode_disabled1 = FALSE;
|
elcode_disabled1 = FALSE;
|
||||||
ordered_list = FALSE;
|
ordered_list = FALSE;
|
||||||
escape_char = FALSE;
|
escape_char = FALSE;
|
||||||
|
inside_table = 0;
|
||||||
j = strlen_retbuf;
|
j = strlen_retbuf;
|
||||||
m = 0;
|
m = 0;
|
||||||
|
|
||||||
@ -5874,6 +5883,11 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
|||||||
if (stristr(pattern_list[l].pattern, "[list="))
|
if (stristr(pattern_list[l].pattern, "[list="))
|
||||||
ordered_list = TRUE;
|
ordered_list = TRUE;
|
||||||
|
|
||||||
|
if (stristr(pattern_list[l].pattern, "[table"))
|
||||||
|
inside_table++;
|
||||||
|
if (stristr(pattern_list[l].pattern, "[/table]"))
|
||||||
|
inside_table--;
|
||||||
|
|
||||||
if (stristr(pattern_list[l].pattern, "[quote")) {
|
if (stristr(pattern_list[l].pattern, "[quote")) {
|
||||||
if (pattern_list[l].pattern[strlen(pattern_list[l].pattern) - 1] == '=') {
|
if (pattern_list[l].pattern[strlen(pattern_list[l].pattern) - 1] == '=') {
|
||||||
i += strlen(pattern_list[l].pattern);
|
i += strlen(pattern_list[l].pattern);
|
||||||
@ -5997,6 +6011,15 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
|||||||
sprintf(return_buffer + j, pattern_list[l].subst, attrib);
|
sprintf(return_buffer + j, pattern_list[l].subst, attrib);
|
||||||
j += strlen(return_buffer + j);
|
j += strlen(return_buffer + j);
|
||||||
|
|
||||||
|
} else if (pattern_list[l].pattern[strlen(pattern_list[l].pattern) - 1] == ' ') {
|
||||||
|
|
||||||
|
/* extract sting after ' ' and put it into '%s' of subst */
|
||||||
|
i += strlen(pattern_list[l].pattern);
|
||||||
|
strextract(str + i, ']', attrib, sizeof(attrib));
|
||||||
|
i += strlen(attrib);
|
||||||
|
sprintf(return_buffer + j, pattern_list[l].subst, attrib);
|
||||||
|
j += strlen(return_buffer + j);
|
||||||
|
|
||||||
} else if (strncmp(pattern_list[l].pattern, "[/list]", 7) == 0) {
|
} else if (strncmp(pattern_list[l].pattern, "[/list]", 7) == 0) {
|
||||||
|
|
||||||
if (ordered_list)
|
if (ordered_list)
|
||||||
@ -6067,7 +6090,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
|
|||||||
} else
|
} else
|
||||||
switch (str[i]) {
|
switch (str[i]) {
|
||||||
case '\r':
|
case '\r':
|
||||||
if (!elcode_disabled && !elcode_disabled1) {
|
if (!elcode_disabled && !elcode_disabled1 && !inside_table) {
|
||||||
strcat(return_buffer, "<br />\r\n");
|
strcat(return_buffer, "<br />\r\n");
|
||||||
j += 8;
|
j += 8;
|
||||||
} else {
|
} else {
|
||||||
@ -9840,6 +9863,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
rsprintf(" ");
|
rsprintf(" ");
|
||||||
ricon("quote", loc("insert quote"), "elcode(document.form1.Text, 'QUOTE','')");
|
ricon("quote", loc("insert quote"), "elcode(document.form1.Text, 'QUOTE','')");
|
||||||
ricon("list", loc("insert list"), "elcode(document.form1.Text, 'LIST','')");
|
ricon("list", loc("insert list"), "elcode(document.form1.Text, 'LIST','')");
|
||||||
|
ricon("table", loc("insert table"), "elcode(document.form1.Text, 'TABLE','')");
|
||||||
ricon("heading", loc("insert heading"), "queryHeading(document.form1.Text)");
|
ricon("heading", loc("insert heading"), "queryHeading(document.form1.Text)");
|
||||||
|
|
||||||
rsprintf(" ");
|
rsprintf(" ");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user