How to change html pages path sphinx - python-sphinx

I write documentation using Sphinx.
Now pages path is "folder/html/". I want to replace it with "folder/" . I tried to change BUILDDIR, but it did't help.
How to do it? I use windows

Replace parameter -M in Makefile and make.bat with -b.
Details
When running sphinx-build with the -b option, the output directory is what you set it to be.
When using the -M option, it does not work exactly the same. The "html" subdirectory (the buildername) is always added. See this bug report: https://github.com/sphinx-doc/sphinx/issues/6896.

Related

how to generate html output in sphinx-needs instead of needs.json

i am trying to use/understand sphinx-needs.
As soon as i run the following command it is generating needs.json
sphinx-build -b needs source build
But how to generate the html output from needs.json?
i don't want to have any custom layouts a default or predefined layouts (such as'complete') will do
Thanks for your answers
I have generated my sphinx folders using the quickstart command
$ sphinx-quickstart
you will have something that looks like this
After writing your needs in .rst format
the following command will generate the html files.
$ make html
PS: You should not have any dependency problems.
Sphinx-needs need to be installed separately.

Git Pre-Commit Hook: Unable to Run `dartfmt` (command not found) (Windows)

Ideally, I would like to have dartfmt to format my code on every commit, and I think that git hooks are ideal for this. So far, I've tried the code found in this link, but with no success, despite it appearing on multiple other websites — maybe it's outdated.
In the end, I think nothing much more complicated than this should work in most cases (inside the .git/hooks/pre-commit file):
#!/bin/bash
dartfmt -w . # or maybe `flutter format .` for Flutter
The errors I get are:
For dartfmt -w .: dartfmt: command not found
For flutter format .: find: ‘> bin [’: No such file or directory
Both of those commands do work if placed directly in the terminal.
to make dartfmt work, try running which dartfmt manually to get the path to the executable, and then use the absolute path when calling it in the script.
If which isn't able to find it, and assuming you know the complete path to the directory where dartfmt is located, try adding that directory to PATH in the script:
#!/bin/bash
PATH="/path/to/dart-sdk/bin:$PATH"
export PATH
Also, I'd suggest taking a moment double check what git will use for the working directory when it calls those hook scripts. There might be some undesired behavior by using . if the CWD isn't what is expected. See this post.
To format your dart code regularly, you can follow one of the two ways mentioned below:
Preferred way:
In IntelliJ Idea go to Settings -> Language & Frameworks -> Flutter -> Select Format Code on save option.
This will format your code every few seconds. This is preferred because you can customize your personal formatting settings such as max words in a line etc.
Alternatively
From Official website run dartfmt -w bin lib to format your code from the command line.
Add dartfmt reference in PATH, like this:
export PATH="/xxx/flutter/bin/cache/dart-sdk/bin:$PATH"

Use curl to download a Dropbox folder via shared link (not public link)

Dropbox makes it easy to programmatically download a single file via curl (EX: curl -O https://dl.dropboxusercontent.com/s/file.ext). It is a little bit trickier for a folder (regular directory folder, not zipped). The shared link for a folder, as opposed to a file, does not link directly to the zipped folder (Dropbox automatically zips the folder before it is downloaded). It would appear that you could just add ?dl=1 to the end of the link, as this will directly start the download in a browser. This, however, points to an intermediary html document that redirects to the actual zip folder and does not seem to work with curl. Is there anyway to use curl to download a folder via a shared link? I realize that the best solution would be to use the Dropbox api, but for this project it is important to keep it as simple as possible. Additionally, the solution must be incorporated into a bash shell script.
It does appear to be possible with curl by using the -L option. This forces curl to follow the redirect. Additionally, it is important to specify an output name with a .zip extension, as the default will be a random alpha-numeric name with no extension. Finally, do not forget to add the ?dl=1 to the end of the link. Without it, curl will never reach the redirect page.
curl -L -o newName.zip https://www.dropbox.com/sh/[folderLink]?dl=1
Follow redirects (use -L). Your immediate problem is that Curl is not following redirects.
Set a filename. (Optional)
Dropbox already sends a Content-Disposition Header with its Dropbox filename. There is no reason to specify the filename if you use the correct curl flags.
Conversely, you can force a filename using something of your choosing.
Use one of these commands:
curl https://www.dropbox.com/sh/AAbbCCEeFF123?dl=1 -O -J -L
Preserve/write the remote filename (-O,-J) and follows any redirects (-L).
This same line works for both individually shared files or entire folders.
Folders will save as a .zip automatically (based on folder name).
Don't forget to change the parameter ?dl=0 to ?dl=1 (see comments).
OR:
curl https://www.dropbox.com/sh/AAbbCCEeFF123?dl=1 -L -o [filename]
Follow any redirects (-L) and set a filename (-o) of your choosing.
NOTE: Using the -J flag in general:
WARNING: Exercise judicious use of this option, especially on Windows. A rogue server could send you the name of a DLL or other file that could possibly be loaded automatically by Windows or some third party software.
Please consult: https://curl.haxx.se/docs/manpage.html#OPTIONS (See: -O, -J, -L, -o) for more.

Netbeans and PhpDocumentor

I have downloaded Netbeans 7.0 beta as I wanted to give the PhpDoc functionality a bash, but can't get it to work.
I seem to be falling over on the configuration options for PhpDoc in netbeans. It is asking for the script location,
but whatever I enter I get the error;
** ERROR *****************************************************************
* Sorry, can't find the php.exe file.
* You must edit this file to point to your php.exe (CLI version!)
* [Currently set to C:\usr\local\php\cli\php.exe]
*
* NOTE: In PHP 4.2.x the PHP-CLI used to be named php-cli.exe.
* PHP 4.3.x renamed it php.exe but stores it in a subdir
* called /cli/php.exe
* E.g. for PHP 4.2 C:\phpdev\php-4.2-Win32\php-cli.exe
* for PHP 4.3 C:\phpdev\php-4.3-Win32\cli\php.exe
**************************************************************************
Press any key to continue . . .
The set-up is Netbeans and xampp running on a windows machine.
Any and all help greatly appreciated.
That error indicates that the php.exe executable file is not in your Windows "PATH", and as such, when Windows tries to run the phpdoc script, it doesn't know how. Fortunately, the phpdoc script itself checks for this condition and explains it to you, in the error text you posted. Otherwise, the Windows error would have been much more generic and probably unhelpful.
You need to determine where your php.exe file is located. Then, edit the phpdoc.bat script file itself to hardcode the absolute path. Look for the line near the beginning that SETs the phpCli value. That is where you should place the absolute path to your php.exe file.
As an aside, I would suggest that your "PhpDoc script" setting in NetBeans should explicitly call the phpdoc.bat script rather than just "phpdoc", e.g. D:\xampp\php\phpdoc.bat, since both files actually exist. I know that Windows will typically look for "foo.bat" if you tell it to execute "foo" when foo doesn't exist and foo.bat does exist, but since phpdoc and phpdoc.bat both exist, ... I think that Windows trying to run phpdoc directly rather than phpdoc.bat will give you trouble.
Further, I see that you have the phpdoc.bat file itself listed as the first "argument" to the phpdoc script. That will probably cause you some grief once you get past the "can't find php.exe" error. You should remove that... the only arguments you should give after naming the script itself are the valid arguments that phpDocumentor expects, particularly the ones it requires -- -o for output template, -t for where to write the doc files, -d or -f to tell it where the PHP code is that you want documented.
for my case, in the version 2:
i changed the last line in phpdoc.bat:
"%PHPBIN%" "%PHP_PERAR_BIN_DIR%\phpdoc.php" %*
to
"%PHPBIN%" "phpdoc.php" %*
%PHP_PERAR_BIN_DIR% in this case is empty & the backslash makes an error finding the phpdoc.php file
I finally figured out an easy way to use phpdoc in Netbeans Windows!
Pear? Drop it. There's way too many problems.
Download it directly - http://sourceforge.net/projects/phpdocu/files/
Download the tar file, not the zip. The zip is bugged and will output 2 letter extensions instead of 3 (ie, .cs instead of .css) (as of 1.4.3)
Unzip it anywhere you want
Open up the phpdoc.bat file, and make 2 changes
a) Change the phpcli path
b) Add in code to navigate to the directory.
So for example, I put my phpdocumentor folder in d:\programs\xampp\php\phpdoc. Modifying the phpdoc.bat file:
SET phpCli=d:\programs\xampp\php\php.exe
d:
cd d:\programs\xampp\php\phpdoc
Then in Netbeans, you put this for the phpdoc script:
D:\programs\xampp\php\phpdoc\phpdoc.bat -o HTML:frames:earthli
Note that when you set the target (right click on project -> properties -> phpdoc), you will need to manually change the backslashes to forward slashes.
Correct - D:/programs/xampp/htdocs/project/phpdoc
Incorrect - D:\programs\xampp\htdocs\project\phpdoc (this will be generated when you use the browse button)
Good luck!
PS. Note that you can also run the phpdoc batch file directly from dos. You don't need to do it through netbeans.
d:\programs\xampp\php\phpdoc\phpdoc.bat -d D:\programs\xampp\htdocs\project -t D:\programs\xampp\htdocs\project\phpdoc -o HTML:frames:phpedit

