MeisterGit / wordpress-java

Automatically exported from code.google.com/p/wordpress-java
Other
0 stars 0 forks source link

Losing information when entering ":" char in post content #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In description:addsomecontent then add:to the content
2. Try to post

What is the expected output? What do you see instead?
Entire post, instead of I see the post is truncated after ":" char.

What version of the product are you using? On what operating system?
0.1 in Linux

Please provide any additional information below.
I think is a parse issue in Page.java line 58, we need to have an option
similar to \: in order to scape ":" char.

Original issue reported on code.google.com by joel.esp...@gmail.com on 17 Nov 2008 at 6:19

GoogleCodeExporter commented 9 years ago
The same happens when you start a line with "[".

I suggest a change in Page.java:

private static void putVal(XmlRpcStruct s, String key, String v) {
    String value = v.trim();
    if (value.startsWith("[")) {
      value = value.replaceFirst("\\[", "");
      value = value.replaceFirst("\\]$", "");
      value = value.replaceAll(",  *", ",");
      value = value.trim();
      String[] valStr = value.split(",");
      XmlRpcArray vals = new XmlRpcArray();
      for (String s1 : valStr) {
        vals.add(s1);
      }
      s.put(key, vals);
    } else {
      if (!"null".equalsIgnoreCase(value)) {
//*******************************
        value = org.apache.commons.lang.StringUtils.replace(value, "\\", "");
//*******************************
        s.put(key, value);
      }
    }
  }

And if you want to put ":" or "[" in your post, escape them this way: "\:" and 
"\[",
the same way if you want "\" you must escape it "\\".

Original comment by joel.esp...@gmail.com on 17 Nov 2008 at 11:57

GoogleCodeExporter commented 9 years ago
Joel,

For the ":" I tried a few combinations, but failed to reproduce the output. 
Please
note that you should indent extra lines with a space, and they will be 
concatenated
together after trimming the leading spaces.

For instance this was OK (content was deneme:123):
categories:[test]
description:deneme:123
title:deneme

And this was also put into the post without problems:
description:
 deneme:123456
title:deneme

This,too:
description:
 deneme:123456
 789
 a
 b
 c
title:deneme

Of course, I may be missing a legitimate case. Can you quote the post you're 
sending?

But "[" is another case, and I'm looking into it. Fix is on the way :)

Original comment by can.bican@gmail.com on 18 Nov 2008 at 9:59

GoogleCodeExporter commented 9 years ago
I've changed the code so that if you'd like to include "[" in the beginning of 
the
post, just put a space before this, which is consistent with the documentation 
too.
Let me know if this is convenient enough

Original comment by can.bican@gmail.com on 18 Nov 2008 at 12:47

GoogleCodeExporter commented 9 years ago
I didn't write this post as a test case, It's a common text for my blog
www.vivirguadalajara.com [in spanish] It's funny how it became in a good test 
case.

title:[Al día] Eventos en Guadalajara para el domingo 23 de noviembre del 2008
description:2ª Feria Reg. de la Birria y la Torta Ahogada de Jalisco 2007 
Plaza Liberación
Informes: 3657 8410 

Honores a la Bandera con la Banda Municipal
Presidencia Municipal de Guadalajara 10:00 hrs.

Festival de Títeres
Función especial para escuelas, previa reservación
Teatro Alarife Martín Casillas 10:00 hrs.
Informes: 3942 1200 ext. 42396

Curso: México y la Historia Universal
Módulo III, Tema - Edad Moderna: El Renacimiento en Italia, por Lic. Javier 
Moreno
Rodríguez
Museo de la Ciudad de Guadalajara 17:00 hrs.

Grupo de música y danza autóctonas Tunkul
Col. Santa Cecilia 19:00 hrs.

Astronomía (telescopio)
Tu Lugar, a partir de las 20:00 hrs.

Sesión Ordinaria del Seminario de Cultura Mexicana
Museo de la Ciudad de Guadalajara 20:00 hrs.

Teatro: Mariposas sin alas
Teatro Alarife Martín Casillas 20:30 hrs.
$80.00 general $60.00 estudiantes

Original comment by joel.esp...@gmail.com on 18 Nov 2008 at 2:34

GoogleCodeExporter commented 9 years ago
I got the latest version from SVN and tested using a space to indent the lines 
and it
worked like a charm. Thanks for your support and sorry for open an issue with no
reason for it.

Regards.

Original comment by joel.esp...@gmail.com on 18 Nov 2008 at 4:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It's been a pleasure, it's me who should thank you for spotting bugs.

I'll be pushing another release in a few days - it's been year since the last 
one. So please check back again to 
get the fixed jars.

Original comment by can.bican@gmail.com on 18 Nov 2008 at 10:59