diff --git a/blog_limos.egg-info/PKG-INFO b/blog_limos.egg-info/PKG-INFO new file mode 100644 index 0000000000000000000000000000000000000000..ae8c7519ba6432641447b711172fad5dbf0e55ae --- /dev/null +++ b/blog_limos.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: blog-limos +Version: 1.0 +Summary: UNKNOWN +Home-page: UNKNOWN +Author: UNKNOWN +Author-email: UNKNOWN +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN diff --git a/blog_limos.egg-info/SOURCES.txt b/blog_limos.egg-info/SOURCES.txt new file mode 100644 index 0000000000000000000000000000000000000000..85f59b0e0b5e6ea9ebb76af7c573829fc4e219e7 --- /dev/null +++ b/blog_limos.egg-info/SOURCES.txt @@ -0,0 +1,5 @@ +blog_limos.egg-info/PKG-INFO +blog_limos.egg-info/SOURCES.txt +blog_limos.egg-info/dependency_links.txt +blog_limos.egg-info/requires.txt +blog_limos.egg-info/top_level.txt \ No newline at end of file diff --git a/blog_limos.egg-info/dependency_links.txt b/blog_limos.egg-info/dependency_links.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/blog_limos.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/blog_limos.egg-info/requires.txt b/blog_limos.egg-info/requires.txt new file mode 100644 index 0000000000000000000000000000000000000000..6adec76cfb940b46229998da006ea7481d624637 --- /dev/null +++ b/blog_limos.egg-info/requires.txt @@ -0,0 +1,3 @@ +pelican +markdown +beautifulsoup4 diff --git a/blog_limos.egg-info/top_level.txt b/blog_limos.egg-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/blog_limos.egg-info/top_level.txt @@ -0,0 +1 @@ + diff --git a/content/ispconfig/git-kit-survie.md b/content/cri/documentation.md similarity index 98% rename from content/ispconfig/git-kit-survie.md rename to content/cri/documentation.md index 8574084148abbc9649e6e4a42061a1782f6127df..fc77a18951a465489f416508a2715c3887d15feb 100644 --- a/content/ispconfig/git-kit-survie.md +++ b/content/cri/documentation.md @@ -1,5 +1,5 @@ -Title: Les documentations ISIMA/LIMOS (cri ou utilisateur) -Date: 2017-05-03 10:20 +Title: Les documentations cri et utilisateur pour ISIMA/LIMOS +Date: 2017-05-16 10:20 Status: Published Tags: doc, admin, www diff --git a/content/pages/cours.md b/content/pages/cours.md index 6bfc9b22f9c622f0e98e0664b53254dacae89ac5..a00ec6b8ddd491974c4ae25ec5ec509dee7ff8da 100644 --- a/content/pages/cours.md +++ b/content/pages/cours.md @@ -1,7 +1,4 @@ Title: <i class="fa fa-graduation-cap" aria-hidden="true"></i> Cours -Date: 2010-12-30 10:25 -Category: pipo -Tags: pipo, mollo +Date: 2017-05-16 10:25 -## Following is a review of my favorite mechanical keyboard. - page +## Cette page est actuellement en cours de construction diff --git a/content/pages/moi.md b/content/pages/moi.md index 4e1c42a17d2d3db2d454eff68b3da84c24d11b54..f50523ff0f87010a57f48fa1aaa60c953acd3a8e 100644 --- a/content/pages/moi.md +++ b/content/pages/moi.md @@ -1,9 +1,4 @@ Title: <i class="fa fa-briefcase" aria-hidden="true"></i> À propos -Date: 2010-12-28 10:27 -Category: pipo -Tags: pipo, mollo +Date: 2010-05-17 10:27 -## Following is a review of my favorite mechanical keyboard. - - - page +## Cette page est actuellement en cours de construction diff --git a/content/pages/projets.md b/content/pages/projets.md index 1c545c35a485d99ac6f6180e0e7c7a222b7001ea..6cdeac434938b141f2413c07f9c43c435a2a960a 100644 --- a/content/pages/projets.md +++ b/content/pages/projets.md @@ -1,8 +1,4 @@ Title: <i class="fa fa-cogs" aria-hidden="true"></i> Projets -Date: 2010-12-12 10:25 +Date: 2010-05-17 10:27 - - -## Following is a review of my favorite mechanical keyboard. - - page +## Cette page est actuellement en cours de construction diff --git a/content/pages/recherche.md b/content/pages/recherche.md index 1cde025f621b8bb3af977188b210cb3eb05814c4..2d40896a769cd96c0252db7172afafd01b0d846b 100644 --- a/content/pages/recherche.md +++ b/content/pages/recherche.md @@ -1,7 +1,4 @@ Title: <i class="fa fa-flask" aria-hidden="true"></i> Recherche -Date: 2010-12-29 10:26 -Category: pipo -Tags: pipo, mollo +Date: 2010-05-17 10:27 -## Following is a review of my favorite mechanical keyboard. - page +## Cette page est actuellement en cours de construction diff --git a/pelicanconf.py b/pelicanconf.py index cfdc68afd6c71aa72b711405c4e68a85b6e465d4..1540b5fcc9adee27793270cdd537cc0cb06194c7 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -94,7 +94,8 @@ DISPLAY_CATEGORIES_ON_MENU = False THEME = os.path.dirname(os.path.abspath(__file__)) + "/themes/limos" JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n']} PLUGIN_PATHS = [os.path.dirname(os.path.abspath(__file__)) + '/plugins'] -PLUGINS = ['i18n_subsites', 'tag_cloud', 'tipue_search'] +PLUGINS = ['i18n_subsites', 'tag_cloud', 'tipue_search', 'extract_toc'] #, 'pandoc_reader'] +MARKDOWN = {'extensions': ['toc']} I18N_TEMPLATES_LANG = 'en' # https://bootswatch.com/ SHOW_ARTICLE_AUTHOR = False diff --git a/plugins/extract_toc/README.md b/plugins/extract_toc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..40d2bee55efe85cf4b1f71425e002919dbe0accc --- /dev/null +++ b/plugins/extract_toc/README.md @@ -0,0 +1,137 @@ +Extract Table of Content +======================== + +A Pelican plugin to extract table of contents (ToC) from `article.content` and +place it in its own `article.toc` variable for use in templates. + +Copyright (c) Talha Mansoor + +Author | Talha Mansoor +----------------|----- +Author Email | talha131@gmail.com +Author Homepage | http://onCrashReboot.com +Github Account | https://github.com/talha131 + + +Acknowledgement +--------------- + +Thanks to [Avaris](https://github.com/avaris) for going out of the way to help +me fix Unicode issues and doing a thorough code review. + +Thanks to [gw0](http://gw.tnode.com/) for adding Pandoc reader support. + + +Why do you need it? +=================== + +Pelican can generate ToC of reST and Markdown files, using markup's respective +directive and extension. Such ToC is generated and placed at the beginning of +`article.content` like a string. Consequently it can not be placed anywhere +else on the page (eg. `<nav>` HTML5 tag, in header, or at the end of your +article's contents). + +To solve this problem, this plugin extracts ToC from `article.content` and +places it in its own `article.toc` variable for use in templates. + + +Requirements +============ + +`extract_toc` requires BeautifulSoup. + +```bash +pip install beautifulsoup4 +``` + + +How to Use +========== + +This plugin works by extracting the first occurrence of enclosed in: + +- `<div class="toc">` for the default Markdown reader +- `<div class="contents topic">` for the default reStructuredText reader +- `<nav class="TOC">` for the Pandoc reader + +If ToC appears in your article at more than one places, `extract_toc` will +remove only the first occurrence. You shouldn't probably need to have multiple +ToC in your article. In case you need to display it multiple times, you can +print it via your template. + + +Template example +---------------- + +Add something like this to your Pelican templates if missing: + +```python +{% if article.toc %} + <nav class="toc"> + {{ article.toc }} + </nav> +{% endif %} +``` + + +reStructuredText reader +----------------------- + +To add a table of contents to your reStructuredText document (`.rst`) you need to add a `.. contents::` directive to its beginning. See the [docutils documentation](http://docutils.sourceforge.net/docs/ref/rst/directives.html#table-of-contents) for more details. + +```rst +My super title +############## + +:date: 2010-10-03 +:tags: thats, awesome + +.. contents:: +.. + 1 Head 1 + 1.1 Head 2 + 2 Head 3 + 3 head 4 + +Heading 1 +--------- + +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. +``` + + +Markdown reader +--------------- + +To enable table of contents generation for the Markdown reader you need to set `MD_EXTENSIONS = (['toc'])` in your Pelican configuration file. + +To add a table of contents to your Markdown document (`.md`) you need to place the `[TOC]` marker to its beginning. See the [Python Markdown documentation](http://pythonhosted.org/Markdown/extensions/toc.html) for more details. + +```markdown +title: My super title +date: 4-4-2013 +tags: thats, awesome + +[TOC] + +# Heading 1 # + +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. +``` + + +Pandoc reader +------------- + +To enable table of contents generation for the Pandoc reader you need to set `PANDOC_ARGS = (['--toc', '--template=pandoc-template-toc'])` in your Pelican configuration file. + +Contents of the Pandoc template file `pandoc-template-toc.html5`: + +```html +$if(toc)$ +<nav id="TOC"> +$toc$ +</nav> +$endif$ +$body$ +``` diff --git a/plugins/extract_toc/__init__.py b/plugins/extract_toc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..52c57781152f76c5ba831d583d4a46fc2420607a --- /dev/null +++ b/plugins/extract_toc/__init__.py @@ -0,0 +1 @@ +from .extract_toc import * diff --git a/plugins/extract_toc/extract_toc.py b/plugins/extract_toc/extract_toc.py new file mode 100644 index 0000000000000000000000000000000000000000..415e6184c1d70db0beb91e69c99ff1d33e5274f5 --- /dev/null +++ b/plugins/extract_toc/extract_toc.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +""" +Extract Table of Content +======================== + +A Pelican plugin to extract table of contents (ToC) from `article.content` and +place it in its own `article.toc` variable for use in templates. +""" + +from os import path +from bs4 import BeautifulSoup +from pelican import signals, readers, contents +import logging +import os + +logger = logging.getLogger(__name__) + + +def extract_toc(content): + if isinstance(content, contents.Static): + return + + soup = BeautifulSoup(content._content, 'html.parser') + filename = content.source_path + extension = path.splitext(filename)[1][1:] + toc = None + + # default Markdown reader + if not toc and readers.MarkdownReader.enabled and extension in readers.MarkdownReader.file_extensions: + toc = soup.find('div', class_='toc') + if toc: + toc.extract() + + # default reStructuredText reader + if not toc and readers.RstReader.enabled and extension in readers.RstReader.file_extensions: + toc = soup.find('div', class_='contents topic') + if toc: + toc.extract() + tag = BeautifulSoup(str(toc), 'html.parser') + tag.div['class'] = 'toc' + tag.div['id'] = '' + p = tag.find('p', class_='topic-title first') + if p: + p.extract() + toc = tag + + # Pandoc reader (markdown and other formats) + if 'pandoc_reader' in content.settings['PLUGINS']: + try: + from pandoc_reader import PandocReader + except ImportError: + PandocReader = False + if not toc and PandocReader and PandocReader.enabled and extension in PandocReader.file_extensions: + toc = soup.find('nav', id='TOC') + + if toc: + toc.extract() + content._content = soup.decode() + content.toc = toc.decode() + if content.toc.startswith('<html>'): + content.toc = content.toc[12:-14] + + +def register(): + signals.content_object_init.connect(extract_toc) diff --git a/plugins/pandoc_reader b/plugins/pandoc_reader new file mode 160000 index 0000000000000000000000000000000000000000..9ef0197eed5d141bf0f3b9a8468cd37ad3e5fbd7 --- /dev/null +++ b/plugins/pandoc_reader @@ -0,0 +1 @@ +Subproject commit 9ef0197eed5d141bf0f3b9a8468cd37ad3e5fbd7