olddoc 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +4 -0
- data/.gitignore +16 -0
- data/.olddoc.yml +9 -0
- data/COPYING +674 -0
- data/Documentation/.gitignore +4 -0
- data/Documentation/GNUmakefile +53 -0
- data/Documentation/olddoc.1.txt +21 -0
- data/Documentation/olddoc.5.txt +26 -0
- data/GNUmakefile +59 -0
- data/INSTALL +9 -0
- data/README +89 -0
- data/Rakefile +31 -0
- data/TODO +1 -0
- data/bin/olddoc +16 -0
- data/lib/olddoc.rb +20 -0
- data/lib/olddoc/gemspec.rb +17 -0
- data/lib/olddoc/history.rb +57 -0
- data/lib/olddoc/merge.rb +26 -0
- data/lib/olddoc/news_atom.rb +51 -0
- data/lib/olddoc/news_rdoc.rb +36 -0
- data/lib/olddoc/prepare.rb +24 -0
- data/lib/olddoc/readme.rb +27 -0
- data/lib/oldweb.rb +303 -0
- data/lib/oldweb/_head.rhtml +7 -0
- data/lib/oldweb/_sidebar_classes.rhtml +27 -0
- data/lib/oldweb/_sidebar_extends.rhtml +13 -0
- data/lib/oldweb/_sidebar_includes.rhtml +12 -0
- data/lib/oldweb/_sidebar_installed.rhtml +10 -0
- data/lib/oldweb/_sidebar_methods.rhtml +6 -0
- data/lib/oldweb/_sidebar_navigation.rhtml +6 -0
- data/lib/oldweb/_sidebar_pages.rhtml +17 -0
- data/lib/oldweb/_sidebar_parent.rhtml +13 -0
- data/lib/oldweb/_sidebar_sections.rhtml +8 -0
- data/lib/oldweb/_sidebar_table_of_contents.rhtml +15 -0
- data/lib/oldweb/_tail.rhtml +25 -0
- data/lib/oldweb/class.rhtml +79 -0
- data/lib/oldweb/page.rhtml +5 -0
- data/lib/oldweb/servlet_not_found.rhtml +5 -0
- data/lib/oldweb/servlet_root.rhtml +39 -0
- data/lib/oldweb/table_of_contents.rhtml +52 -0
- data/lib/rdoc/discover.rb +5 -0
- data/olddoc.gemspec +21 -0
- metadata +119 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
|
2
|
+
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
+
all::
|
|
4
|
+
|
|
5
|
+
INSTALL = install
|
|
6
|
+
PANDOC = pandoc
|
|
7
|
+
PANDOC_OPTS = -f markdown --email-obfuscation=none
|
|
8
|
+
pandoc = $(PANDOC) $(PANDOC_OPTS)
|
|
9
|
+
pandoc_html = $(pandoc) --toc -t html --no-wrap
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
man1 := olddoc.1
|
|
13
|
+
man5 := olddoc.5
|
|
14
|
+
man7 :=
|
|
15
|
+
|
|
16
|
+
html1 := $(addsuffix .html, $(man1))
|
|
17
|
+
html5 := $(addsuffix .html, $(man5))
|
|
18
|
+
html7 := $(addsuffix .html, $(man7))
|
|
19
|
+
|
|
20
|
+
all:: man
|
|
21
|
+
|
|
22
|
+
man: $(man1) $(man5) $(man7)
|
|
23
|
+
html: $(html1) $(html5) $(html7)
|
|
24
|
+
|
|
25
|
+
prefix ?= $(HOME)
|
|
26
|
+
mandir ?= $(prefix)/share/man
|
|
27
|
+
man1dir = $(mandir)/man1
|
|
28
|
+
man5dir = $(mandir)/man5
|
|
29
|
+
man7dir = $(mandir)/man7
|
|
30
|
+
|
|
31
|
+
gem-man: man
|
|
32
|
+
$(INSTALL) -d -m 755 ../man
|
|
33
|
+
test -z "$(man1)" || $(INSTALL) -m 644 $(man1) ../man
|
|
34
|
+
test -z "$(man5)" || $(INSTALL) -m 644 $(man5) ../man
|
|
35
|
+
test -z "$(man7)" || $(INSTALL) -m 644 $(man7) ../man
|
|
36
|
+
|
|
37
|
+
install-man: man
|
|
38
|
+
$(INSTALL) -d -m 755 $(DESTDIR)$(mandir)
|
|
39
|
+
test -z "$(man1)" || $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
|
|
40
|
+
test -z "$(man5)" || $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
|
|
41
|
+
test -z "$(man7)" || $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
|
|
42
|
+
test -z "$(man1)" || $(INSTALL) -m 644 $(man1) $(DESTDIR)$(man1dir)
|
|
43
|
+
test -z "$(man5)" || $(INSTALL) -m 644 $(man5) $(DESTDIR)$(man5dir)
|
|
44
|
+
test -z "$(man7)" || $(INSTALL) -m 644 $(man7) $(DESTDIR)$(man7dir)
|
|
45
|
+
|
|
46
|
+
%: %.txt
|
|
47
|
+
$(pandoc) -s -t man < $< > $@+ && mv $@+ $@
|
|
48
|
+
|
|
49
|
+
%.html : %.txt
|
|
50
|
+
$(pandoc_html) < $< > $@+ && mv $@+ $@
|
|
51
|
+
|
|
52
|
+
clean::
|
|
53
|
+
$(RM) $(man1) $(man5) $(man7) $(html1) $(html5) $(html7)
|
|
@@ -0,0 +1,21 @@
|
|
|
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)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
% olddoc(1) olddoc user manual
|
|
2
|
+
|
|
3
|
+
# NAME
|
|
4
|
+
|
|
5
|
+
.olddoc.yml - olddoc config file format
|
|
6
|
+
|
|
7
|
+
# SYNOPSIS
|
|
8
|
+
|
|
9
|
+
A YAML file in the top-level project directory named ".olddoc.yml"
|
|
10
|
+
|
|
11
|
+
# DESCRIPTION
|
|
12
|
+
|
|
13
|
+
As olddoc favors consistency over configuration, there is minimal
|
|
14
|
+
configuration to deal with.
|
|
15
|
+
|
|
16
|
+
# KEYS
|
|
17
|
+
|
|
18
|
+
`rdoc_url`, `cgit_url` should be obvious
|
|
19
|
+
|
|
20
|
+
`merge_html` is a key-value mapping of (empty) RDoc source files to an
|
|
21
|
+
HTML file that will be merged into RDoc after-the-fact. It is useful
|
|
22
|
+
for merging non-RDoc generated HTML into the project.
|
|
23
|
+
|
|
24
|
+
# SEE ALSO
|
|
25
|
+
|
|
26
|
+
olddoc(1)
|
data/GNUmakefile
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
|
2
|
+
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
+
all::
|
|
4
|
+
pkg = olddoc
|
|
5
|
+
RUBY = ruby
|
|
6
|
+
VERSION := $(shell $(RUBY) -Ilib -rolddoc -e 'puts Olddoc::VERSION')
|
|
7
|
+
|
|
8
|
+
check-warnings:
|
|
9
|
+
@(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
|
|
10
|
+
do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
|
|
11
|
+
|
|
12
|
+
pkggem := pkg/$(pkg)-$(VERSION).gem
|
|
13
|
+
fix-perms:
|
|
14
|
+
git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
|
|
15
|
+
git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
|
|
16
|
+
gem-man:
|
|
17
|
+
$(MAKE) -C Documentation/ gem-man
|
|
18
|
+
|
|
19
|
+
pkg_extra := NEWS
|
|
20
|
+
|
|
21
|
+
.manifest: fix-perms
|
|
22
|
+
$(RUBY) -I lib bin/olddoc prepare
|
|
23
|
+
rm -rf man
|
|
24
|
+
(git ls-files; \
|
|
25
|
+
for i in $(pkg_extra); do echo $$i; done) | \
|
|
26
|
+
LC_ALL=C sort > $@+
|
|
27
|
+
cmp $@+ $@ || mv $@+ $@; rm -f $@+
|
|
28
|
+
|
|
29
|
+
placeholders := olddoc_5 olddoc_1
|
|
30
|
+
|
|
31
|
+
$(placeholders):
|
|
32
|
+
echo olddoc_placeholder > $@
|
|
33
|
+
|
|
34
|
+
.gem-manifest: .manifest gem-man $(placeholders)
|
|
35
|
+
(ls man/*.?; cat .manifest) | LC_ALL=C sort > $@+
|
|
36
|
+
cmp $@+ $@ || mv $@+ $@; rm -f $@+
|
|
37
|
+
|
|
38
|
+
doc: $(placeholders)
|
|
39
|
+
$(MAKE) -C Documentation html
|
|
40
|
+
rm -rf doc
|
|
41
|
+
olddoc prepare
|
|
42
|
+
rdoc --debug -f oldweb
|
|
43
|
+
olddoc merge
|
|
44
|
+
ln NEWS.atom.xml doc/
|
|
45
|
+
|
|
46
|
+
gem: $(pkggem)
|
|
47
|
+
|
|
48
|
+
install-gem: $(pkggem)
|
|
49
|
+
gem install $(CURDIR)/$<
|
|
50
|
+
|
|
51
|
+
$(pkggem): fix-perms .gem-manifest
|
|
52
|
+
VERSION=$(VERSION) gem build $(pkg).gemspec
|
|
53
|
+
mkdir -p pkg
|
|
54
|
+
mv $(@F) $@
|
|
55
|
+
|
|
56
|
+
package: $(pkggem)
|
|
57
|
+
|
|
58
|
+
.PHONY: all .FORCE-GIT-VERSION-FILE NEWS
|
|
59
|
+
.PHONY: check-warnings fix-perms doc
|
data/INSTALL
ADDED
data/README
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
= olddoc - old-fashioned Ruby documentation generator
|
|
2
|
+
|
|
3
|
+
olddoc contains old-fashioned document generators for those who do not
|
|
4
|
+
wish to impose bloated, new-fangled web cruft on their readers.
|
|
5
|
+
|
|
6
|
+
olddoc contains oldweb, an HTML generator without any images, frames,
|
|
7
|
+
CSS, or JavaScript. It is designed for users of text-based browsers
|
|
8
|
+
and/or low-bandwidth connections. oldweb focuses on text as it is
|
|
9
|
+
the lowest common denominator for accessibility and compatibility
|
|
10
|
+
with people and hardware.
|
|
11
|
+
|
|
12
|
+
== Reasons
|
|
13
|
+
|
|
14
|
+
* No CSS. Encouraging users to use CSS leads to problems like
|
|
15
|
+
copy-paste hijacking: http://thejh.net/misc/website-terminal-copy-paste
|
|
16
|
+
External CSS also increases page load time as it often blocks page
|
|
17
|
+
rendering. Asynchronous loading of CSS also causes accessibility
|
|
18
|
+
problems as links/buttons may move as a user attempts to click.
|
|
19
|
+
|
|
20
|
+
* No JavaScript. There is a constant barrage of security and
|
|
21
|
+
client-side performance problems associated with it. It's also
|
|
22
|
+
unreasonable to expect users to rely on LibreJS and inspect every
|
|
23
|
+
piece of JS they run.
|
|
24
|
+
|
|
25
|
+
* No frames. Frames are an accessibility hassle and unfriendly
|
|
26
|
+
to users of tiny screens on mobile devices and text-based browsers.
|
|
27
|
+
|
|
28
|
+
* No images. Not everyone can view or afford bandwidth to load images.
|
|
29
|
+
This also reduces the potential for security vulnerabilities as less
|
|
30
|
+
code gets run. Furthermore, loading the wrong image in a public
|
|
31
|
+
place can get you arrested (or worse).
|
|
32
|
+
|
|
33
|
+
Encourage readers to simplify and speed up their browsing experience.
|
|
34
|
+
They can disable CSS, JavaScript, and images in their browser without
|
|
35
|
+
missing out!
|
|
36
|
+
|
|
37
|
+
== Usage
|
|
38
|
+
|
|
39
|
+
gem install olddoc
|
|
40
|
+
cd $ANY_RDOC_USING_RUBY_PROJECT
|
|
41
|
+
rdoc -f oldweb
|
|
42
|
+
|
|
43
|
+
You can also use olddoc to generate NEWS entries
|
|
44
|
+
assuming you have git tags, a README file and .olddoc.yml
|
|
45
|
+
|
|
46
|
+
olddoc prepare
|
|
47
|
+
|
|
48
|
+
And "olddoc merge" to merge instances of "olddoc_placeholder" in
|
|
49
|
+
an HTML file with HTML fragments generated with other tools
|
|
50
|
+
such as pandoc(1). This requries an appropriately configured
|
|
51
|
+
.olddoc.yml with a "merge_html" section see olddoc(5)
|
|
52
|
+
|
|
53
|
+
== Source code
|
|
54
|
+
|
|
55
|
+
git clone git://80x24.org/olddoc
|
|
56
|
+
|
|
57
|
+
Please use git-format-patch(1) and git-send-email(1) distributed with
|
|
58
|
+
the git(7) suite for generating and sending patches. Please format
|
|
59
|
+
pull requests with the git-request-pull(1) script (also distributed
|
|
60
|
+
with git(7)) and send them via email to <olddoc-public@80x24.org>
|
|
61
|
+
|
|
62
|
+
== Contact
|
|
63
|
+
|
|
64
|
+
All feedback (comments, results, feature requests, bug reports, patches,
|
|
65
|
+
pull-requests) via plain-text mail to the mailing list is very much
|
|
66
|
+
appreciated.
|
|
67
|
+
|
|
68
|
+
Please send plain-text mail to the list at <olddoc-public@80x24.org>
|
|
69
|
+
HTML will not be read. olddoc is for GUI-phobes, by GUI-phobes.
|
|
70
|
+
Mailing list archives available at http://80x24.org/olddoc-public/
|
|
71
|
+
No subscription is necessary to post to the mailing list.
|
|
72
|
+
|
|
73
|
+
== License
|
|
74
|
+
|
|
75
|
+
olddoc is copyrighted Free Software by all contributors, see logs
|
|
76
|
+
in revision control for names and email addresses of all of them.
|
|
77
|
+
|
|
78
|
+
olddoc is free software; you can redistribute it and/or modify it
|
|
79
|
+
under the terms of the GNU General Public License as published by the
|
|
80
|
+
Free Software Foundation; either version 3 of the License, or (at your
|
|
81
|
+
option) any later version.
|
|
82
|
+
|
|
83
|
+
olddoc is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
84
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
85
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
86
|
+
for more details.
|
|
87
|
+
|
|
88
|
+
You should have received a copy of the GNU General Public License along
|
|
89
|
+
with this program; if not, see https://www.gnu.org/licenses/gpl-3.0.txt
|
data/Rakefile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
|
2
|
+
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
+
require 'tempfile'
|
|
4
|
+
include Rake::DSL
|
|
5
|
+
task :rsync_docs do
|
|
6
|
+
dest = ENV["RSYNC_DEST"] || "80x24.org:/srv/80x24/olddoc/"
|
|
7
|
+
top = %w(INSTALL README COPYING)
|
|
8
|
+
|
|
9
|
+
# git-set-file-times is distributed with rsync,
|
|
10
|
+
# Also available at: http://yhbt.net/git-set-file-times
|
|
11
|
+
# on Debian systems: /usr/share/doc/rsync/scripts/git-set-file-times.gz
|
|
12
|
+
sh("git", "set-file-times", 'Documentation', *top)
|
|
13
|
+
|
|
14
|
+
do_gzip = lambda do |txt|
|
|
15
|
+
gz = "#{txt}.gz"
|
|
16
|
+
tmp = "#{gz}.#$$"
|
|
17
|
+
sh("gzip --rsyncable -9 < #{txt} > #{tmp}")
|
|
18
|
+
st = File.stat(txt)
|
|
19
|
+
File.utime(st.atime, st.mtime, tmp) # make nginx gzip_static happy
|
|
20
|
+
File.rename(tmp, gz)
|
|
21
|
+
gz
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
files = `git ls-files Documentation/*.txt`.split(/\n/)
|
|
25
|
+
files.concat(top)
|
|
26
|
+
files.concat(%w(NEWS))
|
|
27
|
+
files.concat(Dir["doc/*.html"].to_a)
|
|
28
|
+
gzfiles = files.map { |txt| do_gzip.call(txt) }
|
|
29
|
+
files.concat(gzfiles)
|
|
30
|
+
sh("rsync --chmod=Fugo=r -av #{files.join(' ')} #{dest}")
|
|
31
|
+
end
|
data/bin/olddoc
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
|
3
|
+
$stderr.sync = $stdout.sync = true
|
|
4
|
+
tasks = %w(prepare merge)
|
|
5
|
+
usage = "Usage: #{File.basename($0)} [#{tasks.join('|')}]"
|
|
6
|
+
require 'olddoc'
|
|
7
|
+
opts = Olddoc.config
|
|
8
|
+
case ARGV[0]
|
|
9
|
+
when "prepare"
|
|
10
|
+
Olddoc::Prepare.new(opts).run
|
|
11
|
+
when "merge"
|
|
12
|
+
Olddoc::Merge.new(opts).run
|
|
13
|
+
else
|
|
14
|
+
warn "#{$0.inspect} #{ARGV.inspect} not understood"
|
|
15
|
+
abort usage
|
|
16
|
+
end
|
data/lib/olddoc.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
|
2
|
+
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
+
module Olddoc
|
|
4
|
+
VERSION = '1.0.0'
|
|
5
|
+
|
|
6
|
+
autoload :Gemspec, 'olddoc/gemspec'
|
|
7
|
+
autoload :History, 'olddoc/history'
|
|
8
|
+
autoload :Merge, 'olddoc/merge'
|
|
9
|
+
autoload :NewsAtom, 'olddoc/news_atom'
|
|
10
|
+
autoload :NewsRdoc, 'olddoc/news_rdoc'
|
|
11
|
+
autoload :Prepare, 'olddoc/prepare'
|
|
12
|
+
autoload :Readme, 'olddoc/readme'
|
|
13
|
+
|
|
14
|
+
def self.config(path = ".olddoc.yml")
|
|
15
|
+
File.readable?(path) and return YAML.load(File.read(path))
|
|
16
|
+
warn "#{path} not found in current directory"
|
|
17
|
+
{}
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
require_relative 'oldweb'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# helper methods for gemspecs
|
|
2
|
+
module Olddoc::Gemspec
|
|
3
|
+
include Olddoc::Readme
|
|
4
|
+
|
|
5
|
+
def extra_rdoc_files(manifest)
|
|
6
|
+
File.readlines('.document').map! do |x|
|
|
7
|
+
x.chomp!
|
|
8
|
+
if File.directory?(x)
|
|
9
|
+
manifest.grep(%r{\A#{x}/})
|
|
10
|
+
elsif File.file?(x)
|
|
11
|
+
x
|
|
12
|
+
else
|
|
13
|
+
nil
|
|
14
|
+
end
|
|
15
|
+
end.flatten.compact
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
|
2
|
+
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module Olddoc::History
|
|
6
|
+
def initialize_history
|
|
7
|
+
@tags = @old_summaries = nil
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# returns a cgit URI for a given +tag_name+
|
|
11
|
+
def tag_uri(tag_name)
|
|
12
|
+
uri = @cgit_uri.dup
|
|
13
|
+
uri.path += "/tag/"
|
|
14
|
+
uri.query = "id=#{tag_name}"
|
|
15
|
+
uri
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def tags
|
|
19
|
+
timefmt = '%Y-%m-%dT%H:%M:%SZ'
|
|
20
|
+
@tags ||= `git tag -l`.split(/\n/).map do |tag|
|
|
21
|
+
next if tag == "v0.0.0"
|
|
22
|
+
if %r{\Av[\d\.]+} =~ tag
|
|
23
|
+
type = `git cat-file -t #{tag}`.chomp
|
|
24
|
+
user_type = { "tag" => "tagger", "commit" => "committer" }[type]
|
|
25
|
+
user_type or abort "unable to determine what to do with #{type}=#{tag}"
|
|
26
|
+
header, subject, body = `git cat-file #{type} #{tag}`.split(/\n\n/, 3)
|
|
27
|
+
body ||= "initial" unless old_summaries.include?(tag)
|
|
28
|
+
header = header.split(/\n/)
|
|
29
|
+
|
|
30
|
+
tagger = header.grep(/\A#{user_type} /).first
|
|
31
|
+
time = Time.at(tagger.split(/ /)[-2].to_i).utc
|
|
32
|
+
{
|
|
33
|
+
:time => time.strftime(timefmt),
|
|
34
|
+
:ruby_time => time,
|
|
35
|
+
:tagger_name => %r{^#{user_type} ([^<]+)}.match(tagger)[1].strip,
|
|
36
|
+
:tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
|
|
37
|
+
:id => `git rev-parse refs/tags/#{tag}`.chomp!,
|
|
38
|
+
:tag => tag,
|
|
39
|
+
:subject => subject.strip,
|
|
40
|
+
:body => (old = old_summaries[tag]) ? "#{old}\n#{body}" : body,
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
end.compact.sort { |a,b| b[:time] <=> a[:time] }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def old_summaries
|
|
47
|
+
@old_summaries ||= if File.exist?(".CHANGELOG.old")
|
|
48
|
+
File.readlines(".CHANGELOG.old").inject({}) do |hash, line|
|
|
49
|
+
version, summary = line.split(/ - /, 2)
|
|
50
|
+
hash[version] = summary
|
|
51
|
+
hash
|
|
52
|
+
end
|
|
53
|
+
else
|
|
54
|
+
{}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/lib/olddoc/merge.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (C) 2015, all contributors <olddoc-public@80x24.org>
|
|
2
|
+
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
+
|
|
4
|
+
class Olddoc::Merge
|
|
5
|
+
def initialize(opts)
|
|
6
|
+
@merge_html = opts["merge_html"] || {}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# FIXME: generate manpages directly from rdoc instead of relying on
|
|
10
|
+
# pandoc to do it via markdown.
|
|
11
|
+
def run
|
|
12
|
+
@merge_html.each do |file, source|
|
|
13
|
+
rdoc_html = "doc/#{file}.html"
|
|
14
|
+
fragment = File.read(source)
|
|
15
|
+
File.open(rdoc_html, "a+") { |fp|
|
|
16
|
+
html = fp.read
|
|
17
|
+
if html.sub!(%r{\s*<p>\s*olddoc_placeholder\s*</p>\s*}sm, fragment)
|
|
18
|
+
fp.truncate(0)
|
|
19
|
+
fp.write(html)
|
|
20
|
+
else
|
|
21
|
+
warn "olddoc_placeholder not found in #{rdoc_html}"
|
|
22
|
+
end
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|