Use sphinx extlinks for various website links

This commit is contained in:
Kovid Goyal 2022-01-21 10:54:42 +05:30
parent e90b87cdfe
commit 38aca62463
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 26 additions and 25 deletions

View File

@ -171,14 +171,17 @@ def sort_languages(x):
return sort_key(type(u'')(name)) return sort_key(type(u'')(name))
website = 'https://calibre-ebook.com'
html_context['other_languages'].sort(key=sort_languages) html_context['other_languages'].sort(key=sort_languages)
html_context['support_text'] = _('Support calibre') html_context['support_text'] = _('Support calibre')
html_context['support_tooltip'] = _('Contribute to support calibre development') html_context['support_tooltip'] = _('Contribute to support calibre development')
html_context['homepage_url'] = 'https://calibre-ebook.com' html_context['homepage_url'] = website
if needs_localization: if needs_localization:
html_context['homepage_url'] = localize_website_link(html_context['homepage_url']) html_context['homepage_url'] = localize_website_link(html_context['homepage_url'])
extlinks = { extlinks = {
'website_en': (website, None),
'website': (html_context['homepage_url'] + '/%s', None), 'website': (html_context['homepage_url'] + '/%s', None),
'download_file': (f'{website}/downloads/%s', '%s'),
} }
del sort_languages, get_language del sort_languages, get_language

View File

@ -652,7 +652,7 @@ calibre can automatically convert ``.docx`` files created by Microsoft Word 2007
newer. Just add the file to calibre and click convert. newer. Just add the file to calibre and click convert.
.. note:: .. note::
There is a `demo .docx file <https://calibre-ebook.com/downloads/demos/demo.docx>`_ There is a :download_file:`demo .docx file <demos/demo.docx>`
that demonstrates the capabilities of the calibre conversion engine. Just that demonstrates the capabilities of the calibre conversion engine. Just
download it and convert it to EPUB or AZW3 to see what calibre can do. download it and convert it to EPUB or AZW3 to see what calibre can do.
@ -791,10 +791,10 @@ calibre will automatically convert this .cbc file into a e-book with a Table of
EPUB advanced formatting demo EPUB advanced formatting demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Various advanced formatting for EPUB files is demonstrated in this `demo file <https://calibre-ebook.com/downloads/demos/demo.epub>`_. Various advanced formatting for EPUB files is demonstrated in this :download_file:`demo file <demos/demo.epub>`.
The file was created from hand coded HTML using calibre and is meant to be used as a template for your own EPUB creation efforts. The file was created from hand coded HTML using calibre and is meant to be used as a template for your own EPUB creation efforts.
The source HTML it was created from is available `demo.zip <https://calibre-ebook.com/downloads/demos/demo.zip>`_. The settings used to create the The source HTML it was created from is available :download_file:`demo.zip <demos/demo.zip>`. The settings used to create the
EPUB from the ZIP file are:: EPUB from the ZIP file are::
ebook-convert demo.zip .epub -vv --authors "Kovid Goyal" --language en --level1-toc '//*[@class="title"]' --disable-font-rescaling --page-breaks-before / --no-default-epub-cover ebook-convert demo.zip .epub -vv --authors "Kovid Goyal" --language en --level1-toc '//*[@class="title"]' --disable-font-rescaling --page-breaks-before / --no-default-epub-cover

View File

@ -40,7 +40,7 @@ the folder in which you created :file:`__init__.py`::
are in :file:`/Applications/calibre.app/Contents/MacOS/`. are in :file:`/Applications/calibre.app/Contents/MacOS/`.
You can download the Hello World plugin from You can download the Hello World plugin from
`helloworld_plugin.zip <https://calibre-ebook.com/downloads/helloworld_plugin.zip>`_. :download_file:`helloworld_plugin.zip`.
Every time you use calibre to convert a book, the plugin's :meth:`run` method will be called and the Every time you use calibre to convert a book, the plugin's :meth:`run` method will be called and the
converted book will have its publisher set to "Hello World". This is a trivial plugin, lets move on to converted book will have its publisher set to "Hello World". This is a trivial plugin, lets move on to
@ -54,7 +54,7 @@ This plugin will be spread over a few files (to keep the code clean). It will sh
how to create elements in the calibre user interface and how to access how to create elements in the calibre user interface and how to access
and query the books database in calibre. and query the books database in calibre.
You can download this plugin from `interface_demo_plugin.zip <https://calibre-ebook.com/downloads/interface_demo_plugin.zip>`_ You can download this plugin from :download_file:`interface_demo_plugin.zip`
.. _import_name_txt: .. _import_name_txt:
@ -185,7 +185,7 @@ Edit book plugins
Now let's change gears for a bit and look at creating a plugin to add tools to Now let's change gears for a bit and look at creating a plugin to add tools to
the calibre book editor. The plugin is available here: the calibre book editor. The plugin is available here:
`editor_demo_plugin.zip <https://calibre-ebook.com/downloads/editor_demo_plugin.zip>`_. :download_file:`editor_demo_plugin.zip`.
The first step, as for all plugins is to create the The first step, as for all plugins is to create the
import name empty txt file, as described :ref:`above <import_name_txt>`. import name empty txt file, as described :ref:`above <import_name_txt>`.
@ -259,7 +259,7 @@ data in a separate process. A simple example plugin follows that shows how
to do this. to do this.
You can download the plugin from You can download the plugin from
`webengine_demo_plugin.zip <https://calibre-ebook.com/downloads/webengine_demo_plugin.zip>`_. :download_file:`webengine_demo_plugin.zip`.
The important part of the plugin is in two functions: The important part of the plugin is in two functions:

