Mercurial > pidgin
annotate libpurple/protocols/myspace/markup.c @ 19435:bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
pieces of code into their proper modules. Now myspace.c isn't so unwieldy.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Sun, 26 Aug 2007 07:37:28 +0000 |
parents | 1e00b684c46f |
children | 11c727b19201 |
rev | line source |
---|---|
19434
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
1 /* MySpaceIM Protocol Plugin - markup |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
2 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
3 * Copyright (C) 2007, Jeff Connelly <jeff2@soc.pidgin.im> |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
4 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
8 * (at your option) any later version. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
9 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
13 * GNU General Public License for more details. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
14 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
16 * along with this program; if not, write to the Free Software |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
18 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
19 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
20 #include "myspace.h" |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
21 |
19435
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
22 typedef void (*MSIM_XMLNODE_CONVERT)(MsimSession *, xmlnode *, gchar **, gchar **); |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
23 |
19434
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
24 /* Internal functions */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
25 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
26 static guint msim_point_to_purple_size(MsimSession *session, guint point); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
27 static guint msim_purple_size_to_point(MsimSession *session, guint size); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
28 static guint msim_height_to_point(MsimSession *session, guint height); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
29 static guint msim_point_to_height(MsimSession *session, guint point); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
30 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
31 static void msim_markup_tag_to_html(MsimSession *, xmlnode *root, gchar **begin, gchar **end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
32 static void html_tag_to_msim_markup(MsimSession *, xmlnode *root, gchar **begin, gchar **end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
33 static gchar *msim_convert_xml(MsimSession *, const gchar *raw, MSIM_XMLNODE_CONVERT f); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
34 static gchar *msim_convert_smileys_to_markup(gchar *before); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
35 static double msim_round(double round); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
36 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
37 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
38 /* Globals */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
39 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
40 /* The names in in emoticon_names (for <i n=whatever>) map to corresponding |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
41 * entries in emoticon_symbols (for the ASCII representation of the emoticon). |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
42 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
43 * Multiple emoticon symbols in Pidgin can map to one name. List the |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
44 * canonical form, as inserted by the "Smile!" dialog, first. For example, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
45 * :) comes before :-), because although both are recognized as 'happy', |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
46 * the first is inserted by the smiley button (first symbol in theme). |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
47 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
48 * Note that symbols are case-sensitive in Pidgin -- :-X is not :-x. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
49 static struct MSIM_EMOTICON |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
50 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
51 gchar *name; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
52 gchar *symbol; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
53 } msim_emoticons[] = { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
54 /* Unfortunately, this list duplicates much of the file |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
55 * pidgin/pidgin/pixmaps/emotes/default/22/default.theme.in, because |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
56 * that file is part of Pidgin, but we're part of libpurple. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
57 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
58 { "bigsmile", ":D" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
59 { "bigsmile", ":-D" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
60 { "devil", "}:)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
61 { "frazzled", ":Z" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
62 { "geek", "B)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
63 { "googles", "%)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
64 { "growl", ":E" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
65 { "laugh", ":))" }, /* Must be before ':)' */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
66 { "happy", ":)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
67 { "happy", ":-)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
68 { "happi", ":)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
69 { "heart", ":X" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
70 { "mohawk", "-:" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
71 { "mad", "X(" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
72 { "messed", "X)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
73 { "nerd", "Q)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
74 { "oops", ":G" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
75 { "pirate", "P)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
76 { "scared", ":O" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
77 { "sidefrown", ":{" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
78 { "sinister", ":B" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
79 { "smirk", ":," }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
80 { "straight", ":|" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
81 { "tongue", ":P" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
82 { "tongue", ":p" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
83 { "tongy", ":P" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
84 { "upset", "B|" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
85 { "wink", ";-)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
86 { "wink", ";)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
87 { "winc", ";)" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
88 { "worried", ":[" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
89 { "kiss", ":x" }, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
90 { NULL, NULL } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
91 }; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
92 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
93 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
94 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
95 /* Indexes of this array + 1 map HTML font size to scale of normal font size. * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
96 * Based on _point_sizes from libpurple/gtkimhtml.c |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
97 * 1 2 3 4 5 6 7 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
98 static gdouble _font_scale[] = { .85, .95, 1, 1.2, 1.44, 1.728, 2.0736 }; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
99 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
100 #define MAX_FONT_SIZE 7 /* Purple maximum font size */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
101 #define POINTS_PER_INCH 72 /* How many pt's in an inch */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
102 |
19435
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
103 /* Text formatting bits for <f s=#> */ |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
104 #define MSIM_TEXT_BOLD 1 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
105 #define MSIM_TEXT_ITALIC 2 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
106 #define MSIM_TEXT_UNDERLINE 4 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
107 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
108 /* Default baseline size of purple's fonts, in points. What is size 3 in points. |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
109 * _font_scale specifies scaling factor relative to this point size. Note this |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
110 * is only the default; it is configurable in account options. */ |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
111 #define MSIM_BASE_FONT_POINT_SIZE 8 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
112 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
113 /* Default display's DPI. 96 is common but it can differ. Also configurable |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
114 * in account options. */ |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
115 #define MSIM_DEFAULT_DPI 96 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
116 |
bddc6a6fddf0
In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
19434
diff
changeset
|
117 |
19434
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
118 /* round is part of C99, but sometimes is unavailable before then. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
119 * Based on http://forums.belution.com/en/cpp/000/050/13.shtml |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
120 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
121 double msim_round(double value) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
122 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
123 if (value < 0) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
124 return -(floor(-value + 0.5)); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
125 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
126 return floor( value + 0.5); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
127 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
128 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
129 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
130 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
131 /** Convert typographical font point size to HTML font size. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
132 * Based on libpurple/gtkimhtml.c */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
133 static guint |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
134 msim_point_to_purple_size(MsimSession *session, guint point) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
135 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
136 guint size, this_point, base; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
137 gdouble scale; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
138 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
139 base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
140 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
141 for (size = 0; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
142 size < sizeof(_font_scale) / sizeof(_font_scale[0]); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
143 ++size) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
144 scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1]; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
145 this_point = (guint)msim_round(scale * base); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
146 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
147 if (this_point >= point) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
148 purple_debug_info("msim", "msim_point_to_purple_size: %d pt -> size=%d\n", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
149 point, size); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
150 return size; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
151 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
152 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
153 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
154 /* No HTML font size was this big; return largest possible. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
155 return this_point; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
156 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
157 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
158 /** Convert HTML font size to point size. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
159 static guint |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
160 msim_purple_size_to_point(MsimSession *session, guint size) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
161 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
162 gdouble scale; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
163 guint point; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
164 guint base; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
165 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
166 scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1]; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
167 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
168 base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
169 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
170 point = (guint)msim_round(scale * base); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
171 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
172 purple_debug_info("msim", "msim_purple_size_to_point: size=%d -> %d pt\n", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
173 size, point); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
174 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
175 return point; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
176 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
177 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
178 /** Convert a msim markup font pixel height to the more usual point size, for incoming messages. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
179 static guint |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
180 msim_height_to_point(MsimSession *session, guint height) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
181 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
182 guint dpi; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
183 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
184 dpi = purple_account_get_int(session->account, "port", MSIM_DEFAULT_DPI); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
185 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
186 return (guint)msim_round((POINTS_PER_INCH * 1. / dpi) * height); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
187 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
188 /* See also: libpurple/protocols/bonjour/jabber.c |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
189 * _font_size_ichat_to_purple */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
190 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
191 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
192 /** Convert point size to msim pixel height font size specification, for outgoing messages. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
193 static guint |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
194 msim_point_to_height(MsimSession *session, guint point) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
195 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
196 guint dpi; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
197 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
198 dpi = purple_account_get_int(session->account, "port", MSIM_DEFAULT_DPI); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
199 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
200 return (guint)msim_round((dpi * 1. / POINTS_PER_INCH) * point); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
201 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
202 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
203 /** Convert the msim markup <f> (font) tag into HTML. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
204 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
205 msim_markup_f_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
206 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
207 const gchar *face, *height_str, *decor_str; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
208 GString *gs_end, *gs_begin; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
209 guint decor, height; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
210 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
211 face = xmlnode_get_attrib(root, "f"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
212 height_str = xmlnode_get_attrib(root, "h"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
213 decor_str = xmlnode_get_attrib(root, "s"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
214 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
215 if (height_str) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
216 height = atol(height_str); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
217 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
218 height = 12; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
219 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
220 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
221 if (decor_str) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
222 decor = atol(decor_str); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
223 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
224 decor = 0; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
225 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
226 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
227 gs_begin = g_string_new(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
228 /* TODO: get font size working */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
229 if (height && !face) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
230 g_string_printf(gs_begin, "<font size='%d'>", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
231 msim_point_to_purple_size(session, msim_height_to_point(session, height))); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
232 } else if (height && face) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
233 g_string_printf(gs_begin, "<font face='%s' size='%d'>", face, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
234 msim_point_to_purple_size(session, msim_height_to_point(session, height))); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
235 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
236 g_string_printf(gs_begin, "<font>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
237 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
238 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
239 /* No support for font-size CSS? */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
240 /* g_string_printf(gs_begin, "<span style='font-family: %s; font-size: %dpt'>", face, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
241 msim_height_to_point(height)); */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
242 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
243 gs_end = g_string_new("</font>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
244 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
245 if (decor & MSIM_TEXT_BOLD) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
246 g_string_append(gs_begin, "<b>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
247 g_string_prepend(gs_end, "</b>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
248 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
249 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
250 if (decor & MSIM_TEXT_ITALIC) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
251 g_string_append(gs_begin, "<i>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
252 g_string_append(gs_end, "</i>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
253 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
254 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
255 if (decor & MSIM_TEXT_UNDERLINE) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
256 g_string_append(gs_begin, "<u>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
257 g_string_append(gs_end, "</u>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
258 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
259 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
260 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
261 *begin = gs_begin->str; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
262 *end = gs_end->str; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
263 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
264 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
265 /** Convert a msim markup color to a color suitable for libpurple. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
266 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
267 * @param msim Either a color name, or an rgb(x,y,z) code. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
268 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
269 * @return A new string, either a color name or #rrggbb code. Must g_free(). |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
270 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
271 static char * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
272 msim_color_to_purple(const char *msim) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
273 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
274 guint red, green, blue; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
275 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
276 if (!msim) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
277 return g_strdup("black"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
278 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
279 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
280 if (sscanf(msim, "rgb(%d,%d,%d)", &red, &green, &blue) != 3) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
281 /* Color name. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
282 return g_strdup(msim); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
283 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
284 /* TODO: rgba (alpha). */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
285 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
286 return g_strdup_printf("#%.2x%.2x%.2x", red, green, blue); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
287 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
288 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
289 /** Convert the msim markup <a> (anchor) tag into HTML. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
290 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
291 msim_markup_a_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
292 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
293 const gchar *href; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
294 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
295 href = xmlnode_get_attrib(root, "h"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
296 if (!href) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
297 href = ""; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
298 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
299 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
300 *begin = g_strdup_printf("<a href=\"%s\">%s", href, href); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
301 *end = g_strdup("</a>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
302 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
303 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
304 /** Convert the msim markup <p> (paragraph) tag into HTML. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
305 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
306 msim_markup_p_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
307 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
308 /* Just pass through unchanged. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
309 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
310 * Note: attributes currently aren't passed, if there are any. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
311 *begin = g_strdup("<p>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
312 *end = g_strdup("</p>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
313 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
314 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
315 /** Convert the msim markup <c> tag (text color) into HTML. TODO: Test */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
316 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
317 msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
318 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
319 const gchar *color; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
320 gchar *purple_color; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
321 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
322 color = xmlnode_get_attrib(root, "v"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
323 if (!color) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
324 purple_debug_info("msim", "msim_markup_c_to_html: <c> tag w/o v attr"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
325 *begin = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
326 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
327 /* TODO: log as unrecognized */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
328 return; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
329 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
330 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
331 purple_color = msim_color_to_purple(color); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
332 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
333 *begin = g_strdup_printf("<font color='%s'>", purple_color); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
334 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
335 g_free(purple_color); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
336 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
337 /* *begin = g_strdup_printf("<span style='color: %s'>", color); */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
338 *end = g_strdup("</font>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
339 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
340 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
341 /** Convert the msim markup <b> tag (background color) into HTML. TODO: Test */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
342 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
343 msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
344 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
345 const gchar *color; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
346 gchar *purple_color; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
347 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
348 color = xmlnode_get_attrib(root, "v"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
349 if (!color) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
350 *begin = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
351 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
352 purple_debug_info("msim", "msim_markup_b_to_html: <b> w/o v attr"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
353 /* TODO: log as unrecognized. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
354 return; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
355 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
356 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
357 purple_color = msim_color_to_purple(color); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
358 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
359 /* TODO: find out how to set background color. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
360 *begin = g_strdup_printf("<span style='background-color: %s'>", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
361 purple_color); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
362 g_free(purple_color); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
363 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
364 *end = g_strdup("</p>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
365 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
366 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
367 /** Convert the msim markup <i> tag (emoticon image) into HTML. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
368 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
369 msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
370 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
371 const gchar *name; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
372 guint i; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
373 struct MSIM_EMOTICON *emote; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
374 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
375 name = xmlnode_get_attrib(root, "n"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
376 if (!name) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
377 purple_debug_info("msim", "msim_markup_i_to_html: <i> w/o n"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
378 *begin = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
379 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
380 /* TODO: log as unrecognized */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
381 return; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
382 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
383 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
384 /* Find and use canonical form of smiley symbol. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
385 for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
386 if (g_str_equal(name, emote->name)) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
387 *begin = g_strdup(emote->symbol); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
388 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
389 return; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
390 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
391 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
392 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
393 /* Couldn't find it, sorry. Try to degrade gracefully. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
394 *begin = g_strdup_printf("**%s**", name); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
395 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
396 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
397 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
398 /** Convert an individual msim markup tag to HTML. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
399 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
400 msim_markup_tag_to_html(MsimSession *session, xmlnode *root, gchar **begin, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
401 gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
402 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
403 if (g_str_equal(root->name, "f")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
404 msim_markup_f_to_html(session, root, begin, end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
405 } else if (g_str_equal(root->name, "a")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
406 msim_markup_a_to_html(session, root, begin, end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
407 } else if (g_str_equal(root->name, "p")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
408 msim_markup_p_to_html(session, root, begin, end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
409 } else if (g_str_equal(root->name, "c")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
410 msim_markup_c_to_html(session, root, begin, end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
411 } else if (g_str_equal(root->name, "b")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
412 msim_markup_b_to_html(session, root, begin, end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
413 } else if (g_str_equal(root->name, "i")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
414 msim_markup_i_to_html(session, root, begin, end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
415 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
416 purple_debug_info("msim", "msim_markup_tag_to_html: " |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
417 "unknown tag name=%s, ignoring", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
418 (root && root->name) ? root->name : "(NULL)"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
419 *begin = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
420 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
421 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
422 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
423 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
424 /** Convert an individual HTML tag to msim markup. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
425 static void |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
426 html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
427 gchar **end) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
428 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
429 /* TODO: Coalesce nested tags into one <f> tag! |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
430 * Currently, the 's' value will be overwritten when b/i/u is nested |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
431 * within another one, and only the inner-most formatting will be |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
432 * applied to the text. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
433 if (!purple_utf8_strcasecmp(root->name, "root")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
434 *begin = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
435 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
436 } else if (!purple_utf8_strcasecmp(root->name, "b")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
437 *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_BOLD); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
438 *end = g_strdup("</f>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
439 } else if (!purple_utf8_strcasecmp(root->name, "i")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
440 *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_ITALIC); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
441 *end = g_strdup("</f>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
442 } else if (!purple_utf8_strcasecmp(root->name, "u")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
443 *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_UNDERLINE); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
444 *end = g_strdup("</f>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
445 } else if (!purple_utf8_strcasecmp(root->name, "a")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
446 const gchar *href, *link_text; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
447 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
448 href = xmlnode_get_attrib(root, "href"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
449 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
450 if (!href) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
451 href = xmlnode_get_attrib(root, "HREF"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
452 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
453 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
454 link_text = xmlnode_get_data(root); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
455 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
456 if (href) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
457 if (g_str_equal(link_text, href)) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
458 /* Purple gives us: <a href="URL">URL</a> |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
459 * Translate to <a h='URL' /> |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
460 * Displayed as text of URL with link to URL |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
461 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
462 *begin = g_strdup_printf("<a h='%s' />", href); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
463 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
464 /* But if we get: <a href="URL">text</a> |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
465 * Translate to: text: <a h='URL' /> |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
466 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
467 * Because official client only supports self-closed <a> |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
468 * tags; you can't change the link text. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
469 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
470 *begin = g_strdup_printf("%s: <a h='%s' />", link_text, href); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
471 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
472 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
473 *begin = g_strdup("<a />"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
474 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
475 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
476 /* Sorry, kid. MySpace doesn't support you within <a> tags. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
477 xmlnode_free(root->child); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
478 root->child = NULL; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
479 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
480 *end = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
481 } else if (!purple_utf8_strcasecmp(root->name, "font")) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
482 const gchar *size; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
483 const gchar *face; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
484 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
485 size = xmlnode_get_attrib(root, "size"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
486 face = xmlnode_get_attrib(root, "face"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
487 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
488 if (face && size) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
489 *begin = g_strdup_printf("<f f='%s' h='%d'>", face, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
490 msim_point_to_height(session, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
491 msim_purple_size_to_point(session, atoi(size)))); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
492 } else if (face) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
493 *begin = g_strdup_printf("<f f='%s'>", face); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
494 } else if (size) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
495 *begin = g_strdup_printf("<f h='%d'>", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
496 msim_point_to_height(session, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
497 msim_purple_size_to_point(session, atoi(size)))); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
498 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
499 *begin = g_strdup("<f>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
500 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
501 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
502 *end = g_strdup("</f>"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
503 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
504 /* TODO: color (bg uses <body>), emoticons */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
505 } else { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
506 *begin = g_strdup_printf("[%s]", root->name); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
507 *end = g_strdup_printf("[/%s]", root->name); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
508 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
509 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
510 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
511 /** Convert an xmlnode of msim markup or HTML to an HTML string or msim markup. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
512 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
513 * @param f Function to convert tags. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
514 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
515 * @return An HTML string. Caller frees. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
516 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
517 static gchar * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
518 msim_convert_xmlnode(MsimSession *session, xmlnode *root, MSIM_XMLNODE_CONVERT f) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
519 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
520 xmlnode *node; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
521 gchar *begin, *inner, *end; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
522 GString *final; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
523 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
524 if (!root || !root->name) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
525 return g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
526 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
527 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
528 purple_debug_info("msim", "msim_convert_xmlnode: got root=%s\n", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
529 root->name); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
530 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
531 begin = inner = end = NULL; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
532 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
533 final = g_string_new(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
534 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
535 f(session, root, &begin, &end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
536 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
537 g_string_append(final, begin); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
538 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
539 /* Loop over all child nodes. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
540 for (node = root->child; node != NULL; node = node->next) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
541 switch (node->type) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
542 case XMLNODE_TYPE_ATTRIB: |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
543 /* Attributes handled above. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
544 break; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
545 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
546 case XMLNODE_TYPE_TAG: |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
547 /* A tag or tag with attributes. Recursively descend. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
548 inner = msim_convert_xmlnode(session, node, f); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
549 g_return_val_if_fail(inner != NULL, NULL); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
550 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
551 purple_debug_info("msim", " ** node name=%s\n", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
552 (node && node->name) ? node->name : "(NULL)"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
553 break; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
554 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
555 case XMLNODE_TYPE_DATA: |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
556 /* Literal text. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
557 inner = g_new0(char, node->data_sz + 1); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
558 strncpy(inner, node->data, node->data_sz); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
559 inner[node->data_sz] = 0; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
560 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
561 purple_debug_info("msim", " ** node data=%s\n", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
562 inner ? inner : "(NULL)"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
563 break; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
564 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
565 default: |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
566 purple_debug_info("msim", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
567 "msim_convert_xmlnode: strange node\n"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
568 inner = g_strdup(""); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
569 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
570 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
571 if (inner) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
572 g_string_append(final, inner); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
573 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
574 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
575 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
576 /* TODO: Note that msim counts each piece of text enclosed by <f> as |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
577 * a paragraph and will display each on its own line. You actually have |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
578 * to _nest_ <f> tags to intersperse different text in one paragraph! |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
579 * Comment out this line below to see. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
580 g_string_append(final, end); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
581 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
582 purple_debug_info("msim", "msim_markup_xmlnode_to_gtkhtml: RETURNING %s\n", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
583 (final && final->str) ? final->str : "(NULL)"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
584 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
585 return final->str; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
586 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
587 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
588 /** Convert XML to something based on MSIM_XMLNODE_CONVERT. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
589 static gchar * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
590 msim_convert_xml(MsimSession *session, const gchar *raw, MSIM_XMLNODE_CONVERT f) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
591 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
592 xmlnode *root; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
593 gchar *str; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
594 gchar *enclosed_raw; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
595 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
596 g_return_val_if_fail(raw != NULL, NULL); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
597 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
598 /* Enclose text in one root tag, to try to make it valid XML for parsing. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
599 enclosed_raw = g_strconcat("<root>", raw, "</root>", NULL); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
600 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
601 root = xmlnode_from_str(enclosed_raw, -1); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
602 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
603 if (!root) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
604 purple_debug_info("msim", "msim_markup_to_html: couldn't parse " |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
605 "%s as XML, returning raw: %s\n", enclosed_raw, raw); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
606 /* TODO: msim_unrecognized */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
607 g_free(enclosed_raw); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
608 return g_strdup(raw); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
609 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
610 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
611 g_free(enclosed_raw); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
612 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
613 str = msim_convert_xmlnode(session, root, f); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
614 g_return_val_if_fail(str != NULL, NULL); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
615 purple_debug_info("msim", "msim_markup_to_html: returning %s\n", str); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
616 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
617 xmlnode_free(root); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
618 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
619 return str; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
620 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
621 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
622 /** Convert plaintext smileys to <i> markup tags. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
623 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
624 * @param before Original text with ASCII smileys. Will be freed. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
625 * @return A new string with <i> tags, if applicable. Must be g_free()'d. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
626 */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
627 static gchar * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
628 msim_convert_smileys_to_markup(gchar *before) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
629 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
630 gchar *old, *new, *replacement; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
631 guint i; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
632 struct MSIM_EMOTICON *emote; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
633 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
634 old = before; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
635 new = NULL; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
636 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
637 for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
638 gchar *name, *symbol; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
639 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
640 name = emote->name; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
641 symbol = emote->symbol; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
642 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
643 replacement = g_strdup_printf("<i n=\"%s\"/>", name); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
644 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
645 purple_debug_info("msim", "msim_convert_smileys_to_markup: %s->%s\n", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
646 symbol ? symbol : "(NULL)", |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
647 replacement ? replacement : "(NULL)"); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
648 new = str_replace(old, symbol, replacement); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
649 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
650 g_free(replacement); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
651 g_free(old); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
652 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
653 old = new; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
654 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
655 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
656 return new; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
657 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
658 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
659 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
660 /** High-level function to convert MySpaceIM markup to Purple (HTML) markup. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
661 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
662 * @return Purple markup string, must be g_free()'d. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
663 gchar * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
664 msim_markup_to_html(MsimSession *session, const gchar *raw) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
665 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
666 return msim_convert_xml(session, raw, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
667 (MSIM_XMLNODE_CONVERT)(msim_markup_tag_to_html)); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
668 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
669 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
670 /** High-level function to convert Purple (HTML) to MySpaceIM markup. |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
671 * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
672 * @return HTML markup string, must be g_free()'d. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
673 gchar * |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
674 html_to_msim_markup(MsimSession *session, const gchar *raw) |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
675 { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
676 gchar *markup; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
677 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
678 markup = msim_convert_xml(session, raw, |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
679 (MSIM_XMLNODE_CONVERT)(html_tag_to_msim_markup)); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
680 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
681 if (purple_account_get_bool(session->account, "emoticons", TRUE)) { |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
682 /* Frees markup and allocates a new one. */ |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
683 markup = msim_convert_smileys_to_markup(markup); |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
684 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
685 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
686 return markup; |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
687 } |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
688 |
1e00b684c46f
In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
689 |