Plugin Directory

Changeset 522673


Ignore:
Timestamp:
03/23/2012 01:46:59 PM (14 years ago)
Author:
mathzqy
Message:

fix a small bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • latex/trunk/latex.php

    r522668 r522673  
    11<?php
    22/*
    3 Plugin Name: LaTex for WordPress
     3Plugin Name: LaTeX for WordPress
    44Plugin URI: http://wordpress.org/extend/plugins/latex/
    55Description: Using MathJax and LaTex image service, this plugin provides a general solution to add and display your mathematical fourmula, no matter the visitors are visiting your blog or read from Google Reader.
    6 Version: 3.4
     6Version: 3.41
    77Author: zhiqiang
    88Author URI: http://zhiqiang.org
     
    114114        $regex = '#\$\$(.*?)\$\$#si';
    115115       
    116         $toParse = str_replace(array("\(", "\)", "\[", "\]", "[latex]", "[tex]", "[/latex]", "[/tex]"), array("$$", " $$", "$$!", " $$", "$$", " $$", "$$", " $$"), $toParse);
     116        $toParse = str_replace(array("\(", "\)", "\[", "\]", "[latex]", "[tex]", "[/latex]", "[/tex]"), array("$$", "$$", "$$!", "$$", "$$", "$$", "$$", "$$"), $toParse);
    117117        return preg_replace_callback($regex, array(&$this, 'createTex'), $toParse);
    118118    }
     
    122122        $formula_text = $toTex[1];
    123123        $imgtext=false;
    124         if(substr($formula_text, -2) == "! ")   {
     124        if(substr($formula_text, -1) == "!")    {
    125125if (substr($formula_text, 0, 1) == "!")
    126             return "<code class='tex2jax_ignore'>\[".substr($formula_text, 1, -2)."\]</code>";
     126            return "<code class='tex2jax_ignore'>\[".substr($formula_text, 1, -1)."\]</code>";
    127127else
    128             return "<code class='tex2jax_ignore'>\(".substr($formula_text, 0, -2)."\)</code>";
     128            return "<code class='tex2jax_ignore'>\(".substr($formula_text, 0, -1)."\)</code>";
    129129}
    130130        if(substr($formula_text, 0, 1) == "!"){
Note: See TracChangeset for help on using the changeset viewer.