プロジェクト

全般

プロフィール

Vote #63825

未完了

Make {{toc}} render as properly nested list + skip support

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Wiki_1
対象バージョン:
-
開始日:
2008/09/04
期日:
進捗率:

50%

予定工数:
category_id:
1
version_id:
0
issue_org_id:
1857
author_id:
1596
assigned_to_id:
0
comments:
3
status_id:
1
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

The attached patch changes the {{toc}}-macro to render as a properly nested HTML unordered list.
Furthermore it adds a parameter to skip the first n headlines, because at least the first one is usually not interesting:

Example:
{{toc:1}} skips the first headline.
{{toc:3}} skips the first three headlines.

The patch also removes the (now superflous) css indentation rules for the

  • elements.


  • journals

    This patch produces invalid HTML when h1 > h2 > h3 hierarchy is not strictly respected.

    Example:

    <pre>
    h1. Heading 1

    h3. Heading 3
    </pre>

    produces non-matching closing tags:

    <pre>
    <ul class="toc">
    <li class="heading1">
    <a href="#Heading-1">Heading 1</a>
    </li>
    <li>
    <ul>
    <li class="heading3"><a href="#Heading-3">Heading 3</a></li>
    </ul>
    </li>
    </ul>
    </li>
    </ul>
    </pre>
    --------------------------------------------------------------------------------
    Sorry, no time to work on a patch right now.
    Please try to replace line 107-113 (after applying the old patch) with this:

    <pre>
    if level > lastlevel
    i = level
    while i > lastlevel
    out << "<li><ul>"
    i-=1
    end
    end

    if level < lastlevel
    while i < lastlevel
    out << "</ul></li>"
    i+=1
    end
    end
    </pre>

    That should create valid HTML even in the face of invalid nesting, I think.

    --------------------------------------------------------------------------------
    TOC is now rendered as nested lists (r4377).
    --------------------------------------------------------------------------------

    Admin Redmine さんが約4年前に更新

    • カテゴリWiki_1 にセット

    他の形式にエクスポート: Atom PDF

    いいね!0
    いいね!0