Поиск по блогу

четверг, 26 июня 2014 г.

Смотрю видео (2:21:04) "Documenting Your Project in Sphinx" с архивом на GitHub ... и нахожу два отличных справочника

Понравились два приема (после просмотра первого часа видео). Пробую здесь не конспектировать, а отмечать интересные идеи (вопросы, приемы, идеи...). Буlу дополнять пост в процессе просмотра оставшихся 80 минут.
После следующих 10 минут просмотра пришла в голову мысль - на бесплатный хостинг залить примеры из видео. Посмотрел на Гугл-сайтах. Там нельзя использовать свои страницы... И вот именно тут "осенило" и тут же нашел два готовых отличных чужих справочника... продвинутый Sampledoc и (азы) Documenting Your Project Using Sphinx
Documenting Your Project in Sphinx
github sphinx-tutorial
Tech Tip: Really Simple HTTP Server with Python
Faster alternative to Python's SimpleHTTPServer
Sphinx documentation contents
20.19. SimpleHTTPServer — Simple HTTP request handler
First Steps with Sphinx
YuoTube python sphinx glossary
Справочники с примерами:
Sampledoc This is a tutorial introduction to quickly get you up and running with your own sphinx documentation system. We’ll cover installing sphinx, customizing the look and feel, using custom extensions for embedding plots, inheritance diagrams, syntax highlighted ipython sessions and more. If you follow along the tutorial, you’ll start with nothing and end up with this site – it’s the bootstrapping documentation tutorial that writes itself!
Documenting Your Project Using Sphinx

Начинаю смотреть видео

Атор напомнил "Namespaces are one honking great idea -- let's do more of those!" ...Этот принцип я (пока) не понимаю... точнее, не уверенЮ что правльно перевожу фразу "Namespaces are one honking"
In [1]:
import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Сначала понравилась команда группового копирования файлов... Подумал о том, что у лектора хорошая школа. ...Надо бы регулярно находить и просматривать видео от высококлассных кодеров. Как их находить? Точнее, совместить такое обучение с текущим планом работ... ???

Оказывается, можно очень просто запустить сервер прямо из рабочей папки и открыть index.html "http://localhost:8000/build/html/"

In []:
#t=309 (пример на 309 секунде ролика)
# Запускаем в консоли из папки проекта
python -m SimpleHTTPServer
При поиске ссылок на SimpleHTTPServer прочитал, что он работает медленно (во многих случаях), потому нашел и обсуждение альтернатив. Эту информацию можно использовать для поисков сборок для работы с прокси-листами.
t=3780 ... полезные примеры разметки в файле quick-rst.rst
In []:
Underline titles with punctuation
=================================

For subtitles, switch to another punctuation mark
-------------------------------------------------

*Italic* **bold** ``name`` ``function()`` ``expression = 3 + 3``
`Hyperlink <http://en.wikipedia.org/wiki/Hyperlink>`_ `Link`_

.. _Link: http://en.wikipedia.org/wiki/Link_(The_Legend_of_Zelda)
.. image:: images/python-logo.png
.. A comment block starts with two periods, can continue indented.

A paragraph is one or more lines of un-indented text, separated
from the material above and below by blank lines.

    Block quotes look like paragraphs, but are indented with
    one or more spaces.

| Because of the pipe characters, this will become one line,
| And this will become another line, like in poetry.

term
  Definition for the term, indented beneath it.
another term
  And its definition; any of these definitions can continue on for
  several lines by  you guessed it!  being similarly indented.

* Each item in a list starts with an asterisk (or 1., a., etc).
* List items can go on for several lines as long as you remember to
  keep the rest of the list item indented.

Code blocks are introduced by a double-colon and are indented::

    import docutils
    print help(docutils)

>>> print 'But doctests start with ">>>" and need no indentation.'
И далее note:: quick-sphinx.rst
In []:
.. note::

   Your note should consist of one or more paragraphs, all indented
   so that they clearly belong to the note and not to the text or
   directive that follows.

   Many other directives are also supported, including: warning,
   versionadded, versionchanged, seealso, deprecated, rubric,
   centered, hlist, glossary, productionlist.

.. code-block:: c

   /* Or say "highlight::" once to set the language for all of the
      code blocks that follow it.  Options include ":linenos:",
      ":linenothreshold:", and ":emphasize-lines: 1,2,3". */

   char s[] = "You can also say 'python', 'ruby', ..., or 'guess'!";

.. literalinclude:: example.py
   :lines: 10-20
   :emphasize-lines: 15,16

.. module:: httplib

.. class:: Request

   Zero or more paragraphs of introductory material for the class.

   .. method:: send()

      Description of the send() method.

   .. attribute:: url

      Description of the url attribute.

   Many more members are possible than just method and attribute,
   and non-Python languages are supported too; see the Sphinx docs
   for more possibilities!

.. testcode::

   print 'The doctest extension supports code without >>> prompts!'

.. testoutput::

   The doctest extension supports code without >>> prompts!

.. _custom-label:
.. index:: single: paragraph, targeted paragraph, indexed paragraph

This paragraph can be targeted with :ref:`custom-label`, and will also
be the :index:`target` of several index entries!

.. index:: pair: copper, wire

This paragraph will be listed in the index under both wire, copper
and copper, wire.  See the Sphinx documentation for even more complex
ways of building index entries.

Many kinds of cross-reference can be used inside of a paragraph:

:ref:`custom-label`             :class:`~module.class`
:doc:`quick-sphinx`             :method:`~module.class.method()`
:mod:`module`                   :attr: `~module.class.attribute`

(See the Sphinx Inline Markup chapter for MANY more examples!)
А после этого я и нашел справочники..., так что... досмотрю как-нибудь потом..., если делать будет нечего...


Посты чуть ниже также могут вас заинтересовать

Комментариев нет:

Отправить комментарий