Fix various links in the manual

This commit is contained in:
Kovid Goyal 2018-06-06 07:05:09 +05:30
parent 8396aa623b
commit fabc938c02
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 44 additions and 36 deletions

View File

@ -80,6 +80,13 @@ def build_pot(base):
return base return base
def build_linkcheck(base):
cmd = [SPHINX_BUILD, '-b', 'linkcheck', '-t', 'online', '-t', 'linkcheck', '.', base]
print (' '.join(cmd))
subprocess.check_call(cmd)
return base
def build_man_pages(language, base): def build_man_pages(language, base):
os.environ[b'CALIBRE_BUILD_MAN_PAGES'] = b'1' os.environ[b'CALIBRE_BUILD_MAN_PAGES'] = b'1'
sphinx_build(language, base, builder='man', bdir=language, very_quiet=True) sphinx_build(language, base, builder='man', bdir=language, very_quiet=True)
@ -108,6 +115,8 @@ if __name__ == '__main__':
language, base = args.language, args.base language, base = args.language, args.base
if language == 'gettext': if language == 'gettext':
build_pot(base) build_pot(base)
elif language == 'linkcheck':
build_linkcheck(base)
elif args.man_pages: elif args.man_pages:
os.environ['CALIBRE_OVERRIDE_LANG'] = language os.environ['CALIBRE_OVERRIDE_LANG'] = language
build_man_pages(language, base) build_man_pages(language, base)

View File

@ -259,7 +259,7 @@ The next interesting feature is::
def get_browser(self): def get_browser(self):
... ...
``needs_subscription = True`` tells calibre that this recipe needs a username and password in order to access the content. This causes, calibre to ask for a username and password whenever you try to use this recipe. The code in :meth:`calibre.web.feeds.news.BasicNewsRecipe.get_browser` actually does the login into the NYT website. Once logged in, calibre will use the same, logged in, browser instance to fetch all content. See `mechanize <https://github.com/jjlee/mechanize>`_ to understand the code in ``get_browser``. ``needs_subscription = True`` tells calibre that this recipe needs a username and password in order to access the content. This causes, calibre to ask for a username and password whenever you try to use this recipe. The code in :meth:`calibre.web.feeds.news.BasicNewsRecipe.get_browser` actually does the login into the NYT website. Once logged in, calibre will use the same, logged in, browser instance to fetch all content. See `mechanize <https://mechanize.readthedocs.io/en/latest/>`_ to understand the code in ``get_browser``.
The next new feature is the The next new feature is the
:meth:`calibre.web.feeds.news.BasicNewsRecipe.parse_index` method. Its job is :meth:`calibre.web.feeds.news.BasicNewsRecipe.parse_index` method. Its job is
@ -267,7 +267,7 @@ to go to https://www.nytimes.com/pages/todayspaper/index.html and fetch the list
of articles that appear in *todays* paper. While more complex than simply using of articles that appear in *todays* paper. While more complex than simply using
:term:`RSS`, the recipe creates an e-book that corresponds very closely to the :term:`RSS`, the recipe creates an e-book that corresponds very closely to the
days paper. ``parse_index`` makes heavy use of `BeautifulSoup days paper. ``parse_index`` makes heavy use of `BeautifulSoup
<https://www.crummy.com/software/BeautifulSoup/documentation.html>`_ to parse <https://www.crummy.com/software/BeautifulSoup/bs3/documentation.html>`_ to parse
the daily paper webpage. You can also use other, more modern parsers if you the daily paper webpage. You can also use other, more modern parsers if you
dislike BeatifulSoup. calibre comes with `lxml <http://lxml.de/>`_ and dislike BeatifulSoup. calibre comes with `lxml <http://lxml.de/>`_ and
`html5lib <https://github.com/html5lib/html5lib-python>`_, which are the `html5lib <https://github.com/html5lib/html5lib-python>`_, which are the

View File

