Gitignore generated pdf but not all pdf - html

In my project we have certain markdownfiles which are used to generate pdf and html with the same filename (just different extensions). I would like to gitignore those pdf files not other pdf files (which are not generated).
I know that I could manually unignore those files one by one, also I know I could designate a folder to be unignored. But I was looking for some kind of a pattern by which I could ignore the generated files, that would by itself ensure that the non-generated files are not ignored.

Generate it to specific folder/subfolder and ignore this folder by gitignore specification.
It is most simple and efective solution.

If you are opened to naming these generated pdf files with a slightly different extension such as .gen.pdf instead of .pdf, this would give you the opportunity to differentiate these files with a pattern:
*.gen.pdf
which will ignore your .gen.pdf files and not the .pdf files while keeping all your files in the same directory.
gitignore rules can't handle such a complex rule for which a file would be ignored only if another file with the same name but not the same extension exists.
If renaming your files is not an option, then you could also add an extra step in the script used to generate these .pdf files, which would simply append the name of the generated .pdf to the .gitignore.

If you have a naming convention for your files that can be used to ignore them. If the filenames does not follow a pattern, you could do it as step pointed in his answer, save the pdf files to a specific folder and just ignore that folder in your .gitignore file.

Related

Use of zip files as Themes in Resource files

I have this bulk load of html, js, css, less files including zip files (themes) to be placed in Resource file in Lotus Notes. Will it be able to view get the zip files? There are so many files in the themes folder and it's going beyond the allowable file path so I wanted it to be placed in zip file.
If you put a zip file in resources, then it will be served as a zip to browsers. So that's not the solution. You need to unzip it and add all files.
You can also put the unzipped files in the default HTML folder on the Domino server without adding them to database resources. On Linux, it's usually /local/notesdata/domino/html/ and on Windows C:\data\domino\html.

How to make doxygen copy a folder without changes into generated HTML docs?

I have a folder with bla.html file and some assets (*.png and *.json) it it.
I want doxygen to copy it into HTML documentation root.
How to make it do such thing in doxygen configuration file (not using external script)?
Upon request:
How about (from the documentation / Doxyfile):
HTML_EXTRA_FILES The HTML_EXTRA_FILES tag can be used to specify one
or more extra images or other source files which should be copied to
the HTML output directory. Note that these files will be copied to the
base HTML output directory. Use the $relpath^ marker in the
HTML_HEADER and/or HTML_FOOTER files to load these files. In the
HTML_STYLESHEET file, use the file name only. Also note that the files
will be copied as-is; there are no commands or markers available. This
tag requires that the tag GENERATE_HTML is set to YES.
The full doxygen documentation can be found at : http://doxygen.nl/manual/index.html and the referred part at: http://doxygen.nl/manual/config.html#cfg_html_extra_files

Mercurial .hgignore file: is it possible to hide extensions in some directories but not others?

We are using Mercurial for keeping track of a number of linguistic papers. We want to keep our source files in Mercurial. The source files are mostly in XML, but the output file is in PDF. Therefore, we have added glob:*.pdf to our .hgignore file. Among our source files, we also have graphic files with extensions like .jpg, .png, and .svg. Recently, we've also added .pdf files as graphic files. Naturally, these PDF graphic files are not showing up when we do a hg status command.
So my question is this: is there a way to create a .hgignore pattern that will ignore *.pdf files in most directories but still show *.pdf in specified directories (directories where we store our graphic files)?
There's a good example which does nearly what you want in the Mercurial wiki.
Quote from the link:
/target/.*\.o$
This would match all files ending with .o below (within and in subdirectories at any depth of) the target directory.
If the number of directories where you want to ignore PDF files is somewhat limited (and not: "ignore *.pdf in all directories but this one"), you can use this solution.

How to extract hhp file from a chm file

I have an A.chm file for my windows application which runs as expected.
When I decompile it using HTML workshop I get set of html files, .hhc file, .hhk file. When I compile another file B.chm from these extracted files without changing any of the files.((I want to add more html contents to this file but looks like I am losing some information after decompiling)) The output file I get is 72K where as the original file was 75K. B.chm's contents look all file when viewed in the chm viewer but the behavior is lost when when used with the application.
After reading around I found that if .hhp can be extracted from a .chm file then it can be re-constructed as it is without losing any mapping or aliases. Is that true?
How can I extract .hhp file from a .chm file?
Thanks,
Sam
No, Yes , and no.
The original hhp can't be guaranteed extracted
however since chm is an archive type, the project could have added all project files to the archive. I assume you already would have found them if that were the case.
If the decompile process does its administration, it can regenerate the .hhp to a certain degree.
Comments and #define names will probably be lost though, maybe more, but that should not result in problems when recompiling.
But of course it could be that the decompiler is limited. You could try some other (search for something from "keytools").
If not, then take "chmlib" and start drilling down into the format.

Issue in creating Zip file using glob.glob

I am creating a Zip file from a folder (and subfolders). it works fine and creates a new .zip file also but I am having an issue while using glob.glob. It is reading all files from the desired folder (source folder) and writing to the new zip file but the problem is that it is, however, adding subdirectories, but not adding files form the subdirectories.
I am giving user an option to select the filename and path as well as filetype also (Zip or Tar). I don;t get any problem while creating .tar.gz file, but when use creates .zip file, this problem comes across.
Here is my code:
for name in (Source_Dir):
for name in glob.glob("/path/to/source/dir/*" ):
myZip.write(name, os.path.basename(name), zipfile.ZIP_DEFLATED)
myZip.close()
Also, if I use code below:
for dirpath, dirnames, filenames in os.walk(Source_Dir):
myZip.write(os.path.join(dirpath, filename) os.path.basename(filename))
myZip.close()
Now the 2nd code taks all files even if it inside the folder/ subfolders, creates a new .zip file and write to it without any directory strucure. It even does not take dir structure for main folder and simply write all files from main dir or subdir to that .zip file.
Can anyone please help me or suggest me. I would prefer glob.glob rather than the 2nd option to use.
Thanks in advance.
Regards,
Akash
Glob by design does not expand into subdirectories. It follows UNIX style path rules and expansions see the documentation for fnmatch for more information. If you want to get at the subdirectories you need to add it to the path. This example will get everything at one level down.
for name in (Source_Dir):
for name in glob.glob("/path/to/source/dir/*/*" ):
myZip.write(name, os.path.basename(name), zipfile.ZIP_DEFLATED)
myZip.close()
Doug Hellman has an excellent discussion here. If you are not using the pattern features of glob (like *.txt for all text files or *[0-9].txt for all text files that have a number before the extension) then I think your os.walk solution is better