View File

@ -75,7 +75,7 @@ Getting the code
------------------ ------------------
You can get the calibre source code in two ways, using a version control system or You can get the calibre source code in two ways, using a version control system or
directly downloading a `tarball <https://calibre-ebook.com/dist/src>`_. directly downloading a :website_en:`tarball <dist/src>`.
calibre uses `Git <https://www.git-scm.com/>`_, a distributed version control calibre uses `Git <https://www.git-scm.com/>`_, a distributed version control
system. Git is available on all the platforms calibre supports. After system. Git is available on all the platforms calibre supports. After
@ -89,7 +89,7 @@ calibre is a very large project with a very long source control history, so the
above can take a while (10 mins to an hour depending on your internet speed). above can take a while (10 mins to an hour depending on your internet speed).
If you want to get the code faster, the source code for the latest release is If you want to get the code faster, the source code for the latest release is
always available as an `archive <https://calibre-ebook.com/dist/src>`_. always available as an :website_en:`archive <dist/src>`.
To update a branch to the latest code, use the command:: To update a branch to the latest code, use the command::

View File

@ -26,8 +26,7 @@ Basic workflow
--------------- ---------------
.. note:: .. note::
A video tour of the calibre E-book editor is available `here A video tour of the calibre E-book editor is available :website:`here <demo#tutorials>`.
<https://calibre-ebook.com/demo#tutorials>`_.
When you first open a book with the Edit book tool, you will be presented with When you first open a book with the Edit book tool, you will be presented with
a list of files on the left. These are the individual HTML files, stylesheets, a list of files on the left. These are the individual HTML files, stylesheets,

View File

