Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-13338

Add ability to override the character symbols used to represent an Entity Reference as a string

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 8.1-milestone-2
    • 7.4
    • Model
    • None
    • Unit, Integration
    • Unknown
    • N/A
    • N/A

    Description

      Proposed interface:

      @Role
      public interface SymbolScheme
      {
          /**
           * @return the character used for escaping characters in Entity Reference names
           */
          Character getEscapeSymbol();
      
          /**
           * @return the map containing all the symbols to separate Entity Types. The map's key is an Entity Type and
           *         the value is another map who's key is the second Entity Type and its value is the character separating
           *         the 2 Entity Types. For example you could have the {code .} character separating an
           *         {@link EntityType#DOCUMENT} and a {@link EntityType#SPACE}. Note that a given Entity Type can have
           *         several separator characters if it can have several different parent types (e.g. a Space reference can
           *         have either a Space Entity Type or a Wiki Entity Type)
           */
          Map<EntityType, Map<EntityType, Character>> getSeparatorSymbols();
      
          /**
           * @param type the Entity Type for which to get the list of strings to escape. For example for a SPACE Entity type
           *             you could want to escape {@code .}, {@code :} and {@code \}.
           * @return the various strings that require escaping for the passed Entity type
           */
          String[] getSymbolsRequiringEscapes(EntityType type);
      
          /**
           * @param type the Entity Type for which to get the list of strings to use to replace each escape returned by
           *             {@link #getSymbolsRequiringEscapes(EntityType)}. For example for a SPACE Entity type you could
           *             want to replace {@code .} with {@code \.}, {@code :} with  {@code \:} and {@code \} with {@code \\}
           * @return the various replacement strings to replace string that require escaping
           */
          String[] getReplacementSymbols(EntityType type);
      }
      

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: