roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Mazza (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (ROL-1420) A option to replace Accented Chars on Anchor creation
Date Sat, 24 Aug 2013 02:19:52 GMT

     [ https://issues.apache.org/jira/browse/ROL-1420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Glen Mazza closed ROL-1420.
---------------------------

    Resolution: Won't Fix

Not worth the effort -- see comment.
                
> A option to replace Accented Chars on Anchor creation
> -----------------------------------------------------
>
>                 Key: ROL-1420
>                 URL: https://issues.apache.org/jira/browse/ROL-1420
>             Project: Roller
>          Issue Type: New Feature
>          Components: Configuration & Settings
>            Reporter: Wladimir Boton
>            Assignee: Roller Unassigned
>
> The user should have the option to convert all accented characters of a post title with
equivalent ascii letters to generate the anchor for that post. It is easer to type urls. 
> My sugestion is to use the sun.text.Normalize library and change the funcion createAnchorBase
as:
> public String createAnchorBase() {
>         
>         // Use title (minus non-alphanumeric characters)
>         String base = null;
>         if (!StringUtils.isEmpty(getTitle())) {
>             base = Utilities.replaceNonAlphanumeric(getTitle(), ' ').trim();    
>         }
>         // If we still have no base, then try text (minus non-alphanumerics)
>         if (StringUtils.isEmpty(base) && !StringUtils.isEmpty(getText())) {
>             base = Utilities.replaceNonAlphanumeric(getText(), ' ').trim();  
>         }
>         
>         if (!StringUtils.isEmpty(base)) {
>             
>             // Use only the first 4 words
>             StringTokenizer toker = new StringTokenizer(base);
>             String tmp = null;
>             int count = 0;
>             while (toker.hasMoreTokens() && count < 5) {
>                 String s = toker.nextToken();
>                 s = s.toLowerCase();
>                 tmp = (tmp == null) ? s : tmp + "_" + s;
>                 count++;
>             }
>             String temp = Normalizer.normalize(tmp, Normalizer.DECOMP, 0);
>             base = temp.replaceAll("[^\\p{ASCII}]","");
>         }
>         // No title or text, so instead we will use the items date
>         // in YYYYMMDD format as the base anchor
>         else {
>             base = DateUtil.format8chars(getPubTime());
>         }
>         
>         return base;
>     }
> Should only to add logic to do the 
>             String temp = Normalizer.normalize(tmp, Normalizer.DECOMP, 0);
>             base = temp.replaceAll("[^\\p{ASCII}]","");
> part when the blog settings Normalize is true.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message