Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Taking care about special charters in the commit message.
- Loading branch information
Showing
with
48 additions
and
10 deletions.
-
+6
−8
scripts/latex-git-log/README.md
-
+42
−2
scripts/latex-git-log/latex-git-log
There are no files selected for viewing
|
|
@@ -16,10 +16,10 @@ Everything else should already be installed. |
|
|
|
|
|
### To compile the output |
|
|
The table is using the *longtable* package and the links to a web resource for |
|
|
each commit use the \href macro from *hyperref*. So this two packages have to be |
|
|
each commit use the `\href` macro from *hyperref*. So this two packages have to be |
|
|
loaded. |
|
|
|
|
|
Furthermore you need to defined the macro *\longtableendfoot* which will be |
|
|
Furthermore you need to defined the macro `\longtableendfoot` which will be |
|
|
expanded on the bottom of every page if the table will be continued on the next |
|
|
page. You can defined it to a localized message to inform the reader that this |
|
|
table is not complete and will be continued. |
|
|
@@ -28,19 +28,17 @@ Because the table can be very large you might want to put the thing on a |
|
|
landscape page. |
|
|
|
|
|
## License and Copyright |
|
|
Copyright (C) by Robin Schneider <ypid23@aol.de> |
|
|
|
|
|
Source code repository: https://github.com/ypid/typesetting |
|
|
|
|
|
Please report bugs and feature requests at https://github.com/ypid/typesetting/issues |
|
|
Copyright (C) by Robin Schneider <ypid23@aol.de> <br /> |
|
|
Source code repository: https://github.com/ypid/typesetting <br /> |
|
|
Please report bugs and feature requests at https://github.com/ypid/typesetting/issues <br /> |
|
|
|
|
|
## Usage |
|
|
|
|
|
latex-git-log [options] |
|
|
|
|
|
Options: |
|
|
|
|
|
--author set this to 1 if you want the author included |
|
|
--author set this if you want the author included |
|
|
--startcommit set the start value of count commit |
|
|
--width set the width in cm of the commit message field in the LaTeX table |
|
|
--git-c-add set an base URL to link to a commit |
|
|
|
|
|
@@ -149,6 +149,34 @@ for (@tags_commits) { |
|
|
} |
|
|
# }}} |
|
|
|
|
|
# Helper function {{{ |
|
|
sub latex_escape { |
|
|
# Source: http://ommammatips.blogspot.de/2011/01/perl-function-for-latex-escape.html |
|
|
my $paragraph = shift; |
|
|
|
|
|
# Replace a \ with $\backslash$ |
|
|
# This is made more complicated because the dollars will be escaped |
|
|
# by the subsequent replacement. Easiest to add \backslash |
|
|
# now and then add the dollars |
|
|
$paragraph =~ s/\\/\\backslash/g; |
|
|
|
|
|
# Must be done after escape of \ since this command adds latex escapes |
|
|
# Replace characters that can be escaped |
|
|
$paragraph =~ s/([\$\#&%_{}])/\\$1/g; |
|
|
|
|
|
# Replace ^ characters with \^{} so that $^F works okay |
|
|
$paragraph =~ s/(\^)/\\$1\{\}/g; |
|
|
|
|
|
# Replace tilde (~) with \texttt{\~{}} |
|
|
# $paragraph =~ s/~/\\texttt\{\\~\{\}\}/g; |
|
|
$paragraph =~ s/~/\\~\{\}/g; |
|
|
|
|
|
# Now add the dollars around each \backslash |
|
|
$paragraph =~ s/(\\backslash)/\$$1\$/g; |
|
|
return $paragraph; |
|
|
} |
|
|
# }}} |
|
|
|
|
|
# Loop over all commits {{{ |
|
|
my $which_line = 0; |
|
|
my @changes; |
|
|
@@ -158,7 +186,19 @@ for (@lines) { |
|
|
if ($which_line) { |
|
|
s/\A([0-9a-f]{40})\s//xms or die "Did not match the commit hash\n"; |
|
|
my $tags = exists $commit_tags{$1} ? $commit_tags{$1} : q(); |
|
|
say "\\hline $commit_count & $tags & $_ & " . join( ' & ', @changes ) . ' \\\\'; |
|
|
my $date_author = ''; |
|
|
my $c_msg; |
|
|
if ($print_author) { |
|
|
/((?:.*? &){2}) (.*)/; |
|
|
$date_author = $1; |
|
|
$c_msg = latex_escape($2); |
|
|
} |
|
|
else { |
|
|
/(.*? &) (.*)/; |
|
|
$date_author = $1; |
|
|
$c_msg = latex_escape($2); |
|
|
} |
|
|
say "\\hline $commit_count & $tags & $date_author $c_msg & " . join( ' & ', @changes ) . ' \\\\'; |
|
|
$commit_count++; |
|
|
} |
|
|
else { |
|
|
@@ -185,7 +225,7 @@ latex-git-log [options] |
|
|
|
|
|
Options: |
|
|
|
|
|
--author set this to 1 if you want the author included |
|
|
--author set this if you want the author included |
|
|
--startcommit set the start value of count commit |
|
|
--width set the width in cm of the commit message field in the LaTeX table |
|
|
--git-c-add set an base URL to link to a commit |
|
|
|