Skip to content

Commit

Permalink
Updated submodule hoedown
Browse files Browse the repository at this point in the history
Updated option name: HoedownTocStarting -> HoedownTocBegin
Updated option name: HoedownTocNesting -> HoedownTocEnd
  • Loading branch information
kamijo committed Mar 26, 2014
1 parent 6d2620d commit 9c49ed4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 60 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ String:

Numeric:

* [HoedownTocStarting](#hoedowntocstarting)
* [HoedownTocNesting](#hoedowntocnesting)
* [HoedownTocBegin](#hoedowntocbegin)
* [HoedownTocEnd](#hoedowntocend)

On/Off:

Expand Down Expand Up @@ -199,7 +199,7 @@ Content Cell | Content Cel</p>
Enable:

```
<pre><code class="php">echo &quot;hello world&quot;;
<pre><code class="language-php">echo &quot;hello world&quot;;
</code></pre>
```

Expand Down Expand Up @@ -234,13 +234,13 @@ Enable:
<hr>
<ol>
<li id="fn1">
<p>This is a footnote&nbsp;<a href="#fnref1" rel="footnote-ref">&#8617;</a></p>
<p>This is a footnote&nbsp;<a href="#fnref1" rev="footnote">&#8617;</a></p>
</li>
<li id="fn2">
<p>A footnote on &quot;label&quot;&nbsp;<a href="#fnref2" rel="footnote-ref">&#8617;</a></p>
<p>A footnote on &quot;label&quot;&nbsp;<a href="#fnref2" rev="footnote">&#8617;</a></p>
</li>
<li id="fn3">
<p>The definition of a footnote.&nbsp;<a href="#fnref3" rel="footnote-ref">&#8617;</a></p>
<p>The definition of a footnote.&nbsp;<a href="#fnref3" rev="footnote">&#8617;</a></p>
</li>
</ol>
</div>
Expand Down Expand Up @@ -433,7 +433,7 @@ Enable:
<ul>
<li id="item1" class="item">item1</li>
<li id="item2" class="hoge item"><p>item2</p></li>
<li id="item2" class="hoge item">item2</li>
</ul>
```

Expand All @@ -446,7 +446,7 @@ Disable:
<ul>
<li>item1 {#item1 .item}</li>
<li><p>item2 {.hoge #item2 .item}</p></li>
<li>item2 {.hoge #item2 .item}</li>
</ul>
```

Expand Down Expand Up @@ -708,15 +708,15 @@ Table of contents header.

Table of contents footer.

View the table of contents as a HoedownTocNesting from HoedownTocStarting.
View the table of contents as a HoedownTocEnd from HoedownTocBegin.

#### HoedownTocStarting
#### HoedownTocBegin

Table of contents starting level (default: 2).
Table of contents begin level (default: 2).

#### HoedownTocNesting
#### HoedownTocEnd

Table of contents nesting level (default: 6).
Table of contents end level (default: 6).

```
# header1
Expand Down Expand Up @@ -759,7 +759,7 @@ default:
</ul>
```

conf: `HoedownTocStarting 1`, `HoedownTocNesting 3`
conf: `HoedownTocBegin 1`, `HoedownTocEnd 3`

```
<ul>
Expand Down Expand Up @@ -815,11 +815,11 @@ You can change the toc range by specifying the toc parameters.

* `http://localhot/markdown.md?toc=3`

Same as HoedownTocStarting = 3, HoedownTocNesting = 3.
Same as HoedownTocBegin = 3, HoedownTocEnd = 3.

* `http://localhot/markdown.md?toc=3:5`

Same as HoedownTocStarting = 3, HoedownTocNesting = 5.
Same as HoedownTocBegin = 3, HoedownTocEnd = 5.


#### HoedownRenderTocUnescape
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT(mod_hoedown, 0.3.1,[])
AC_INIT(mod_hoedown, 0.4.0,[])

AC_CONFIG_SRCDIR([mod_hoedown.c])
AC_CONFIG_HEADERS([config.h])
Expand Down
2 changes: 1 addition & 1 deletion hoedown
Submodule hoedown updated 1 files
+7 −6 src/html.c
77 changes: 35 additions & 42 deletions mod_hoedown.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
** # Toc options
** HoedownTocHeader '<div class="toc">'
** HoedownTocFooter '</div>'
** HoedownTocStarting 2
** HoedownTocNesting 6
** HoedownTocBegin 2
** HoedownTocEnd 6
** HoedownTocUnescape Off
** # Raw options
** HoedownRaw On
Expand Down Expand Up @@ -108,8 +108,8 @@
#define HOEDOWN_TAG "<body*>"
#define HOEDOWN_STYLE_EXT ".html"
#define HOEDOWN_DIRECTORY_INDEX "index.md"
#define HOEDOWN_TOC_STARTING 2
#define HOEDOWN_TOC_NESTING 6
#define HOEDOWN_TOC_BEGIN 2
#define HOEDOWN_TOC_END 6

typedef struct {
char *default_page;
Expand All @@ -125,8 +125,8 @@ typedef struct {
char *task;
} class;
struct {
int starting;
int nesting;
int begin;
int end;
int unescape;
char *header;
char *footer;
Expand Down Expand Up @@ -364,7 +364,7 @@ hoedown_handler(request_rec *r)
char *text = NULL;
char *raw = NULL;
char *toc = NULL;
int toc_starting = HOEDOWN_TOC_STARTING, toc_nesting = HOEDOWN_TOC_NESTING;
int toc_begin = HOEDOWN_TOC_BEGIN, toc_end = HOEDOWN_TOC_END;
apreq_handle_t *apreq;
apr_table_t *params;

Expand Down Expand Up @@ -469,8 +469,8 @@ hoedown_handler(request_rec *r)
}

/* default toc level */
toc_starting = cfg->toc.starting;
toc_nesting = cfg->toc.nesting;
toc_begin = cfg->toc.begin;
toc_end = cfg->toc.end;

if (ib->size > 0) {
if (cfg->raw != 0 && raw != NULL) {
Expand All @@ -483,8 +483,11 @@ hoedown_handler(request_rec *r)
/* output style header */
fp = style_header(r, cfg, style, r->filename);

/* performing markdown parsing */
ob = hoedown_buffer_new(HOEDOWN_OUTPUT_UNIT);

/* toc */
if (cfg->html & HOEDOWN_HTML_TOC) {
/* toc */
if (toc) {
size_t len = strlen(toc);
int n;
Expand All @@ -497,31 +500,29 @@ hoedown_handler(request_rec *r)
toc_b = apr_pstrndup(r->pool, toc, i++);
n = atoi(toc_b);
if (n) {
toc_starting = n;
toc_begin = n;
}

toc_e = apr_pstrndup(r->pool, toc + i, len - i);
n = atoi(toc_e);
if (n) {
toc_nesting = n;
toc_end = n;
}
} else {
n = atoi(toc);
if (n) {
toc_starting = n;
toc_begin = n;
}
}
}
}

ob = hoedown_buffer_new(HOEDOWN_OUTPUT_UNIT);

renderer = hoedown_html_toc_renderer_new(0);
state = (hoedown_html_renderer_state *)renderer->opaque;

state->flags = cfg->html;
state->toc_data.level_offset = toc_starting;
state->toc_data.nesting_level = toc_nesting;
state->toc_data.level_offset = toc_begin;
state->toc_data.nesting_level = toc_end;
#ifdef HOEDOWN_VERSION_EXTRAS
state->toc_data.header = cfg->toc.header;
state->toc_data.footer = cfg->toc.footer;
Expand All @@ -537,22 +538,14 @@ hoedown_handler(request_rec *r)

ap_rwrite(ob->data, ob->size, r);

hoedown_buffer_free(ob);
hoedown_buffer_reset(ob);
}

/* performing markdown parsing */
ob = hoedown_buffer_new(HOEDOWN_OUTPUT_UNIT);

/* markdown render */
renderer = hoedown_html_renderer_new(0, 0);
state = (hoedown_html_renderer_state *)renderer->opaque;

state->flags = cfg->html;

state->toc_data.level_offset = toc_starting;
state->toc_data.nesting_level = toc_nesting;
renderer = hoedown_html_renderer_new(cfg->html, toc_end);

#ifdef HOEDOWN_VERSION_EXTRAS
state = (hoedown_html_renderer_state *)renderer->opaque;
if ((state->flags & HOEDOWN_HTML_USE_TASK_LIST) && cfg->class.task) {
state->class_data.task = cfg->class.task;
}
Expand Down Expand Up @@ -607,8 +600,8 @@ hoedown_create_dir_config(apr_pool_t *p, char * UNUSED(dir))
cfg->class.ul = NULL;
cfg->class.ol = NULL;
cfg->class.task = NULL;
cfg->toc.starting = HOEDOWN_TOC_STARTING;
cfg->toc.nesting = HOEDOWN_TOC_NESTING;
cfg->toc.begin = HOEDOWN_TOC_BEGIN;
cfg->toc.end = HOEDOWN_TOC_END;
cfg->toc.header = NULL;
cfg->toc.footer = NULL;
cfg->toc.unescape = 0;
Expand Down Expand Up @@ -674,15 +667,15 @@ hoedown_merge_dir_config(apr_pool_t *p, void *base_conf, void *override_conf)
}
#endif

if (override->toc.starting != HOEDOWN_TOC_STARTING) {
cfg->toc.starting = override->toc.starting;
if (override->toc.begin != HOEDOWN_TOC_BEGIN) {
cfg->toc.begin = override->toc.begin;
} else {
cfg->toc.starting = base->toc.starting;
cfg->toc.begin = base->toc.begin;
}
if (override->toc.nesting != HOEDOWN_TOC_NESTING) {
cfg->toc.nesting = override->toc.nesting;
if (override->toc.end != HOEDOWN_TOC_END) {
cfg->toc.end = override->toc.end;
} else {
cfg->toc.nesting = base->toc.nesting;
cfg->toc.end = base->toc.end;
}
#ifdef HOEDOWN_VERSION_EXTRAS
if (override->toc.header && strlen(override->toc.header) > 0) {
Expand Down Expand Up @@ -811,12 +804,12 @@ hoedown_cmds[] = {
OR_ALL, "hoedown task list class attributes"),
#endif
/* Toc options */
AP_INIT_TAKE1("HoedownTocStarting", ap_set_int_slot,
(void *)APR_OFFSETOF(hoedown_config_rec, toc.starting),
OR_ALL, "hoedown toc starting level"),
AP_INIT_TAKE1("HoedownTocNesting", ap_set_int_slot,
(void *)APR_OFFSETOF(hoedown_config_rec, toc.nesting),
OR_ALL, "hoedown toc nesting level"),
AP_INIT_TAKE1("HoedownTocBegin", ap_set_int_slot,
(void *)APR_OFFSETOF(hoedown_config_rec, toc.begin),
OR_ALL, "hoedown toc begin level"),
AP_INIT_TAKE1("HoedownTocEnd", ap_set_int_slot,
(void *)APR_OFFSETOF(hoedown_config_rec, toc.end),
OR_ALL, "hoedown toc end level"),
#ifdef HOEDOWN_VERSION_EXTRAS
AP_INIT_TAKE1("HoedownTocHeader", ap_set_string_slot,
(void *)APR_OFFSETOF(hoedown_config_rec, toc.header),
Expand Down

0 comments on commit 9c49ed4

Please sign in to comment.