@ -158,8 +158,7 @@ How do I use some of the advanced features of the conversion tools?
You can get help on any individual feature of the converters by mousing over You can get help on any individual feature of the converters by mousing over
it in the GUI or running ``ebook-convert dummy.html .epub -h`` at a terminal. it in the GUI or running ``ebook-convert dummy.html .epub -h`` at a terminal.
A good place to start is to look at the following demo file that demonstrates A good place to start is to look at the following demo file that demonstrates
some of the advanced features some of the advanced features :download_file:`html-demo.zip <html-demo.zip>`.
`html-demo.zip <https://calibre-ebook.com/downloads/html-demo.zip>`_
Device integration Device integration
@ -196,7 +195,7 @@ We just need some information from you:
Once you send us the output for a particular operating system, support for the device in that operating system Once you send us the output for a particular operating system, support for the device in that operating system
will appear in the next release of calibre. To send us the output, open a bug report and attach the output to it. will appear in the next release of calibre. To send us the output, open a bug report and attach the output to it.
See `how to report bugs <https://calibre-ebook.com/bugs>`_. See :website:`how to report bugs <bugs>`.
My device is not being detected by calibre? My device is not being detected by calibre?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -216,8 +215,8 @@ Follow these steps to find the problem:
fix that by looking under :guilabel:`System Preferences > Security and fix that by looking under :guilabel:`System Preferences > Security and
Privacy > Privacy > Files and Folders`. Privacy > Privacy > Files and Folders`.
* Make sure you are running the latest version of calibre (currently * Make sure you are running the latest version of calibre (currently
|version|). The latest version can always be downloaded from `the calibre |version|). The latest version can always be downloaded from :website:`the calibre
website <https://calibre-ebook.com/download>`_. You can tell what website <download>`. You can tell what
version of calibre you are currently running by looking at the bottom version of calibre you are currently running by looking at the bottom
line of the main calibre window. line of the main calibre window.
* Ensure your operating system is seeing the device. That is, the device * Ensure your operating system is seeing the device. That is, the device
@ -603,7 +602,7 @@ Why doesn't calibre have a column for foo?
calibre is designed to have columns for the most frequently and widely used calibre is designed to have columns for the most frequently and widely used
fields. In addition, you can add any columns you like. Columns can be added via fields. In addition, you can add any columns you like. Columns can be added via
:guilabel:`Preferences->Interface->Add your own columns`. Watch the tutorial :guilabel:`Preferences->Interface->Add your own columns`. Watch the tutorial
`UI Power tips <https://calibre-ebook.com/demo#tutorials>`_ to learn how to :website:`UI Power tips <demo#tutorials>` to learn how to
create your own columns, or read `this blog post create your own columns, or read `this blog post
<https://blog.calibre-ebook.com/calibre-custom-columns/>`_. <https://blog.calibre-ebook.com/calibre-custom-columns/>`_.
@ -921,13 +920,13 @@ Downloading from the Internet can sometimes result in a corrupted download. If t
the :guilabel:`Security` tab. Make sure that your user account has full control the :guilabel:`Security` tab. Make sure that your user account has full control
for this folder. for this folder.
If you still cannot get the installer to work and you are on Windows, you can use the `calibre portable install <https://calibre-ebook.com/download_portable>`_, which does not need an installer (it is just a zip file). If you still cannot get the installer to work and you are on Windows, you can use the :website:`calibre portable install <download_portable>`, which does not need an installer (it is just a zip file).
My antivirus program claims calibre is a virus/trojan? My antivirus program claims calibre is a virus/trojan?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The first thing to check is that you are downloading calibre from the official The first thing to check is that you are downloading calibre from the official
website: `<https://calibre-ebook.com/download>`_. Make sure you are clicking the website: :website:`<download>`. Make sure you are clicking the
download links on the left, not the advertisements on the right. calibre is a download links on the left, not the advertisements on the right. calibre is a
very popular program and unscrupulous people try to setup websites offering it very popular program and unscrupulous people try to setup websites offering it
for download to fool the unwary. for download to fool the unwary.
@ -995,8 +994,8 @@ proxies used by calibre in Preferences->Miscellaneous.
I want some feature added to calibre. What can I do? I want some feature added to calibre. What can I do?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You have two choices: You have two choices:
1. Create a patch by hacking on calibre and send it to me for review and inclusion. See `Development <https://calibre-ebook.com/get-involved>`_. 1. Create a patch by hacking on calibre and send it to me for review and inclusion. See :website:`Development <get-involved>`.
2. `Open a bug requesting the feature <https://calibre-ebook.com/bugs>`_. Remember that while you may think your feature request is extremely important/essential, calibre developers might not agree. Fortunately, calibre is open source, which means you always have the option of implementing your feature yourself, or hiring someone to do it for you. Furthermore, calibre has a comprehensive plugin architecture, so you might be able to develop your feature as a plugin, see :ref:`pluginstutorial`. 2. :website:`Open a bug requesting the feature <bugs>`. Remember that while you may think your feature request is extremely important/essential, calibre developers might not agree. Fortunately, calibre is open source, which means you always have the option of implementing your feature yourself, or hiring someone to do it for you. Furthermore, calibre has a comprehensive plugin architecture, so you might be able to develop your feature as a plugin, see :ref:`pluginstutorial`.
Why doesn't calibre have an automatic update? Why doesn't calibre have an automatic update?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1008,8 +1007,8 @@ For many reasons:
to see if you want to update once a year or so. There is a check box to to see if you want to update once a year or so. There is a check box to
turn off the update notification, on the update notification itself. turn off the update notification, on the update notification itself.
* calibre downloads currently use `about 150TB of bandwidth a month * calibre downloads currently use :website_en:`about 150TB of bandwidth a month
<https://calibre-ebook.com/dynamic/downloads>`_. Implementing automatic <dynamic/downloads>`. Implementing automatic
updates would greatly increase that and end up costing thousands of dollars updates would greatly increase that and end up costing thousands of dollars
a month, which someone has to pay. a month, which someone has to pay.
@ -1032,7 +1031,7 @@ calibre is licensed under the GNU General Public License v3 (an open source lice
How do I run calibre from my USB stick? How do I run calibre from my USB stick?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A portable version of calibre is available `here <https://calibre-ebook.com/download_portable>`_. A portable version of calibre is available :website:`here <download_portable>`.
How do I run parts of calibre like news download and the Content server on my own Linux server? How do I run parts of calibre like news download and the Content server on my own Linux server?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~