From 1871d57a9e3647ed794509fbe9d131340efceb88 Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Fri, 22 Jan 2010 00:18:18 +0000 Subject: [PATCH] Build: hackily add bibliography. This is quite yucky, but it's taken over an hour and frankly nobody's complained that the bibliography has been broken for a year, so I'm inclined just to go with this. --- Documentation/GNUmakefile | 20 ++++++ Documentation/essay/literature.itely | 39 ++++++++---- scripts/build/html-to-texi.py | 94 ++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+), 13 deletions(-) create mode 100644 scripts/build/html-to-texi.py diff --git a/Documentation/GNUmakefile b/Documentation/GNUmakefile index 9592e548c5..d2a4eb2f58 100644 --- a/Documentation/GNUmakefile +++ b/Documentation/GNUmakefile @@ -100,6 +100,26 @@ $(outdir)/ROADMAP: cp $(top-src-dir)/ROADMAP $(outdir) $(outdir)/contributor.texi: $(outdir)/ROADMAP +### bad hack for badly-integrated bibliography +$(outdir)/engravingbib.itexi: + BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2html \ + -o $(outdir)/colorado.html \ + $(src-dir)/essay/colorado.bib + $(buildscript-dir)/html-to-texi \ + < $(outdir)/colorado.html > $(outdir)/colorado.itexi + BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2html \ + -o $(outdir)/computer-notation.html \ + $(src-dir)/essay/computer-notation.bib + $(buildscript-dir)/html-to-texi \ + < $(outdir)/computer-notation.html > $(outdir)/computer-notation.itexi + BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2html \ + -o $(outdir)/engravingbib.html \ + $(src-dir)/essay/engravingbib.bib + $(buildscript-dir)/html-to-texi \ + < $(outdir)/engravingbib.html > $(outdir)/engravingbib.itexi + +$(outdir)/essay.texi: $(outdir)/engravingbib.itexi + ########### ### Targets diff --git a/Documentation/essay/literature.itely b/Documentation/essay/literature.itely index 3479046b4a..2ebc7a300d 100644 --- a/Documentation/essay/literature.itely +++ b/Documentation/essay/literature.itely @@ -13,6 +13,17 @@ @node Literature list @chapter Literature list +FIXME: blah + +@menu +* Short literature list:: +* Long literature list:: +@end menu + +@node Short literature list +@section Short literature list + + If you need to know more about music notation, here are some interesting titles to read. @@ -69,17 +80,19 @@ practices. @end table -The source archive includes a more elaborate Bib@TeX{} bibliography of -over 100 entries in -@ifhtml -@ifset bigpage -@uref{../bibliography/index.html, the bibliography}. -@end ifset -@ifclear bigpage -@uref{../../bibliography/index.html, the bibliography}. -@end ifclear -@end ifhtml -@ifnothtml -@file{Documentation/@/bibliography/}. -@end ifnothtml + +@node Long literature list +@section Long literature list + +@subheading Colorado + +@include colorado.itexi + +@subheading Computer notation + +@include computer-notation.itexi + +@subheading Engraving + +@include engravingbib.itexi diff --git a/scripts/build/html-to-texi.py b/scripts/build/html-to-texi.py new file mode 100644 index 0000000000..520c3ecce8 --- /dev/null +++ b/scripts/build/html-to-texi.py @@ -0,0 +1,94 @@ +#! @PYTHON@ + +import re +import sys + +header = ''' +''' + +print header + +body = sys.stdin.read () +body = re.sub ('(?ms)', '', body) +body = re.sub ('(?ms)\n*\s*', r'@ignore\n\1\n@end ignore', body) +body = re.sub ('(?ms)(.*?)', r'@ref{\1,\2}', body) + +body = re.sub ('(?ms) *', r'@node \1 ', body) +body = re.sub ('(?ms)

(.*?)

', r'@chapheading \1', body) +body = re.sub ('(?ms)

(.*?)

', r'@unnumberedsec \1', body) +#body = re.sub ('(?ms) *', '', body) +#body = re.sub ('(?ms)

(.*?)

', r'@node \1\n@unnumberedsec \1', body) + +body = re.sub ('(?ms)]*src="*([^">]*)(.png|.jpeg)"*.*?>', r'@image{\1,,,\2}', body) +body = re.sub ('\n*
\s*\n*', r'@*\n', body) +body = re.sub ('\n*]*>\s*\n*', r'@*\n', body) +body = re.sub ('(?ms)(.*?)', r'@emph{\1}', body) +body = re.sub ('(?ms)
(.*?)
', r'@quote{\1}', body) +body = re.sub ('(?ms)(.*?)', r'@code{\1}', body) +body = re.sub ('(?ms)
  • (.*?)(
  • )', r'@item\n\1\n', body) +body = re.sub ('(?ms)
  • (.*?)(
  • )', r'@item\n\1\n\2', body) +body = re.sub ('(?ms)
  • (.*?)(
  • )', r'@item\n\1\n\2', body) +body = re.sub ('(?ms)
  • (.*?)(
  • )', r'@item\n\1\n\2', body) +body = re.sub ('(?ms)
  • (.*?)(
  • )', r'@item\n\1\n\2', body) +body = re.sub ('(?ms)
  • (.*?)(
  • )', r'@item\n\1\n\2', body) +body = re.sub ('(?ms)
  • (.*?)()', r'@item\n\1\n\2', body) +body = re.sub ('(?ms)
      ', r'@itemize', body) +body = re.sub ('(?ms)
    ', r'@end itemize', body) + +# added for the bib => bib2html => html2texinfo chain. -gp +body = re.sub ('(?ms)', r'', body) +body = re.sub ('(?ms)(.*?)()', r'', body) +body = re.sub ('(?ms)', r'', body) +body = re.sub ('(?ms)', r'', body) +body = re.sub ('(?ms)', r'', body) + +body = re.sub ('(?ms)
    ', r'@table @emph', body) +body = re.sub ('(?ms)
    ', r'@end table', body) + +body = re.sub ('(?ms)
    (.*?)(
    )', r'@item \1', body) +body = re.sub ('(?ms)', r'', body) +body = re.sub ('(?ms):', r'', body) +body = re.sub ('(?ms)
    (.*?)(
    )', r'\1', body) + +body = re.sub ('(?ms)(.*?)()', r'@strong{\1}', body) +body = re.sub ('(?ms)(.*?)()', r'@emph{\1}', body) + +body = re.sub ('(?ms) ', r'@tie{}', body) + +body = re.sub ('(?ms)\cite{(.*?)}', r'[\1]', body) +body = re.sub ('(?ms)\cite{(.*?)}', r'[\1]', body) + +# dangerous rule, but with the spaces should be ok +body = re.sub ('(?ms) {(.*?)} ', r' @q{\1} ', body) + +# end stuff added for the bib => bib2html => html2texinfo chain -gp +# the other lines in the file can _probably_ be trimmed. + + +body = re.sub ('(?ms)
      ', r'@enumerate POSITIVE-INTEGER', body) +body = re.sub ('(?ms)', r'@enumerate \1', body) +body = re.sub ('(?ms)
    ', r'@end enumerate', body) + +body = re.sub ('“(.*?)”', r'@qq{\1}', body) +body = re.sub ('ä', '@"a', body) +body = re.sub ('(?ms)\s*

    \s*', '\n\n', body) +body = re.sub ('\n*\s*

    \s*\n*', '\n\n', body) +body = re.sub ('(?ms)', '', body) +body = re.sub ('(?ms)(.*?)', r'@code{\1}', body) +body = re.sub ('(?ms)(.*?)', r'@emph{\1}', body) +body = re.sub ('(?ms)(.*?)', r'@strong{\1}', body) +body = re.sub ('(?ms)
    (.*?)
    ', r'@verbatim\n\1\n@end verbatim', body) +body = re.sub ('(?ms)
    (.*?)
    ', r'@verbatim\n\1\n@end verbatim', body) + +body = re.sub ('(?ms)', r'@table asis', body) +body = re.sub ('(?ms)
    ]*>', r'@table asis', body) +body = re.sub ('(?ms)
    ', r'@end table', body) +body = re.sub ('(?ms)(.*?)', r'@item\n\1\n', body) +body = re.sub ('(?ms)(.*?)', r'@item\n\1\n', body) +body = re.sub ('(?ms)]*>(.*?)', r'@tab\n\1\n', body) + +#body = re.sub ('(?ms)\s*

    \s*((?:.|\n)*)\n\n', '@divClass{float-\\1}\n\\2\n@divEnd', body) +body = re.sub ('(?ms)\s*

    \s*', '\n\n@divClass{float-\\1}\n@divEnd\n', body) + +print body + -- 2.39.5