Skip to content

Commit

Permalink
Generate new hash using html5 block names
Browse files Browse the repository at this point in the history
  • Loading branch information
silverhammermba committed Dec 11, 2013
1 parent 52c5fa3 commit 108e65d
Showing 1 changed file with 63 additions and 51 deletions.
114 changes: 63 additions & 51 deletions ext/redcarpet/html_blocks.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* C code produced by gperf version 3.0.3 */
/* C code produced by gperf version 3.0.4 */
/* Command-line: gperf -N find_block_tag -H hash_block_tag -C -c -E --ignore-case html_block_names.txt */
/* Computed positions: -k'1-2' */

Expand Down Expand Up @@ -29,7 +29,7 @@
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif

/* maximum key range = 37, duplicates = 0 */
/* maximum key range = 51, duplicates = 0 */

#ifndef GPERF_DOWNCASE
#define GPERF_DOWNCASE 1
Expand Down Expand Up @@ -93,32 +93,32 @@ hash_block_tag (str, len)
{
static const unsigned char asso_values[] =
{
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
8, 30, 25, 20, 15, 10, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 0, 38, 0, 38,
5, 5, 5, 15, 0, 38, 38, 0, 15, 10,
0, 38, 38, 15, 0, 5, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 0, 38,
0, 38, 5, 5, 5, 15, 0, 38, 38, 0,
15, 10, 0, 38, 38, 15, 0, 5, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38, 38, 38, 38, 38, 38, 38
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
35, 30, 25, 20, 15, 10, 53, 53, 53, 53,
53, 53, 53, 53, 53, 15, 0, 25, 15, 53,
5, 10, 15, 25, 0, 53, 53, 0, 25, 5,
5, 53, 53, 0, 10, 0, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 15, 0, 25,
15, 53, 5, 10, 15, 25, 0, 53, 53, 0,
25, 5, 5, 53, 53, 0, 10, 0, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53
};
register int hval = len;

Expand All @@ -136,7 +136,7 @@ hash_block_tag (str, len)

#ifdef __GNUC__
__inline
#ifdef __GNUC_STDC_INLINE__
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif
Expand All @@ -147,47 +147,59 @@ find_block_tag (str, len)
{
enum
{
TOTAL_KEYWORDS = 24,
TOTAL_KEYWORDS = 33,
MIN_WORD_LENGTH = 1,
MAX_WORD_LENGTH = 10,
MIN_HASH_VALUE = 1,
MAX_HASH_VALUE = 37
MIN_HASH_VALUE = 2,
MAX_HASH_VALUE = 52
};

static const char * const wordlist[] =
{
"", "",
"ul",
"",
"p",
"dl",
"div",
"math",
"table",
"style",
"p",
"ol",
"pre",
"",
"ul",
"del",
"form",
"blockquote",
"figure",
"ol",
"section",
"fieldset",
"",
"h1",
"",
"h6",
"pre",
"form",
"table",
"footer",
"dl",
"div",
"", "",
"script",
"article",
"del",
"", "",
"header",
"h6",
"nav",
"",
"aside",
"canvas",
"h5",
"ins",
"", "",
"hgroup",
"h4",
"noscript",
"",
"style",
"", "",
"iframe",
"h4",
"ins",
"", "", "",
"h3",
"",
"abbr",
"", "",
"h2",
"", "", "", "",
"h2"
"h1"
};

if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
Expand Down

0 comments on commit 108e65d

Please sign in to comment.