Changeset 1480 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2009-03-10T17:07:46+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/WikiReader.java
r1475 r1480 14 14 public class WikiReader { 15 15 16 public static final String JOSM_EXTERN = "http://josm-extern.";17 16 private final String baseurl; 18 17 … … 38 37 39 38 private String readNormal(BufferedReader in) throws IOException { 40 String b = " <html>";39 String b = ""; 41 40 for (String line = in.readLine(); line != null; line = in.readLine()) { 42 line = adjustText(line);43 41 if(!line.contains("[[TranslatedPages]]")) 44 b += line+ "\n";42 b += line.replaceAll(" />", ">") + "\n"; 45 43 } 46 return b;44 return "<html>" + b + "</html>"; 47 45 } 48 46 49 47 private String readFromTrac(BufferedReader in, String url) throws IOException { 50 48 boolean inside = false; 51 String Builder b = new StringBuilder("<html>");49 String b = ""; 52 50 for (String line = in.readLine(); line != null; line = in.readLine()) { 53 51 if (line.contains("<div id=\"searchable\">")) … … 58 56 inside = false; 59 57 if (inside) { 60 line = line.replaceAll("<img src=\"/", "<img src=\""+baseurl+"/"); 61 line = line.replaceAll("href=\"/", "href=\""+baseurl+"/"); 62 if (!line.contains("$")) 63 line = line.replaceAll("<p>Describe \"([^\"]+)\" here</p>", "<p>Describe \"$1\" <a href=\""+JOSM_EXTERN+url.substring(7)+"\">here</a></p>"); 64 line = adjustText(line); 65 b.append(line); 66 b.append("\n"); 58 b += line.replaceAll("<img src=\"/", "<img src=\""+baseurl+"/") 59 .replaceAll("href=\"/", "href=\""+baseurl+"/") 60 .replaceAll(" />", ">") + "\n"; 67 61 } 68 62 } 69 b.append("</html>"); 70 return b.toString(); 71 } 72 73 private String adjustText(String text) { 74 text = text.replaceAll(" />", ">"); 75 return text; 63 return "<html>" + b + "</html>"; 76 64 } 77 65 }
Note:
See TracChangeset
for help on using the changeset viewer.