@ -66,9 +66,9 @@ class TXTInput(InputFormatPlugin):
OptionRecommendation(name="markdown_extensions", recommended_value='footnotes, tables, toc', OptionRecommendation(name="markdown_extensions", recommended_value='footnotes, tables, toc',
help=_('Enable extensions to markdown syntax. Extensions are formatting that is not part ' help=_('Enable extensions to markdown syntax. Extensions are formatting that is not part '
'of the standard markdown format. The extensions enabled by default: %default.\n' 'of the standard markdown format. The extensions enabled by default: %default.\n'
'To learn more about markdown extensions, see https://pythonhosted.org/Markdown/extensions/index.html\n' 'To learn more about markdown extensions, see {}\n'
'This should be a comma separated list of extensions to enable:\n' 'This should be a comma separated list of extensions to enable:\n'
) + '\n'.join('* %s: %s' % (k, MD_EXTENSIONS[k]) for k in sorted(MD_EXTENSIONS))), ).format('https://python-markdown.github.io/extensions/') + '\n'.join('* %s: %s' % (k, MD_EXTENSIONS[k]) for k in sorted(MD_EXTENSIONS))),
]) ])
def shift_file(self, base_dir, fname, data): def shift_file(self, base_dir, fname, data):

View File

@ -130,7 +130,7 @@
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>More information on &lt;a href=&quot;https://pythonhosted.org/Markdown/extensions/index.html&quot;&gt;Markdown extensions&lt;/a&gt;</string> <string>More information on &lt;a href=&quot;https://python-markdown.github.io/extensions/&quot;&gt;Markdown extensions&lt;/a&gt;</string>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>

View File

@ -483,7 +483,7 @@ class BasicNewsRecipe(Recipe):
def get_browser(self, *args, **kwargs): def get_browser(self, *args, **kwargs):
''' '''
Return a browser instance used to fetch documents from the web. By default Return a browser instance used to fetch documents from the web. By default
it returns a `mechanize <https://github.com/jjlee/mechanize>`_ it returns a `mechanize <https://mechanize.readthedocs.io/en/latest/>`_
browser instance that supports cookies, ignores robots.txt, handles browser instance that supports cookies, ignores robots.txt, handles
refreshes and has a mozilla firefox user agent. refreshes and has a mozilla firefox user agent.
@ -890,8 +890,8 @@ class BasicNewsRecipe(Recipe):
self.report_progress = progress_reporter self.report_progress = progress_reporter
if self.needs_subscription and ( if self.needs_subscription and (
self.username is None or self.password is None or self.username is None or self.password is None or (
(not self.username and not self.password)): not self.username and not self.password)):
if self.needs_subscription != 'optional': if self.needs_subscription != 'optional':
raise ValueError(_('The "%s" recipe needs a username and password.')%self.title) raise ValueError(_('The "%s" recipe needs a username and password.')%self.title)
@ -1432,8 +1432,8 @@ class BasicNewsRecipe(Recipe):
desc = self.description desc = self.description
if not isinstance(desc, unicode): if not isinstance(desc, unicode):
desc = desc.decode('utf-8', 'replace') desc = desc.decode('utf-8', 'replace')
mi.comments = (_('Articles in this issue:') + '\n\n' + mi.comments = (_('Articles in this issue:'
'\n\n'.join(article_titles)) + '\n\n' + desc ) + '\n\n' + '\n\n'.join(article_titles)) + '\n\n' + desc
language = canonicalize_lang(self.language) language = canonicalize_lang(self.language)
if language is not None: if language is not None:
@ -1633,8 +1633,7 @@ class BasicNewsRecipe(Recipe):
parsed_feeds.append(feed) parsed_feeds.append(feed)
self.log.exception(msg) self.log.exception(msg)
remove = [fl for fl in parsed_feeds if len(fl) == 0 and remove = [fl for fl in parsed_feeds if len(fl) == 0 and self.remove_empty_feeds]
self.remove_empty_feeds]
for f in remove: for f in remove:
parsed_feeds.remove(f) parsed_feeds.remove(f)