Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bleargh45/data-formvalidator-filters-wikitrim
Trim filter for wikitext fields
https://github.com/bleargh45/data-formvalidator-filters-wikitrim
data-formvalidator validation wikitext
Last synced: about 1 month ago
JSON representation
Trim filter for wikitext fields
- Host: GitHub
- URL: https://github.com/bleargh45/data-formvalidator-filters-wikitrim
- Owner: bleargh45
- Created: 2021-01-17T23:57:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-12T20:11:09.000Z (over 1 year ago)
- Last Synced: 2023-08-20T22:59:15.158Z (about 1 year ago)
- Topics: data-formvalidator, validation, wikitext
- Language: Perl
- Homepage: http://metacpan.org/release/Data-FormValidator-Filters-WikiTrim/
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
# NAME
Data::FormValidator::Filters::WikiTrim - Trim filter for wikitext fields
# SYNOPSIS
```perl
use Data::FormValidator::Filters::WikiTrim qw(wiki_trim);# Build Data::FormValidator profile
my $profile = {
'required' => [qw( subject body )],
'field_filters' => {
'subject' => 'trim',
'body' => wiki_trim(),
},
};
```# DESCRIPTION
`Data::FormValidator::Filters::WikiTrim` provides a slightly different `trim`
filter than the default. Rather than trimming _all_ leading/trailing
whitespace, we trim all leading _blank lines_ and all trailing whitespace. In
a wikitext field, leading spaces on the first line could be important so they
need to be preserved (while leading blank lines aren't important and could be
trimmed out).# METHODS
- wiki\_trim()
Returns a filter which trims leading/trailing whitespace in a manner more
suitable for wikitext entry fields; leading blank -lines- are trimmed, as
well as all trailing whitespace.This differs from the standard "trim" filter in that we're only trimming
leading blank -lines- but leave any leading whitespace on the first line;
those leading spaces may be important.# AUTHOR
Graham TerMarsch
# COPYRIGHT
Copyright (C) 2007, Graham TerMarsch. All Rights Reserved.
This is free software; you can redistribute it and/or modify it under the same
license as Perl itself.# SEE ALSO
- [Data::FormValidator](https://metacpan.org/pod/Data%3A%3AFormValidator)