#include <assert.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "markup.h"
#include "log.h"
#include "settings.h"
#include "utils.h"
Go to the source code of this file.
|
| static char * | markup_quote (char *str) |
| | Convert all HTML special symbols to HTML entities.
|
| |
| static char * | markup_unquote (char *str) |
| | Convert all HTML special entities to their actual char.
|
| |
| static char * | markup_br2nl (char *str) |
| | Convert all HTML linebreak tags to a newline character.
|
| |
| void | markup_strip_a (char **str, char **urls) |
| | Remove HTML hyperlinks of a string.
|
| |
| void | markup_strip_img (char **str, char **urls) |
| | Remove img-tags of a string.
|
| |
| char * | markup_strip (char *str) |
| | Strip any markup from text; turn it in to plain text.
|
| |
| static bool | markup_is_entity (const char *str) |
| | Determine if an & character pointed to by str is a markup & entity or part of the text.
|
| |
| static char * | markup_escape_unsupported (char *str) |
| | Escape all unsupported and invalid &-entities in a string.
|
| |
| char * | markup_transform (char *str, enum markup_mode markup_mode) |
| | Transform the string in accordance with markup_mode and settings.ignore_newline
|
| |
- Copyright
- Copyright 2013-2014 Sascha Kruse
-
Copyright 2014-2026 Dunst contributors
- License
- BSD-3-Clause
Definition in file markup.c.
◆ markup_br2nl()
| static char * markup_br2nl |
( |
char * | str | ) |
|
|
static |
Convert all HTML linebreak tags to a newline character.
- Parameters
-
Definition at line 58 of file markup.c.
◆ markup_escape_unsupported()
| static char * markup_escape_unsupported |
( |
char * | str | ) |
|
|
static |
Escape all unsupported and invalid &-entities in a string.
If the resulting string does not fit it will be reallocated.
- Parameters
-
| str | The string to be transformed |
Definition at line 298 of file markup.c.
◆ markup_is_entity()
| static bool markup_is_entity |
( |
const char * | str | ) |
|
|
static |
Determine if an & character pointed to by str is a markup & entity or part of the text.
- Return values
-
| true | if str is an entity |
| false | otherwise |
Definition at line 250 of file markup.c.
◆ markup_quote()
| static char * markup_quote |
( |
char * | str | ) |
|
|
static |
Convert all HTML special symbols to HTML entities.
- Parameters
-
Definition at line 24 of file markup.c.
◆ markup_strip()
| char * markup_strip |
( |
char * | str | ) |
|
Strip any markup from text; turn it in to plain text.
For well-formed markup, the following two commands should be roughly equivalent:
out = markup_strip(in);
pango_parse_markup(in, -1, 0, NULL, &out, NULL, NULL);
However, pango_parse_markup() balks at invalid markup; markup_strip() shouldn't care if there is invalid markup.
Definition at line 230 of file markup.c.
◆ markup_strip_a()
| void markup_strip_a |
( |
char ** | str, |
|
|
char ** | urls ) |
Remove HTML hyperlinks of a string.
- Parameters
-
| str | The string to replace a tags |
| urls | (nullable) If any href-attributes found, an \n concatenated string of the URLs in format [<text between tags>] <href> |
Definition at line 69 of file markup.c.
◆ markup_strip_img()
| void markup_strip_img |
( |
char ** | str, |
|
|
char ** | urls ) |
Remove img-tags of a string.
If alt attribute given, use this as replacement.
- Parameters
-
| str | The string to replace img tags |
| urls | (nullable) If any src-attributes found, an \n concatenated string of the URLs in format [<alt>] <src> |
Definition at line 144 of file markup.c.
◆ markup_transform()
| char * markup_transform |
( |
char * | str, |
|
|
enum markup_mode markup_mode markup_mode | ) |
Transform the string in accordance with markup_mode and settings.ignore_newline
Definition at line 317 of file markup.c.
◆ markup_unquote()
| static char * markup_unquote |
( |
char * | str | ) |
|
|
static |
Convert all HTML special entities to their actual char.
- Parameters
-
Definition at line 41 of file markup.c.