Share on Google+Share on Google+

Klaus
Disable BBcode encoding within a latex tag
1 Answer(s)      4 years and 6 months 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!










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
nsstring encoding types
nsstring encoding types   What is NSString Encoding Type in XCode
Advertisements
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
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
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
uikeyboard disable return key
uikeyboard disable return key  uikeyboard - hot to disable return key
enable disable checkbox in javascript
enable disable checkbox in javascript  How to enable disable checkbox in javascript
How to disable an HTML object?
How to disable an HTML object?  How to disable an HTML object
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 UITableView Scrolling
Disable UITableView Scrolling   How to disable the UITableView Scrolling either programmatically or in XIB
Java file encoding
Java file encoding In this section, you will learn how to get the file encoding. Description of code: An encoding is a mapping between a byte value and its... stream and called its method getEncoding() which returns the desired encoding
White Space encoding problem in PDF
White Space encoding problem in PDF  I am reading PDF version 1.3 using iText. Things are fine but with one problem that is I am not able to get whitespace. Is there any problem in whitespace encoding in PDF version 1.3
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
Character encoding problem with chinese language
Character encoding problem with chinese language  I have a issue with characters in chinese locale in java. Iam using eclipse IDE My code is "java.util.Date stdDate = new SimpleDateFormat("dd/MM/yyyy").parse(10/10/2012); String
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
JSP URL Encoding
JSP URL Encoding          JSP URL Encoding is used to encode the url in JSP. URL Encoding is the process of converting string into valid URL format
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
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 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
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 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
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
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
Nest tables within tables
Nest tables within tables  Can I nest tables within tables
error within servlet
error within servlet  List leagueList=(List).context.getAttribute("leagueList"); this is one line in my servlet code. but i have error with this line. The error is.... illegal start of type. Cannot find symbol. Symbol:variable
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
How to Disable Catch-all Emails on CPanel
How to Disable Catch-all Emails on CPanel  Hi, How to disable catch all emails setting on CPanel? Thanks
How to disable task manager using java
How to disable task manager using java  How to disable task manager using java
Facelet define Tag
. This named content can be included within a template. This tag is used within... is given value "face1". So the content within define tag, whose name...Facelet define Tag      
Tutorials   
Java Spring Hibernate Struts Training I am Java programmer. Should I learn Java Script or Python? Delete multiple records with pagination by selecting checkboxes How to add one hour in php date? connection in php connection in php connection in php PHP magento how to make previous and next Button Display Data in php session written exam display database results question create a simple form Magento Strings in PHP Zend Framework Installation in xampp? How to prevent adding duplicate items to the shopping cart php problem maximum execution time of 30 seconds exceeded in php Call-time pass-by-reference has been removed in HTTP_POST_VARS is deprecated $_GET[] index is not defined Function mysql_db_query() is deprecated Function mysql_db_query() is deprecated Function split() is deprecated Fatal error: Call to undefined function session_register() in .php file php tag not working Error reporting in PHP Why are MySQL Routines and Views not used with PHP? How to add Click to copy function to my wordpres blog? connection of php to MySQL. loan calculator Datepicker not getting called through include function of php change url string integrate login in php Installation of wamp server Display PHP clock with user input date and time value in div from php, reloading form pre-populate form developing a system using php n mysql Configure apache Tomcat to work with Eclipse and PDT in php How to display a file for 24 hours? LOGIN ERROR LOGIN FAILED", $_SESSION['login fail']='0',}?> I GOT ERROR FOR MY PROJECT PHP Sending emails and insert into trable Tutorial college Student Admission System PLZ HELP ME. i need php code.

Ads

 
Advertisement null

Ads