Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of quote entities in extended pre block #55

Closed
tynopet opened this issue Sep 25, 2017 · 4 comments
Closed

Incorrect handling of quote entities in extended pre block #55

tynopet opened this issue Sep 25, 2017 · 4 comments

Comments

@tynopet
Copy link

tynopet commented Sep 25, 2017

Hello, I try to wrap this text:

pre.. import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.onyma.job.Context;
import ru.onyma.job.RescheduleTask;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author ustits
 */
public abstract class MainService<T> extends RescheduleTask implements Context<T> {

  private static final Logger log = LoggerFactory.getLogger(MainService.class);
  private final ScheduledExecutorService scheduler;

  private boolean isFirstRun = true;
  private T configs;

  public MainService(final ScheduledExecutorService scheduler) {
    super(scheduler);
    this.scheduler = scheduler;
  }

  @Override
  public void setConfig(final T configs) {
    this.configs = configs;
    if (isFirstRun) {
      scheduler.schedule(this, 0, TimeUnit.SECONDS);
      isFirstRun = false;
    }
  }

  @Override
  public void stop() {
    super.stop();
    scheduler.shutdown();
    try {
      scheduler.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
    } catch (InterruptedException ie) {
      log.warn("Unable to wait for syncs termination", ie);
      Thread.currentThread().interrupt();
    }
  }

  protected final T getConfigs() {
    return configs;
  }
}

and I getting this result:

<pre>

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.onyma.job.Context;
import ru.onyma.job.RescheduleTask;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author ustits
 */
public abstract class MainService<T> extends RescheduleTask implements Context<T> {

  private static final Logger log = LoggerFactory.getLogger(MainService.class);
  private final ScheduledExecutorService scheduler;

  private boolean isFirstRun = true;
  private T configs;

  public MainService(final ScheduledExecutorService scheduler) {
    super(scheduler);
    this.scheduler = scheduler;
  }

  @Override
  public void setConfig(final T configs) {
    this.configs = configs;
    if (isFirstRun) {
      scheduler.schedule(this, 0, TimeUnit.SECONDS);
      isFirstRun = false;
    }
  }

  @Override
  public void stop() {
    super.stop();
    scheduler.shutdown();
    try {
      scheduler.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
    } catch (InterruptedException ie) {
      log.warn(&#8220;Unable to wait for syncs termination&#8221;, ie);
      Thread.currentThread().interrupt();
    }
  }

  protected final T getConfigs() {
    return configs;
  }
}</pre>

but on txstyle.org I getting this result:

<pre>import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.onyma.job.Context;
import ru.onyma.job.RescheduleTask;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author ustits
 */
public abstract class MainService&lt;T&gt; extends RescheduleTask implements Context&lt;T&gt; {

  private static final Logger log = LoggerFactory.getLogger(MainService.class);
  private final ScheduledExecutorService scheduler;

  private boolean isFirstRun = true;
  private T configs;

  public MainService(final ScheduledExecutorService scheduler) {
    super(scheduler);
    this.scheduler = scheduler;
  }

  @Override
  public void setConfig(final T configs) {
    this.configs = configs;
    if (isFirstRun) {
      scheduler.schedule(this, 0, TimeUnit.SECONDS);
      isFirstRun = false;
    }
  }

  @Override
  public void stop() {
    super.stop();
    scheduler.shutdown();
    try {
      scheduler.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
    } catch (InterruptedException ie) {
      log.warn(&quot;Unable to wait for syncs termination&quot;, ie);
      Thread.currentThread().interrupt();
    }
  }

  protected final T getConfigs() {
    return configs;
  }
}</pre>

Difference in parse ". Python parser return ”, php parser return ". &#8221 in not transform in > within pre tag.

@ikirudennis ikirudennis changed the title Incorrect wrap pre in long text Incorrect handling of quote entities in extended pre block Sep 25, 2017
@ikirudennis
Copy link
Member

Thanks for this. I can see the issue, and while I usually like to use the text provided by users in issues to test against, in this case it can be reduced quite a bit while exposing the problem:

pre.. this is the first line

but "quotes" in an extended pre block need to be handled properly.

Should be rendered as:

<pre>this is the first line

but &quot;quotes&quot; in an extended pre block need to be handled properly.</pre>

Hopefully, I can sort this out relatively easily.

@ikirudennis
Copy link
Member

Actually, your test is more complete. There are issues with the angle brackets as well. Committing a fix shortly.

ikirudennis added a commit that referenced this issue Sep 25, 2017
@tynopet
Copy link
Author

tynopet commented Sep 27, 2017

Thank you!

@ikirudennis
Copy link
Member

This was merged into version 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants