Homec4science

Move object monogram rules later in the parse order

Authored by epriestley <git@epriestley.com> on Aug 11 2014, 21:29.

Description

Move object monogram rules later in the parse order

Summary:
Fixes T5837. The problem is that the hash is being recognized as a commit hash. We currently fire the object monogram rules fairly early, but there's no real reason to do this. Move them after all of the hyperlink rules:

  0 PhutilRemarkupEscapeRemarkupRule
  100 PhutilRemarkupMonospaceRule
  150 PhutilRemarkupDocumentLinkRule
  175 PhrictionRemarkupRule

<<< OLD OBJECT RULE POSITION

  200 PhabricatorIconRemarkupRule
  200 PhabricatorMemeRemarkupRule
  200 DivinerSymbolRemarkupRule
  350 DoorkeeperRemarkupRuleJIRA
  350 PhabricatorYoutubeRemarkupRule
  350 DoorkeeperRemarkupRuleAsana
  400 PhutilRemarkupHyperlinkRule

>>> NEW OBJECT RULE POSITION

  500 PhabricatorImageMacroRemarkupRule
  500 CustomInlineJIRA5Rule
  500 PhabricatorMentionRemarkupRule
  500 CustomInlineCodeRule
  1000 PhutilRemarkupDelRule
  1000 PhutilRemarkupBoldRule
  1000 PhutilRemarkupItalicRule
  1000 PhutilRemarkupUnderlineRule

- The disadvantage of this approach is that `{F123, alt=go look at http://lol.com/ omg}` will parse the URL first, and then fail to resolve the object embed. This seems very rare / unusual.
- The advantage is that all URLs which happen to have monograms in them work.

In the future, we could refine this by separating the rules, so the embed ({...}) versions fired at priority 200, while the normal versions fired at priority 450. We can wait for use cases, though. This is a little messy because the same code implements both rules.

Test Plan:

  • Verified example in T5837.
  • Marked up object rules like F123 (works), [[ asdf | F123 ]] (works), {F123, alt=http://example.com} (does not work).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5837

Differential Revision: https://secure.phabricator.com/D10212

Details

Committed
epriestley <git@epriestley.com>Aug 11 2014, 21:29
Pushed
aubortJan 31 2017, 17:16
Parents
rPH448020a57351: Rename Lisk internal getProperties() methods to avoid collisions
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH98cd2cd7992a: Move object monogram rules later in the parse order (authored by epriestley <git@epriestley.com>).Aug 11 2014, 21:29