Disable BBcode encoding within a latex tag

Ads

 
 

Share on Google+Share on Google+

Klaus
Disable BBcode encoding within a latex tag
1 Answer(s)      5 years and a month ago
Posted in : PHP

Hello, I have the following bb function

function bb($string) {
  $string = trim($string);
  $search = array(
    '@\<(?i)latex\>(.*?)\</(?i)latex\>@si',
    '@\<(?i)b\>(.*?)\</(?i)b\>@si',
    '@\<(?i)i\>(.*?)\</(?i)i\>@si',
    '@\<(?i)u\>(.*?)\</(?i)u\>@si',
    '@\<(?i)blockquote\>(.*?)\</(?i)blockquote\>@si',
    '@\<(?i)pre\>(.*?)\</(?i)pre\>@si'
  );
  $replace = array(
    '<img src="cgi/mathtex.cgi?\\1">',
    '<b>\\1</b>',
    '<i>\\1</i>',
    '<u>\\1</u>',
    '<blockquote>\\1</blockquote>',
    '<pre>\\1</pre>'
  );
  $string = strtr($string, array("\n" => '<br>'));
  $string = preg_replace($search ,$replace, $string);
  return $string;
}

The problem is that if one enters newlines within latex tags (to make latex more clearly arranged), the function replaces the \n by <br>, which then becomes of course invalid latex code. How to disable the encoding of code which is within latex tags?

Ads
View Answers

October 6, 2012 at 12:01 AM


fixed!


Ads









Related Tutorials/Questions & Answers:
Disable BBcode encoding within a latex tag
Disable BBcode encoding within a latex tag  Hello, I have... invalid latex code. How to disable the encoding of code which is within latex tags... is that if one enters newlines within latex tags (to make latex more clearly
Version of com.nfbsoftware>latex-converter dependency
List of Version of com.nfbsoftware>latex-converter dependency
Advertisements
Version of com.nfbsoftware>latex-converter dependency
List of Version of com.nfbsoftware>latex-converter dependency
disable function
disable function  Sir, I have called a java script function when one radio button is checked i want to disable this function when another radio button is checked ,both radio buttons are of same group Please help Thanks in advance
Version of maven>maven-latex-plugin dependency
List of Version of maven>maven-latex-plugin dependency
Maven Dependency latex-converter >> 1.0.0
You should include the dependency code given in this page to add Maven Dependency of com.nfbsoftware >> latex-converter version1.0.0 in your project
Maven Dependency latex-converter >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of com.nfbsoftware >> latex-converter version1.0.1 in your project
How to disable an HTML object?
How to disable an HTML object?  How to disable an HTML object
enable disable checkbox in javascript
enable disable checkbox in javascript  How to enable disable checkbox in javascript
uikeyboard disable return key
uikeyboard disable return key  uikeyboard - hot to disable return key
nsstring encoding types
nsstring encoding types   What is NSString Encoding Type in XCode
JSF verbatim Tag
of this tag. This tag can be used to nest plain html within the JSF component tree. Any Html and jsp tags in the view tag can be nested within verbatim tag. The reason...JSF verbatim Tag      
Disable UITableView Scrolling
Disable UITableView Scrolling   How to disable the UITableView Scrolling either programmatically or in XIB
disable keyboard in java applet
disable keyboard in java applet  How to disable key board of my client in an java applet embedded in a website while the applet is running.? Plz help
Maven Dependency maven-latex-plugin >> 1.0
You should include the dependency code given in this page to add Maven Dependency of maven >> maven-latex-plugin version1.0 in your project
Maven Dependency maven-latex-plugin >> 1.2
You should include the dependency code given in this page to add Maven Dependency of maven >> maven-latex-plugin version1.2 in your project
Maven Dependency maven-latex-plugin >> 1.4.1
You should include the dependency code given in this page to add Maven Dependency of maven >> maven-latex-plugin version1.4.1 in your project
enable disable table
enable disable table  hi I have table with 3 columns if i click one column the other 2 column should disable pls can anyboby help me
URL Encoding and URL Decoding
URL Encoding and URL Decoding  What is URL Encoding and URL Decoding ?   URL encoding is the method of replacing all the spaces and other extra characters into their corresponding Hex Characters and Decoding
uitextfield disable keyboard
uitextfield disable keyboard  How to disable keyboard of UITextView in iPhone SDK application?   There are two ways to disable the keyboard...)]; [self.view¬†addSubview:pv]; return¬†NO; } //or simply disable
Output Encoding - JSP-Servlet
Output Encoding  From security vulnerability perspective, we?d like to perform output encoding of special characters (ex: < > ? ? % ; ( ) & +) on JSP while displaying pages.How can this be achieved ? Can we achieve
Facelet remove Tag
Facelet remove Tag          This tag is used to remove content within this tag  from a facelet at compile time. This tag don't have any
code to disable back button of browser
code to disable back button of browser  code to disable back button of browser
code to disable back button of browser
code to disable back button of browser  code to disable back button of browser
disable and enable the submit buttons
disable and enable the submit buttons  i have two summit button in my form. one is disabled and other is navigating to the other page. after 3 submissions of the submit button the disabled one must be enabled and the enabled one
Disable of Combo - JSP-Servlet
Disable of Combo  Hi! Thanks for your fast reply. In my project i am giving grading facility to the user. Once user selected his grade in combo.... That means every user can give grade only at once... so i would like to disable
Nest tables within tables
Nest tables within tables  Can I nest tables within tables
how to disable browser back button
how to disable browser back button  Am doing a web application in that how to disable browser back button using java script
HTTP URL Address Encoding in Java
HTTP URL Address Encoding in Java  HTTP URL Address Encoding in Java
Setting the default Java character encoding?
Setting the default Java character encoding?  Setting the default Java character encoding
disable the form - JSP-Servlet
disable the form  Hi All, I'm developing a small application. I wrote jsp page in that 8 forms are there.all forms are same but the input values... that particular button disable by using document.formname.buttonname.disable = true

Ads

 
Advertisement null

Ads