How can I convert Markdown documents to HTML en masse?

I'm writing some documentation in Markdown, and creating a separate file for each section of the doc. I would like to be able to convert all the files to HTML in one go, but I can't find anyone else who has tried the same thing. I'm on a Mac, so I would think a simple bash script should be able to handle it, but I've never done anything in bash and haven't had any luck. It seems like it should be simple to write something so I could just run:
markdown-batch ./*.markdown
Any ideas?
Use pandoc — it's a commandline tool that lets you convert from one format to another. This tool supports Markdown to HTML and back.
E.g. to generate HTML from Markdown, run:
pandoc -f markdown index.md > index.html
This is how you would do it in Bash.
for i in ./*.markdown; do perl markdown.pl --html4tags $i > $i.html; done;
Of course, you need the Markdown script.
If you have Node.js installed, then you can use the [MdPugToHtml] converter (https://www.npmjs.com/package/md-pug-to-html). It massively converts Markdown to Html. Moreover, it is possible to use Pug templates, but you can use them without templates.
The conversion is performed in the terminal with just one command:
npx md-pug-to-html /home/content
where:
npx is an npm command that installs md-pug-to-html at the first launch, and then launches the md-pug-to-html converter.
/home/content is a directory with your Markdown files. You may have another one.
The converter has various settings and can be used both in the CLI command line and has an API for use in applications.
There is detailed documentation on the MdPugToHtml converter in English and Russian.
You can do this really easily with VS Code. (Well, this is not a command line tool, but proved itself to be super helpful.)
Install the Markdown All In One extension by Yu Zhang
Open the VS Code Command Palette (Ctrl-Shift-P), and select Markdown All In One: Print documents to HTML (select a source folder)
Tip: If you want to make your export portable, you want to change absolute image paths to relative paths by using the following setting in your settings.json (Ctrl-Shift-P -> Preferences: Open Settings (JSON))
"markdown.extension.print.absoluteImgPath": false
In this way, after conversion, just copy all non-markdown files (images) to the destination folder and the HTML pages are portable.
I use this in a .bat file:
#echo off
for %i in (*.txt) python markdown.py "%i"
// using Bash in mac
for i in *.md; do asciidoc $i; done;

Resources