@@ -0,0 +1,1910 @@
+package org.attribyte.wp.model;%0A%0Aimport com.google.common.base.Strings;%0Aimport com.google.common.collect.ImmutableMap;%0A%0Aimport java.util.Map;%0A%0A/**%0A * A shortcode.%0A * See: %3Ca href=%22https://codex.wordpress.org/Shortcode_API%22%3Ehttps://codex.wordpress.org/Shortcode_API%3C/a%3E.%0A */%0Apublic class Shortcode %7B%0A%0A   /**%0A    * Creates a shortcode without content.%0A    * @param name The name.%0A    * @param attributes The attributes.%0A    */%0A   public Shortcode(final String name, final Map%3CString, String%3E attributes) %7B%0A      this(name, attributes, null);%0A   %7D%0A%0A   /**%0A    * Creates a shortcode with content.%0A    * @param name The name.%0A    * @param attributes The attributes.%0A    * @param content The content.%0A    */%0A   public Shortcode(final String name, final Map%3CString, String%3E attributes,%0A                    final String content) %7B%0A      this.name = name;%0A      this.attributes = attributes != null ? ImmutableMap.copyOf(attributes) : ImmutableMap.of();%0A      this.content = Strings.emptyToNull(content);%0A   %7D%0A%0A   /**%0A    * The name.%0A    */%0A   public final String name;%0A%0A   /**%0A    * The attributes.%0A    */%0A   public final ImmutableMap%3CString, String%3E attributes;%0A%0A   /**%0A    * The content.%0A    */%0A   public final String content;%0A%0A   @Override%0A   public final String toString() %7B%0A      StringBuilder buf = new StringBuilder(%22%5B%22);%0A      buf.append(name);%0A      attributes.entrySet().forEach(kv -%3E %7B%0A         buf.append(%22 %22).append(kv.getKey()).append(%22=%5C%22%22).append(escapeAttribute(kv.getValue())).append(%22%5C%22%22);%0A      %7D);%0A      buf.append(%22%5D%22);%0A      if(content != null) %7B%0A         buf.append(content);%0A         buf.append(%22%5B/%22).append(name).append(%22%5D%22);%0A      %7D%0A      return buf.toString();%0A   %7D%0A%0A   /**%0A    * Escapes an attribute value.%0A    * @param val The value.%0A    * @return The escaped value.%0A    */%0A   public static String escapeAttribute(final String val) %7B%0A      return Strings.nullToEmpty(val); //TODO?%0A   %7D%0A%7D%0A

Add shortcode