summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-09-13 16:56:43 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-13 16:58:49 +0200
commit266fd9bb368bf80b80809b364543d788efc334dd (patch)
tree947f3a44a79de94e12004fcb7fe24b2f5a312538 /src/bin/eolian
parentbc8c432841c50278bca2a7d118fbb3f14a800cab (diff)
eolian: support complex monospace syntax $[...]
This is to allow monospace bits with periods, commas and other non-alphabetical characters. Newlines are not supported (they end the block) and escapes are supported (for ]). Fixes T8213.
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/docs.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c
index 0e0d359..e9af2e8 100644
--- a/src/bin/eolian/docs.c
+++ b/src/bin/eolian/docs.c
@@ -126,7 +126,6 @@ _append_section(const Eolian_State *state, const char *desc, int ind, int curl,
126 Eina_Bool try_note = EINA_TRUE; 126 Eina_Bool try_note = EINA_TRUE;
127 while (*desc) 127 while (*desc)
128 { 128 {
129 eina_strbuf_reset(wbuf);
130 while (*desc && isspace(*desc) && (*desc != '\n')) 129 while (*desc && isspace(*desc) && (*desc != '\n'))
131 eina_strbuf_append_char(wbuf, *desc++); 130 eina_strbuf_append_char(wbuf, *desc++);
132 if (try_note) 131 if (try_note)
@@ -155,6 +154,8 @@ _append_section(const Eolian_State *state, const char *desc, int ind, int curl,
155#undef CHECK_NOTE 154#undef CHECK_NOTE
156 try_note = EINA_FALSE; 155 try_note = EINA_FALSE;
157 } 156 }
157 int limit = DOC_LIMIT(ind);
158 int wlen;
158 if (*desc == '\\') 159 if (*desc == '\\')
159 { 160 {
160 desc++; 161 desc++;
@@ -180,7 +181,47 @@ _append_section(const Eolian_State *state, const char *desc, int ind, int curl,
180 } 181 }
181 else if (*desc == '$') 182 else if (*desc == '$')
182 { 183 {
183 desc++; 184 if (*++desc == '[')
185 {
186 ++desc;
187 eina_strbuf_append(wbuf, "<tt>");
188 wlen = eina_strbuf_length_get(wbuf);
189 while ((*desc != '\0') && (*desc != ']') && (*desc != '\n'))
190 {
191 if (*desc == ' ')
192 {
193 eina_strbuf_append_char(wbuf, ' ');
194 wlen = eina_strbuf_length_get(wbuf);
195 if ((int)(curl + wlen) > limit)
196 {
197 curl = 3;
198 eina_strbuf_append_char(buf, '\n');
199 curl += _indent_line(buf, ind);
200 eina_strbuf_append(buf, " * ");
201 if (*eina_strbuf_string_get(wbuf) == ' ')
202 eina_strbuf_remove(wbuf, 0, 1);
203 }
204 curl += eina_strbuf_length_get(wbuf);
205 eina_strbuf_append(buf, eina_strbuf_string_get(wbuf));
206 eina_strbuf_reset(wbuf);
207 ++desc;
208 continue;
209 }
210 /* skip escape */
211 if (*desc == '\\')
212 {
213 ++desc;
214 if ((*desc == '\0') || (*desc == '\n'))
215 break;
216 }
217 eina_strbuf_append_char(wbuf, *desc++);
218 }
219 if (*desc == ']')
220 ++desc;
221 eina_strbuf_append(wbuf, "</tt>");
222 curl += 5;
223 goto split;
224 }
184 if (isalpha(*desc)) 225 if (isalpha(*desc))
185 eina_strbuf_append(wbuf, "@c "); 226 eina_strbuf_append(wbuf, "@c ");
186 else 227 else
@@ -188,8 +229,8 @@ _append_section(const Eolian_State *state, const char *desc, int ind, int curl,
188 } 229 }
189 while (*desc && !isspace(*desc)) 230 while (*desc && !isspace(*desc))
190 eina_strbuf_append_char(wbuf, *desc++); 231 eina_strbuf_append_char(wbuf, *desc++);
191 int limit = DOC_LIMIT(ind); 232split:
192 int wlen = eina_strbuf_length_get(wbuf); 233 wlen = eina_strbuf_length_get(wbuf);
193 if ((int)(curl + wlen) > limit) 234 if ((int)(curl + wlen) > limit)
194 { 235 {
195 curl = 3; 236 curl = 3;
@@ -201,6 +242,7 @@ _append_section(const Eolian_State *state, const char *desc, int ind, int curl,
201 } 242 }
202 curl += eina_strbuf_length_get(wbuf); 243 curl += eina_strbuf_length_get(wbuf);
203 eina_strbuf_append(buf, eina_strbuf_string_get(wbuf)); 244 eina_strbuf_append(buf, eina_strbuf_string_get(wbuf));
245 eina_strbuf_reset(wbuf);
204 if (*desc == '\n') 246 if (*desc == '\n')
205 { 247 {
206 desc++; 248 desc++;