From 77216f4c7e458d859adad028dc6b630628e48adf Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Thu, 11 Jun 2015 10:01:32 +0100 Subject: [PATCH] Revert to manually defining the Pages so we can order them --- mkdocs.yml | 16 ++++++++++++++-- mkdocs/relative_path_ext.py | 5 ++++- mkdocs/tests/build_tests.py | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index c33fdcb3..d5736eeb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,10 +4,22 @@ site_description: Project documentation with Markdown. repo_url: https://github.com/mkdocs/mkdocs/ +pages: +- Home: index.md +- User Guide: + - Writing Your Docs: user-guide/writing-your-docs.md + - Styling Your Docs: user-guide/styling-your-docs.md + - Configuration: user-guide/configuration.md + - Deploying your docs: user-guide/deploying-your-docs.md +- About: + - Release Notes: about/release-notes.md + - Contributing: about/contributing.md + - License: about/license.md + markdown_extensions: - toc: - permalink: "" + permalink:  - admonition: -copyright: Copyright © 2014, Tom Christie. Maintenance and development by Dougal Matthews +copyright: Copyright © 2014 Tom Christie, Dougal Matthews. google_analytics: ['UA-27795084-5', 'mkdocs.org'] diff --git a/mkdocs/relative_path_ext.py b/mkdocs/relative_path_ext.py index f5b800da..ab8fe901 100644 --- a/mkdocs/relative_path_ext.py +++ b/mkdocs/relative_path_ext.py @@ -35,8 +35,11 @@ tutorial/install.md | tutorial/install/ | ../img/initial-layout.png | tutorial/intro.md | tutorial/intro/ | ../../img/initial-layout.png | """ + from __future__ import unicode_literals + import logging +import os from markdown.extensions import Extension from markdown.treeprocessors import Treeprocessor @@ -69,7 +72,7 @@ def path_to_url(url, nav, strict): # the internal hyperlink, making sure the target actually exists. target_file = nav.file_context.make_absolute(path) - if target_file.startswith('/'): + if target_file.startswith(os.path.sep): target_file = target_file[1:] if target_file not in nav.source_files: diff --git a/mkdocs/tests/build_tests.py b/mkdocs/tests/build_tests.py index 9939b222..d2bf0900 100644 --- a/mkdocs/tests/build_tests.py +++ b/mkdocs/tests/build_tests.py @@ -345,12 +345,12 @@ class BuildTests(unittest.TestCase): def test_absolute_link(self): pages = [ 'index.md', + 'sub/index.md', ] site_nav = nav.SiteNavigation(pages) - markdown = "[test](/index.md)" + markdown = "[test 1](/index.md) [test 2](/sub/index.md)" cfg = load_config({'strict': True}) - build.convert_markdown(markdown, cfg, site_nav) def test_extension_config(self):