Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-5734

Make it possible for url|text substitutions to also have arbitrary attributes

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2014-03-03
    • Component/s: None
    • Labels:
      None

      Description

      For MBS-5651 I would have loved to do something like:

      l('Review the {doc|list of packaging types|target="_blank"} for help.', { doc => doc_link('Release/Packaging') })

      I'm sure there are places where a |class="foo" could be useful as well, and there are probably plenty of other cases. I don't much care for how the syntax ends up being, as long as it becomes possible.

      The current substitution happens in lib/MusicBrainz/Server/Translation.pm::_expand : $string =~ s/{($re)|(.*?)}/defined $args{$1} ? "<a href=\"" . $args{$1} . "\">" . (defined $args{$2} ? $args{$2} : $2) . "<\/a>" : "{$0}"/ge;

      One possible way, as mentioned by Kuno in #musicbrainz-devel, is to make it accept something other than strings. This would allow us to still be able to say something similar to:

      l('{url|some text}', { url => {
          href => doc_link('Some_text'),
          class => 'some-text-class',
          id => 'not-just-some-test',
          target => 'SuperFrame',
          hreflang => 'nxx',
      }})

      - ie., adding more power/flexibility to the developers, without increasing complexity for translators! \o/

        Attachments

          Activity

            People

            • Assignee:
              ianmcorvidae Ian McEwen
              Reporter:
              freso Frederik “Freso” S. Olesen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Packages

                Version Package
                2014-03-03