Plugin Directory

Changeset 489021


Ignore:
Timestamp:
01/12/2012 09:24:42 PM (14 years ago)
Author:
divinenephron
Message:

Added the latex_text() function to escape Latex macro arguments.

Location:
latex-everything/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • latex-everything/trunk/default-template.php

    r489019 r489021  
    88<?php the_post() ?>
    99
    10 \date{<?php h2l( get_the_date() ) ?>}
    11 \title{<?php h2l( get_the_title() ) ?>}
    12 \author{<?php h2l( get_the_author() ) ?>}
     10\date{<?php lt( get_the_date() ) ?>}
     11\title{<?php lt( get_the_title() ) ?>}
     12\author{<?php lt( get_the_author() ) ?>}
    1313
    1414\begin{document}
  • latex-everything/trunk/html-to-latex.php

    r489019 r489021  
    3333 *                      $element (The DOMText object the text is from)
    3434 */
     35
     36define( 'H2L_DEBUG', false );
    3537
    3638class A2l_Html_To_Latex {
     
    115117                    $tag = $this->tags[$element->tagName];
    116118                    $handler = $tag['handler'];
     119                    if (H2L_DEBUG)
     120                        error_log( "Sending {$element->tagName} tag to {$handler[1]} handler. \"{$element->textContent}\"" );
    117121                    if ( is_callable( $handler ) ) {
    118122                        $output .= apply_filters( "a2l_{$element->tagName}_element",
     
    127131                }
    128132            } else if ( $element->nodeType == XML_TEXT_NODE ) {
    129                 $output .= apply_filters( 'a2l_text',
    130                         $element->wholeText,
    131                         $element );
     133                if ( H2L_DEBUG )
     134                    error_log( "Have text node: {$element->wholeText}" );
     135                $output .= get_latex_text( $element->wholeText );
    132136            } else if ( $element->nodeType == XML_DOCUMENT_NODE ) {
    133137                $output .= $this->_texify( $element );
     
    286290
    287291    }
    288 
    289 
    290292}
    291293
     
    302304        $a2l_html_to_latex = new A2l_Html_To_Latex();
    303305    return $a2l_html_to_latex->html_to_latex( $html );
     306}
     307
     308function lt( $text ) {
     309    latex_text( $text );
     310}
     311function latex_text( $text ) {
     312    echo get_latex_text( $text );
     313}
     314function get_latex_text ( $text ) {
     315    return apply_filters( 'a2l_latex_text', $text );
    304316}
    305317
     
    328340
    329341// Register filters
    330 add_filter('a2l_img_element', 'float_filter', 98);
    331 add_filter('a2l_table_element', 'float_filter', 98);
    332 add_filter('a2l_text', 'urlify_filter', 98);
    333 add_filter('a2l_text','quote_expansion_filter', 99);
     342add_filter('a2l_img_element', 'float_filter' );
     343add_filter('a2l_table_element', 'float_filter' );
     344add_filter('a2l_latex_text', 'urlify_filter' );
     345add_filter('a2l_latex_text','quote_expansion_filter' );
    334346
    335347?>
Note: See TracChangeset for help on using the changeset viewer.