Overview
Comment: | Use mark tag instead of b in search results snippet |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA3-256: |
b0c0add320a3c7537ac61dac9d786bae |
User & Date: | bohwaz on 2023-04-02 17:27:38 |
Other Links: | branch diff | manifest | tags |
Context
2023-04-02
| ||
17:59 | Fix issues in trash management, improve docs UX details check-in: cc9476ed3f user: bohwaz tags: dev | |
17:27 | Use mark tag instead of b in search results snippet check-in: b0c0add320 user: bohwaz tags: dev | |
17:19 | Merge changes from trunk check-in: 3245575fd3 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Files/Files.php from [00a46a65c0] to [5d768a9851].
︙ | ︙ | |||
232 233 234 235 236 237 238 | $where = ' AND path LIKE ?'; $params[] = $path; } $query = sprintf('SELECT *, dirname(path) AS parent, | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | $where = ' AND path LIKE ?'; $params[] = $path; } $query = sprintf('SELECT *, dirname(path) AS parent, snippet(files_search, \'<mark>\', \'</mark>\', \'…\', 2, -30) AS snippet, rank(matchinfo(files_search), 0, 1.0, 1.0) AS points FROM files_search WHERE files_search MATCH ? %s ORDER BY points DESC LIMIT 0,50;', $where); $out = []; |
︙ | ︙ |
Modified src/include/lib/Garradin/Template.php from [eeb038069c] to [5d9a71d778].
︙ | ︙ | |||
153 154 155 156 157 158 159 160 161 162 163 164 165 166 | return sprintf('<a href="%s%d">#%2$d</a>', Utils::getLocalURL('!acc/transactions/details.php?id='), $m[1] ); }, $str); }); $this->register_modifier('format_skriv', function ($str) { $skriv = new Skriv; return $skriv->render((string) $str); }); foreach (CommonModifiers::PHP_MODIFIERS_LIST as $name) { $this->register_modifier($name, [CommonModifiers::class, $name]); | > > > > > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | return sprintf('<a href="%s%d">#%2$d</a>', Utils::getLocalURL('!acc/transactions/details.php?id='), $m[1] ); }, $str); }); $this->register_modifier('restore_snippet_markup', function ($str) { return preg_replace('!<(/?mark)>!', '<$1>', $str); }); $this->register_modifier('format_skriv', function ($str) { $skriv = new Skriv; return $skriv->render((string) $str); }); foreach (CommonModifiers::PHP_MODIFIERS_LIST as $name) { $this->register_modifier($name, [CommonModifiers::class, $name]); |
︙ | ︙ |
Modified src/templates/docs/search.tpl from [1fa759f529] to [3f24150974].
︙ | ︙ | |||
16 17 18 19 20 21 22 | </p> <section class="search-results"> {foreach from=$results item="result"} <article> <h4><a href="{"!docs/?parent=%s"|local_url|args:$result.parent}" target="_parent">{$result.path}</a></h4> <h3><a href="{"!docs/?parent=%s"|local_url|args:$result.parent}" target="_parent">{$result.title}</a></h3> | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | </p> <section class="search-results"> {foreach from=$results item="result"} <article> <h4><a href="{"!docs/?parent=%s"|local_url|args:$result.parent}" target="_parent">{$result.path}</a></h4> <h3><a href="{"!docs/?parent=%s"|local_url|args:$result.parent}" target="_parent">{$result.title}</a></h3> <p>{$result.snippet|escape|restore_snippet_markup}</p> </article> {/foreach} </section> {/if} {include file="_foot.tpl"} |
Modified src/templates/web/index.tpl from [d05ac2e430] to [c07e0cd1de].
1 2 3 4 | {include file="_head.tpl" title=$title current="web" hide_title=true} <nav class="tabs"> <aside> | > > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | {include file="_head.tpl" title=$title current="web" hide_title=true} <nav class="tabs"> <aside> <form method="post" action="search.php"> {input type="search" name="q" size=25 placeholder="Rechercher dans le site" title="Rechercher dans le site"} {button shape="search" type="submit" title="Rechercher"} </form> {if !$config.site_disabled} {if $page && $page->isOnline()} {linkbutton shape="eye" label="Voir sur le site" target="_blank" href=$page->url()} {elseif !$page} {linkbutton shape="eye" label="Voir sur le site" target="_blank" href=$www_url} {/if} {/if} |
︙ | ︙ | |||
22 23 24 25 26 27 28 | </ul> {if $page} <small>{linkbutton href="?p=%s"|args:$page.parent shape="left" label="Retour à la catégorie parent"}</small> {/if} </nav> | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | </ul> {if $page} <small>{linkbutton href="?p=%s"|args:$page.parent shape="left" label="Retour à la catégorie parent"}</small> {/if} </nav> {if !$page && $config.site_disabled && $session->canAccess($session::SECTION_CONFIG, $session::ACCESS_ADMIN)} <p class="block alert"> Le site public est désactivé. {linkbutton shape="settings" href="!config/" label="Activer le site dans la configuration"} </p> {/if} {if count($links_errors) && !$page} <div class="block alert"> Des pages contiennent des liens qui mènent à des pages qui n'existent pas : |
︙ | ︙ |
Modified src/templates/web/search.tpl from [5625d212e9] to [ce8587f5cf].
1 2 | {include file="_head.tpl" title="Rechercher dans le site web" current="web"} | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | {include file="_head.tpl" title="Rechercher dans le site web" current="web"} <form method="post" action="{$self_url}"> <fieldset> <legend>Rechercher une page ou catégorie</legend> <p class="submit"> <input type="text" name="q" value="{$query}" size="25" /> {button type="submit" name="search" label="Chercher" shape="search" class="main"} </p> </fieldset> </form> {if $query} <p class="help"> {{%n résultat trouvé.}{%n résultats trouvés.} n=$results_count} </p> <section class="search-results"> {foreach from=$results item="result"} <article> <h3><a href="{"!web/?p=%s"|local_url|args:$result.path}" target="_parent">{$result.title}</a></h3> <h4> <nav class="breadcrumbs"> <ul> {foreach from=$result.breadcrumbs key="id" item="title"} <li><a href="{"!web/?p=%s"|local_url|args:$id}" target="_parent">{$title}</a></li> {/foreach} </ul> </nav> </h4> <p>{$result.snippet|escape|restore_snippet_markup}</p> </article> {/foreach} </section> {/if} {include file="_foot.tpl"} |
Modified src/www/admin/docs/search.php from [8ca80671b0] to [08d305837d].
︙ | ︙ | |||
12 13 14 15 16 17 18 | if ($q) { $r = Files::search($q, File::CONTEXT_DOCUMENTS . '%'); $tpl->assign('results', $r); $tpl->assign('results_count', count($r)); } | < < < < < < | 12 13 14 15 16 17 18 19 | if ($q) { $r = Files::search($q, File::CONTEXT_DOCUMENTS . '%'); $tpl->assign('results', $r); $tpl->assign('results_count', count($r)); } $tpl->display('docs/search.tpl'); |
Modified src/www/admin/web/search.php from [1a70f9e5ce] to [ecae193a27].
︙ | ︙ | |||
12 13 14 15 16 17 18 | if ($q) { $r = Web::search($q); $tpl->assign('results', $r); $tpl->assign('results_count', count($r)); } | < < < < < < | 12 13 14 15 16 17 18 19 | if ($q) { $r = Web::search($q); $tpl->assign('results', $r); $tpl->assign('results_count', count($r)); } $tpl->display('web/search.tpl'); |