From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH 1/2] Add script to tweak output of 'alphapf' bibliography stile
Date: Sun, 25 Dec 2016 20:45:07 +0900 [thread overview]
Message-ID: <c24b3bcb-e6d5-eae6-e0da-4cc13c04fafb@gmail.com> (raw)
In-Reply-To: <af2c3345-2e60-1582-1f8f-d2adb3413927@gmail.com>
From 446d9fb1743d3750b06923e32f449469cb1364de Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 25 Dec 2016 19:59:58 +0900
Subject: [PATCH 1/2] Add script to tweak output of 'alphapf' bibliography stile
"inlinelinks" in alphapf.bst caused PDFTeX to abort.
This was because href-ed long titles in Bibliography can cross
page boundaries. The combination of PDFTeX and "hyperref" package
can't handle such a situation.
You can avoid the issue by manually adjust page breaks. But in
perfbook, page boundaries in Bibliography can not be controlled
precisely.
This commit adds a script to convert \href related output of BiBTeX
on the fly. It shortens the href-ed part in title strings to the
beginning of two characters.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Makefile | 1 +
utilities/tweakhrefinbbl.pl | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 utilities/tweakhrefinbbl.pl
diff --git a/Makefile b/Makefile
index f0944f0..0ace9dc 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,7 @@ $(PDFTARGETS): %.pdf: %.tex %.bbl
$(PDFTARGETS:.pdf=.bbl): %.bbl: %.aux
bibtex $(basename $@)
+ perl utilities/tweakhrefinbbl.pl $@
$(PDFTARGETS:.pdf=.aux): $(LATEXSOURCES) $(LATEXGENERATED) $(BIBSOURCES)
sh utilities/runfirstlatex.sh $(basename $@)
diff --git a/utilities/tweakhrefinbbl.pl b/utilities/tweakhrefinbbl.pl
new file mode 100644
index 0000000..6727a28
--- /dev/null
+++ b/utilities/tweakhrefinbbl.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -pi
+# Tweak output of BiBTeX with alphapf bibliography style
+#
+# This script does the following conversion in .bbl
+#
+# o \newblock \href {http://URL} {Title of the site}.
+# ->
+# \newblock \href {http://URL} {Ti}{tle of the site}.
+# o \newblock \href {http://URL} {{\em Book Title}}.
+# ->
+# \newblock \href {http://URL} {{\em {Bo}}}{\em {ok Title}}.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+# Copyright (C) Akira Yokosawa, 2016
+#
+# Authors: Akira Yokosawa <akiyks@gmail.com>
+
+use strict;
+use warnings;
+
+BEGIN {undef $/;}
+
+s/\\newblock \\href\s+\{([^}]*)\}\s+\{([^\\\{]{1}\S?)(.*?)\}\.$/\\newblock \\href {$1} {$2}{$3}./smg ;
+s/\\newblock \\href\s+\{([^}]*)\}\s+\{\{\\em\s+([^\\\{]{1}\S?)(.*?)\}\.$/\\newblock \\href {$1} {{\\em {$2}}}{\\em {$3}./smg ;
--
2.7.4
next prev parent reply other threads:[~2016-12-25 11:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-05 8:16 [RFC PULL] Bibliography URL cleanup Akira Yokosawa
2016-11-06 23:47 ` Paul E. McKenney
2016-12-24 7:05 ` Paul E. McKenney
2016-12-24 7:36 ` Akira Yokosawa
2016-12-24 7:49 ` Akira Yokosawa
2016-12-25 11:42 ` [PATCH 0/2] Add script to convert BiBTeX output (was Re: [RFC PULL] Bibliography URL cleanup) Akira Yokosawa
2016-12-25 11:45 ` Akira Yokosawa [this message]
2016-12-25 11:46 ` [PATCH 2/2] alphapf.bst: Enable 'inlinelinks' Akira Yokosawa
2016-12-25 16:15 ` [PATCH 0/2] Add script to convert BiBTeX output (was Re: [RFC PULL] Bibliography URL cleanup) Paul E. McKenney
2016-12-26 14:52 ` Akira Yokosawa
2016-12-27 0:39 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c24b3bcb-e6d5-eae6-e0da-4cc13c04fafb@gmail.com \
--to=akiyks@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=perfbook@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox