Skip to content

Commit

Permalink
Item14398: First attrbute should always be the default
Browse files Browse the repository at this point in the history
If the first attribute does not have a value assignment then it should
be the default attribute and not become a boolean.

This lets macros like ICON work fine without quoting.

ENCODE and INCLUDE don't work with the new parser.  All the other Fn_*
tests pass.
  • Loading branch information
gac410 committed Jul 13, 2017
1 parent f160a77 commit bf4a920
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
8 changes: 7 additions & 1 deletion core/lib/Foswiki/Attrs.pm
Expand Up @@ -263,9 +263,15 @@ sub _friendly {

# simple name with no value (boolean, or _DEFAULT)
elsif ( $string =~ s/^[\s,]*([a-z][a-z0-9_]*)\b//is ) {
$this->{$1} = 1;

#print STDERR "Match9 $1\n";
if ( defined( $this->{_DEFAULT} ) ) {
$this->{$1} = 1;
}
else {
$key = '_DEFAULT';
$this->{_DEFAULT} = $1;
}
}

# otherwise the whole string - sans padding - is the default
Expand Down
3 changes: 0 additions & 3 deletions core/lib/Foswiki/Macros/ICON.pm
Expand Up @@ -11,9 +11,6 @@ BEGIN {
}
}

# Macro takes unquoted default parameter - context-free not supported.
$Foswiki::contextFreeSyntax{ICON} = 0;

# Uses:
# _ICONSPACE to reference the meta object of the %ICONTOPIC%,
# _EXT2ICON to record the mapping of file extensions to icon names
Expand Down
3 changes: 0 additions & 3 deletions core/lib/Foswiki/Macros/ICONURLPATH.pm
Expand Up @@ -6,9 +6,6 @@ use warnings;

use Foswiki::Macros::ICON ();

# Macro takes unquoted default parameter - context-free not supported.
$Foswiki::contextFreeSyntax{ICONURLPATH} = 0;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
Expand Down
3 changes: 3 additions & 0 deletions core/lib/Foswiki/Macros/INCLUDE.pm
Expand Up @@ -7,6 +7,9 @@ use warnings;
use Foswiki::Render;
use Foswiki::Func;

# Macro takes unquoted default parameter - context-free not supported.
$Foswiki::contextFreeSyntax{INCLUDE} = 0;

BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
require locale;
Expand Down

0 comments on commit bf4a920

Please sign in to comment.