From 38aca6246302840c19e7047b7c3ea0cde353a82c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Jan 2022 10:54:42 +0530 Subject: [PATCH] Use sphinx extlinks for various website links --- manual/conf.py | 5 ++++- manual/conversion.rst | 6 +++--- manual/creating_plugins.rst | 8 ++++---- manual/develop.rst | 4 ++-- manual/edit.rst | 3 +-- manual/faq.rst | 25 ++++++++++++------------- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/manual/conf.py b/manual/conf.py index d66a397c89..8789bead9f 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -171,14 +171,17 @@ def sort_languages(x): return sort_key(type(u'')(name)) +website = 'https://calibre-ebook.com' html_context['other_languages'].sort(key=sort_languages) html_context['support_text'] = _('Support calibre') 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: html_context['homepage_url'] = localize_website_link(html_context['homepage_url']) extlinks = { + 'website_en': (website, None), 'website': (html_context['homepage_url'] + '/%s', None), + 'download_file': (f'{website}/downloads/%s', '%s'), } del sort_languages, get_language diff --git a/manual/conversion.rst b/manual/conversion.rst index f9d7a348a0..f58ff1952b 100644 --- a/manual/conversion.rst +++ b/manual/conversion.rst @@ -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. .. note:: - There is a `demo .docx file `_ + There is a :download_file:`demo .docx file ` 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. @@ -791,10 +791,10 @@ calibre will automatically convert this .cbc file into a e-book with a Table of EPUB advanced formatting demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Various advanced formatting for EPUB files is demonstrated in this `demo file `_. +Various advanced formatting for EPUB files is demonstrated in this :download_file:`demo file `. 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 `_. The settings used to create the +The source HTML it was created from is available :download_file:`demo.zip `. The settings used to create the 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 diff --git a/manual/creating_plugins.rst b/manual/creating_plugins.rst index a6dbd0814a..bf1bd1b43b 100644 --- a/manual/creating_plugins.rst +++ b/manual/creating_plugins.rst @@ -40,7 +40,7 @@ the folder in which you created :file:`__init__.py`:: are in :file:`/Applications/calibre.app/Contents/MacOS/`. You can download the Hello World plugin from -`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 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 and query the books database in calibre. -You can download this plugin from `interface_demo_plugin.zip `_ +You can download this plugin from :download_file:`interface_demo_plugin.zip` .. _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 the calibre book editor. The plugin is available here: -`editor_demo_plugin.zip `_. +:download_file:`editor_demo_plugin.zip`. The first step, as for all plugins is to create the import name empty txt file, as described :ref:`above `. @@ -259,7 +259,7 @@ data in a separate process. A simple example plugin follows that shows how to do this. You can download the plugin from -`webengine_demo_plugin.zip `_. +:download_file:`webengine_demo_plugin.zip`. The important part of the plugin is in two functions: diff --git a/manual/develop.rst b/manual/develop.rst index 3fe79e228a..d712bf5042 100644 --- a/manual/develop.rst +++ b/manual/develop.rst @@ -75,7 +75,7 @@ Getting the code ------------------ You can get the calibre source code in two ways, using a version control system or -directly downloading a `tarball `_. +directly downloading a :website_en:`tarball `. calibre uses `Git `_, a distributed version control 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). If you want to get the code faster, the source code for the latest release is -always available as an `archive `_. +always available as an :website_en:`archive `. To update a branch to the latest code, use the command:: diff --git a/manual/edit.rst b/manual/edit.rst index f04e783c57..0a7eaf825b 100644 --- a/manual/edit.rst +++ b/manual/edit.rst @@ -26,8 +26,7 @@ Basic workflow --------------- .. 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 `. 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, diff --git a/manual/faq.rst b/manual/faq.rst index d2fa20f2a7..221246b5ad 100644 --- a/manual/faq.rst +++ b/manual/faq.rst @@ -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 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 -some of the advanced features -`html-demo.zip `_ +some of the advanced features :download_file:`html-demo.zip `. 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 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 `_. +See :website:`how to report bugs `. 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 Privacy > Privacy > Files and Folders`. * Make sure you are running the latest version of calibre (currently - |version|). The latest version can always be downloaded from `the calibre - website `_. You can tell what + |version|). The latest version can always be downloaded from :website:`the calibre + website `. You can tell what version of calibre you are currently running by looking at the bottom line of the main calibre window. * 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 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 -`UI Power tips `_ to learn how to +:website:`UI Power tips ` to learn how to create your own columns, or read `this blog post `_. @@ -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 for this folder. -If you still cannot get the installer to work and you are on Windows, you can use the `calibre portable install `_, 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 `, which does not need an installer (it is just a zip file). My antivirus program claims calibre is a virus/trojan? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The first thing to check is that you are downloading calibre from the official -website: ``_. Make sure you are clicking the +website: :website:``. Make sure you are clicking the 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 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? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You have two choices: - 1. Create a patch by hacking on calibre and send it to me for review and inclusion. See `Development `_. - 2. `Open a bug requesting the feature `_. 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`. + 1. Create a patch by hacking on calibre and send it to me for review and inclusion. See :website:`Development `. + 2. :website:`Open a bug requesting the feature `. 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? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -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 turn off the update notification, on the update notification itself. - * calibre downloads currently use `about 150TB of bandwidth a month - `_. Implementing automatic + * calibre downloads currently use :website_en:`about 150TB of bandwidth a month + `. Implementing automatic updates would greatly increase that and end up costing thousands of dollars 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? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A portable version of calibre is available `here `_. +A portable version of calibre is available :website:`here `. How do I run parts of calibre like news download and the Content server on my own Linux server? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~