Best way to generate Mastering the Lightning Network PDF from ASCIIDOC - asciidoc

The Book "Mastering the Lightning Network" is accessible through Github (https://github.com/lnbook/lnbook) and there are multiple asciidoc files that make the book. The License is that it is free for the own use to generate a pdf. So I looked a bit how to do it and it seems not too easy. It sounds a bit like Latex, but I found not a quick way to make a pdf from the files.
I found something like Asciidoctor . I am not sure if this is the best approach.
So I would be grateful for hints how to generate the book in the easiest way.

AsciiDoctor is based on Ruby plus many other related dependancies thus a Mahoosive potential installation of over 32000 files with a learning curve like LaTeX or any other heavyweight book publishing system.
You asked for the easiest way to "generate" in book format, and you can literally read the docs in a few clicks, but the license specifically allows you to only produce a pdf or similar for private use and you dont need to do a full book at a time for personal everyday reading/reviewing.
Note a similar query was how to combine all the book chapters in
Convert a folder containing asciidocs and pictures to pdf and that could perhaps be answered by building your own book.asciidoc or .asoc as suggested in Generate single PDF from multiple Asciidoc files, however for a few "books for the road" visual or audio, the Ruby Plus Asciidoc installation is overkill and potential for frustrations. Primarily this books navigation is still incomplete.
For the intervening months this year (2022) "You can't create ebooks in PDF, HTML EPUB or any other format unless it is for personal use only and not shared/distributed." https://github.com/lnbook/lnbook#licensing-change-in-12-months
Thus you can print parts to pdf if you need them say while traveling with your ebook / audio reader, but must not do so, for your family, friends or other individuals etc...
Here I am reading the source in FireFox (on the right) and checking a PDF live compilation in my portable book reader. (But please dont read that, its my personal copy for tommorow :-)
The AsciiDoc reader is at https://github.com/asciidoctor/asciidoctor-browser-extension and you simply point the extension at the chapter you wish to read.

The license specifically states:
Mastering the Lightning Network is released under the Creative Commons CC-BY-NC-ND license, which allows sharing the source code for personal use only. You may read this book for free. You may not create derivatives (such as PDF copies), or distribute the book commercially.
The source code is free for personal use, but it explicitly does not permit generation of derivatives such as PDF copies. As such, you won't get help to willfully violate the license.

Related

Why is there no alternative to Adobe Acrobat DC considering features and good/better UI?

I recently started working and came to know AdobeAcrobat DC which I really, really like as a tool to archive and send around information.
Especially loved that you could ...
Convert images (JPEG etc.) to PDF
Combine - Merge multiple pdfs into one document and order them
Compress - Enhance and test around compression
Use the typewriter feature to fill out forms
(really delete) blacken content to send around without exposing confidential parts of a document
OCR - search a scanned document
Really liking the software I thought about buying it. Having a MacOS I sadly had to realize I could only get the Adobe Acrobat DC Pro, because the Standard is not available for my OS.
Now the real shock started. Looking at the price I either could pay 29,74 € a month on demand, or up front either 17,84*12= 214,08 € per year or 665,21 € ones. I was shocked and thought thats way to much for a software just moving data from one format to another!
Then I tried to research and test alternatives using this page and also Mac's own tools (Automater, Preview). Again I was shocked, either the UI was really bad or the features were not even close to Adobe DC.
That was the time I started to ask myself, are there patents
protecting Adobe? Why is there no competition earning the name? For
Windows their is at least Foxit and Nitro ... but for Mac?
Does somebody could help out, and state if the technology is really
tough to reengineer or if there are patents protecting the format?
First and foremost, there is the ISO 32000 standard, and anyone is free to create a viewer which is compliant to that standard. In fact, this is kind of encouraged.
Why Acrobat? Well, Adobe has 25 years of experience and knowledge on how to create a PDF viewer. Adobe also has the necessary resources. And Adobe has the market power… which they do use.
Apple would have the resources to do something useful, but Apple gives a shit about PDF (that's obvious, considering Preview.app messing up certain PDF documents beyond all repair).
Update, added after comment by OP:
About the features mentioned in the OP… Most of these implementations by Adobe are well done, and kind of mature technology. However, there are other implementations out there, and anyone is free to do something following ISO 32000… In detail:
• Converting to PDF is, of course, a side effect of the PDF-creation library Adobe uses in their other applications (InDesign, Illustrator, PostScript, etc.). This library is considered to be top class, and therefore, using it does make a lot of sense…
• Combining… Again, it is the library Adobe developed (for their own and for licenceable use), which can very well read, understand and write PDF. For this feature, there are other good products out in the market.
• Compressing… Smart use of compression provides an optimum between file size and handling speed. Good use and implementation of the various compression schemes.
• Typewriter feature… A bit of a marketing gimmick; it is essenitally an "add Text" annotation. The sole advantage of a form filled with the typewriter tool over a hand-filled form is that the further is better readability. Forms should be fillable, and their data should be retrievable without human interference.
• Redaction… Indeed, Adobe made good progress on this. The industry standard for Redaction is, however, still a plug-in (or server application) for Acrobat (Pro); (Redax by Appligent is the product).
• OCR… Adobe did acquire and license some very good OCR tools; for certain kind of text, the leading third party tools are somewhat better, for others, Acrobat would be the choice.

Applescript to grab text from a text file and highlight said text in Skim. Two failed attempts?

PDF's ubiquity, specially in academia, makes being able to highlight them (and saving these annotations) extremely important. Some academic journals (specially in law) allows the user to send journal articles to a Kindle reader, which makes reading and taking notes extremely easy. The question is how to take the underlined text from the MyClippings.txt file to the PDF. About a year ago I found that this is possible through an action in Adobe Acrobat Pro X which would parse a text file which is feeded to it and would highlight the relevant sections. The action takes advantage of the Search and Redact tool but instead of redacting, it highlights.
However, I would like to get out of the Adobe environment (for different reasons, one of which is that the Adobe reader is demanding resource wise and not-free). Skim in Mac OSX sounds like a good alternative for its support of AppleScript integration. I found two projects in GitHub which attempt to do this, but with both of them I failed.
my-clippings-to-pdf
Skim-AppleScript
Would anyone with knowledge in AppleScript take a look at that code and tell me if they look sound? It seems this would be a great functionality for integrating PDFs and ePub in a useful and meaningful way specially for academics.

Pretty print code to PDF

I'm searching for a tool that will take a source directory and produce a single PDF containing the source code, preferably with syntax highlighting.
I would like to read the PDF on my phone, in order to get familiar with a code-base, or just to see what I can learn by reading a lot of code. I will most often be reading Ruby.
I would prefer if the tool ran on Linux. I don't mind paying for a tool if it is particularly good.
Any suggestions?
You could wipe something up yourself with Prawn and Ultraviolet.
PDF is no good for reflowing. You might like a html based solution better.
And in reading existing code, a lineair model is no good. You need to jump from one file to the other. A hypertext model with history would probably work best on the limited screen estate of a phone. It should borrow some features of the smalltalk IDEs (jump to senders, implementors).
For the UI, take a look at clamato
GNU source-highlight supports many languages and can output LaTeX in particular that can be converted to pdf.
The SciTE editor can export the currently edited file (with syntax highlighting) to PDF (and HTML, RTF, LaTeX and XML).
Alas, it doesn't have batch conversion capability, but IIRC somebody made a batch tool out of this code base.
I realize this is very late, but I wanted to do the same thing, except I wanted it for my tablet, which is a Galaxy Note 10.1 with a Wacom digitizer that I can use to annotate code. I found that one good solution is to use Doxygen to generate a PDF which will have hyperlinks and everything you would want in a PDF. For my use case, I would pair it with EzPDF on Android to annotate the code. This was also for the purpose of learning a new codebase. In the end I ended up not using the generated PDF but it was pretty usable.

Is there a website to look up common, already written functions?

I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
Possibly a wiki of some type that contains free code that anybody can edit and improve?
Edit: I can code things fine, I just don't know HOW to do them. So for example, right now, I'm trying to localize a robot/car/point in space. I KNOW there is a way to do it, just based off of range and distance. Triangulation and Trilateration. How to code that is a different story. A site that could have psuedo code, step by step how to do that would be ridiculously helpful. It would also ensure the optimal solution since everybody can edit it. I'm also writing in Matlab, which I hate because it's quirky, adding to my desire for creating a website like I describe.
StackOverflow.com. No, I'm not joking.
At its best, people come here saying "hasn't some library done X already", and very often the Collective Wisdom answers "yes". But the biggest obstacle is lack of a description language: even here, a big problem for many posters is describing the problem clearly enough for others to recognize it as something they've seen before.
And if people can't understand what you're trying to do, no search engine will.
Firstly, two caveats:
Copy and pasting code you don't understand is a bad idea. Make sure you understand exactly what the code does before you use it.
Make sure you respect the license of the code you are copying. This is important!
Those caveats aside, it's often language dependent. Languages with an open development ethos (not just an open source implementation, think Python as compared to Java) tend to have official archives of open source libraries. For example:
Perl (which probably started this trend) has CPAN
Python has PyPI and Python Cookbook
PHP has PEAR
C++ has boost
Ruby has gems
R has CRAN.
Haskell has Hoogle and Hackage
Furthermore, don't forget to look in your languages standard library. Some modern languages have massive standard libraries, which have often contained the functionality I am looking for:
Java has its API documentation
C# and VB.NET have the massive MSDN
Non-openly developed languages often have non-official community archives. For example:
C# tends to have a lot of code at CodePlex and CodeProject
MATLAB has the Matlab Central File Exchange
A third category of sites are language agnostic. They are often best search through POG (plain old-fashioned Google). For example:
Stack Overflow
SourceForge
The confusingly language agnostic Java2s
Planet source code
Github
Finally, a fourth category of sites that I find increasingly useful are source-code search engines:
Google Codesearch
Koders
You may also be able to find useful source code, or at least get help writing something, through various pastebins.
Pastebin is language-agnostic
HPaste is mostly Haskell, but has a little in other languages.
Often, at the end of the day it is easiest just to google it, though.
There is a wiki that contains free code that anybody can edit and improve:
Rosetta Code.
As a means of an overview there is the "Solutions by Programming Task" page.
From the former page:
"Rosetta Code is a programming chrestomathy site. The
idea is to present solutions to the same task in as
many different languages as possible, to demonstrate
how languages are similar and different, and to aid a
person with a grounding in one approach to a problem
in learning another."
Cutting and pasting code you find on the Internet into production code would be like chewing gum found in the street. - Mike Johnson
With that in mind, try sites that host opensource projects like GitHub, CodePlex, code.google.com, etc.
I'm not sure this question is language agnostic, but I use GitHub this way ;) Other languages may have places where this is possible.
Safari Bookshelf from O'Reilly has many, many books that contain many implementations from which to choose.
http://my.safaribooksonline.com/
I was a subscriber for a few years before coming to my current job, where we have a corporate account! It's one of the best perks, and one of the best resources I have available. I haven't bought a computer book in years.
Aside from sites like this (Stack Overflow) I don't think there's many, maybe CodePlex, but I almost marked you -1 for assuming that code found on the Internet is yours to copy.
I'd suggest reading about software licencing, I hope you'd at least comment where you got it from.

Windows Help files - what are the options?

Back in the old days, Help was not trivial but possible: generate some funky .rtf file with special tags, run it through a compiler, and you got a WinHelp file (.hlp) that actually works really well.
Then, Microsoft decided that WinHelp was not hip and cool anymore and switched to CHM, up to the point they actually axed WinHelp from Vista.
Now, CHM maybe nice, but everyone that tried to open a .chm file on the Network will know the nice "Navigation to the webpage was canceled" screen that is caused by security restrictions.
While there are ways to make CHM work off the network, this is hardly a good choice, because when a user presses the Help Button he wants help and not have to make some funky settings.
Bottom Line: I find CHM absolutely unusable. But with WinHelp not being an option anymore either, I wonder what the alternatives are, especially when it comes to integrate with my Application (i.e. for WinHelp and CHM there are functions that allow you to directly jump to a topic)?
PDF has the disadvantage of requiring the Adobe Reader (or one of the more lightweight ones that not many people use). I could live with that seeing as this is kind of standard nowadays, but can you tell it reliably to jump to a given page/anchor?
HTML files seem to be the best choice, you then just have to deal with different browsers (CSS and stuff).
Edit: I am looking to create my own Help Files. As I am a fan of the "No Setup, Just Extract and Run" Philosophy, i had that problem many times in the past because many of my users will run it off the network, which causes exactly this problem.
So i am looking for a more robust and future-proof way to provide help to my users without having to code a different help system for each application i make.
CHM is a really nice format, but that Security Stuff makes it unusable, as a Help system is supposed to provide help to the user, not to generate even more problems.
HTML would be the next best choice, ONLY IF you would serve them from a public web server. If you tried to bundle it with your app, all the files (and images (and stylesheets (and ...) ) ) would make CHM look like a gift from gods.
That said, when actually bundled in the installation package, (instead of being served over the network), I found the CHM files to work nicely.
OTOH, another pitfall about CHM files: Even if you try to open a CHM file on a local disk, you may bump into the security block if you initially downloaded it from somewhere, because the file could be marked as "came from external source" when it was obtained.
I don't like the html option, and actually moved from plain HTML to CHM by compressing and indexing them. Even use them on a handful of non-Windows customers even.
It simply solved the constant little breakage of people putting it on the network (nesting depth limited, strange locking effects), antivirus that died in directories with 30000 html files, and 20 minutes decompression time while installing on an older system, browser safety zones and features, miscalculations of needed space in the installer etc.
And then I don't even include the people that start "correcting" them, 3rd party product with faulty "integration" attempts etc, complaints about slowliness (browser start-up)
We all had waited years for the problems to go away as OSes and hardware improved, but the problems kept recurring in a bedazzling number of varieties and enough was enough. We found chmlib, and decided we could forever use something based on this as escape with a simple external reader, if the OS provided ones stopped working and switched.
Meanwhile we also have an own compiler, so we are MS free future-proof. That doesn't mean we never will change (solutions with local web-servers seem favourite nowadays), but at least we have a choice.
Our software is both distributed locally to the clients and served from a network share. We opted for generating both a CHM file and a set of HTML files for serving from the network. Users starting the program locally use the CHM file, and users getting their program served from a network share has to use the HTML files.
We use Help and Manual and can thus easily produce both types of output from the same source project. The HTML files also contain searching capabilities and doesn't require a web server, so though it isn't an optimal solution, works fine.
So far all the single-file types for Windows seems broken in one way or another:
WinHelp - obsoleted
HtmlHelp (CHM) - obsoleted on Vista, doesn't work from network share, other than that works really nice
Microsoft Help 2 (HXS) - this seems to work right up until the point when it doesn't, corrupted indexes or similar, this is used by Visual Studio 2005 and above, as an example
If you don't want to use an installer and you don't want the user to perform any extra steps to allow CHM files over the network, why not fall back to WinHelp? Vista does not include WinHlp32.exe out of the box, but it is freely available as a download for both Vista and Server 2008.
It depends on how import the online documentation is to your product, a good documentation infrastructure can be complex to establish but once done it pays off. Here is how we do it -
Help source DITA compilant XML, stored in SCC (ClearCase).
Help editing XMetal
Help compilation, customized Open DITA Toolkit, with custom Perl/Java preprocessing
Help source cross references applications resources at compile time, .RC files etc
Help deliverables from single source, PDF, CHM, Eclipse Help, HTML.
Single source repository produces help for multiple products 10+ with thousands of shared topics.
From what you describe I would look at Eclipse Help, its not simple to integrate into .NET or MFC applications, you basically have to do the help mapping to resolve the request to a URL then fire the URL to Eclipse Help wrapper or a browser.
Is the question how to generate your own help files, or what is the best help file format?
Personally, I find CHM to be excellent. One of the first things I do when setting up a machine is to download the PHP Manual in CHM format (http://www.php.net/download-docs.php) and add a hotkey to it in Crimson Editor. So when I press F1 it loads the CHM and performs a search for the word my cursor is on (great for quick function reference).
If you are doing "just extract and run", you are going to run in security issues. This is especially true if you are users are running Vista (or later). is there a reason why you wanted to avoid packaging your applications inside an installer? Using an installer would alleviate the "external source" problem. You would be able to use .chm files without any problems.
We use InstallAware to create our install packages. It's not cheap, but is very good. If cost is your concern, WIX is open source and pretty robust. WIX does have a learning curve, but it's easy to work with.
PDF has the disadvantage of requiring the Adobe Reader
I use Foxit Reader on Windows at home and at work. A lot smaller and very quick to open. Very handy when you are wondering what exactly a80000326.pdf is and why it is clogging up your documents folder.
I think the solution we're going to end up going with for our application is hosting the help files ourselves. This gives us immediate access to the files and the ability to keep them up to date.
What I plan is to have the content loaded into a huge series of XML files, each one containing help for a specific item. This XML would contain links to other XML files. We would use XSLT to display the contents as necessary.
Depending on the licensing, we may build a client-specific XSLT file in order to tailor the look and feel to what they need. We may need to be able to only show help for particular versions of our product as well and that can be done by filtering out stuff in the XSLT.
I use a commercial package called AuthorIT that can generate a number of different formats, such as chm, html, pdf, word, windows help, xml, xhtml, and some others I have never heard of (does dita ring a bell?).
It is a content management system oriented towards the needs of technical documentation writers.
The advantage is that you can use and re-use the same content to build a set of guides, and then generate them in different formats.
So the bottom line relative to the question of choosing chm or html or whatever is that if you are using this you are not locked into a given format, but you can provide several among which the user can choose, and you can even add more formats as you go along, at no extra cost.
If you just have one guide to create it won't be worth your while, but if you have a documentation set to manage then it is the best to my knowledge. Their support is very helpful also.

Resources