Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
1
answers
32
views
Sphinx: Generate one TOC per .rst
I am trying to convert GNU Parallel's (boring) POD-html to Sphinx. I use this `index.rst`: ~~~ .. SPDX-FileCopyrightText: 2021 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc. .. .. SPDX-License-Identifier: GPL-3.0-or-later .. GNU Parallel documentation master file, created by s...
I am trying to convert GNU Parallel's (boring) POD-html to Sphinx.
I use this
index.rst
:
~~~
.. SPDX-FileCopyrightText: 2021 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
..
.. SPDX-License-Identifier: GPL-3.0-or-later
.. GNU Parallel documentation master file, created by
sphinx-quickstart on Sat Jan 23 14:06:27 2021.
You can adapt this file completely to your liking, but it should at least
contain the root toctree
directive.
Welcome to GNU Parallel's documentation!
========================================
.. toctree::
:maxdepth: 3
:caption: Contents:
parallel
sem
env_parallel
parset
parsort
parallel_design
parallel_tutorial
parallel_alternatives
parcat
niceload
sql
Indices and tables
==================
* :ref:genindex
* :ref:modindex
* :ref:search
~~~
It generates amongst other files: https://www.gnu.org/software/parallel/parset.html
The problem here is that I want the left sidebar to only include headings relevant to parset
- not to all the other files (e.g. the top link under CONTENTS links to parallel.html) Or at the very least: Insert a header over each new file, so the user can see this links to another command.
I assume I simply need to add some magic to index.rst
to tell it only to base CONTENTS on the current file.
(The .rst files are generated from POD using pod2rst - and yes there are a few formatting bugs, but I am not going to maintain the documentation in .rst-format).
Ole Tange
(37348 rep)
Jul 12, 2021, 09:22 AM
• Last activity: Jul 12, 2021, 09:56 AM
1
votes
1
answers
1113
views
PDF output with correct spaces in code examples
I have been using `rst2pdf` and `pandoc` to convert the following reStructuredText into PDF: This is a python example:: def main(): print("Hello World!") if __name__ == '__main__': main() And one for YAML:: server: name: ts0 location: paris although the two programs use a different engine to generat...
I have been using
The highlighted code (green background) is missing spaces because the empty spaces are generated in these PDF files with offsets.
Copy and paste results in ugly formatted code for many languages, but for programming languages like Occam and Python and for configuration files in YAML, this actually changes the meaning. If you are lucky that actually breaks things and you notice, but the YAML example e.g. is also correct without the spaces at the beginning of the line, it just has a different meaning.
This space-mangling-in-code-examples also happens in the PDF documents generated by the readthedocs site.
---
If you take the output from:
pandoc example.rst -o example.epub
and view the resulting one page file, you can copy and paste the code correctly. If you convert that
, but when pasting there are no spaces for the indent, and even the space between
rst2pdf
and pandoc
to convert the following reStructuredText into PDF:
This is a python example::
def main():
print("Hello World!")
if __name__ == '__main__':
main()
And one for YAML::
server:
name: ts0
location: paris
although the two programs use a different engine to generate PDF (pandoc
even requires you to install TeX for that) the result is a PDF file, from which you cannot correctly cut-and-paste code examples:

example.epub
with calibre (version 2.55.0) via its user-interface you get a PDF file from which you **can** correctly copy the code (with spaces), but the resulting PDF consists of 3 pages.
Trying to convert from the command line:
ebook-convert example.epub example.pdf
results in a rendering exception, adding the --old-pdf-engine
option the conversion works, but you still have a 3 page PDF instead of a single page.
Converting via HTML:
rst2html example.rst > example.html; ebook-convert example.html example.pdf
pandoc example.rst -o example.html; ebook-convert example.html example.pdf
gives you correclty selectable code:

