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] [Commented] (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:comment-tabpanel&focusedCommentId=13749253#comment-13749253
] 

Glen Mazza commented on ROL-1420:
---------------------------------

I don't see much use in this, because the user can already enter the precise URL he wants
(without the accent marks in this case), then hit "save draft" to create the permanent URL,
then change the blog title to whatever he or she wants (with accent marks or whatever).  This
will need to be done anyway because the blog title is rarely what you want the URL to be,
the blog title is for easy readability while the URL needs to be more terse (5 word limit)
and include just the most important words for SEO.
                
> 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