Class: Polytexnic::Pipeline
- Inherits:
-
Object
- Object
- Polytexnic::Pipeline
- Includes:
- Postprocessor, Preprocessor, Utils
- Defined in:
- lib/polytexnic.rb
Constant Summary
Constants included from Literal
Instance Attribute Summary collapse
-
#article ⇒ Object
Returns the value of attribute article.
-
#code_cache ⇒ Object
Returns the value of attribute code_cache.
-
#custom_commands ⇒ Object
Returns the value of attribute custom_commands.
-
#figure_quote_cache ⇒ Object
Returns the value of attribute figure_quote_cache.
-
#highlight_cache ⇒ Object
Returns the value of attribute highlight_cache.
-
#html ⇒ Object
Returns the value of attribute html.
-
#language_labels ⇒ Object
Returns the value of attribute language_labels.
-
#literal_cache ⇒ Object
Returns the value of attribute literal_cache.
-
#literal_html_cache ⇒ Object
Returns the value of attribute literal_html_cache.
-
#maketitle_elements ⇒ Object
Returns the value of attribute maketitle_elements.
-
#math_label_cache ⇒ Object
Returns the value of attribute math_label_cache.
-
#polytex ⇒ Object
Returns the value of attribute polytex.
-
#unicode_cache ⇒ Object
Returns the value of attribute unicode_cache.
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(source, options = {}) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #to_html ⇒ Object
- #to_latex ⇒ Object
Methods included from Utils
#add_font_info, #cache_urls, #debug?, #digest, #escape_backslashes, #expand_input!, #framed, #highlight, #highlight_lines, #highlight_source_code, #highlighted_lines, #horrible_backslash_kludge, #linux?, #os_x?, #os_x_newer?, #os_x_older?, #pipeline_digest, #profiling?, #set_test_mode!, #test?, #tralics, #tralics_commands, #underscore_digest, #xmlelement
Methods included from Postprocessor
Methods included from Polytexnic::Postprocessor::Polytex
#escape_hack, #fix_verbatim_bug, #remove_hypertarget, #write_polytex_code
Methods included from Polytexnic::Postprocessor::Latex
#extra_escape, #replace_hashes
Methods included from Polytexnic::Postprocessor::Html
Methods included from Preprocessor
Methods included from Polytexnic::Preprocessor::Polytex
#cache_code_environments, #cache_image_locations, #cache_latex_literal, #cache_math, #cache_raw_latex, #convert_code_inclusion, #convert_includegraphics, #remove_kramdown_comments, #restore_hashed_content, #restore_math, #to_polytex
Methods included from Literal
#cache_display_inline_math, #cache_display_math, #cache_inline_math, #cache_literal, #cache_literal_environments, #cache_unicode, #code_salt, #element, #equation_element, #hyperrefs, #literal_types, #math_environments
Methods included from Polytexnic::Preprocessor::Latex
#clean_latex_document, #convert_gifs, #polish_tables, #process_asides, #to_processed_latex
Methods included from Polytexnic::Preprocessor::Html
Constructor Details
#initialize(source, options = {}) ⇒ Pipeline
Returns a new instance of Pipeline.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/polytexnic.rb', line 44 def initialize(source, = {}) @literal_cache = [:literal_cache] || {} @unicode_cache = {} @code_cache = {} @figure_quote_cache = {} @literal_html_cache = {} @maketitle_elements = {} @article = [:article] @language_labels = if (labels = [:language_labels]).nil? default_language_labels else default_language_labels.merge(labels) end @highlight_cache_filename = '.highlight_cache' if File.exist?(@highlight_cache_filename) content = File.read(@highlight_cache_filename) .force_encoding('ASCII-8BIT') begin @highlight_cache = MessagePack.unpack(content) unless content.empty? rescue MessagePack::UnpackError FileUtils.rm @highlight_cache_filename end end @highlight_cache ||= {} @math_label_cache = {} @source_format = [:source] || :polytex @custom_commands = File.read(Polytexnic.core_style_file) rescue '' @custom_commands += "\n" + ([:custom_commands] || '') @source = source if markdown? preprocess(:polytex) postprocess(:polytex) end @polytex = @source end |
Instance Attribute Details
#article ⇒ Object
Returns the value of attribute article.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def article @article end |
#code_cache ⇒ Object
Returns the value of attribute code_cache.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def code_cache @code_cache end |
#custom_commands ⇒ Object
Returns the value of attribute custom_commands.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def custom_commands @custom_commands end |
#figure_quote_cache ⇒ Object
Returns the value of attribute figure_quote_cache.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def figure_quote_cache @figure_quote_cache end |
#highlight_cache ⇒ Object
Returns the value of attribute highlight_cache.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def highlight_cache @highlight_cache end |
#html ⇒ Object
Returns the value of attribute html.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def html @html end |
#language_labels ⇒ Object
Returns the value of attribute language_labels.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def language_labels @language_labels end |
#literal_cache ⇒ Object
Returns the value of attribute literal_cache.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def literal_cache @literal_cache end |
#literal_html_cache ⇒ Object
Returns the value of attribute literal_html_cache.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def literal_html_cache @literal_html_cache end |
#maketitle_elements ⇒ Object
Returns the value of attribute maketitle_elements.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def maketitle_elements @maketitle_elements end |
#math_label_cache ⇒ Object
Returns the value of attribute math_label_cache.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def math_label_cache @math_label_cache end |
#polytex ⇒ Object
Returns the value of attribute polytex.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def polytex @polytex end |
#unicode_cache ⇒ Object
Returns the value of attribute unicode_cache.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def unicode_cache @unicode_cache end |
#xml ⇒ Object
Returns the value of attribute xml.
39 40 41 |
# File 'lib/polytexnic.rb', line 39 def xml @xml end |
Instance Method Details
#to_html ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/polytexnic.rb', line 80 def to_html if profiling? require 'ruby-prof' RubyProf.start end puts "before preprocess:\n#{@polytex}" if debug? preprocess(:html) puts "\nafter preprocess:\n#{@xml}" if debug? postprocess(:html) puts "\nafter postprocess:\n#{@html}" if debug? if profiling? result = RubyProf.stop printer = RubyProf::GraphPrinter.new(result) printer.print(STDOUT, {}) end @html.strip end |
#to_latex ⇒ Object
100 101 102 103 104 |
# File 'lib/polytexnic.rb', line 100 def to_latex preprocess(:latex) postprocess(:latex) @latex end |