Hello
and World
disappears. Apart from that on larger files you get pagebreaks at unwanted places and the layout would need extensive tweaking via style sheets.
I tried conversion via .odt
but that ended up in PDF files with completely unselectable text.
---
Given the following requirements for the PDF output:
- code fragments correctly selectable with spaces
- results similar in layout to that of rst2pdf
or readthedocs
are there any command line tools to generate a PDF file, starting with a .rst
file or some other mark-up format?
Anthon
(81143 rep)
Apr 24, 2016, 02:09 PM
• Last activity: May 1, 2016, 12:07 PM
8
votes
4
answers
935
views
The best Linux Open-source wiki with native support for Windows (NTLM) authentication
I need to set up a wiki for our engineering group; we are part of an Enterprise-wide Windows Active Directory domain. Most of the corporate IT applications use NTLM to authenticate (automatically via Internet Exploder); while I'm not part of corporate IT, I recognize that Single Sign-On (SSO) is imp...
I need to set up a wiki for our engineering group; we are part of an Enterprise-wide Windows Active Directory domain. Most of the corporate IT applications use NTLM to authenticate (automatically via Internet Exploder); while I'm not part of corporate IT, I recognize that Single Sign-On (SSO) is important for user acceptance.
I am hoping to find a free and open-source wiki that is well-tested and can be hosted on linuxSee End Note 1, while allowing corporate windows laptops to automatically authenticate without a password prompt.
I have seen some hacks to make [moin](http://moinmo.in/) authenticate with NTLMSee End Note 2, but I don't know how well this would actually work in practice; so any deployment experiences with moin + NTLM would be valuable. I have also seen [FOS Wiki](http://foswiki.org/) , but [FOS Wiki doesn't seem to have support for automatic login](http://foswiki.org/Support/Question690) .
Question:
---
In short, I am looking for the best free, open-source, linux wiki implementation with native, automatic NTLM authentication supportSee End Note 3; I give bonus points if it can use [Markdown](http://daringfireball.net/projects/markdown/) or [reStructured Text](http://docutils.sourceforge.net/rst.html) .
End Notes:
1. If I felt like running this under Windows, I could use [Screwturn wiki](http://www.screwturn.eu/) ; however, the thought of hosting web services on windows makes me feel all dirty inside.
2. See [this post on wikimatrix](http://www.wikimatrix.org/forum/t51-ntlm-support-windows-authentication)
3. If such a thing even exists
Mike Pennington
(2521 rep)
Jun 23, 2011, 10:32 PM
• Last activity: Apr 24, 2016, 02:41 PM
15
votes
1
answers
4415
views
generate a hyperlinked table of contents and insert into existing PDF
I have an existing PDF (without any corresponding source file), and a text file which is a list of items referencing sections within the PDF file, along with a page number for each item. I would like to generate a new PDF which starts with a generated table of contents index, followed by the content...
I have an existing PDF (without any corresponding source file), and a text file which is a list of items referencing sections within the PDF file, along with a page number for each item. I would like to generate a new PDF which starts with a generated table of contents index, followed by the contents of the original PDF. The generated index needs to be hyperlinked so that clicking on any item will automatically jump to the page containing the referenced section.
I'm looking for a suitable set of tools (preferably CLI-oriented) to accomplish this on Linux; all the tools I've looked at so far don't seem to offer a solution. I'm an experienced programmer, and am more than happy to write code if required (preferably in Ruby/Python/Perl/shell) to parse my text file and convert it into a hyperlinked index, but I can't find the right tools to solve it. I think part of the problem is that the hyperlinks need to point to within the same file, but their targets won't exist until later when the ToC is joined with the original PDF.
I'm also familiar with various markup languages, e.g. Markdown, reStructuredText, TeX, LaTeX, org-mode, and an ideal solution would use one of these as an intermediate step for generating the hyperlinked ToC.
Adam Spiers
(952 rep)
Oct 26, 2013, 01:30 PM
• Last activity: Apr 24, 2016, 02:40 PM
3
votes
1
answers
310
views
updating rst2pdf leads to pip uninstall
I had some problem generating PDF files from reStructuredText, which I thought I could solve with updating rst2pdf. I got a `Permission denied` error when I did `pip install -U rst2pdf` OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-6.0.8.dist-info/DESCRIPTION.rst...
I had some problem generating PDF files from reStructuredText, which I thought I could solve with updating rst2pdf.
I got a
Permission denied
error when I did
pip install -U rst2pdf
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-6.0.8.dist-info/DESCRIPTION.rst' $ sudo !! sudo pip install -U rst2pdf [sudo] password for root: sudo: pip: command not found $ pip install -U rst2pdf pip: command not foundHow can I solve this, and how to prevent it from happening again?
user4927615
(33 rep)
May 22, 2015, 06:11 AM
• Last activity: Apr 24, 2016, 02:38 PM
Showing page 1 of 5 total questions