olddoc 1.5.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.olddoc.yml +14 -5
- data/Documentation/.gitignore +1 -0
- data/Documentation/GNUmakefile +53 -24
- data/Documentation/olddoc.1.pod +21 -0
- data/Documentation/{olddoc.5.txt → olddoc.5.pod} +9 -12
- data/Documentation/podtxt2html +54 -0
- data/GIT-VERSION-GEN +2 -2
- data/GNUmakefile +1 -1
- data/README +16 -13
- data/Rakefile +1 -1
- data/bin/olddoc +3 -1
- data/lib/dark216.rb +41 -0
- data/lib/olddoc.rb +3 -1
- data/lib/olddoc/history.rb +1 -1
- data/lib/olddoc/man2html.rb +149 -0
- data/lib/olddoc/news_atom.rb +2 -2
- data/lib/olddoc/prepare.rb +2 -2
- data/lib/oldweb.rb +25 -8
- data/lib/oldweb/_head.rhtml +5 -1
- data/lib/oldweb/_tail.rhtml +5 -2
- metadata +8 -6
- data/Documentation/olddoc.1.txt +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1400bf9d3e94d012404961bf1f665ba6006eb0edc8bdc5e55c178ef068893828
|
4
|
+
data.tar.gz: a3c8a0d8e9642af7c00f92592c5d61e52a430a321b5e26aac604fac1f9b05b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a48ad6a40397a4fa28eccd7c1346f7eb65d8625e73c2be73585226fe7c6acf858e6175043fe93021f05bf8a2ff3b57cd3a0c9e9db584cc046bb680b64f41ba88
|
7
|
+
data.tar.gz: 10f049dc25df53ef808a9b8afe74f80889f61f116938c0573dab427299c622608e7b7aed775ad9e530421cc465647effe39d41f4fb03658e9a2759cbaf9e32b4
|
data/.olddoc.yml
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
---
|
2
|
-
cgit_url:
|
3
|
-
|
2
|
+
cgit_url:
|
3
|
+
- https://80x24.org/olddoc.git
|
4
|
+
- https://ou63pmih66umazou.onion/olddoc.git
|
5
|
+
git_url: https://80x24.org/olddoc.git
|
4
6
|
rdoc_url: https://80x24.org/olddoc/
|
5
|
-
ml_url:
|
6
|
-
|
7
|
+
ml_url:
|
8
|
+
- https://80x24.org/olddoc-public/
|
9
|
+
- http://ou63pmih66umazou.onion/olddoc-public/
|
10
|
+
nntp_url:
|
11
|
+
- nntps://news.public-inbox.org/inbox.comp.lang.ruby.olddoc
|
12
|
+
- nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.olddoc
|
13
|
+
imap_url:
|
14
|
+
- imaps://news.public-inbox.org/inbox.comp.lang.ruby.olddoc.0
|
15
|
+
- imap://ou63pmih66umazou.onion/inbox.comp.lang.ruby.olddoc.0
|
7
16
|
merge_html:
|
8
17
|
olddoc_1: Documentation/olddoc.1.html
|
9
18
|
olddoc_5: Documentation/olddoc.5.html
|
10
19
|
public_email: olddoc-public@80x24.org
|
11
|
-
source_code: git clone
|
20
|
+
source_code: git clone https://80x24.org/olddoc.git
|
data/Documentation/.gitignore
CHANGED
data/Documentation/GNUmakefile
CHANGED
@@ -1,26 +1,32 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2019 all contributors <olddoc-public@80x24.org>
|
2
2
|
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
3
3
|
all::
|
4
4
|
|
5
5
|
INSTALL = install
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
POD2MAN = pod2man
|
7
|
+
-include ../GIT-VERSION-FILE
|
8
|
+
release := olddoc $(VERSION)
|
9
|
+
POD2MAN_OPTS = -v -r '$(release)' --stderr -d 1994-10-02 -c 'olddoc user manual'
|
10
|
+
pod2man = $(POD2MAN) $(POD2MAN_OPTS)
|
11
|
+
POD2TEXT = pod2text
|
12
|
+
POD2TEXT_OPTS = --stderr
|
13
|
+
pod2text = $(POD2TEXT) $(POD2TEXT_OPTS)
|
10
14
|
|
15
|
+
m1 =
|
16
|
+
m1 += olddoc.1
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
man7 :=
|
18
|
+
m5 =
|
19
|
+
m5 += olddoc.5
|
15
20
|
|
16
|
-
|
17
|
-
|
18
|
-
|
21
|
+
m7 =
|
22
|
+
|
23
|
+
man1 := $(m1)
|
24
|
+
man5 := $(m5)
|
25
|
+
man7 := $(m7)
|
19
26
|
|
20
27
|
all:: man
|
21
28
|
|
22
29
|
man: $(man1) $(man5) $(man7)
|
23
|
-
html: $(html1) $(html5) $(html7)
|
24
30
|
|
25
31
|
prefix ?= $(HOME)
|
26
32
|
mandir ?= $(prefix)/share/man
|
@@ -30,24 +36,47 @@ man7dir = $(mandir)/man7
|
|
30
36
|
|
31
37
|
gem-man: man
|
32
38
|
$(INSTALL) -d -m 755 ../man
|
33
|
-
|
34
|
-
|
39
|
+
$(INSTALL) -m 644 $(man1) ../man
|
40
|
+
$(INSTALL) -m 644 $(man5) ../man
|
35
41
|
test -z "$(man7)" || $(INSTALL) -m 644 $(man7) ../man
|
36
42
|
|
37
43
|
install-man: man
|
38
|
-
$(INSTALL) -d -m 755 $(DESTDIR)$(
|
39
|
-
|
40
|
-
test -z "$(man5)" || $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
|
44
|
+
$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
|
45
|
+
$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
|
41
46
|
test -z "$(man7)" || $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
|
42
|
-
|
43
|
-
|
47
|
+
$(INSTALL) -m 644 $(man1) $(DESTDIR)$(man1dir)
|
48
|
+
$(INSTALL) -m 644 $(man5) $(DESTDIR)$(man5dir)
|
44
49
|
test -z "$(man7)" || $(INSTALL) -m 644 $(man7) $(DESTDIR)$(man7dir)
|
45
50
|
|
46
|
-
|
47
|
-
$(
|
51
|
+
%.1 : %.1.pod
|
52
|
+
$(pod2man) -s 1 $< $@+
|
53
|
+
mv $@+ $@
|
54
|
+
|
55
|
+
%.5 : %.5.pod
|
56
|
+
$(pod2man) -s 5 $< $@+
|
57
|
+
mv $@+ $@
|
58
|
+
|
59
|
+
%.7 : %.7.pod
|
60
|
+
$(pod2man) -s 7 $< $@+
|
61
|
+
mv $@+ $@
|
62
|
+
|
63
|
+
mantxt = $(addsuffix .txt, $(m1) $(m5) $(m7))
|
64
|
+
|
65
|
+
txt :: $(mantxt)
|
66
|
+
|
67
|
+
all :: txt
|
68
|
+
|
69
|
+
%.txt : %.pod
|
70
|
+
$(pod2text) $< $@+
|
71
|
+
touch -r $< $@+
|
72
|
+
mv $@+ $@
|
48
73
|
|
49
|
-
|
50
|
-
$(
|
74
|
+
html : podtxt2html $(mantxt)
|
75
|
+
./podtxt2html $(mantxt)
|
51
76
|
|
52
77
|
clean::
|
53
|
-
$(RM) $(man1) $(man5) $(man7)
|
78
|
+
$(RM) $(man1) $(man5) $(man7)
|
79
|
+
$(RM) $(addsuffix .txt.gz, $(m1) $(m5) $(m7))
|
80
|
+
$(RM) $(addsuffix .txt, $(m1) $(m5) $(m7))
|
81
|
+
$(RM) $(addsuffix .html, $(subst .,_,$(m1) $(m5) $(m7)))
|
82
|
+
$(RM) $(addsuffix .html.gz, $(subst .,_,$(m1) $(m5) $(m7)))
|
@@ -0,0 +1,21 @@
|
|
1
|
+
=head1 NAME
|
2
|
+
|
3
|
+
olddoc - old-fashioned RDoc HTML generator
|
4
|
+
|
5
|
+
=head1 SYNOPSYS
|
6
|
+
|
7
|
+
olddoc prepare
|
8
|
+
|
9
|
+
rdoc -f oldweb
|
10
|
+
|
11
|
+
rdoc -f dark216
|
12
|
+
|
13
|
+
=head1 DESCRIPTION
|
14
|
+
|
15
|
+
olddoc features dark216, and old-fashioned RDoc HTML generator.
|
16
|
+
You can also use "olddoc prepare" to generate NEWS files from
|
17
|
+
git tags.
|
18
|
+
|
19
|
+
=head1 SEE ALSO
|
20
|
+
|
21
|
+
L<olddoc(5)>
|
@@ -1,29 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# NAME
|
1
|
+
=head1 NAME
|
4
2
|
|
5
3
|
.olddoc.yml - olddoc config file format
|
6
4
|
|
7
|
-
|
5
|
+
=head1 SYNOPSIS
|
8
6
|
|
9
7
|
A YAML file in the top-level project directory named ".olddoc.yml"
|
10
8
|
|
11
|
-
|
9
|
+
=head1 DESCRIPTION
|
12
10
|
|
13
11
|
As olddoc favors consistency over configuration, there is minimal
|
14
12
|
configuration to deal with.
|
15
13
|
|
16
|
-
|
14
|
+
=head1 KEYS
|
17
15
|
|
18
|
-
`rdoc_url`, `cgit_url`, and `nntp_url` should be obvious
|
16
|
+
`rdoc_url`, `cgit_url`, `imap_url`, and `nntp_url` should be obvious
|
19
17
|
|
20
18
|
`merge_html` is a key-value mapping of (empty) RDoc source files to an
|
21
19
|
HTML file that will be merged into RDoc after-the-fact. It is useful
|
22
20
|
for merging non-RDoc generated HTML into the project.
|
23
21
|
|
24
|
-
`ml_url` is the
|
25
|
-
`public_email` is the email address of a
|
26
|
-
at `ml_url`
|
22
|
+
`ml_url` is the mail archive location.
|
23
|
+
`public_email` is the email address of a mail archived at `ml_url`
|
27
24
|
|
28
25
|
As of olddoc 1.2.0, `ml_url` and `nntp_url` may be YAML arrays
|
29
26
|
with multiple URLs.
|
@@ -33,6 +30,6 @@ commands or URLs. This allows users of arbitrary version
|
|
33
30
|
control systems to specify instructions for getting the code
|
34
31
|
and not assume users are familiar with any particular system.
|
35
32
|
|
36
|
-
|
33
|
+
=head1 SEE ALSO
|
37
34
|
|
38
|
-
olddoc(1)
|
35
|
+
L<olddoc(1)>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# Copyright (C) 2019 all contributors <olddoc-public@80x24.org>
|
3
|
+
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
4
|
+
|
5
|
+
# pod2html isn't to my liking, and we need to generate anchors
|
6
|
+
# compatible with what pandoc was generating to avoid breaking
|
7
|
+
# links. Takes pod2text-generated text and transforms it to
|
8
|
+
# an HTML fragment
|
9
|
+
|
10
|
+
txts = ARGV
|
11
|
+
links = {}
|
12
|
+
txts.each do |f|
|
13
|
+
if f =~ /(\A[\w\-]+)\.(\d)\.txt\z/
|
14
|
+
base = $1
|
15
|
+
section = $2
|
16
|
+
links["#{base}(#{section})"] = "#{base}_#{section}.html"
|
17
|
+
else
|
18
|
+
abort "#{f} is not of <BASE>.<SECTION>.txt\n"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
linkre = links.keys.map { |x| Regexp.escape(x) }.join('|')
|
23
|
+
|
24
|
+
sections = '[A-Z][A-Z ]+'
|
25
|
+
txts.each do |f|
|
26
|
+
str = File.read(f)
|
27
|
+
str = str.split(/^(#{sections})$/mo)
|
28
|
+
str = str.map! do |s|
|
29
|
+
case s
|
30
|
+
when /\A(#{sections})$/o
|
31
|
+
# this is to be compatible with HTML fragments pandoc used
|
32
|
+
sec = $1
|
33
|
+
anchor = sec.downcase.tr(' ', '-')
|
34
|
+
%Q(<h1\nid=#{anchor}>#{sec}</h1>)
|
35
|
+
else
|
36
|
+
s.encode!(xml: :text)
|
37
|
+
s.gsub!(/\b(#{linkre})/mo) do |m|
|
38
|
+
manref = $1
|
39
|
+
if url = links[manref]
|
40
|
+
%Q(<a\nhref="#{url}">#{manref}</a>)
|
41
|
+
else
|
42
|
+
manref
|
43
|
+
end
|
44
|
+
end
|
45
|
+
s.rstrip!
|
46
|
+
s.empty? ? '' : "<pre>#{s}</pre>"
|
47
|
+
end # case s
|
48
|
+
end.join
|
49
|
+
|
50
|
+
html = f.sub(/.txt\z/, '.html')
|
51
|
+
tmp = html + '+'
|
52
|
+
File.open(tmp, 'w') { |f| f.write(str) }
|
53
|
+
File.rename(tmp, html)
|
54
|
+
end
|
data/GIT-VERSION-GEN
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (C) 2016 all contributors <olddoc-public@80x24.org>
|
2
|
+
# Copyright (C) 2016-2019 all contributors <olddoc-public@80x24.org>
|
3
3
|
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
4
4
|
# frozen_string_literal: true
|
5
5
|
CONSTANT = "Olddoc::VERSION"
|
6
6
|
RVF = "lib/olddoc/version.rb"
|
7
7
|
GVF = "GIT-VERSION-FILE"
|
8
|
-
DEF_VER = "v1.
|
8
|
+
DEF_VER = "v1.9.0"
|
9
9
|
vn = DEF_VER.dup
|
10
10
|
|
11
11
|
# First see if there is a version file (included in release tarballs),
|
data/GNUmakefile
CHANGED
data/README
CHANGED
@@ -3,15 +3,17 @@
|
|
3
3
|
olddoc contains old-fashioned document generators for those who do not
|
4
4
|
wish to impose bloated, new-fangled web cruft on their readers.
|
5
5
|
|
6
|
-
olddoc contains
|
7
|
-
|
8
|
-
and/or low-bandwidth connections
|
9
|
-
|
6
|
+
olddoc contains dark216, a HTML generator without any images, frames,
|
7
|
+
or JavaScript. It is designed for users of text-based browsers
|
8
|
+
and/or low-bandwidth connections; yet respects user preference for
|
9
|
+
light color schemes in new CSS browsers while favoring darkness for
|
10
|
+
power savings on OLED and CRT displays. dark216 focuses on text as
|
11
|
+
it is the lowest common denominator for accessibility and compatibility
|
10
12
|
with people and hardware.
|
11
13
|
|
12
14
|
== Reasons
|
13
15
|
|
14
|
-
* No CSS. Encouraging users to use CSS leads to problems like
|
16
|
+
* No CSS required. Encouraging users to use CSS leads to problems like
|
15
17
|
copy-paste hijacking: https://thejh.net/misc/website-terminal-copy-paste
|
16
18
|
External CSS also increases page load time as it often blocks page
|
17
19
|
rendering. Asynchronous loading of CSS also causes accessibility
|
@@ -38,7 +40,7 @@ missing out!
|
|
38
40
|
|
39
41
|
gem install olddoc
|
40
42
|
cd $ANY_RDOC_USING_RUBY_PROJECT
|
41
|
-
rdoc -f
|
43
|
+
rdoc -f dark216
|
42
44
|
|
43
45
|
You can also use olddoc to generate NEWS entries
|
44
46
|
assuming you have git tags, a README file and .olddoc.yml
|
@@ -52,7 +54,7 @@ such as pandoc(1). This requries an appropriately configured
|
|
52
54
|
|
53
55
|
== Source code
|
54
56
|
|
55
|
-
git clone
|
57
|
+
git clone https://80x24.org/olddoc.git
|
56
58
|
|
57
59
|
Please use git-format-patch(1) and git-send-email(1) distributed with
|
58
60
|
the git(7) suite for generating and sending patches. Please format
|
@@ -62,14 +64,15 @@ with git(7)) and send them via email to <olddoc-public@80x24.org>
|
|
62
64
|
== Contact
|
63
65
|
|
64
66
|
All feedback (comments, results, feature requests, bug reports, patches,
|
65
|
-
pull-requests) via plain-text
|
66
|
-
appreciated.
|
67
|
+
pull-requests) via plain-text email is very much appreciated.
|
67
68
|
|
68
|
-
Please send plain-text
|
69
|
+
Please send plain-text email to us at <olddoc-public@80x24.org>
|
70
|
+
Use reply-to-all as we do not require any sort of subscription.
|
69
71
|
HTML will not be read. olddoc is for GUI-phobes, by GUI-phobes.
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
We archive all of our mail publically at:
|
73
|
+
|
74
|
+
https://80x24.org/olddoc-public/
|
75
|
+
nntp://news.public-inbox.org/inbox.comp.lang.ruby.olddoc
|
73
76
|
|
74
77
|
== License
|
75
78
|
|
data/Rakefile
CHANGED
data/bin/olddoc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
2
|
+
# Copyright (C) 2015,2019 all contributors <olddoc-public@80x24.org>
|
3
3
|
$stderr.sync = $stdout.sync = true
|
4
4
|
tasks = %w(prepare merge)
|
5
5
|
usage = "Usage: #{File.basename($0)} [#{tasks.join('|')}]"
|
@@ -10,6 +10,8 @@ when "prepare"
|
|
10
10
|
Olddoc::Prepare.new(opts).run
|
11
11
|
when "merge"
|
12
12
|
Olddoc::Merge.new(opts).run
|
13
|
+
when "man2html"
|
14
|
+
Olddoc::Man2HTML.new(opts).run(ARGV[1..-1])
|
13
15
|
else
|
14
16
|
warn "#{$0.inspect} #{ARGV.inspect} not understood"
|
15
17
|
abort usage
|
data/lib/dark216.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (C) 2019 all contributors <olddoc-public@80x24.org>
|
2
|
+
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
3
|
+
|
4
|
+
# Loosely derived from Darkfish in the main rdoc distribution
|
5
|
+
require_relative 'oldweb'
|
6
|
+
|
7
|
+
# dark216 is an \RDoc template and not intended as a programming API.
|
8
|
+
# It respect prefers-color-scheme:light on newer browsers with CSS
|
9
|
+
# support, but favors darkness for power-savings.
|
10
|
+
# You may specify it as an \RDoc formatter:
|
11
|
+
#
|
12
|
+
# rdoc -f dark216 ...
|
13
|
+
class Dark216 < Oldweb
|
14
|
+
RDoc::RDoc.add_generator(self) # :nodoc:
|
15
|
+
include ERB::Util # :nodoc:
|
16
|
+
|
17
|
+
# description of the generator
|
18
|
+
DESCRIPTION = 'minimal dark HTML generator'
|
19
|
+
|
20
|
+
# default to a dark, web-safe (216 color) palette for power-savings.
|
21
|
+
# Color-capable browsers can respect the prefers-color-scheme:light
|
22
|
+
# @media query (browser support a work-in-progress)
|
23
|
+
STYLE = <<'EOF'.gsub(/^\s*/m, '').delete!("\n") # :nodoc:
|
24
|
+
@media screen {
|
25
|
+
*{background:#000;color:#ccc}
|
26
|
+
a{color:#69f;text-decoration:none}
|
27
|
+
a:visited{color:#96f}
|
28
|
+
}
|
29
|
+
@media screen AND (prefers-color-scheme:light) {
|
30
|
+
*{background:#fff;color:#333}
|
31
|
+
a{color:#00f;text-decoration:none}
|
32
|
+
a:visited{color:#808}
|
33
|
+
}
|
34
|
+
EOF
|
35
|
+
|
36
|
+
def initialize(*args) # :nodoc:
|
37
|
+
super
|
38
|
+
@oldweb_style = STYLE
|
39
|
+
end
|
40
|
+
end
|
41
|
+
# :startdoc:
|
data/lib/olddoc.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2015-
|
1
|
+
# Copyright (C) 2015-2019 all contributors <olddoc-public@80x24.org>
|
2
2
|
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
3
3
|
module Olddoc # :nodoc:
|
4
4
|
autoload :Gemspec, 'olddoc/gemspec'
|
@@ -8,6 +8,7 @@ module Olddoc # :nodoc:
|
|
8
8
|
autoload :NewsRdoc, 'olddoc/news_rdoc'
|
9
9
|
autoload :Prepare, 'olddoc/prepare'
|
10
10
|
autoload :Readme, 'olddoc/readme'
|
11
|
+
autoload :Man2HTML, 'olddoc/man2html'
|
11
12
|
|
12
13
|
def self.config(path = ".olddoc.yml")
|
13
14
|
File.readable?(path) and return YAML.load(File.read(path))
|
@@ -16,3 +17,4 @@ module Olddoc # :nodoc:
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
require_relative 'oldweb'
|
20
|
+
require_relative 'dark216'
|
data/lib/olddoc/history.rb
CHANGED
@@ -0,0 +1,149 @@
|
|
1
|
+
# Copyright (C) 2019 all contributors <olddoc-public@80x24.org>
|
2
|
+
# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
|
3
|
+
# frozen_string_literal: true
|
4
|
+
require 'digest'
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
# linkifier for manpages rendered to a terminal. man2html(1) and
|
8
|
+
# groff generate too much style
|
9
|
+
|
10
|
+
class Olddoc::Man2HTML # :nodoc:
|
11
|
+
SALT = rand
|
12
|
+
LINK_RE = %r{([\('!])?\b((?:ftps?|https?|nntps?|gopher|imaps?)://
|
13
|
+
[\@:\w\.-]+(?:/
|
14
|
+
(?:[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]*)
|
15
|
+
(?:\?[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%]+)?
|
16
|
+
(?:\#[a-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@/%\?]+)?
|
17
|
+
)?
|
18
|
+
)}xi
|
19
|
+
|
20
|
+
PAIRS = {
|
21
|
+
"(" => %r/(\)[\.,;\+]?)\z/, # Markdown (,), Ruby (+) (, for arrays)
|
22
|
+
"'" => %r/('[\.,;\+]?)\z/, # Perl / Ruby
|
23
|
+
"!" => %r/(![\.,;\+]?)\z/, # Perl / Ruby
|
24
|
+
}
|
25
|
+
|
26
|
+
def initialize(opts) # :nodoc:
|
27
|
+
end
|
28
|
+
|
29
|
+
def run(argv) # :nodoc:
|
30
|
+
out = $stdout
|
31
|
+
OptionParser.new("", 24, ' ') do |opts|
|
32
|
+
opts.on('-o', '--output PATH', 'output to given file') { |path|
|
33
|
+
out = File.open(path, 'w')
|
34
|
+
}
|
35
|
+
opts.parse!(argv)
|
36
|
+
end
|
37
|
+
argv[0] or abort 'manpage required'
|
38
|
+
cols = '72'
|
39
|
+
env = ENV.to_hash
|
40
|
+
env.merge!({ 'COLUMNS' => cols, 'MANWIDTH' => cols, 'TERM' => 'dumb' })
|
41
|
+
|
42
|
+
# note: I don't care for the styles groff and man2html throw
|
43
|
+
# on us, I just want indented and wrapped text with <a hrefs>
|
44
|
+
# for URLs.
|
45
|
+
|
46
|
+
# try man-db options, first:
|
47
|
+
str = IO.popen(env, ['man', '--nh', '--nj', *argv], &:read)
|
48
|
+
|
49
|
+
if str.empty? || !$?.success?
|
50
|
+
str = IO.popen(env, ['man', *argv], &:read)
|
51
|
+
end
|
52
|
+
if $?.success?
|
53
|
+
sections = '[A-Z][A-Z ]+'
|
54
|
+
str = str.split(/^(#{sections})$/mo)
|
55
|
+
|
56
|
+
str = str.map! do |s|
|
57
|
+
case s
|
58
|
+
when /\A(#{sections})$/o
|
59
|
+
# this is to be compatible with HTML fragments pandoc used
|
60
|
+
sec = $1
|
61
|
+
anchor = sec.downcase.tr(' ', '-')
|
62
|
+
"<h1\nid=#{anchor.encode(xml: :attr)}>#{sec}</h1>"
|
63
|
+
else
|
64
|
+
state = linkify_1(s)
|
65
|
+
s.encode!(xml: :text)
|
66
|
+
linkify_2(state, s)
|
67
|
+
s.rstrip!
|
68
|
+
s.empty? ? '' : "<pre>#{s}</pre>"
|
69
|
+
end
|
70
|
+
end.join
|
71
|
+
|
72
|
+
out.print(str)
|
73
|
+
|
74
|
+
# use mtime of the original source
|
75
|
+
if out.respond_to?(:path)
|
76
|
+
path = out.path
|
77
|
+
out.close
|
78
|
+
stat = src_input_stat(argv)
|
79
|
+
File.utime(stat.atime, stat.mtime, path) if stat
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def src_input_stat(argv)
|
85
|
+
argv.reverse_each do |f|
|
86
|
+
next unless File.file?(f)
|
87
|
+
return File.stat(f)
|
88
|
+
end
|
89
|
+
|
90
|
+
argv.reverse_each do |f|
|
91
|
+
path = IO.popen(%W(man -w #{f}), &:read)
|
92
|
+
path.chomp!
|
93
|
+
next unless File.file?(path)
|
94
|
+
return File.stat(path)
|
95
|
+
end
|
96
|
+
nil
|
97
|
+
end
|
98
|
+
|
99
|
+
def linkify_1(str) # :nodoc:
|
100
|
+
state = {}
|
101
|
+
str.gsub!(LINK_RE) do
|
102
|
+
head = $1 || ''
|
103
|
+
url = $2.dup
|
104
|
+
tail = ''.dup
|
105
|
+
|
106
|
+
# it's fairly common to end URLs in messages with
|
107
|
+
# '.', ',' or ';' to denote the end of a statement;
|
108
|
+
# assume the intent was to end the statement/sentence
|
109
|
+
# in English
|
110
|
+
if re = PAIRS[head]
|
111
|
+
url.sub!(re, '')
|
112
|
+
tail = $1
|
113
|
+
elsif url.sub!(/(\))?([\.,;])\z/, '')
|
114
|
+
tail = $2
|
115
|
+
# require ')' to be paired with '('
|
116
|
+
if $1 # ')'
|
117
|
+
if url.index('(').nil?
|
118
|
+
tail = ")#{tail}"
|
119
|
+
else
|
120
|
+
url += ')'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
elsif url !~ /\(/ && url.sub!(/\)\z/, '')
|
124
|
+
tail = ')'
|
125
|
+
end
|
126
|
+
|
127
|
+
# salt this, as this could be exploited to show
|
128
|
+
# links in the HTML which don't show up in the raw mail.
|
129
|
+
key = Digest::MD5.hexdigest("#{url}#{SALT}").freeze
|
130
|
+
state[key] = url
|
131
|
+
"#{head}OLD-LINK-#{key}#{tail}"
|
132
|
+
end
|
133
|
+
state
|
134
|
+
end
|
135
|
+
|
136
|
+
def linkify_2(state, str) # :nodoc:
|
137
|
+
# Added "OLD-LINK-" prefix to avoid false-positives on git commits
|
138
|
+
str.gsub!(/\bOLD-LINK-([a-f0-9]{32})\b/) do
|
139
|
+
key = $1
|
140
|
+
url = state[key]
|
141
|
+
if url
|
142
|
+
%Q{<a\nhref=#{url.encode(xml: :attr)}>#{url.encode(xml: :text)}</a>}
|
143
|
+
else
|
144
|
+
# false positive or somebody tried to mess with us
|
145
|
+
key
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
data/lib/olddoc/news_atom.rb
CHANGED
@@ -32,9 +32,9 @@ module Olddoc::NewsAtom # :nodoc:
|
|
32
32
|
def news_atom_xml
|
33
33
|
project_name, short_desc, _ = readme_metadata
|
34
34
|
new_tags = tags[0,10]
|
35
|
-
atom_uri = @rdoc_uri.dup
|
35
|
+
atom_uri = @rdoc_uri[0].dup
|
36
36
|
atom_uri.path += "NEWS.atom.xml"
|
37
|
-
news_uri = @rdoc_uri.dup
|
37
|
+
news_uri = @rdoc_uri[0].dup
|
38
38
|
news_uri.path += "NEWS.html"
|
39
39
|
|
40
40
|
dst = ''
|
data/lib/olddoc/prepare.rb
CHANGED
@@ -12,8 +12,8 @@ class Olddoc::Prepare # :nodoc:
|
|
12
12
|
cgit_url = opts['cgit_url']
|
13
13
|
rdoc_url && cgit_url or
|
14
14
|
abort "rdoc_url and cgit_url required in .olddoc.yml for `prepare'"
|
15
|
-
@rdoc_uri = URI.parse(
|
16
|
-
@cgit_uri = URI.parse(
|
15
|
+
@rdoc_uri = Array(rdoc_url).map { |u| URI.parse(u) }
|
16
|
+
@cgit_uri = Array(cgit_url).map { |u| URI.parse(u) }
|
17
17
|
@name, @short_desc = readme_metadata
|
18
18
|
end
|
19
19
|
|
data/lib/oldweb.rb
CHANGED
@@ -5,7 +5,7 @@ require 'rdoc'
|
|
5
5
|
require 'erb'
|
6
6
|
require 'pathname'
|
7
7
|
require 'yaml'
|
8
|
-
require '
|
8
|
+
require 'cgi'
|
9
9
|
|
10
10
|
# oldweb is an \RDoc template and not intended as a programming API.
|
11
11
|
# You may specify it as an \RDoc formatter:
|
@@ -73,12 +73,25 @@ class Oldweb
|
|
73
73
|
noindex = @old_cfg['noindex'] and noindex.each { |k| ni[k] = true }
|
74
74
|
@old_cfg['noindex'] = ni
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
76
|
+
cgit_url = Array(@old_cfg['cgit_url'])
|
77
|
+
source = @old_cfg['source_code'] ||= []
|
78
|
+
if source.empty?
|
79
|
+
source << "git clone #{cgit_url[0]}" if cgit_url[0]
|
80
|
+
git_url = @old_cfg['git_url']
|
81
|
+
if git_url && git_url != cgit_url[0]
|
82
|
+
source << "git clone #{git_url}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
if cgit_url[0]
|
87
|
+
cgit_url.each do |u|
|
88
|
+
u += '/tree/%s' # path name
|
89
|
+
tag = @git_tag and u << "id=#{CGI.escape(tag)}"
|
90
|
+
u << '#n%d' # lineno
|
91
|
+
end
|
92
|
+
@old_vcs_url = cgit_url[0]
|
81
93
|
end
|
94
|
+
@oldweb_style = nil # used by dark216
|
82
95
|
end
|
83
96
|
|
84
97
|
def generate # :nodoc:
|
@@ -269,7 +282,11 @@ class Oldweb
|
|
269
282
|
erbout = "_erbout_#{file_var}"
|
270
283
|
end
|
271
284
|
|
272
|
-
|
285
|
+
if ERB.instance_method(:initialize).parameters.assoc(:key)
|
286
|
+
template = klass.new(template, trim_mode: '<>', eoutvar: erbout)
|
287
|
+
else
|
288
|
+
template = klass.new(template, nil, '<>', erbout)
|
289
|
+
end
|
273
290
|
@template_cache[file] = template
|
274
291
|
end
|
275
292
|
|
@@ -280,7 +297,7 @@ class Oldweb
|
|
280
297
|
def method_srclink(m) # :nodoc:
|
281
298
|
url = @old_vcs_url or return ""
|
282
299
|
line = m.line or return ""
|
283
|
-
path =
|
300
|
+
path = CGI.escape(m.file_name)
|
284
301
|
%Q(<a href="#{url % [ path, line ]}">source</a>)
|
285
302
|
end
|
286
303
|
|
data/lib/oldweb/_head.rhtml
CHANGED
@@ -8,4 +8,8 @@ type="application/atom+xml" /><%
|
|
8
8
|
end
|
9
9
|
%><meta
|
10
10
|
http-equiv="Content-Type"
|
11
|
-
content="text/html; charset=<%= @options.charset %>"
|
11
|
+
content="text/html; charset=<%= @options.charset %>"><%
|
12
|
+
if @oldweb_style
|
13
|
+
%><style><%= @oldweb_style %></style><%
|
14
|
+
end
|
15
|
+
%>
|
data/lib/oldweb/_tail.rhtml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
public_email = @old_cfg['public_email']
|
3
3
|
private_email = @old_cfg['private_email']
|
4
4
|
source_code = Array(@old_cfg['source_code']).dup
|
5
|
-
archive_urls = Array(@old_cfg
|
5
|
+
archive_urls = Array(@old_cfg.values_at(*%W(ml_url nntp_url imap_url))).flatten
|
6
6
|
if url = archive_urls.shift %><hr /><pre>
|
7
7
|
mail archives: <a
|
8
8
|
href="<%= url %>"><%= url %></a><%
|
@@ -22,8 +22,11 @@ href="mailto:<%= private_email %>"><%= private_email %></a><%
|
|
22
22
|
end
|
23
23
|
|
24
24
|
if url_or_cmd = source_code.shift
|
25
|
+
url_or_cmd = url_or_cmd.sub(%r{\b(https?://\S+)}, "<a\nhref='\\1'>\\1</a>")
|
25
26
|
%>
|
26
27
|
source code: <%= url_or_cmd %>
|
27
|
-
<% source_code.each do |x| %><%=
|
28
|
+
<% source_code.each do |x| %><%=
|
29
|
+
%Q{\t#{x.sub(%r{\b(https?://\S+)}, %Q{<a\nhref='\\1'>\\1</a>})}}
|
30
|
+
%><% end
|
28
31
|
end
|
29
32
|
%></pre><% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: olddoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- olddoc hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -45,8 +45,9 @@ files:
|
|
45
45
|
- COPYING
|
46
46
|
- Documentation/.gitignore
|
47
47
|
- Documentation/GNUmakefile
|
48
|
-
- Documentation/olddoc.1.
|
49
|
-
- Documentation/olddoc.5.
|
48
|
+
- Documentation/olddoc.1.pod
|
49
|
+
- Documentation/olddoc.5.pod
|
50
|
+
- Documentation/podtxt2html
|
50
51
|
- GIT-VERSION-GEN
|
51
52
|
- GNUmakefile
|
52
53
|
- INSTALL
|
@@ -55,9 +56,11 @@ files:
|
|
55
56
|
- Rakefile
|
56
57
|
- TODO
|
57
58
|
- bin/olddoc
|
59
|
+
- lib/dark216.rb
|
58
60
|
- lib/olddoc.rb
|
59
61
|
- lib/olddoc/gemspec.rb
|
60
62
|
- lib/olddoc/history.rb
|
63
|
+
- lib/olddoc/man2html.rb
|
61
64
|
- lib/olddoc/merge.rb
|
62
65
|
- lib/olddoc/news_atom.rb
|
63
66
|
- lib/olddoc/news_rdoc.rb
|
@@ -104,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
107
|
- !ruby/object:Gem::Version
|
105
108
|
version: '0'
|
106
109
|
requirements: []
|
107
|
-
|
108
|
-
rubygems_version: 2.7.3
|
110
|
+
rubygems_version: 3.0.2
|
109
111
|
signing_key:
|
110
112
|
specification_version: 4
|
111
113
|
summary: old-fashioned Ruby documentation generator
|
data/Documentation/olddoc.1.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
% olddoc(1) olddoc user manual
|
2
|
-
|
3
|
-
# NAME
|
4
|
-
|
5
|
-
olddoc - old-fashioned RDoc HTML generator
|
6
|
-
|
7
|
-
# SYNOPSIS
|
8
|
-
|
9
|
-
`olddoc` prepare
|
10
|
-
|
11
|
-
`rdoc` -f oldweb
|
12
|
-
|
13
|
-
# DESCRIPTION
|
14
|
-
|
15
|
-
olddoc features oldweb, and old-fashioned RDoc HTML generator.
|
16
|
-
You can also use "olddoc prepare" to generate NEWS files from
|
17
|
-
git tags.
|
18
|
-
|
19
|
-
# SEE ALSO
|
20
|
-
|
21
|
-
olddoc(5)
|