Sha256: 31e366586bd0f5774dc723c2d6fdee1167ec79adb033b7538ee80f0eb12044af

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

/*
 * redcloth_bbcode_inline.c.rl
 *
 * Copyright (C) 2009 Ryan Alyea
 */
#include <ruby.h>
#include "redcloth.h"

%%{
  
  machine redcloth_bbcode_inline;
  include redcloth_common "redcloth_common.c.rl";
  include redcloth_bbcode_inline "redcloth_bbcode_inline.rl";
  
  bbcode_tag = "[";
  
  dim_digit = [0-9.]+ ;
  prime = ("'" | '"')?;
  dim_noactions = dim_digit prime (("x" | " x ") dim_digit prime) %T (("x" | " x ") dim_digit prime)? ;
  
  other_phrase = phrase -- dim_noactions;
  
  main := |*
    bbcode_tag => {
      fhold;
      fcall bbcode_inline;
    };
    other_phrase => esc;
    PUNCT => esc;
    space => esc;
    
    EOF;
  *|;
  
}%%

%% write data nofinal;

VALUE
redcloth_bbcode_inline(self, p, pe, refs)
  VALUE self;
  char *p, *pe;
  VALUE refs;
{
  int cs, act, nest;
  char *ts = NULL, *te = NULL, *reg = NULL, *bck = NULL, *eof = NULL;
  char *orig_p = p, *orig_pe = pe;
  VALUE block = rb_str_new2("");
  VALUE regs = Qnil; CLEAR_REGS()
  unsigned int opts = 0;
  VALUE buf = Qnil;
  VALUE hash = Qnil;

  VALUE html = rb_str_new2("");
  VALUE failed_start = rb_str_new2("");
  char *failed_start_point_p = NULL, *failed_start_point_ts = NULL, *failed_start_point_te = NULL;
  int stack[CALL_STACK_SIZE],top,nested_quote = 0, nested_spoiler = 0, store_cite = 1, store_title = 1;

  %% write init;

  %% write exec;

  return block;
}

VALUE
redcloth_bbcode_inline2(self, str, refs)
  VALUE self, str, refs;
{
  StringValue(str);
  return redcloth_bbcode_inline(self, RSTRING_PTR(str), RSTRING_PTR(str) + RSTRING_LEN(str) + 1, refs);
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
BBRedCloth-0.8.4 ext/redcloth_scan/redcloth_bbcode_inline.c.rl
BBRedCloth-0.8.3 ext/redcloth_scan/redcloth_bbcode_inline.c.rl
BBRedCloth-0.8.2 ext/redcloth_scan/redcloth_bbcode_inline.c.rl
BBRedCloth-0.8.1 ext/redcloth_scan/redcloth_bbcode_inline.c.rl