From a97c9ed35baa68ddefa8034cf97e13718034a246 Mon Sep 17 00:00:00 2001 From: Shaun McCance Date: Mon, 1 Feb 2021 20:03:22 -0500 Subject: Switch to new python tools --- meson.build | 5 + templates/concept.duck | 36 +- templates/concept.page | 40 +- templates/guide.duck | 36 +- templates/guide.page | 40 +- templates/info.ducktype.include | 33 + templates/info.mallard.include | 35 + templates/meson.build | 6 +- templates/py/templates/concept.duck | 15 - templates/py/templates/concept.page | 18 - templates/py/templates/guide.duck | 17 - templates/py/templates/guide.page | 21 - templates/py/templates/info.ducktype.include | 33 - templates/py/templates/info.mallard.include | 35 - templates/py/templates/reference.duck | 58 - templates/py/templates/reference.page | 65 - templates/py/templates/task.duck | 29 - templates/py/templates/task.page | 35 - templates/reference.duck | 36 +- templates/reference.page | 40 +- templates/task.duck | 38 +- templates/task.page | 40 +- tools/meson.build | 20 +- tools/yelp-build.in | 1403 ++++++++------- tools/yelp-build.py | 834 --------- tools/yelp-check.in | 2438 +++++++++++++------------- tools/yelp-check.py | 1245 ------------- tools/yelp-new.in | 445 +++-- tools/yelp-new.py | 317 ---- xslt/comments.xsl | 122 -- xslt/mal-epub.xsl | 20 - xslt/mal-files.xsl | 171 -- xslt/mal-license.xsl | 105 -- xslt/mal-status.xsl | 140 -- xslt/media.xsl | 39 - xslt/meson.build | 20 +- 36 files changed, 2443 insertions(+), 5587 deletions(-) create mode 100644 templates/info.ducktype.include create mode 100644 templates/info.mallard.include delete mode 100644 templates/py/templates/concept.duck delete mode 100644 templates/py/templates/concept.page delete mode 100644 templates/py/templates/guide.duck delete mode 100644 templates/py/templates/guide.page delete mode 100644 templates/py/templates/info.ducktype.include delete mode 100644 templates/py/templates/info.mallard.include delete mode 100644 templates/py/templates/reference.duck delete mode 100644 templates/py/templates/reference.page delete mode 100644 templates/py/templates/task.duck delete mode 100644 templates/py/templates/task.page delete mode 100644 tools/yelp-build.py delete mode 100644 tools/yelp-check.py delete mode 100644 tools/yelp-new.py delete mode 100644 xslt/comments.xsl delete mode 100644 xslt/mal-epub.xsl delete mode 100644 xslt/mal-files.xsl delete mode 100644 xslt/mal-license.xsl delete mode 100644 xslt/mal-status.xsl delete mode 100644 xslt/media.xsl diff --git a/meson.build b/meson.build index e705550..475f4bb 100644 --- a/meson.build +++ b/meson.build @@ -6,6 +6,11 @@ project('yelp-tools', gnome = import('gnome') +python = import('python') +pyinst = python.find_installation('python3', required: true) +lxml = run_command('python3', '-c', 'import lxml') +assert(lxml.returncode() == 0, 'Python module `lxml` required') + # Versioning version = meson.project_version() version_arr = version.split('.') diff --git a/templates/concept.duck b/templates/concept.duck index c349e88..0e6dff4 100644 --- a/templates/concept.duck +++ b/templates/concept.duck @@ -1,42 +1,10 @@ @ducktype/1.0 [-] yelp-tmpl-desc Explanation of a concept or background information -= @TITLE@ += {{TITLE}} [topic .concept version=1.1] -[-- - Recommended statuses: stub incomplete draft outdated review candidate final - Remove version attributes you don't use. ---] -@revision[version=0.1 docversion=0.1 pkgversion=0.1 date=@DATE@ status=stub] - -@credit[author copyright] - @name @NAME@ - @email @EMAIL@ - @years @YEAR@ - -[-- - This puts a link to this topic on the index page. - Change the xref to link it from another guide. ---] -@link[guide >index] - -[-- - Think about whether other pages should be in the seealso list. - The target page will automatically get a seealso link back. -@link[seealso >someotherid] ---] - -[-- - Think about whether external resources should be in the seealso - list. These require a title. -@link[seealso >>http://someurl] - @title Link title ---] - -@desc Write a short page description here. - -@keywords comma-separated list, of keywords, for search +{{INCLUDE info.ducktype.include}} Provide as many paragraphs, lists, or media as necessary to explain. diff --git a/templates/concept.page b/templates/concept.page index 92fbbb8..16f56e4 100644 --- a/templates/concept.page +++ b/templates/concept.page @@ -1,46 +1,12 @@ + id="{{ID}}"> - - - - - @NAME@ - @EMAIL@ - @YEAR@ - - - - - - - - - - Write a short page description here. - - comma-separated list, of keywords, for search +{{INCLUDE info.mallard.include}} - @TITLE@ + {{TITLE}}

Provide as many paragraphs, lists, or media as necessary to explain.

diff --git a/templates/guide.duck b/templates/guide.duck index 61cd746..a7d13ea 100644 --- a/templates/guide.duck +++ b/templates/guide.duck @@ -1,42 +1,10 @@ @ducktype/1.0 [-] yelp-tmpl-desc Navigational glue for Mallard documents -= @TITLE@ += {{TITLE}} [guide version=1.1] -[-- - Recommended statuses: stub incomplete draft outdated review candidate final - Remove version attributes you don't use. ---] -@revision[version=0.1 docversion=0.1 pkgversion=0.1 date=@DATE@ status=stub] - -@credit[author copyright] - @name @NAME@ - @email @EMAIL@ - @years @YEAR@ - -[-- - This puts a link to this topic on the index page. - Change the xref to link it from another guide. ---] -@link[guide >index] - -[-- - Think about whether other pages should be in the seealso list. - The target page will automatically get a seealso link back. -@link[seealso >someotherid] ---] - -[-- - Think about whether external resources should be in the seealso - list. These require a title. -@link[seealso >>http://someurl] - @title Link title ---] - -@desc Write a short page description here. - -@keywords comma-separated list, of keywords, for search +{{INCLUDE info.ducktype.include}} Optionally, an introductory paragraph. diff --git a/templates/guide.page b/templates/guide.page index 894b276..90b8a7d 100644 --- a/templates/guide.page +++ b/templates/guide.page @@ -1,46 +1,12 @@ + id="{{ID}}"> - - - - - @NAME@ - @EMAIL@ - @YEAR@ - - - - - - - - - - Write a short page description here. - - comma-separated list, of keywords, for search +{{INCLUDE info.mallard.include}} - @TITLE@ + {{TITLE}}

Optionally, an introductory paragraph.

diff --git a/templates/info.ducktype.include b/templates/info.ducktype.include new file mode 100644 index 0000000..fdc6de1 --- /dev/null +++ b/templates/info.ducktype.include @@ -0,0 +1,33 @@ +[-- + Recommended statuses: stub incomplete draft outdated review candidate final + Remove version attributes you don't use. +--] +@revision[version={{VERSION}} date={{DATE}} status=stub] + +@credit[author copyright] + @name {{NAME}} + @email {{EMAIL}} + @years {{YEAR}} + +[-- + This puts a link to this topic on the index page. + Change the xref to link it from another guide. +--] +@link[guide >index] + +[-- + Think about whether other pages should be in the seealso list. + The target page will automatically get a seealso link back. +@link[seealso >someotherid] +--] + +[-- + Think about whether external resources should be in the seealso + list. These require a title. +@link[seealso >>http://someurl] + @title Link title +--] + +@desc Write a short page description here. + +@keywords comma-separated list, of keywords, for search diff --git a/templates/info.mallard.include b/templates/info.mallard.include new file mode 100644 index 0000000..d3209d7 --- /dev/null +++ b/templates/info.mallard.include @@ -0,0 +1,35 @@ + + + + + {{NAME}} + {{EMAIL}} + {{YEAR}} + + + + + + + + + + Write a short page description here. + + comma-separated list, of keywords, for search diff --git a/templates/meson.build b/templates/meson.build index fa55c73..fdb424b 100644 --- a/templates/meson.build +++ b/templates/meson.build @@ -6,7 +6,9 @@ yelp_tools_templates_data = [ 'reference.duck', 'reference.page', 'task.duck', - 'task.page' + 'task.page', + 'info.ducktype.include', + 'info.mallard.include' ] install_data( @@ -14,4 +16,4 @@ install_data( install_dir: join_paths( pkgtemplatesdir, ) -) \ No newline at end of file +) diff --git a/templates/py/templates/concept.duck b/templates/py/templates/concept.duck deleted file mode 100644 index 0e6dff4..0000000 --- a/templates/py/templates/concept.duck +++ /dev/null @@ -1,15 +0,0 @@ -@ducktype/1.0 -[-] yelp-tmpl-desc Explanation of a concept or background information - -= {{TITLE}} - [topic .concept version=1.1] - -{{INCLUDE info.ducktype.include}} - - -Provide as many paragraphs, lists, or media as necessary to explain. - -[list] -. Next steps -* Optionally, links to other things the user might do now. -* But consider using seealso and other info links instead. diff --git a/templates/py/templates/concept.page b/templates/py/templates/concept.page deleted file mode 100644 index 16f56e4..0000000 --- a/templates/py/templates/concept.page +++ /dev/null @@ -1,18 +0,0 @@ - - - -{{INCLUDE info.mallard.include}} - - - {{TITLE}} - -

Provide as many paragraphs, lists, or media as necessary to explain.

- - - Next steps -

Optionally, links to other things the user might do now.

-

But consider using seealso and other info links instead.

-
-
diff --git a/templates/py/templates/guide.duck b/templates/py/templates/guide.duck deleted file mode 100644 index a7d13ea..0000000 --- a/templates/py/templates/guide.duck +++ /dev/null @@ -1,17 +0,0 @@ -@ducktype/1.0 -[-] yelp-tmpl-desc Navigational glue for Mallard documents - -= {{TITLE}} - [guide version=1.1] - -{{INCLUDE info.ducktype.include}} - - -Optionally, an introductory paragraph. - -[-- - The links element is implicit, but you might want to add one - explicitly if you want to do link grouping or styles. -[links topic .STYLE groups="GROUPS"] - . Optional title ---] diff --git a/templates/py/templates/guide.page b/templates/py/templates/guide.page deleted file mode 100644 index 90b8a7d..0000000 --- a/templates/py/templates/guide.page +++ /dev/null @@ -1,21 +0,0 @@ - - - -{{INCLUDE info.mallard.include}} - - - {{TITLE}} - -

Optionally, an introductory paragraph.

- - - -
diff --git a/templates/py/templates/info.ducktype.include b/templates/py/templates/info.ducktype.include deleted file mode 100644 index fdc6de1..0000000 --- a/templates/py/templates/info.ducktype.include +++ /dev/null @@ -1,33 +0,0 @@ -[-- - Recommended statuses: stub incomplete draft outdated review candidate final - Remove version attributes you don't use. ---] -@revision[version={{VERSION}} date={{DATE}} status=stub] - -@credit[author copyright] - @name {{NAME}} - @email {{EMAIL}} - @years {{YEAR}} - -[-- - This puts a link to this topic on the index page. - Change the xref to link it from another guide. ---] -@link[guide >index] - -[-- - Think about whether other pages should be in the seealso list. - The target page will automatically get a seealso link back. -@link[seealso >someotherid] ---] - -[-- - Think about whether external resources should be in the seealso - list. These require a title. -@link[seealso >>http://someurl] - @title Link title ---] - -@desc Write a short page description here. - -@keywords comma-separated list, of keywords, for search diff --git a/templates/py/templates/info.mallard.include b/templates/py/templates/info.mallard.include deleted file mode 100644 index d3209d7..0000000 --- a/templates/py/templates/info.mallard.include +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {{NAME}} - {{EMAIL}} - {{YEAR}} - - - - - - - - - - Write a short page description here. - - comma-separated list, of keywords, for search diff --git a/templates/py/templates/reference.duck b/templates/py/templates/reference.duck deleted file mode 100644 index 2d1a770..0000000 --- a/templates/py/templates/reference.duck +++ /dev/null @@ -1,58 +0,0 @@ -@ducktype/1.0 -[-] yelp-tmpl-desc Lists or tables of information for quick lookup - -= {{TITLE}} - [topic .reference version=1.1] - -{{INCLUDE info.ducktype.include}} - - -Optionally provide introductory text. -Use terms lists, tables, and bullet lists for reference material. - - -[terms] -. Example terms list (title optional) - -- Term 1 -* Description - -- Term 2 -* Terms can have multiple paragraphs. - - [screen] - Or any other block element. - -- Term 3.1 -- Term 3.2 -* Terms can also have multiple titles. - - -[table] -. Example table (title optional) - -[thead] -[tr] -- Column 1 -- Column 2 - -[tbody] -[tr] -* Row 1, column 1 -* Row 1, column 2 - -[tr] -* Row 2, column 1 -* Row 2, column 2 - - -[list] -. Example list (title optional) - -* Item 1 - -* Item 2 - * Subitem 2.1 - * Subitem 2.2 - -* Item 3 diff --git a/templates/py/templates/reference.page b/templates/py/templates/reference.page deleted file mode 100644 index 3551452..0000000 --- a/templates/py/templates/reference.page +++ /dev/null @@ -1,65 +0,0 @@ - - - -{{INCLUDE info.mallard.include}} - - - {{TITLE}} - -

Optionally provide introductory text. - Use terms lists, tables, and bullet lists for reference material.

- - - Example terms list (title optional) - - Term 1 - Description - - - Term 2 -

Terms can have multiple paragraphs.

- Or any other block element. -
- - Term 3.1 - Term 3.2 -

Terms can also have multiple titles.

-
-
- - - Example table (title optional) - - - - - - - - - - - - - - - - -
Column 1Column 2
Row 1, column 1Row 1, column 2
Row 2, column 1Row 2, column 2
- - - Example list (title optional) -

Item 1

- -

Item 2

- -

Subitem 2.1

-

Subitem 2.2

-
-
-

Item 3

-
- -
diff --git a/templates/py/templates/task.duck b/templates/py/templates/task.duck deleted file mode 100644 index aab510c..0000000 --- a/templates/py/templates/task.duck +++ /dev/null @@ -1,29 +0,0 @@ -@ducktype/1.0 -[-] yelp-tmpl-desc Description of how to accomplish a user task - -= {{TITLE}} - [topic .task version=1.1] - -{{INCLUDE info.ducktype.include}} - - -Short introductory text: Write a couple sentences about what the -user is doing here, and why they might want to do it. - -[list] -. Prerequisites -* Optionally, list things the user needs to know or do first. -* Use links to other pages whenever they make sense. - -[steps] -. Optional title if different from page title or if prereqs present -* First step... -* Second step... -* Third step... - -Optionally, write expected results if non-obvious. - -[list] -. Next steps -* Optionally, links to other things the user might do now. -* But consider using seealso and other info links instead. diff --git a/templates/py/templates/task.page b/templates/py/templates/task.page deleted file mode 100644 index ba6da8b..0000000 --- a/templates/py/templates/task.page +++ /dev/null @@ -1,35 +0,0 @@ - - - -{{INCLUDE info.mallard.include}} - - - {{TITLE}} - -

Short introductory text: Write a couple sentences about what the - user is doing here, and why they might want to do it.

- - - Prerequisites -

Optionally, list things the user needs to know or do first.

-

Use links to other pages whenever they make sense.

-
- - - Optional title if different from page title or if prereqs present -

First step...

-

Second step...

-

Third step...

-
- -

Optionally, write expected results if non-obvious.

- - - Next steps -

Optionally, links to other things the user might do now.

-

But consider using seealso and other info links instead.

-
- -
diff --git a/templates/reference.duck b/templates/reference.duck index 0aae96b..2d1a770 100644 --- a/templates/reference.duck +++ b/templates/reference.duck @@ -1,42 +1,10 @@ @ducktype/1.0 [-] yelp-tmpl-desc Lists or tables of information for quick lookup -= @TITLE@ += {{TITLE}} [topic .reference version=1.1] -[-- - Recommended statuses: stub incomplete draft outdated review candidate final - Remove version attributes you don't use. ---] -@revision[version=0.1 docversion=0.1 pkgversion=0.1 date=@DATE@ status=stub] - -@credit[author copyright] - @name @NAME@ - @email @EMAIL@ - @years @YEAR@ - -[-- - This puts a link to this topic on the index page. - Change the xref to link it from another guide. ---] -@link[guide >index] - -[-- - Think about whether other pages should be in the seealso list. - The target page will automatically get a seealso link back. -@link[seealso >someotherid] ---] - -[-- - Think about whether external resources should be in the seealso - list. These require a title. -@link[seealso >>http://someurl] - @title Link title ---] - -@desc Write a short page description here. - -@keywords comma-separated list, of keywords, for search +{{INCLUDE info.ducktype.include}} Optionally provide introductory text. diff --git a/templates/reference.page b/templates/reference.page index c7364ee..3551452 100644 --- a/templates/reference.page +++ b/templates/reference.page @@ -1,46 +1,12 @@ + id="{{ID}}"> - - - - - @NAME@ - @EMAIL@ - @YEAR@ - - - - - - - - - - Write a short page description here. - - comma-separated list, of keywords, for search +{{INCLUDE info.mallard.include}} - @TITLE@ + {{TITLE}}

Optionally provide introductory text. Use terms lists, tables, and bullet lists for reference material.

diff --git a/templates/task.duck b/templates/task.duck index 75c8243..aab510c 100644 --- a/templates/task.duck +++ b/templates/task.duck @@ -1,42 +1,10 @@ @ducktype/1.0 [-] yelp-tmpl-desc Description of how to accomplish a user task -= @TITLE@ += {{TITLE}} [topic .task version=1.1] -[-- - Recommended statuses: stub incomplete draft outdated review candidate final - Remove version attributes you don't use. ---] -@revision[version=0.1 docversion=0.1 pkgversion=0.1 date=@DATE@ status=stub] - -@credit[author copyright] - @name @NAME@ - @email @EMAIL@ - @years @YEAR@ - -[-- - This puts a link to this topic on the index page. - Change the xref to link it from another guide. ---] -@link[guide >index] - -[-- - Think about whether other pages should be in the seealso list. - The target page will automatically get a seealso link back. -@link[seealso >someotherid] ---] - -[-- - Think about whether external resources should be in the seealso - list. These require a title. -@link[seealso >>http://someurl] - @title Link title ---] - -@desc Write a short page description here. - -@keywords comma-separated list, of keywords, for search +{{INCLUDE info.ducktype.include}} Short introductory text: Write a couple sentences about what the @@ -59,5 +27,3 @@ Optionally, write expected results if non-obvious. . Next steps * Optionally, links to other things the user might do now. * But consider using seealso and other info links instead. - - diff --git a/templates/task.page b/templates/task.page index ba7be5f..ba6da8b 100644 --- a/templates/task.page +++ b/templates/task.page @@ -1,46 +1,12 @@ + id="{{ID}}"> - - - - - @NAME@ - @EMAIL@ - @YEAR@ - - - - - - - - - - Write a short page description here. - - comma-separated list, of keywords, for search +{{INCLUDE info.mallard.include}} - @TITLE@ + {{TITLE}}

Short introductory text: Write a couple sentences about what the user is doing here, and why they might want to do it.

diff --git a/tools/meson.build b/tools/meson.build index b6b3956..35187ca 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -1,10 +1,7 @@ yelp_tools_in = configuration_data() yelp_tools_in.set('DATADIR', pkgdir) -yelp_tools_in.set('YELP_XSLT_DIR', yelp_xslt_dir) -yelp_tools_in.set('YELP_TMPL_DIR', join_paths(yelp_templates_dir, '')) # Hack for trailing '/' yelp_tools_in.set('YELP_JS_DIR', yelp_js_dir) -yelp_tools_in.set('YELP_ICON_DIR', yelp_icons_dir) yelp_tools_in.set('XSL_DB2HTML', yelp_db2html_path) yelp_tools_in.set('XSL_DB2XHTML', yelp_db2xhtml_path) @@ -19,21 +16,6 @@ yelp_tools_in.set('XSL_MAL_CACHE', join_paths( ) ) -yelp_tools_in.set('XSL_MAL_LINK', join_paths( - yelp_xslt_dir, - 'mallard', - 'common', - 'mal-link.xsl', - ) -) - -yelp_tools_in.set('ID', '@ID@') -yelp_tools_in.set('DATE', '@DATE@') -yelp_tools_in.set('YEAR', '@YEAR@') -yelp_tools_in.set('NAME', '@NAME@') -yelp_tools_in.set('EMAIL', '@EMAIL@') -yelp_tools_in.set('TITLE', '@TITLE@') - configure_file( input: 'yelp-build.in', output: 'yelp-build', @@ -65,4 +47,4 @@ if get_option('yelpm4') == true autoconfdatadir, ) ) -endif \ No newline at end of file +endif diff --git a/tools/yelp-build.in b/tools/yelp-build.in index f3e21d8..d53db52 100755 --- a/tools/yelp-build.in +++ b/tools/yelp-build.in @@ -1,8 +1,7 @@ -#!/bin/sh -# -*- indent-tabs-mode: nil -*- +#!/bin/python3 # # yelp-build -# Copyright (C) 2010-2015 Shaun McCance +# Copyright (C) 2010-2020 Shaun McCance # # 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 @@ -18,590 +17,816 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -xsl_mal_cache='@XSL_MAL_CACHE@' -xsl_db2html='@XSL_DB2HTML@' -xsl_db2xhtml='@XSL_DB2XHTML@' -xsl_mal2html='@XSL_MAL2HTML@' -xsl_mal2xhtml='@XSL_MAL2XHTML@' -yelp_icon_dir='@YELP_ICON_DIR@' -yelp_js_dir='@YELP_JS_DIR@' -xsl_mal_epub='@DATADIR@/xslt/mal-epub.xsl' -xsl_mal_opf='@DATADIR@/xslt/mal-opf.xsl' -xsl_mal_ncx='@DATADIR@/xslt/mal-ncx.xsl' -xsl_mal_files='@DATADIR@/xslt/mal-files.xsl' - -mkdir_p () { - if [ ! -d "$1" ]; then - mkdir_p `dirname "$1"` - mkdir "$1" - fi -} - -urlencode () { - LC_ALL=C awk ' -BEGIN { - for (i = 1; i <= 255; i++) chars[sprintf("%c", i)] = i; -} -{ - ret = ""; - for (i = 1; i <= length($0); i++) { - c = substr($0, i, 1); - if (c ~ /[\/a-zA-Z0-9._-]/) - ret = ret c; - else - ret = ret sprintf("%%%X%X", int(chars[c] / 16), chars[c] % 16); - } - print ret; -}' -} - -urldecode () { - LC_ALL=C awk ' -BEGIN { - for(i = 0; i < 10; i++) hex[i] = i; - hex["A"] = hex["a"] = 10; - hex["B"] = hex["b"] = 11; - hex["C"] = hex["c"] = 12; - hex["D"] = hex["d"] = 13; - hex["E"] = hex["e"] = 14; - hex["F"] = hex["f"] = 15; -} -{ - ret = ""; - for (i = 1; i <= length($0); i++) { - c = substr($0, i, 1); - if (c == "+") { - ret = ret " "; - } - else if (c == "%") { - c = sprintf("%c", hex[substr($0, i + 1, 1)] * 16 + hex[substr($0, i + 2, 1)]); - ret = ret c; - i += 2; - } - else { - ret = ret c; - } - } - print ret; -}' -} - -yelp_usage () { - ( - echo "Usage: yelp-build [OPTIONS] [FILES]" - echo "" - echo "Commands:" - echo " cache Create a Mallard cache file" - echo " epub Create an EPUB file for Mallard" - echo " html Convert input files to HTML" - echo " xhtml Convert input files to XHTML" - ) 1>&2 -} -yelp_usage_cache () { - ( - echo "Usage: yelp-build cache " - echo "" - echo " Create a Mallard cache file from the page files FILES." - echo " If FILES contains directories, all .page files in those" - echo " directories will be used." - echo "" - echo "Options:" - echo " -o OUT Output cache to the file OUT" - echo " -s Treat pages as belonging to a Mallard site" - ) 1>&2 -} -yelp_usage_epub () { - ( - echo "Usage: yelp-build epub [OPTIONS] " - echo "" - echo " Create and EPUB file from the Mallard page files FILES." - echo "" - echo "Options:" - echo " -c CACHE Use the existing Mallard cache CACHE" - echo " -o OUT Output en EPUB file named OUT" - echo " -x CUSTOM Import the custom XSLT file CUSTOM" - echo " -p PATHS Extra paths to search for files" - echo " -i Ignore missing media files" - ) 1>&2 -} -yelp_usage_html () { - ( - echo "Usage: yelp-build [OPTIONS] " - echo "" - echo " Create HTML or XHTML from the input files FILES." - echo " FILES can be DocBook files, Mallard page files," - echo " or directories containing Mallard page files." - echo "" - echo "Options:" - echo " -c CACHE Use the existing Mallard cache CACHE" - echo " -o OUT Output files in the directory OUT" - echo " -x CUSTOM Import the custom XSLT file CUSTOM" - echo " -p PATHS Extra paths to search for files" - echo " -i Ignore missing media files" - ) 1>&2 -} - -if [ $# = 0 ]; then - yelp_usage - exit 1 -fi - -yelp_paths_normalize () { - for path in $(echo "$1" | sed -e 's/[: ]/\n/g'); do - (cd "$path" && pwd) - done | tr '\n' ' ' -} - -yelp_cache_in_page () { - fbase=$(basename "$1") - ext=$(echo "$fbase" | sed -e 's/.*\.//') - fdir=$( (cd $(dirname "$1") && pwd) ) - sdir=${fdir##${cache_site_root}}/ - url=file://$(echo "$fdir/$fbase" | urlencode) - if [ "x$cache_site" = "x1" ]; then - siteattr=' site:dir="'"$sdir"'"' - fi - if [ "x$ext" = "xstack" ]; then - echo '' - else - echo '' - fi -} - -yelp_cache_in_site () { - for dir in "$1"/*; do - if [ -d "$dir" ]; then - if [ $(basename "$dir") != "__pintail__" ]; then - yelp_cache_in_site "$dir" - fi - fi - done - for page in "$1"/*.page "$1"/*.stack; do - if [ -e "$page" ]; then - yelp_cache_in_page "$page" - fi - done -} - -yelp_cache_in () { - echo '' - for page in "$@"; do - if [ -d "$page" ]; then - if [ "x$cache_site" = "x1" ]; then - yelp_cache_in_site "$page" - else - for sub in "$page"/*.page "$page"/*.stack; do - if [ -e "$sub" ]; then - yelp_cache_in_page "$sub" - fi - done - fi - else - yelp_cache_in_page "$page" - fi - done - echo '' -} - -yelp_cache () { - cache_out="index.cache" - while [ "$#" != "0" ]; do - case "$1" in - "-o") - shift - cache_out="$1" - shift - ;; - "-s") - cache_site="1" - cache_site_root=$(pwd) - shift - ;; - *) - break - ;; - esac - done - if [ "$#" = "0" -o "x$1" = "x--help" -o "x$1" = "x-h" ]; then - yelp_usage_cache - exit 1 - fi - yelp_cache_in "$@" | xsltproc --path "$html_paths" \ - --xinclude -o "$cache_out" \ - "$xsl_mal_cache" - -} - -yelp_html_xsl_common () { - if [ "x$html_internal_datadir" != "x" ]; then - echo '' - echo '' - echo '' - else - echo '' - fi - if [ "x$html_internal_xsl" != "x" ]; then - echo '' - fi - if [ "x$html_custom" != "x" ]; then - echo '' - fi - echo '' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' C' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo '' - echo '' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo ' ' - echo '