Podpora Markdown syntaxe pro komentáře.
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 07 Nov 2011 20:31:44 +0100
changeset 19740b7aa9126d0
parent 196 27b751390163
child 198 3464334db89a
Podpora Markdown syntaxe pro komentáře.
java/nekurak.net-ejb/nbproject/build-impl.xml
java/nekurak.net-ejb/nbproject/genfiles.properties
java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/ejb/PodnikEJB.java
java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/ext/Texy.java
java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/ext/WikiSyntaxProcesor.java
java/nekurak.net-ejb/test/cz/frantovo/nekurak/ext/TexyTest.java
java/nekurak.net-ejb/test/cz/frantovo/nekurak/ext/WikiSyntaxProcesorTest.java
java/nekurak.net-lib/nbproject/build-impl.xml
java/nekurak.net-lib/nbproject/genfiles.properties
java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Komentar.java
java/nekurak.net-lib/src/cz/frantovo/nekurak/ejb/PodnikRemote.java
java/nekurak.net-lib/src/cz/frantovo/nekurak/preklady_cs.properties
java/nekurak.net-lib/src/cz/frantovo/nekurak/util/Komentare.java
java/nekurak.net-lib/src/cz/frantovo/nekurak/vyjimky/TexyVyjimka.java
java/nekurak.net-lib/src/cz/frantovo/nekurak/vyjimky/WikiSyntaxVyjimka.java
java/nekurak.net-web/nbproject/build-impl.xml
java/nekurak.net-web/nbproject/genfiles.properties
java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/OdeslatKomentar.java
java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikKomentare.tag
java/nekurak.net-web/web/WEB-INF/web.xml
     1.1 --- a/java/nekurak.net-ejb/nbproject/build-impl.xml	Mon Nov 07 20:31:08 2011 +0100
     1.2 +++ b/java/nekurak.net-ejb/nbproject/build-impl.xml	Mon Nov 07 20:31:44 2011 +0100
     1.3 @@ -138,7 +138,10 @@
     1.4      </target>
     1.5      <target depends="init" name="-init-cos" unless="deploy.on.save">
     1.6          <condition property="deploy.on.save" value="true">
     1.7 -            <istrue value="${j2ee.deploy.on.save}"/>
     1.8 +            <or>
     1.9 +                <istrue value="${j2ee.deploy.on.save}"/>
    1.10 +                <istrue value="${j2ee.compile.on.save}"/>
    1.11 +            </or>
    1.12          </condition>
    1.13      </target>
    1.14      <target name="-post-init">
    1.15 @@ -361,7 +364,7 @@
    1.16                  </nbjpdareload>
    1.17              </sequential>
    1.18          </macrodef>
    1.19 -        <macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1">
    1.20 +        <macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/1">
    1.21              <sequential>
    1.22                  <nbjpdaappreloaded/>
    1.23              </sequential>
    1.24 @@ -614,9 +617,7 @@
    1.25      <target name="-run-deploy-am">
    1.26          <!-- Task to deploy to the Access Manager runtime. -->
    1.27      </target>
    1.28 -    <target depends="init,-init-cos,-init-deploy,compile,library-inclusion-in-archive,dist-directory-deploy,pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,post-run-deploy" name="run-deploy">
    1.29 -        <nbjpdaappreloaded/>
    1.30 -    </target>
    1.31 +    <target depends="init,-init-cos,-init-deploy,compile,library-inclusion-in-archive,dist-directory-deploy,pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,post-run-deploy,-do-update-breakpoints" name="run-deploy"/>
    1.32      <target if="netbeans.home" name="-run-deploy-nb">
    1.33          <nbdeploy debugmode="false" forceRedeploy="${forceRedeploy}"/>
    1.34      </target>
    1.35 @@ -636,6 +637,9 @@
    1.36          <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
    1.37          <ejbjarproject3:java classname="${run.class}"/>
    1.38      </target>
    1.39 +    <target depends="init" if="netbeans.home" name="-do-update-breakpoints">
    1.40 +        <ejbjarproject1:nbjpdaappreloaded/>
    1.41 +    </target>
    1.42      <!--
    1.43                  DEBUGGING SECTION
    1.44              -->
    1.45 @@ -845,7 +849,7 @@
    1.46      <!--
    1.47                  CLEANUP SECTION
    1.48              -->
    1.49 -    <target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps">
    1.50 +    <target depends="init" name="deps-clean" unless="no.deps">
    1.51          <ant antfile="${project.SuperDAO}/build.xml" inheritall="false" target="clean"/>
    1.52          <ant antfile="${project.nekurak_net-lib}/build.xml" inheritall="false" target="clean"/>
    1.53      </target>
     2.1 --- a/java/nekurak.net-ejb/nbproject/genfiles.properties	Mon Nov 07 20:31:08 2011 +0100
     2.2 +++ b/java/nekurak.net-ejb/nbproject/genfiles.properties	Mon Nov 07 20:31:44 2011 +0100
     2.3 @@ -4,5 +4,5 @@
     2.4  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     2.5  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     2.6  nbproject/build-impl.xml.data.CRC32=ec49fdf0
     2.7 -nbproject/build-impl.xml.script.CRC32=7d2f29de
     2.8 -nbproject/build-impl.xml.stylesheet.CRC32=6cd662d4@1.28.1
     2.9 +nbproject/build-impl.xml.script.CRC32=c9f547dd
    2.10 +nbproject/build-impl.xml.stylesheet.CRC32=2bce7fe8@1.30.1
     3.1 --- a/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/ejb/PodnikEJB.java	Mon Nov 07 20:31:08 2011 +0100
     3.2 +++ b/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/ejb/PodnikEJB.java	Mon Nov 07 20:31:44 2011 +0100
     3.3 @@ -8,10 +8,10 @@
     3.4  import cz.frantovo.nekurak.dto.VysledekHlasovani;
     3.5  import cz.frantovo.nekurak.ext.Geo;
     3.6  import cz.frantovo.nekurak.ext.Geo.Souradnice;
     3.7 -import cz.frantovo.nekurak.ext.Texy;
     3.8 +import cz.frantovo.nekurak.ext.WikiSyntaxProcesor;
     3.9  import cz.frantovo.nekurak.util.Komentare;
    3.10  import cz.frantovo.nekurak.vyjimky.KomentarovaVyjimka;
    3.11 -import cz.frantovo.nekurak.vyjimky.TexyVyjimka;
    3.12 +import cz.frantovo.nekurak.vyjimky.WikiSyntaxVyjimka;
    3.13  import java.util.Collection;
    3.14  import java.util.logging.Logger;
    3.15  import javax.annotation.Resource;
    3.16 @@ -32,6 +32,8 @@
    3.17  	private PodnikDAO podnikDAO;
    3.18  	@Resource
    3.19  	private SessionContext ctx;
    3.20 +	
    3.21 +	private WikiSyntaxProcesor wikiSyntaxProcesor = new WikiSyntaxProcesor();
    3.22  
    3.23  	@Override
    3.24  	public Collection<Podnik> getPodniky() {
    3.25 @@ -122,7 +124,7 @@
    3.26  		return podnikDAO.getVysledekHlasovani(podnik);
    3.27  	}
    3.28  
    3.29 -	private void kontrolaKomentare(Komentar k) throws TexyVyjimka, KomentarovaVyjimka {
    3.30 +	private void kontrolaKomentare(Komentar k) throws WikiSyntaxVyjimka, KomentarovaVyjimka {
    3.31  		k.setUzivatel(ctx.getCallerPrincipal().getName());
    3.32  		k.setDatum(null);
    3.33  
    3.34 @@ -135,9 +137,11 @@
    3.35  			case PROSTY_TEXT:
    3.36  				k.setKomentar(Komentare.upravProstyText(k.getKomentar()));
    3.37  				break;
    3.38 +			case MARKDOWN:
    3.39 +				k.setKomentar(wikiSyntaxProcesor.převeď(k.getKomentar(), Komentar.TYP.MARKDOWN));
    3.40 +				break;
    3.41  			case TEXY:
    3.42 -				Texy t = new Texy();
    3.43 -				k.setKomentar(t.preved(k.getKomentar()));
    3.44 +				k.setKomentar(wikiSyntaxProcesor.převeď(k.getKomentar(), Komentar.TYP.TEXY));
    3.45  				break;
    3.46  			case XHTML:
    3.47  				k.setKomentar(Komentare.upravXHTML(k.getKomentar()));
    3.48 @@ -152,7 +156,7 @@
    3.49  
    3.50  	@Override
    3.51  	@RolesAllowed("opravneny")
    3.52 -	public Komentar komentuj(Komentar k, boolean uloz) throws KomentarovaVyjimka, TexyVyjimka {
    3.53 +	public Komentar komentuj(Komentar k, boolean uloz) throws KomentarovaVyjimka, WikiSyntaxVyjimka {
    3.54  		kontrolaKomentare(k);
    3.55  		if (uloz) {
    3.56  			podnikDAO.zaloz(k);
     4.1 --- a/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/ext/Texy.java	Mon Nov 07 20:31:08 2011 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,63 +0,0 @@
     4.4 -package cz.frantovo.nekurak.ext;
     4.5 -
     4.6 -import cz.frantovo.nekurak.vyjimky.TexyVyjimka;
     4.7 -import java.io.BufferedReader;
     4.8 -import java.io.IOException;
     4.9 -import java.io.InputStreamReader;
    4.10 -import java.io.OutputStreamWriter;
    4.11 -import java.net.URL;
    4.12 -import java.net.URLConnection;
    4.13 -import java.net.URLEncoder;
    4.14 -import java.util.logging.Level;
    4.15 -import java.util.logging.Logger;
    4.16 -
    4.17 -/**
    4.18 - * Neprovádí vlastní interpretaci Texy syntaxe, ale volá HTTP službu napsanou v PHP.
    4.19 - * TODO: použít webové služby, nebo něco lepšího než ruční práci s URL.
    4.20 - * @author fiki
    4.21 - */
    4.22 -public class Texy {
    4.23 -
    4.24 -	/** TODO: parametrizovatelnost */
    4.25 -	private static final String URL_SLUZBY = "http://nekurak.net/texy/http/";
    4.26 -	private static final String KODOVANI = "UTF-8";
    4.27 -	private static final Logger log = Logger.getLogger(Texy.class.getSimpleName());
    4.28 -
    4.29 -	public String preved(String text) throws TexyVyjimka {
    4.30 -		OutputStreamWriter wr = null;
    4.31 -		BufferedReader rd = null;
    4.32 -		try {
    4.33 -			URL url = new URL(URL_SLUZBY);
    4.34 -			URLConnection spojeni = url.openConnection();
    4.35 -			spojeni.setDoOutput(true);
    4.36 -
    4.37 -			/** Odešleme data */
    4.38 -			wr = new OutputStreamWriter(spojeni.getOutputStream());
    4.39 -			wr.write(URLEncoder.encode(text, KODOVANI));
    4.40 -			wr.flush();
    4.41 -
    4.42 -			/** Přijmeme odpověď */
    4.43 -			rd = new BufferedReader(new InputStreamReader(spojeni.getInputStream(), KODOVANI));
    4.44 -			StringBuilder vysledek = new StringBuilder();
    4.45 -			String radka;
    4.46 -			while ((radka = rd.readLine()) != null) {
    4.47 -				vysledek.append(radka);
    4.48 -			}
    4.49 -
    4.50 -			return vysledek.toString();
    4.51 -		} catch (Exception e) {
    4.52 -			throw new TexyVyjimka("Chyba při zpracovávání textu: " + text, e);
    4.53 -		} finally {
    4.54 -			try {
    4.55 -				wr.close();
    4.56 -			} catch (IOException e) {
    4.57 -				log.log(Level.WARNING, "Selhalo zavírání OutputStreamWriteru", e);
    4.58 -			}
    4.59 -			try {
    4.60 -				rd.close();
    4.61 -			} catch (IOException e) {
    4.62 -				log.log(Level.WARNING, "Selhalo zavírání BufferedReaderu", e);
    4.63 -			}
    4.64 -		}
    4.65 -	}
    4.66 -}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/java/nekurak.net-ejb/src/java/cz/frantovo/nekurak/ext/WikiSyntaxProcesor.java	Mon Nov 07 20:31:44 2011 +0100
     5.3 @@ -0,0 +1,130 @@
     5.4 +package cz.frantovo.nekurak.ext;
     5.5 +
     5.6 +import cz.frantovo.nekurak.dto.Komentar;
     5.7 +import cz.frantovo.nekurak.vyjimky.WikiSyntaxVyjimka;
     5.8 +import java.io.BufferedReader;
     5.9 +import java.io.IOException;
    5.10 +import java.io.InputStream;
    5.11 +import java.io.InputStreamReader;
    5.12 +import java.io.OutputStreamWriter;
    5.13 +import java.io.PrintStream;
    5.14 +import java.net.URL;
    5.15 +import java.net.URLConnection;
    5.16 +import java.net.URLEncoder;
    5.17 +import java.util.logging.Level;
    5.18 +import java.util.logging.Logger;
    5.19 +
    5.20 +/**
    5.21 + * Neprovádí vlastní interpretaci wiki syntaxe syntaxe, ale volá HTTP službu napsanou v PHP nebo samostatný proces v systému.
    5.22 + * TODO: použít webové služby, nebo něco lepšího než ruční práci s URL.
    5.23 + * @author fiki
    5.24 + */
    5.25 +public class WikiSyntaxProcesor {
    5.26 +
    5.27 +	/** TODO: parametrizovatelnost */
    5.28 +	private static final String URL_SLUZBY = "http://nekurak.net/texy/http/";
    5.29 +	private static final String KODOVANI = "UTF-8";
    5.30 +	private static final Logger log = Logger.getLogger(WikiSyntaxProcesor.class.getSimpleName());
    5.31 +	private String[] markdownPříkaz = new String[]{"sudo", "-u", "markdown", "/usr/bin/markdown"};
    5.32 +
    5.33 +	public String převeď(String text, Komentar.TYP syntaxe) throws WikiSyntaxVyjimka {
    5.34 +		switch (syntaxe) {
    5.35 +			case MARKDOWN:
    5.36 +				return převeďMarkdown(text);
    5.37 +			case TEXY:
    5.38 +				return převeďTexy(text);
    5.39 +			default:
    5.40 +				throw new WikiSyntaxVyjimka("Nepodporovaná wiki syntaxe.", null);
    5.41 +		}
    5.42 +	}
    5.43 +
    5.44 +	private String převeďMarkdown(String text) throws WikiSyntaxVyjimka {
    5.45 +		try {
    5.46 +			Runtime r = Runtime.getRuntime();
    5.47 +			Process p = r.exec(markdownPříkaz);
    5.48 +
    5.49 +			PrintStream processInput = new PrintStream(p.getOutputStream());
    5.50 +			processInput.print(text);
    5.51 +			processInput.close();
    5.52 +
    5.53 +			String errors = načtiProud(p.getErrorStream());
    5.54 +			String htmlFragment = načtiProud(p.getInputStream());
    5.55 +
    5.56 +			if (errors.length() == 0) {
    5.57 +				return htmlFragment;
    5.58 +			} else {
    5.59 +				throw new WikiSyntaxVyjimka("Markdown procesor vrátil chyby: " + errors, null);
    5.60 +			}
    5.61 +		} catch (Exception e) {
    5.62 +			throw new WikiSyntaxVyjimka("Chyba při transformaci Markdown → XHTML", e);
    5.63 +		}
    5.64 +	}
    5.65 +
    5.66 +	private String převeďTexy(String text) throws WikiSyntaxVyjimka {
    5.67 +		OutputStreamWriter wr = null;
    5.68 +		BufferedReader rd = null;
    5.69 +		try {
    5.70 +			URL url = new URL(URL_SLUZBY);
    5.71 +			URLConnection spojeni = url.openConnection();
    5.72 +			spojeni.setDoOutput(true);
    5.73 +
    5.74 +			/** Odešleme data */
    5.75 +			wr = new OutputStreamWriter(spojeni.getOutputStream());
    5.76 +			wr.write(URLEncoder.encode(text, KODOVANI));
    5.77 +			wr.flush();
    5.78 +
    5.79 +			/** Přijmeme odpověď */
    5.80 +			rd = new BufferedReader(new InputStreamReader(spojeni.getInputStream(), KODOVANI));
    5.81 +			StringBuilder vysledek = new StringBuilder();
    5.82 +			String radka;
    5.83 +			while ((radka = rd.readLine()) != null) {
    5.84 +				vysledek.append(radka);
    5.85 +			}
    5.86 +
    5.87 +			return vysledek.toString();
    5.88 +		} catch (Exception e) {
    5.89 +			throw new WikiSyntaxVyjimka("Chyba při zpracovávání textu: " + text, e);
    5.90 +		} finally {
    5.91 +			try {
    5.92 +				wr.close();
    5.93 +			} catch (IOException e) {
    5.94 +				log.log(Level.WARNING, "Selhalo zavírání OutputStreamWriteru", e);
    5.95 +			}
    5.96 +			try {
    5.97 +				rd.close();
    5.98 +			} catch (IOException e) {
    5.99 +				log.log(Level.WARNING, "Selhalo zavírání BufferedReaderu", e);
   5.100 +			}
   5.101 +		}
   5.102 +	}
   5.103 +
   5.104 +	/**
   5.105 +	 * Čte proud dat dokud to jde a výsledek pak vrátí jako text.
   5.106 +	 * @param proud vstupní proud
   5.107 +	 * @return obsah proudu jako text
   5.108 +	 * @throws IOException 
   5.109 +	 */
   5.110 +	public static String načtiProud(InputStream proud) throws IOException {
   5.111 +		StringBuilder výsledek = new StringBuilder();
   5.112 +		BufferedReader buf = new BufferedReader(new InputStreamReader(proud));
   5.113 +		while (true) {
   5.114 +			String radek = buf.readLine();
   5.115 +			if (radek == null) {
   5.116 +				break;
   5.117 +			} else {
   5.118 +				výsledek.append(radek);
   5.119 +				výsledek.append("\n");
   5.120 +			}
   5.121 +		}
   5.122 +		return výsledek.toString();
   5.123 +	}
   5.124 +
   5.125 +	/**
   5.126 +	 * Můžeme nastavit vlastní příkaz pro transformaci Markdown syntaxe.
   5.127 +	 * Ve výchozím nastavení se Markdown procesor volá přes sudo pod uživatelem markdown.
   5.128 +	 * @param markdownPříkaz první je příkaz, následují případné parametry
   5.129 +	 */
   5.130 +	public void setMarkdownPříkaz(String[] markdownPříkaz) {
   5.131 +		this.markdownPříkaz = markdownPříkaz;
   5.132 +	}
   5.133 +}
     6.1 --- a/java/nekurak.net-ejb/test/cz/frantovo/nekurak/ext/TexyTest.java	Mon Nov 07 20:31:08 2011 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,33 +0,0 @@
     6.4 -package cz.frantovo.nekurak.ext;
     6.5 -
     6.6 -import cz.frantovo.nekurak.vyjimky.TexyVyjimka;
     6.7 -import org.junit.Test;
     6.8 -import static org.junit.Assert.*;
     6.9 -
    6.10 -/**
    6.11 - * Testuje spíš dostupnost vzdálené služby a fungování samotného Texy než implementaci javové části –
    6.12 - * ta buď funguje, nebo nefunguje → není potřeba testovat moc do podrobna.
    6.13 - * (testovat by se měla případná parametrizovatelnost – zatím žádná není)
    6.14 - * @author fiki
    6.15 - */
    6.16 -public class TexyTest {
    6.17 -
    6.18 -	private Texy texy = new Texy();
    6.19 -	private static final int CASOVY_LIMIT = 1000;
    6.20 -
    6.21 -	@Test(timeout = CASOVY_LIMIT)
    6.22 -	public void prostyText() throws TexyVyjimka {
    6.23 -		testuj("", "");
    6.24 -		testuj("ahoj", "<p>ahoj</p>");
    6.25 -	}
    6.26 -
    6.27 -	@Test(timeout = CASOVY_LIMIT)
    6.28 -	public void nadpisy() throws TexyVyjimka {
    6.29 -		testuj("===Nadpis===", "<h1>Nadpis</h1>");
    6.30 -	}
    6.31 -
    6.32 -	private void testuj(String vstup, String pozadovanyVystup) throws TexyVyjimka {
    6.33 -		String vystup = texy.preved(vstup);
    6.34 -		assertEquals(pozadovanyVystup, vystup);
    6.35 -	}
    6.36 -}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/java/nekurak.net-ejb/test/cz/frantovo/nekurak/ext/WikiSyntaxProcesorTest.java	Mon Nov 07 20:31:44 2011 +0100
     7.3 @@ -0,0 +1,44 @@
     7.4 +package cz.frantovo.nekurak.ext;
     7.5 +
     7.6 +import cz.frantovo.nekurak.dto.Komentar.TYP;
     7.7 +import cz.frantovo.nekurak.vyjimky.WikiSyntaxVyjimka;
     7.8 +import org.junit.Before;
     7.9 +import org.junit.Test;
    7.10 +import static org.junit.Assert.*;
    7.11 +
    7.12 +/**
    7.13 + * Testuje spíš dostupnost vzdálené služby a fungování samotného WikiSyntaxProcesor než implementaci javové části –
    7.14 + * ta buď funguje, nebo nefunguje → není potřeba testovat moc do podrobna.
    7.15 + * (testovat by se měla případná parametrizovatelnost – zatím žádná není)
    7.16 + * @author fiki
    7.17 + */
    7.18 +public class WikiSyntaxProcesorTest {
    7.19 +
    7.20 +	private WikiSyntaxProcesor wikiSyntaxProcesor = new WikiSyntaxProcesor();
    7.21 +	private static final int CASOVY_LIMIT = 1000;
    7.22 +
    7.23 +	@Before
    7.24 +	public void setUp() {
    7.25 +		wikiSyntaxProcesor.setMarkdownPříkaz(new String[]{"markdown"});
    7.26 +	}
    7.27 +
    7.28 +	@Test(timeout = CASOVY_LIMIT)
    7.29 +	public void prostyText() throws WikiSyntaxVyjimka {
    7.30 +		testuj("", "", TYP.TEXY);
    7.31 +		testuj("", "", TYP.MARKDOWN);
    7.32 +		
    7.33 +		testuj("ahoj", "<p>ahoj</p>", TYP.TEXY);
    7.34 +		testuj("ahoj", "<p>ahoj</p>", TYP.MARKDOWN);
    7.35 +	}
    7.36 +
    7.37 +	@Test(timeout = CASOVY_LIMIT)
    7.38 +	public void nadpisy() throws WikiSyntaxVyjimka {
    7.39 +		testuj("===Nadpis===", "<h1>Nadpis</h1>", TYP.TEXY);
    7.40 +		testuj("Nadpis\n======", "<h1>Nadpis</h1>", TYP.MARKDOWN);
    7.41 +	}
    7.42 +
    7.43 +	private void testuj(String vstup, String pozadovanyVystup, TYP syntaxe) throws WikiSyntaxVyjimka {
    7.44 +		String vystup = wikiSyntaxProcesor.převeď(vstup, syntaxe);
    7.45 +		assertEquals(pozadovanyVystup, vystup.trim());
    7.46 +	}
    7.47 +}
     8.1 --- a/java/nekurak.net-lib/nbproject/build-impl.xml	Mon Nov 07 20:31:08 2011 +0100
     8.2 +++ b/java/nekurak.net-lib/nbproject/build-impl.xml	Mon Nov 07 20:31:44 2011 +0100
     8.3 @@ -843,11 +843,12 @@
     8.4              <classpath>
     8.5                  <path path="${javac.classpath}"/>
     8.6              </classpath>
     8.7 -            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
     8.8 +            <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
     8.9                  <filename name="**/*.java"/>
    8.10              </fileset>
    8.11              <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
    8.12                  <include name="**/*.java"/>
    8.13 +                <exclude name="*.java"/>
    8.14              </fileset>
    8.15          </javadoc>
    8.16          <copy todir="${dist.javadoc.dir}">
     9.1 --- a/java/nekurak.net-lib/nbproject/genfiles.properties	Mon Nov 07 20:31:08 2011 +0100
     9.2 +++ b/java/nekurak.net-lib/nbproject/genfiles.properties	Mon Nov 07 20:31:44 2011 +0100
     9.3 @@ -4,5 +4,5 @@
     9.4  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     9.5  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     9.6  nbproject/build-impl.xml.data.CRC32=11ce77af
     9.7 -nbproject/build-impl.xml.script.CRC32=2e465a03
     9.8 -nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45
     9.9 +nbproject/build-impl.xml.script.CRC32=455ed348
    9.10 +nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
    10.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Komentar.java	Mon Nov 07 20:31:08 2011 +0100
    10.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Komentar.java	Mon Nov 07 20:31:44 2011 +0100
    10.3 @@ -28,6 +28,7 @@
    10.4  
    10.5  		PROSTY_TEXT,
    10.6  		XHTML,
    10.7 +		MARKDOWN,
    10.8  		TEXY
    10.9  	}
   10.10  
    11.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/ejb/PodnikRemote.java	Mon Nov 07 20:31:08 2011 +0100
    11.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/ejb/PodnikRemote.java	Mon Nov 07 20:31:44 2011 +0100
    11.3 @@ -6,7 +6,7 @@
    11.4  import cz.frantovo.nekurak.dto.Podnik;
    11.5  import cz.frantovo.nekurak.dto.VysledekHlasovani;
    11.6  import cz.frantovo.nekurak.vyjimky.KomentarovaVyjimka;
    11.7 -import cz.frantovo.nekurak.vyjimky.TexyVyjimka;
    11.8 +import cz.frantovo.nekurak.vyjimky.WikiSyntaxVyjimka;
    11.9  import java.util.Collection;
   11.10  import javax.ejb.Remote;
   11.11  
   11.12 @@ -52,5 +52,5 @@
   11.13  	 * @param k komentář, který se má přidat k podniku
   11.14  	 * @param uloz true = vloží komentář | false = pouze zkontroluje (naformátuje obsah komentáře)
   11.15  	 */
   11.16 -	public Komentar komentuj(Komentar k, boolean uloz) throws KomentarovaVyjimka, TexyVyjimka;
   11.17 +	public Komentar komentuj(Komentar k, boolean uloz) throws KomentarovaVyjimka, WikiSyntaxVyjimka;
   11.18  }
    12.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/preklady_cs.properties	Mon Nov 07 20:31:08 2011 +0100
    12.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/preklady_cs.properties	Mon Nov 07 20:31:44 2011 +0100
    12.3 @@ -141,6 +141,7 @@
    12.4  komentar.typ.prostyText=Prost\u00fd text
    12.5  komentar.typ.xhtml=XHTML form\u00e1tovan\u00fd text
    12.6  komentar.typ.xhtml.povoleneZnacky=Povolen\u00e9 zna\u010dky jsou: p, strong, em a br.
    12.7 +komentar.typ.markdown=Markdown form\u00e1tovan\u00fd text
    12.8  komentar.typ.texy=Texy form\u00e1tovan\u00fd text
    12.9  komentar.nejdeZobrazit=Tento koment\u00e1\u0159 bohu\u017eel nelze z technick\u00fdch d\u016fvod\u016f zobrazit.
   12.10  
    13.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/util/Komentare.java	Mon Nov 07 20:31:08 2011 +0100
    13.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/util/Komentare.java	Mon Nov 07 20:31:44 2011 +0100
    13.3 @@ -116,6 +116,5 @@
    13.4  
    13.5  	private static String escapujXML(String str) {
    13.6  		return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
    13.7 -
    13.8  	}
    13.9  }
    14.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/vyjimky/TexyVyjimka.java	Mon Nov 07 20:31:08 2011 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,12 +0,0 @@
    14.4 -package cz.frantovo.nekurak.vyjimky;
    14.5 -
    14.6 -/**
    14.7 - *
    14.8 - * @author fiki
    14.9 - */
   14.10 -public class TexyVyjimka extends NekurakVyjimka {
   14.11 -
   14.12 -	public TexyVyjimka(String chyba, Exception e) {
   14.13 -		super(chyba, e);
   14.14 -	}
   14.15 -}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/vyjimky/WikiSyntaxVyjimka.java	Mon Nov 07 20:31:44 2011 +0100
    15.3 @@ -0,0 +1,12 @@
    15.4 +package cz.frantovo.nekurak.vyjimky;
    15.5 +
    15.6 +/**
    15.7 + *
    15.8 + * @author fiki
    15.9 + */
   15.10 +public class WikiSyntaxVyjimka extends NekurakVyjimka {
   15.11 +
   15.12 +	public WikiSyntaxVyjimka(String chyba, Exception e) {
   15.13 +		super(chyba, e);
   15.14 +	}
   15.15 +}
    16.1 --- a/java/nekurak.net-web/nbproject/build-impl.xml	Mon Nov 07 20:31:08 2011 +0100
    16.2 +++ b/java/nekurak.net-web/nbproject/build-impl.xml	Mon Nov 07 20:31:44 2011 +0100
    16.3 @@ -191,7 +191,10 @@
    16.4      </target>
    16.5      <target depends="init" name="-init-cos" unless="deploy.on.save">
    16.6          <condition property="deploy.on.save" value="true">
    16.7 -            <istrue value="${j2ee.deploy.on.save}"/>
    16.8 +            <or>
    16.9 +                <istrue value="${j2ee.deploy.on.save}"/>
   16.10 +                <istrue value="${j2ee.compile.on.save}"/>
   16.11 +            </or>
   16.12          </condition>
   16.13      </target>
   16.14      <target name="-post-init">
   16.15 @@ -727,9 +730,7 @@
   16.16      <target name="-run-deploy-am">
   16.17          <!-- Task to deploy to the Access Manager runtime. -->
   16.18      </target>
   16.19 -    <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy" name="run-deploy">
   16.20 -        <nbjpdaappreloaded/>
   16.21 -    </target>
   16.22 +    <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy,-do-update-breakpoints" name="run-deploy"/>
   16.23      <target if="netbeans.home" name="-run-deploy-nb">
   16.24          <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
   16.25      </target>
   16.26 @@ -815,6 +816,9 @@
   16.27          <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   16.28          <webproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
   16.29      </target>
   16.30 +    <target depends="init" if="netbeans.home" name="-do-update-breakpoints">
   16.31 +        <webproject1:nbjpdaappreloaded/>
   16.32 +    </target>
   16.33      <!--
   16.34                  DEBUGGING SECTION
   16.35              -->
   16.36 @@ -1049,7 +1053,7 @@
   16.37                  
   16.38                  CLEANUP SECTION
   16.39              -->
   16.40 -    <target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps">
   16.41 +    <target depends="init" name="deps-clean" unless="no.deps">
   16.42          <ant antfile="${project.nekurak_net-lib}/build.xml" inheritall="false" target="clean"/>
   16.43      </target>
   16.44      <target depends="init" name="do-clean">
    17.1 --- a/java/nekurak.net-web/nbproject/genfiles.properties	Mon Nov 07 20:31:08 2011 +0100
    17.2 +++ b/java/nekurak.net-web/nbproject/genfiles.properties	Mon Nov 07 20:31:44 2011 +0100
    17.3 @@ -4,8 +4,8 @@
    17.4  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    17.5  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    17.6  nbproject/build-impl.xml.data.CRC32=28fc3c5a
    17.7 -nbproject/build-impl.xml.script.CRC32=37b9073f
    17.8 -nbproject/build-impl.xml.stylesheet.CRC32=8ca9f0e6@1.31.2.1
    17.9 +nbproject/build-impl.xml.script.CRC32=fa3d6af3
   17.10 +nbproject/build-impl.xml.stylesheet.CRC32=0cbf5bb7@1.33.1.1
   17.11  nbproject/rest-build.xml.data.CRC32=84da1c7b
   17.12  nbproject/rest-build.xml.script.CRC32=3db088b3
   17.13  nbproject/rest-build.xml.stylesheet.CRC32=ddd64843@1.4.1
    18.1 --- a/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/OdeslatKomentar.java	Mon Nov 07 20:31:08 2011 +0100
    18.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/OdeslatKomentar.java	Mon Nov 07 20:31:44 2011 +0100
    18.3 @@ -2,7 +2,7 @@
    18.4  
    18.5  import cz.frantovo.nekurak.dto.Komentar;
    18.6  import cz.frantovo.nekurak.vyjimky.KomentarovaVyjimka;
    18.7 -import cz.frantovo.nekurak.vyjimky.TexyVyjimka;
    18.8 +import cz.frantovo.nekurak.vyjimky.WikiSyntaxVyjimka;
    18.9  import java.util.logging.Level;
   18.10  import java.util.logging.Logger;
   18.11  
   18.12 @@ -16,7 +16,7 @@
   18.13  	private static final Logger log = Logger.getLogger(OdeslatKomentar.class.getSimpleName());
   18.14  	private boolean ok = false;
   18.15  
   18.16 -	public void setKomentar(Komentar k) throws TexyVyjimka {
   18.17 +	public void setKomentar(Komentar k) throws WikiSyntaxVyjimka {
   18.18  		try {
   18.19  			hledac.getPodnikEJB().komentuj(k, true);
   18.20  			ok = true;
    19.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikKomentare.tag	Mon Nov 07 20:31:08 2011 +0100
    19.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/podnikKomentare.tag	Mon Nov 07 20:31:44 2011 +0100
    19.3 @@ -34,6 +34,7 @@
    19.4  							<select name="typ">
    19.5  								<option value="PROSTY_TEXT" selected="selected"><fmt:message key="komentar.typ.prostyText"/></option>
    19.6  								<option value="XHTML"><fmt:message key="komentar.typ.xhtml"/></option>
    19.7 +								<option value="MARKDOWN"><fmt:message key="komentar.typ.markdown"/></option>
    19.8  								<option value="TEXY"><fmt:message key="komentar.typ.texy"/></option>
    19.9  							</select>
   19.10  							<br/>
    20.1 --- a/java/nekurak.net-web/web/WEB-INF/web.xml	Mon Nov 07 20:31:08 2011 +0100
    20.2 +++ b/java/nekurak.net-web/web/WEB-INF/web.xml	Mon Nov 07 20:31:44 2011 +0100
    20.3 @@ -123,7 +123,7 @@
    20.4  	</security-role>
    20.5  	<login-config>
    20.6  		<auth-method>FORM</auth-method>
    20.7 -		<realm-name>nekurakNET</realm-name>
    20.8 +		<realm-name>nekurak.net</realm-name>
    20.9  		<form-login-config>
   20.10  			<form-login-page>/prihlaseni</form-login-page>
   20.11  			<form-error-page>/prihlaseni?chyba=ano</form-error-page>