1 31 package org.blojsom.plugin.macro; 32 33 import org.blojsom.blog.Blog; 34 35 import java.util.Map ; 36 import java.util.HashMap ; 37 import java.util.Iterator ; 38 39 46 public class MacroExpansionUtilities { 47 48 public static final String PLUGIN_MACRO_PREFIX = "plugin-macro-"; 49 50 56 public static Map readMacros(Blog blog) { 57 Map macros = new HashMap (); 58 Map blogProperties = blog.getProperties(); 59 Iterator propertyIterator = blogProperties.keySet().iterator(); 60 61 while (propertyIterator.hasNext()) { 62 String property = (String ) propertyIterator.next(); 63 if (property.startsWith(PLUGIN_MACRO_PREFIX)) { 64 macros.put(property.substring(property.indexOf(PLUGIN_MACRO_PREFIX) + PLUGIN_MACRO_PREFIX.length()), blogProperties.get(property)); 65 } 66 } 67 68 return macros; 69 } 70 } 71 | Popular Tags |