aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-02-09 22:03:10 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit1c73ddf3894085c646b55d63e61a2483e03a3b4d (patch)
tree34e3a837d0e0d224008ff380055ea263a03d3c14
parentpaths, further adjustments (diff)
0.24.0 toml or sdlang for configuration
-rw-r--r--.gitignore9
-rw-r--r--dub.sdl4
-rw-r--r--dub.selections.json1
-rw-r--r--makefile343
-rw-r--r--maker.org492
-rw-r--r--org/default_misc.org375
-rw-r--r--org/default_paths.org71
-rw-r--r--org/default_regex.org9
-rw-r--r--org/meta_abstraction.org29
-rw-r--r--org/meta_conf_make_meta.org1538
-rw-r--r--org/meta_debugs.org12
-rw-r--r--org/meta_read_source_files.org338
-rw-r--r--org/output_sisupod.org58
-rw-r--r--org/sdp.org52
-rw-r--r--src/sdp/meta/conf_make_meta.d38
-rw-r--r--src/sdp/meta/conf_make_meta_composite.d45
-rw-r--r--src/sdp/meta/conf_make_meta_json.d369
-rw-r--r--src/sdp/meta/conf_make_meta_sdlang.d432
-rw-r--r--src/sdp/meta/conf_make_meta_structs.d305
-rw-r--r--src/sdp/meta/conf_make_meta_toml.d79
-rw-r--r--src/sdp/meta/defaults.d269
-rw-r--r--src/sdp/meta/doc_debugs.d12
-rw-r--r--src/sdp/meta/metadoc.d39
-rw-r--r--src/sdp/meta/metadoc_from_src.d29
-rw-r--r--src/sdp/meta/read_config_files.d271
-rw-r--r--src/sdp/meta/read_source_files.d6
-rw-r--r--src/sdp/meta/rgx.d9
-rw-r--r--src/sdp/output/paths_output.d2
-rw-r--r--src/sdp/output/paths_source.d49
-rw-r--r--src/sdp/output/rgx.d6
-rw-r--r--src/sdp/output/source_sisupod.d58
-rwxr-xr-xsrc/sdp/sdp.d11
-rw-r--r--views/version.txt2
33 files changed, 4078 insertions, 1284 deletions
diff --git a/.gitignore b/.gitignore
index f824d25..76a1754 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,15 +13,22 @@
!*.txt
!*.sst
!conf.sdl
-!sisu_document_make
+!sisupod.manifest
+!sisu_document_make.sdl
+!config_local_site.sdl
+!sisu_document_make.toml
+!config_local_site.toml
!org
!src
!src/*
+!data
+!data/*
!sisudoc
!views
!docs/*.html
!**/
**/.#*
+tmp/**
#!*/
#*~
#\#*
diff --git a/dub.sdl b/dub.sdl
index 67c26d8..408408b 100644
--- a/dub.sdl
+++ b/dub.sdl
@@ -8,6 +8,8 @@ targetPath "./bin"
#sourcePath "./src/sdp"
stringImportPaths "./views"
buildRequirements "allowWarnings"
+dependency "toml" version="~>0.4.0-rc.2"
+dependency "toml:json" version="~>0.4.0-rc.2" # if not possible to parse toml directly go through json
dependency "sdlang-d" version="~>0.10.1"
dependency "d2sqlite3" version="~>0.13.1" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3.html
subconfiguration "d2sqlite3" "all-included"
@@ -174,7 +176,7 @@ configuration "sdp-ldc-debug" {
buildRequirements "allowWarnings"
buildOptions "verbose" "debugMode" "debugInfo" "optimize"
debugVersions "checkdoc" "summary"
- postGenerateCommands "/usr/bin/notify-send -t 0 'D (debug) executable ready' 'sdp-ldc-debug'"
+ postGenerateCommands "time (./bin/sdp-ldc-debug --source --html --epub -v --output-dir=tmp/program-output data/sisupod/sisu-manual )" "/usr/bin/notify-send -t 0 'D (debug) executable ready' 'sdp-ldc-debug'"
}
configuration "sdp-ldc-debug-version" {
name "debuging"
diff --git a/dub.selections.json b/dub.selections.json
index df36b25..8ada484 100644
--- a/dub.selections.json
+++ b/dub.selections.json
@@ -6,6 +6,7 @@
"libinputvisitor": "1.2.2",
"sdlang-d": "0.10.1",
"taggedalgebraic": "0.10.7",
+ "toml": "0.4.0-rc.4",
"unit-threaded": "0.6.36"
}
}
diff --git a/makefile b/makefile
index 2c44855..b7f3ffe 100644
--- a/makefile
+++ b/makefile
@@ -14,7 +14,71 @@ ORG_CONTRIB_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-plus-????????
EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-$($(shell echo $(ORG_CONTRIB_VER_AVAILABLE)))
ORGFILELIST=$(shell echo `ls -1 maker.org org/*.org`)
ORGFILES=""
-ORGDIR=$(shell echo `pwd`)
+ORGDIR :=$(shell echo `pwd`)
+SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND= \
+find data/sdlang/sisupod -maxdepth 2 -name sisupod.manifest | sort | xargs
+
+SiSU_MARKUP_SAMPLES_POD_SDL= \
+data/sdlang/sisupod/accelerando.charles_stross \
+data/sdlang/sisupod/alices_adventures_in_wonderland.lewis_carroll \
+data/sdlang/sisupod/content.cory_doctorow \
+data/sdlang/sisupod/democratizing_innovation.eric_von_hippel \
+data/sdlang/sisupod/down_and_out_in_the_magic_kingdom.cory_doctorow \
+data/sdlang/sisupod/for_the_win.cory_doctorow \
+data/sdlang/sisupod/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman \
+data/sdlang/sisupod/free_culture.lawrence_lessig \
+data/sdlang/sisupod/free_for_all.peter_wayner \
+data/sdlang/sisupod/gpl2.fsf \
+data/sdlang/sisupod/gpl3.fsf \
+data/sdlang/sisupod/gullivers_travels.jonathan_swift \
+data/sdlang/sisupod/little_brother.cory_doctorow \
+data/sdlang/sisupod/live-manual \
+data/sdlang/sisupod/sisu-manual \
+data/sdlang/sisupod/the_autonomous_contract.ralph_amissah \
+data/sdlang/sisupod/the_cathedral_and_the_bazaar.eric_s_raymond \
+data/sdlang/sisupod/the_public_domain.james_boyle \
+data/sdlang/sisupod/the_wealth_of_networks.yochai_benkler \
+data/sdlang/sisupod/through_the_looking_glass.lewis_carroll \
+data/sdlang/sisupod/two_bits.christopher_kelty \
+data/sdlang/sisupod/un_contracts_international_sale_of_goods_convention_1980 \
+data/sdlang/sisupod/viral_spiral.david_bollier
+SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND= \
+find data/sdlang/sisudir/media/text -name *.ss[tm] | sort | xargs
+
+SiSU_MARKUP_SAMPLES_DIR_SDL= \
+data/sdlang/sisudir/media/text/accelerando.charles_stross.sst \
+data/sdlang/sisudir/media/text/alices_adventures_in_wonderland.lewis_carroll.sst \
+data/sdlang/sisudir/media/text/content.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/democratizing_innovation.eric_von_hippel.sst \
+data/sdlang/sisudir/media/text/down_and_out_in_the_magic_kingdom.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/ffa_tmp.sst \
+data/sdlang/sisudir/media/text/for_the_win.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst \
+data/sdlang/sisudir/media/text/free_culture.lawrence_lessig.sst \
+data/sdlang/sisudir/media/text/free_for_all.peter_wayner.sst \
+data/sdlang/sisudir/media/text/gpl2.fsf.sst \
+data/sdlang/sisudir/media/text/gpl3.fsf.sst \
+data/sdlang/sisudir/media/text/gullivers_travels.jonathan_swift.sst \
+data/sdlang/sisudir/media/text/little_brother.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/sisu_markup.sst \
+data/sdlang/sisudir/media/text/sisu_markup_stress_test.sst \
+data/sdlang/sisudir/media/text/sisu_markup_test.sst \
+data/sdlang/sisudir/media/text/table_special_markup.sst \
+data/sdlang/sisudir/media/text/the_autonomous_contract.ralph_amissah.sst \
+data/sdlang/sisudir/media/text/the_cathedral_and_the_bazaar.eric_s_raymond.sst \
+data/sdlang/sisudir/media/text/the_public_domain.james_boyle.sst \
+data/sdlang/sisudir/media/text/the_wealth_of_networks.yochai_benkler.sst \
+data/sdlang/sisudir/media/text/through_the_looking_glass.lewis_carroll.sst \
+data/sdlang/sisudir/media/text/two_bits.christopher_kelty.sst \
+data/sdlang/sisudir/media/text/un_contracts_international_sale_of_goods_convention_1980.sst \
+data/sdlang/sisudir/media/text/viral_spiral.david_bollier.sst
+markup_samples:
+ find data/sdlang/sisupod -name sisupod.manifest | sort; \
+find data/sdlang/sisudir/media/text -name *.ss[tm] | sort
+markup_pod_samples:
+ find data/sdlang/sisupod -name sisupod.manifest | sort
+markup_dir_samples:
+ find data/sdlang/sisudir/media/text -name *.ss[tm] | sort
all: dmd ldc gdc
all_ver: dmd_ver ldc_ver gdc_ver
all_debug: dmd_debug gdc_debug ldc_debug
@@ -137,6 +201,283 @@ rebuild: $(PRG_SRCDIR)/$(PRG_SRC) $(PRG_BINDIR)/$(PRG_BIN).o clean build
makefile_new:
make -k tangle_maker
restart: clean tangle
+dmd_testrun_find:
+ ./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+dmd_testrun_find_pod_source:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-ldc -v --source --html --epub \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_sisupod:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_html:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_epub:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_all:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod
+dmd_testrun_paths_pod_source:
+ ./bin/sdp-dmd -v --source \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_sisupod:
+ ./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_html:
+ ./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_epub:
+ ./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_all:
+ ./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_find:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+gdc_testrun_find_pod_source:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_sisupod:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_html:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_epub:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_all:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod
+gdc_testrun_paths:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+gdc_testrun_paths_pod_source:
+ ./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_sisupod:
+ ./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_html:
+ ./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_epub:
+ ./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_all:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_find:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+ldc_testrun_find_pod_source:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_sisupod:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_html:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_epub:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_all:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod
+ldc_testrun_paths:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+ldc_testrun_paths_pod_source:
+ ./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_sisupod:
+ ./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_html:
+ ./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_epub:
+ ./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_all:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_find_dir_source:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --source \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_sisupod:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_html:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_epub:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_all:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir
+dmd_testrun_filelist_dir_source:
+ ./bin/sdp-dmd -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_sisupod:
+ ./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_html:
+ ./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_epub:
+ ./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_all:
+ ./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_find_dir_source:
+ ./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_find_dir_sisupod:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_dir
+gdc_testrun_find_dir_html:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_dir
+gdc_testrun_find_dir_epub:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_dir
+gdc_testrun_find_dir_all:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir
+gdc_testrun_filelist_dir_source:
+ ./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_sisupod:
+ ./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_html:
+ ./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_epub:
+ ./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_all:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_find_dir_source:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_sisupod:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_html:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_epub:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_all:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir
+ldc_testrun_filelist_dir_source:
+ ./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_sisupod:
+ ./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_html:
+ ./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_epub:
+ ./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_all:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
tangle: skel
for f in $(ORGFILELIST); do \
ORGFILES="$$ORGFILES \"$$f\""; \
diff --git a/maker.org b/maker.org
index c3a50d6..21fbd50 100644
--- a/maker.org
+++ b/maker.org
@@ -50,7 +50,75 @@ ORG_CONTRIB_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-plus-????????
EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-$($(shell echo $(ORG_CONTRIB_VER_AVAILABLE)))
ORGFILELIST=$(shell echo `ls -1 maker.org org/*.org`)
ORGFILES=""
-ORGDIR=$(shell echo `pwd`)
+ORGDIR :=$(shell echo `pwd`)
+#+END_SRC
+
+*** Markup Samples
+**** pods
+
+#+BEGIN_SRC makefile :tangle makefile
+SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND= \
+find data/sdlang/sisupod -maxdepth 2 -name sisupod.manifest | sort | xargs
+
+SiSU_MARKUP_SAMPLES_POD_SDL= \
+data/sdlang/sisupod/accelerando.charles_stross \
+data/sdlang/sisupod/alices_adventures_in_wonderland.lewis_carroll \
+data/sdlang/sisupod/content.cory_doctorow \
+data/sdlang/sisupod/democratizing_innovation.eric_von_hippel \
+data/sdlang/sisupod/down_and_out_in_the_magic_kingdom.cory_doctorow \
+data/sdlang/sisupod/for_the_win.cory_doctorow \
+data/sdlang/sisupod/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman \
+data/sdlang/sisupod/free_culture.lawrence_lessig \
+data/sdlang/sisupod/free_for_all.peter_wayner \
+data/sdlang/sisupod/gpl2.fsf \
+data/sdlang/sisupod/gpl3.fsf \
+data/sdlang/sisupod/gullivers_travels.jonathan_swift \
+data/sdlang/sisupod/little_brother.cory_doctorow \
+data/sdlang/sisupod/live-manual \
+data/sdlang/sisupod/sisu-manual \
+data/sdlang/sisupod/the_autonomous_contract.ralph_amissah \
+data/sdlang/sisupod/the_cathedral_and_the_bazaar.eric_s_raymond \
+data/sdlang/sisupod/the_public_domain.james_boyle \
+data/sdlang/sisupod/the_wealth_of_networks.yochai_benkler \
+data/sdlang/sisupod/through_the_looking_glass.lewis_carroll \
+data/sdlang/sisupod/two_bits.christopher_kelty \
+data/sdlang/sisupod/un_contracts_international_sale_of_goods_convention_1980 \
+data/sdlang/sisupod/viral_spiral.david_bollier
+#+END_SRC
+
+**** dir
+
+#+BEGIN_SRC makefile :tangle makefile
+SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND= \
+find data/sdlang/sisudir/media/text -name *.ss[tm] | sort | xargs
+
+SiSU_MARKUP_SAMPLES_DIR_SDL= \
+data/sdlang/sisudir/media/text/accelerando.charles_stross.sst \
+data/sdlang/sisudir/media/text/alices_adventures_in_wonderland.lewis_carroll.sst \
+data/sdlang/sisudir/media/text/content.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/democratizing_innovation.eric_von_hippel.sst \
+data/sdlang/sisudir/media/text/down_and_out_in_the_magic_kingdom.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/ffa_tmp.sst \
+data/sdlang/sisudir/media/text/for_the_win.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst \
+data/sdlang/sisudir/media/text/free_culture.lawrence_lessig.sst \
+data/sdlang/sisudir/media/text/free_for_all.peter_wayner.sst \
+data/sdlang/sisudir/media/text/gpl2.fsf.sst \
+data/sdlang/sisudir/media/text/gpl3.fsf.sst \
+data/sdlang/sisudir/media/text/gullivers_travels.jonathan_swift.sst \
+data/sdlang/sisudir/media/text/little_brother.cory_doctorow.sst \
+data/sdlang/sisudir/media/text/sisu_markup.sst \
+data/sdlang/sisudir/media/text/sisu_markup_stress_test.sst \
+data/sdlang/sisudir/media/text/sisu_markup_test.sst \
+data/sdlang/sisudir/media/text/table_special_markup.sst \
+data/sdlang/sisudir/media/text/the_autonomous_contract.ralph_amissah.sst \
+data/sdlang/sisudir/media/text/the_cathedral_and_the_bazaar.eric_s_raymond.sst \
+data/sdlang/sisudir/media/text/the_public_domain.james_boyle.sst \
+data/sdlang/sisudir/media/text/the_wealth_of_networks.yochai_benkler.sst \
+data/sdlang/sisudir/media/text/through_the_looking_glass.lewis_carroll.sst \
+data/sdlang/sisudir/media/text/two_bits.christopher_kelty.sst \
+data/sdlang/sisudir/media/text/un_contracts_international_sale_of_goods_convention_1980.sst \
+data/sdlang/sisudir/media/text/viral_spiral.david_bollier.sst
#+END_SRC
** _make_ commands [+2] :make:commands:
@@ -74,6 +142,24 @@ ORGDIR=$(shell echo `pwd`)
**** _dub_ build rebuild :dub:
***** all compiler builds :all:dmd:gdc:ldc:
****** all builds
+******* sample markup file list
+
+#+BEGIN_SRC makefile :tangle makefile
+markup_samples:
+ find data/sdlang/sisupod -name sisupod.manifest | sort; \
+find data/sdlang/sisudir/media/text -name *.ss[tm] | sort
+#+END_SRC
+
+#+BEGIN_SRC makefile :tangle makefile
+markup_pod_samples:
+ find data/sdlang/sisupod -name sisupod.manifest | sort
+#+END_SRC
+
+#+BEGIN_SRC makefile :tangle makefile
+markup_dir_samples:
+ find data/sdlang/sisudir/media/text -name *.ss[tm] | sort
+#+END_SRC
+
******* quick :quick:
******** default :default:
#+BEGIN_SRC makefile :tangle makefile
@@ -310,6 +396,352 @@ makefile_new:
restart: clean tangle
#+END_SRC
+*** testrun (program against document markup)
+**** pods
+***** dmd
+****** find files
+
+#+BEGIN_SRC makefile :tangle makefile
+dmd_testrun_find:
+ ./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+dmd_testrun_find_pod_source:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-ldc -v --source --html --epub \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_sisupod:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_html:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_epub:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_pod
+dmd_testrun_find_pod_all:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod
+#+END_SRC
+
+****** path list
+
+#+BEGIN_SRC makefile :tangle makefile
+dmd_testrun_paths_pod_source:
+ ./bin/sdp-dmd -v --source \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_sisupod:
+ ./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_html:
+ ./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_epub:
+ ./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+dmd_testrun_paths_pod_all:
+ ./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+#+END_SRC
+
+***** gdc
+****** find files
+
+#+BEGIN_SRC makefile :tangle makefile
+gdc_testrun_find:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+gdc_testrun_find_pod_source:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_sisupod:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_html:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_epub:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_pod
+gdc_testrun_find_pod_all:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod
+#+END_SRC
+
+****** path list
+
+#+BEGIN_SRC makefile :tangle makefile
+gdc_testrun_paths:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+gdc_testrun_paths_pod_source:
+ ./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_sisupod:
+ ./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_html:
+ ./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_epub:
+ ./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+gdc_testrun_paths_pod_all:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+#+END_SRC
+
+***** ldc
+****** find files
+
+#+BEGIN_SRC makefile :tangle makefile
+ldc_testrun_find:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+ldc_testrun_find_pod_source:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_sisupod:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_html:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_epub:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_pod
+ldc_testrun_find_pod_all:
+ $(SiSU_MARKUP_SAMPLES_PODS_SDL_FOUND) \
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod
+#+END_SRC
+
+****** path list
+
+#+BEGIN_SRC makefile :tangle makefile
+ldc_testrun_paths:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+data/sdlang/sisupod/sisu-manual
+ldc_testrun_paths_pod_source:
+ ./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_sisupod:
+ ./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_html:
+ ./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_epub:
+ ./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+ldc_testrun_paths_pod_all:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_pod \
+$(SiSU_MARKUP_SAMPLES_POD_SDL)
+#+END_SRC
+
+**** dir
+***** dmd
+****** find files
+
+#+BEGIN_SRC makefile :tangle makefile
+dmd_testrun_find_dir_source:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --source \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_sisupod:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_html:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_epub:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_dir
+dmd_testrun_find_dir_all:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir
+#+END_SRC
+
+****** file list
+
+#+BEGIN_SRC makefile :tangle makefile
+dmd_testrun_filelist_dir_source:
+ ./bin/sdp-dmd -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_sisupod:
+ ./bin/sdp-dmd -v --sisupod \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_html:
+ ./bin/sdp-dmd -v --html \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_epub:
+ ./bin/sdp-dmd -v --epub \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+dmd_testrun_filelist_dir_all:
+ ./bin/sdp-dmd -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+#+END_SRC
+
+***** gdc
+****** find files
+
+#+BEGIN_SRC makefile :tangle makefile
+gdc_testrun_find_dir_source:
+ ./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_find_dir_sisupod:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_dir
+gdc_testrun_find_dir_html:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_dir
+gdc_testrun_find_dir_epub:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_dir
+gdc_testrun_find_dir_all:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir
+#+END_SRC
+
+****** file list
+
+#+BEGIN_SRC makefile :tangle makefile
+gdc_testrun_filelist_dir_source:
+ ./bin/sdp-gdc -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_sisupod:
+ ./bin/sdp-gdc -v --sisupod \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_html:
+ ./bin/sdp-gdc -v --html \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_epub:
+ ./bin/sdp-gdc -v --epub \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+gdc_testrun_filelist_dir_all:
+ ./bin/sdp-gdc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+#+END_SRC
+
+***** ldc
+****** find files
+
+#+BEGIN_SRC makefile :tangle makefile
+ldc_testrun_find_dir_source:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_sisupod:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_html:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_epub:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_dir
+ldc_testrun_find_dir_all:
+ $(SiSU_MARKUP_SAMPLES_DIR_SDL_FILES_FOUND) \
+./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir
+#+END_SRC
+
+****** file list
+
+#+BEGIN_SRC makefile :tangle makefile
+ldc_testrun_filelist_dir_source:
+ ./bin/sdp-ldc -v --source \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_sisupod:
+ ./bin/sdp-ldc -v --sisupod \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_html:
+ ./bin/sdp-ldc -v --html \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_epub:
+ ./bin/sdp-ldc -v --epub \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+ldc_testrun_filelist_dir_all:
+ ./bin/sdp-ldc -v --source --html --epub --sqlite-discrete \
+--sqlite-create --sqlite-update \
+--output-dir=tmp/program_output_dir \
+$(SiSU_MARKUP_SAMPLES_DIR_SDL)
+#+END_SRC
+
*** org babel tangle batch process command :tangle:
**** tangle: org babel tangle *.org
@@ -390,6 +822,8 @@ targetPath "./bin"
#sourcePath "./src/sdp"
stringImportPaths "./views"
buildRequirements "allowWarnings"
+dependency "toml" version="~>0.4.0-rc.2"
+dependency "toml:json" version="~>0.4.0-rc.2" # if not possible to parse toml directly go through json
dependency "sdlang-d" version="~>0.10.1"
dependency "d2sqlite3" version="~>0.13.1" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3.html
subconfiguration "d2sqlite3" "all-included"
@@ -638,7 +1072,7 @@ configuration "sdp-ldc-debug" {
buildRequirements "allowWarnings"
buildOptions "verbose" "debugMode" "debugInfo" "optimize"
debugVersions "checkdoc" "summary"
- postGenerateCommands "/usr/bin/notify-send -t 0 'D (debug) executable ready' 'sdp-ldc-debug'"
+ postGenerateCommands "time (./bin/sdp-ldc-debug --source --html --epub -v --output-dir=tmp/program-output data/sisupod/sisu-manual )" "/usr/bin/notify-send -t 0 'D (debug) executable ready' 'sdp-ldc-debug'"
}
#+END_SRC
@@ -859,15 +1293,22 @@ time dub --compiler=gdc -v --force
!*.txt
!*.sst
!conf.sdl
-!sisu_document_make
+!sisupod.manifest
+!sisu_document_make.sdl
+!config_local_site.sdl
+!sisu_document_make.toml
+!config_local_site.toml
!org
!src
!src/*
+!data
+!data/*
!sisudoc
!views
!docs/*.html
!**/
**/.#*
+tmp/**
#!*/
#*~
#\#*
@@ -946,7 +1387,7 @@ dub fetch unit-threaded ?
sdp ~master: /home/ralph/grotto/repo/git.repo/utils/sdp-x/
/home/ralph/.dub/packages/*
-**** TODO build
+**** build
***** call dub directly
#+BEGIN_SRC sh :tangle no
@@ -957,6 +1398,7 @@ dub build -h
time (dub --compiler=ldc2 --config=sdp-ldc --debug=checkdoc --debug=summary --debug=dumpdoc)
time (dub --compiler=ldc2 --config=sdp-ldc --debug=io)
time (dub --compiler=ldc2 --config=sdp-ldc --debug=checkdoc --debug=summary --debug=dumpdoc --debug=io)
+time (dub --compiler=ldc2 --config=sdp-ldc --debug=steps --debug=configsdlang)
time (dub --compiler=ldc2 --config=sdp-ldc-debug --debug=io)
time (dub --compiler=gdc --config=sdp-gdc-debug --debug=io)
time (dub --compiler=dmd --config=sdp-dmd-debug --debug=io)
@@ -1036,3 +1478,45 @@ time make tangle ldc
*** project version
echo $(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g')
+
+*** what files changed
+git whatchanged --since="1 day ago" --oneline --name-only --pretty=format: | sort -u
+git log --since="1 day ago" --name-only --pretty=format: | sort -u
+
+** test run
+*** e.g.
+time (./bin/sdp-ldc --source --html -v --output-dir=tmp/program-output data/sdlang/sisupod/sisu-manual/media/text/en/sisu_markup.sst )
+
+time (./bin/sdp-ldc --source --html -v --output-dir=tmp/program-output data/sdlang/sisupod/sisu-manual )
+time (./bin/sdp-ldc --source --html -v --output-dir=tmp/program-output data/sdlang/sisupod/the_wealth_of_networks.yochai_benkler )
+time (./bin/sdp-ldc --source --html -v --output-dir=tmp/program-output data/sdlang/sisupod/live-manual )
+
+time (~sdp2/bin/sdp-ldc --sisupod --source --html --epub --sqlite-create --sqlite-update -v sisudoc/media/text/en/sisu_markup_stress_test.sst sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst )
+
+can point to directory containing sisudoc.txt file (listing which files to process)
+
+time (~sdp2/bin/sdp-ldc --html -v sisudoc)
+# will process source files listed in sisudoc.txt for appropriate files and dir structure
+
+e.g. live-manual a multilingual document (with source file inserts .ssi)
+
+time (~sdp2/bin/sdp-ldc --html --lang=en,es -v sisudoc)
+
+time ( find data/sdlang/sisupod -name sisupod.manifest | sort | xargs ./bin/sdp-ldc --source --html --epub -v --output-dir=tmp/program-output )
+
+time ( find data/sdlang/sisupod -maxdepth 2 -name sisupod.manifest | sort | xargs ./bin/sdp-ldc --source --html --epub -v --output-dir=tmp/program-output )
+time ( find data/sdlang/sisudir/media/text -name *.ss[tm] | sort | xargs ./bin/sdp-ldc --source --html --epub -v --output-dir=tmp/program-output )
+
+find data/sdlang/sisupod -maxdepth 2 -name sisupod.manifest | sort | xargs
+
+find data/sdlang/sisudir/media/text -name *.ss[tm] | sort | xargs
+
+*** list markup files
+find data/sdlang/sisupod -name sisupod.manifest | sort
+find data/sdlang/sisudir/media/text -name *.ss[tm] | sort
+
+time make ldc_testrun_paths_pod_sisupod
+time make ldc_testrun_paths_pod_sisupod | ag "^\".+\"|NOT found"
+time make ldc_testrun_find_pod_sisupod
+time make ldc_testrun_find_dir_sisupod
+time make ldc_testrun_filelist_dir_sisupod
diff --git a/org/default_misc.org b/org/default_misc.org
index 9129db2..2fcef58 100644
--- a/org/default_misc.org
+++ b/org/default_misc.org
@@ -24,10 +24,6 @@
default settings
+/
module sdp.meta.defaults;
-template SiSUregisters() {
- <<meta_defaults_imports>>
- <<meta_defaults_template_registers>>
-}
<<meta_defaults_template_init_flags>>
<<meta_defaults_template_node>>
<<meta_defaults_template_biblio>>
@@ -35,377 +31,6 @@ template SiSUregisters() {
<<defaults_template_language_codes>>
#+END_SRC
-** imports
-
-#+name: meta_defaults_imports
-#+BEGIN_SRC d
-import
- std.algorithm,
- std.array,
- std.container,
- std.exception,
- std.file,
- std.getopt,
- std.json,
- std.path,
- std.process,
- std.range,
- std.regex,
- std.stdio,
- std.string,
- std.traits,
- std.typecons,
- std.uni,
- std.utf,
- std.conv : to;
-#+END_SRC
-
-** struct ConfComposite
-
-#+name: meta_defaults_template_registers
-#+BEGIN_SRC d
-struct ConfCompositeMake {
- string bold = "";
- string breaks = "";
- string cover_image = "";
- string css = "";
- string emphasis = "";
- string footer = "";
- string headings = "";
- string home_button_image = "";
- string home_button_text = "";
- string italics = "";
- string num_top = "";
- string num_depth = "";
- string substitute = "";
- string texpdf_font = "";
-}
-struct ConfCompositeMakeStr {
- string bold = "";
- string breaks = "";
- string cover_image = "";
- string css = "";
- string emphasis = "";
- string footer = "";
- string headings = "";
- string home_button_image = "";
- string home_button_text = "";
- string italics = "";
- string num_top = "";
- string num_depth = "";
- string substitute = "";
- string texpdf_font = "";
-}
-struct ConfCompositeSiteLocal {
- string webserv_url_root = "";
- string webserv_path = "";
- string webserv_images = "";
- string webserv_cgi = "";
- string webserv_cgi_host = "";
- string webserv_cgi_host_path = "";
- string webserv_cgi_port = "";
- string webserv_cgi_user = "";
- string webserv_cgi_file_links = "";
- string processing_path = "";
- string processing_dir = "";
- string processing_concord_max = "";
- string flag_act0 = "";
- string flag_act1 = "";
- string flag_act2 = "";
- string flag_act3 = "";
- string flag_act4 = "";
- string flag_act5 = "";
- string flag_act6 = "";
- string flag_act7 = "";
- string flag_act8 = "";
- string flag_act9 = "";
- string default_papersize = "";
- string default_text_wrap = "";
- string default_emphasis = "";
- string default_language = "";
- string default_digest = "";
- string permission_share_source = "";
- string search_flag = "";
- string search_action = "";
- string search_db = "";
- string search_title = "";
-}
-struct MetaComposite {
- string classify_dewey = "";
- string classify_keywords = "";
- string classify_loc = "";
- string classify_subject = "";
- string classify_topic_register = "";
- string creator_author = "";
- string creator_author_email = "";
- string creator_illustrator = "";
- string creator_translator = "";
- string date_added_to_site = "";
- string date_available = "";
- string date_created = "";
- string date_issued = "";
- string date_modified = "";
- string date_published = "";
- string date_valid = "";
- string identifier_isbn = "";
- string identifier_oclc = "";
- string identifier_pg = "";
- string language_document = "";
- string language_document_char = "";
- string links = "";
- string notes_abstract = "";
- string notes_description = "";
- string original_language = "";
- string original_language_char = "";
- string original_publisher = "";
- string original_source = "";
- string original_title = "";
- string publisher = "";
- string rights_copyright = "";
- string rights_copyright_audio = "";
- string rights_copyright_cover = "";
- string rights_copyright_illustrations = "";
- string rights_copyright_photographs = "";
- string rights_copyright_text = "";
- string rights_copyright_translation = "";
- string rights_copyright_video = "";
- string rights_license = "";
- string title_edition = "";
- string title_full = "";
- string title_language = "";
- string title_main = "";
- string title_note = "";
- string title_short = "";
- string title_sub = "";
- string title_subtitle = "";
-}
-struct ConfComposite {
- MetaComposite meta;
- ConfCompositeMake make;
- ConfCompositeSiteLocal conf;
-}
-struct ConfCompositePlus {
- MetaComposite meta;
- ConfCompositeMake make;
- ConfCompositeMakeStr make_str;
- ConfCompositeSiteLocal conf;
-}
-#+END_SRC
-
-** extractSDLangTabOrAttrib
-
-#+name: meta_defaults_template_registers
-#+BEGIN_SRC d
-string extractSDLangTabOrAttrib(S)(S conf_sdlang, string maintab, string atab) {
- string _conf_composite_string = "";
- if (maintab in conf_sdlang.maybe.tags) {
- auto _maintag = conf_sdlang.getTag(maintab);
- if ((atab in _maintag.maybe.tags)
- && (_maintag.getTagValues(atab).length > 0)) {
- debug(configsdlang) {
- writeln(__LINE__, ": make:", atab, ": ", _maintag.getTagValues(atab)[0]);
- }
- if (_maintag.getTagValues(atab).length == 1) {
- writeln((_maintag.getTagValues(atab)[0]).to!string);
- _conf_composite_string = (_maintag.getTagValues(atab)[0]).to!string;
- } else if (_maintag.getTagValues(atab).length > 1) {
- string _tmp = "";
- foreach (st; _maintag.getTagValues(atab)) {
- writeln(st.to!string, ";");
- _tmp ~= st.to!string ~ ";";
- }
- _conf_composite_string = _tmp;
- }
- } else if ((atab in _maintag.maybe.attributes)
- && (_maintag.maybe.attributes[atab][0].value.length > 0)) {
- debug(configsdlang) {
- writeln(__LINE__, ": make:", atab, ": ", conf_sdlang.tags[maintag][0].attributes[atab][0].value);
- }
- _conf_composite_string = (_maintag.attributes[atab][0].value).to!string;
- }
- }
- return _conf_composite_string;
-}
-#+END_SRC
-
-** metadata associative array indexes :header:
-
-#+name: meta_defaults_template_registers
-#+BEGIN_SRC d
-static auto ptr_head_main
- = [
- "classify",
- "creator",
- "date",
- "identifier",
- "links",
- "make",
- "original",
- "notes",
- "rights",
- "title"
- ];
-static auto ptr_head_sub_classify
- = [
- "dewey",
- "keywords",
- "loc",
- "subject",
- "topic_register"
- ];
-static auto ptr_head_sub_creator
- = [
- "author",
- "author_email",
- "cover",
- "illustrator",
- "translator"
- ];
-static auto ptr_head_sub_date
- = [
- "added_to_site",
- "available",
- "created",
- "issued",
- "modified",
- "published",
- "valid"
- ];
-static auto ptr_head_sub_identifier
- = [
- "isbn",
- "oclc",
- "pg"
- ];
-/+ make +/
-static auto ptr_head_sub_make
- = [
- "cover_image",
- "home_button_image",
- "home_button_text",
- "footer", "headings",
- "num_top", "num_depth",
- "breaks",
- "substitute",
- "bold",
- "italics",
- "emphasis",
- "texpdf_font",
- "css"
- ];
-static auto ptr_head_sub_notes
- = [
- "abstract",
- "description"
- ];
-static auto ptr_head_sub_original
- = [
- "language",
- "source",
- "title"
- ];
-static auto ptr_head_sub_publisher
- = [ "name" ];
-static auto ptr_head_sub_rights
- = [
- "copyright",
- "cover",
- "illustrations",
- "license"
- ];
-static auto ptr_head_sub_title
- = [
- "edition",
- "full",
- "language",
- "main",
- "note",
- "sub"
- ];
-auto config_jsonstr = `{
-}`;
-#+END_SRC
-
-*** notes headers
-
-#+name: meta_defaults_template
-#+BEGIN_SRC d
-/+
- /+
- unify internal representation of header info for native & sdlang document headers
- represent either using struct, hashes or possibly json
- sdp internal representation should be identical for native & sdlang variants
- +/
-header.
- ├── make // make instructions
- │   ├── bold
- │   ├── breaks
- │   ├── cover_image
- │   ├── css
- │   ├── emphasis
- │   ├── footer
- │   ├── headings
- │   ├── home_button_image
- │   ├── home_button_text
- │   ├── italics
- │   ├── num_top
- │   ├── substitute
- │   └── texpdf_font
- └── meta // metadata
-    ├── author // move author to creator:author
-    ├── classify
-    │   ├── dewey
-    │   ├── keyword
-    │   ├── loc
-    │   ├── subject
-    │   └── topic_register
-    ├── creator
-    │   ├── author
- │ │ ├── [ [first_name: x0, last_name: y0], [first_name: x1, last_name: y1] ]
- │ │ └── [ full_name0, full_name1 ]
-    │   ├── author_email
-    │   ├── illustrator
-    │   └── translator
-    ├── date
-    │   ├── added_to_site
-    │   ├── available
-    │   ├── created
-    │   ├── issued
-    │   ├── modified
-    │   ├── published
-    │   └── valid
-    ├── identifier
-    │   ├── isbn
-    │   ├── oclc
-    │   └── pg
-    ├── links
-    ├── notes
-    │   ├── abstract
-    │   └── description
-    ├── original
-    │   ├── language
-    │   ├── source
-    │   └── title
-    ├── publisher
-    │   └── name
-    ├── rights
-    │   ├── copyright
-    │   ├── cover
-    │   ├── illustrations
-    │   └── license
-    └── title // move title: to title:main
-    ├── edition
-    ├── [ full (main + sub) ]
-    ├── language
-    ├── main
-    ├── note
-    ├── sub
-    └── subtitle // move title:subtitle to title:sub
-
-61 leaves
-+/
-#+END_SRC
-
** template: flags regex initialize :regex_flags:
#+name: meta_defaults_template_init_flags
diff --git a/org/default_paths.org b/org/default_paths.org
index 5334a78..914703c 100644
--- a/org/default_paths.org
+++ b/org/default_paths.org
@@ -60,9 +60,15 @@ template PodManifest() {
&& (_pth.chainPath(pod_manifest_filename).array).isFile)) {
_manifest_path = _pth;
} else if (_pth.match(rgx.src_pth_contents)
- && exists(_pth)!=0 && _pth.isDir && (_pth.isFile)) {
+ && exists(_pth)!=0 && _pth.isDir) {
_manifest_path = dirName(_pth);
+ } else if (_pth.match(rgx.src_pth_pod_sst_or_ssm)
+ && exists(_pth)!=0 && (_pth.isFile)) {
+ if (auto m = _pth.match(rgx.src_pth_pod_sst_or_ssm)) {
+ _manifest_path = m.captures["podpath"];
+ }
} else {
+ writeln("WARNING, issue with manifest_path: ", _pth);
_manifest_path = _pth; // _manifest_path = null;
}
return _manifest_path;
@@ -86,7 +92,23 @@ template PodManifest() {
}
#+END_SRC
-** _manifest and source files_ :manifest:
+** _path matters (pod, manifest and source files)_ :manifest:
+
+tree sisupod
+sisupod
+└─ [sisudoc filename]
+ ├── conf
+ │   └── sisu_document_make
+ ├── media
+ │   ├── audio
+ │   ├── image
+ │   ├── text
+ │   │ └── en
+ │   │ ...
+ │  │  ├── [conf]
+ │   │ └── [image]
+ │   └── video
+ └── sisupod.manifest
#+name: template_paths_src
#+BEGIN_SRC d
@@ -131,6 +153,15 @@ template PathMatters() {
auto _src_is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false;
return _src_is_pod;
}
+ auto collection_root() {
+ auto _collection_root = asNormalizedPath(chainPath(_manifest.pod_manifest_path, "..")).array;
+ if (auto m = (_collection_root).match(rgx.src_pth_pod_root)) {
+ // consider testing for last dir in path name being sisupod, and giving warning if not
+ } else {
+ writeln("WARNING, collection_root not named \"sisupod\"");
+ }
+ return _collection_root;
+ }
auto manifest_filename() {
return _manifest.pod_manifest_filename;
}
@@ -140,7 +171,11 @@ template PathMatters() {
auto manifest_file_with_path() {
return _manifest.pod_manifest_file_with_path;
}
- auto config_dirs() { // TODO
+ auto config_sisu_document_make_dirs() { // TODO sisu_document_make
+ string[] _config_dirs;
+ return _config_dirs;
+ }
+ auto config_local_site_dirs() { // TODO sisu_document_make
string[] _config_dirs;
return _config_dirs;
}
@@ -323,7 +358,7 @@ template PathMatters() {
}
#+END_SRC
-** _config_ :config:
+** _config_ (sisu_document_make & config_local_site) :config:
#+name: template_paths_src
#+BEGIN_SRC d
@@ -335,12 +370,21 @@ template ConfigFilePaths() {
E _env,
) {
struct ConfFilePaths {
- auto config_filename_document() {
- return "config_document";
+ auto config_filename_document_sdl() {
+ return "sisu_document_make.sdl";
+ }
+ auto config_filename_site_sdl() {
+ return "config_local_site.sdl";
+ }
+ auto config_filename_document_toml() {
+ return "sisu_document_make.toml";
+ }
+ auto config_filename_site_toml() {
+ return "config_local_site.toml";
}
auto possible_config_path_locations() {
struct _ConfFilePaths {
- auto document() {
+ auto sisu_document_make() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
/+ return paths +/
@@ -383,10 +427,7 @@ template ConfigFilePaths() {
+/
return _possible_config_path_locations;
}
- auto config_filename_site() {
- return "config_local_site";
- }
- auto local_site() {
+ auto config_local_site() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
string _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".sisu")).array;
@@ -395,11 +436,15 @@ template ConfigFilePaths() {
/+ return paths +/
string[] _possible_config_path_locations;
if (_manifest.src.is_pod) {
+ string _collection_root_a = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), ".sisu")).array;
+ string _collection_root_b = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), "_sisu")).array;
_possible_config_path_locations = [
_dot_pwd,
_underscore_pwd,
_dot_home,
- "/etc/sisu"
+ "/etc/sisu",
+ _collection_root_a, // set priority higher?
+ _collection_root_b // set priority higher?
];
} else {
/+ config document (& or local site) on filesystem +/
@@ -1004,7 +1049,7 @@ template SiSUpathsSQLiteDiscrete() {
return fn_src.baseName.stripExtension;
}
string base() {
- return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array;
+ return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array;
}
string seg(string fn_src) {
return asNormalizedPath(base.chainPath(base_filename(fn_src))).array;
diff --git a/org/default_regex.org b/org/default_regex.org
index 1ad8ee5..a5cf084 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -110,6 +110,8 @@ static native_header_meta_title = ctRegex!(`^@title:\s`, "
static variable_doc_title = ctRegex!(`@title`);
static variable_doc_author = ctRegex!(`@author|@creator`);
static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i");
+static sdlang_header_meta_title = ctRegex!(`^\s*title\s+["\\]`, "m");
+static toml_header_meta_title = ctRegex!(`^\s*(title\s*=\s*"|\[title\])`, "m");
#+END_SRC
*** subheader :native:subheader:
@@ -313,6 +315,7 @@ static break_page_new = ctRegex!(`^=[\\]{2}=$`);
static break_page_line_across = ctRegex!(`^=[.]{2}=$`);
static break_string = ctRegex!(`』`);
static parent = ctRegex!(`([0-7]):([0-9]+)`);
+static header_regex_content = ctRegex!(`([0-7]):([0-9]+)`);
#+END_SRC
** json :json:
@@ -412,7 +415,9 @@ static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg")
#+name: prgmkup_rgx
#+BEGIN_SRC d
static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
+static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+)/sisupod[.]manifest$`);
+static src_pth_pod_root = ctRegex!(`^(?P<podroot>(?:[/]?(?:[a-zA-Z0-9._-]+/)*)(sisupod))$`);
static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`);
static src_pth_unzip_pod = ctRegex!(`^(?P<path>media/text/[a-z]{2}/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
static src_pth_types =
@@ -427,7 +432,8 @@ static src_fn_insert = ctRegex!(`^(?P<path>[a-z
static src_fn_find_inserts = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`);
static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
-static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalized dir structure
+static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
+static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
#+END_SRC
** inline markup
@@ -492,6 +498,7 @@ static inline_bold_line = ctRegex!(`^!_ (?P<text>.
static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg");
+static no_header_rgx = ctRegex!(`^=NULL$`);
#+END_SRC
*** table related
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index b1464b5..aa79d9a 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -1907,7 +1907,8 @@ if (the_table_of_contents_section["scroll"].length > 1) {
segnames_0_4 ~= obj.segment_anchor_tag;
if (obj.heading_lev_markup == 4) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1936,7 +1937,8 @@ if (the_table_of_contents_section["scroll"].length > 1) {
segnames_0_4 ~= obj.segment_anchor_tag;
if (obj.heading_lev_markup == 4) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
if ((opt_action.html)
@@ -1971,7 +1973,8 @@ if (the_document_body_section.length > 1) {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -2019,7 +2022,8 @@ if (the_endnotes_section.length > 1) {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -2060,7 +2064,8 @@ if (the_glossary_section.length > 1) {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -2105,7 +2110,8 @@ if (the_bibliography_section.length > 1) {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -2155,7 +2161,8 @@ if (the_bookindex_section["scroll"].length > 1) {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -2194,7 +2201,8 @@ if (the_bookindex_section["scroll"].length > 1) {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -2243,7 +2251,8 @@ if (the_blurb_section.length > 1) {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -3784,7 +3793,7 @@ void _block_flag_line_empty_(B,N,CMM)(
comp_obj_block = comp_obj_block.init;
obj_cite_digits = ocn_emit(OCNstatus.on);
an_object["bookindex_nugget"]
- =("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
+ = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes
= bookindex_extract_hash.bookindex_nugget_hash(
an_object["bookindex_nugget"],
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 1494410..91c9d11 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -1,4 +1,4 @@
-#+TITLE: sdp header extract
+#+TITLE: sdp config & header (make & meta) extract
#+AUTHOR: Ralph Amissah
#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
#+DESCRIPTION: documents - structuring, publishing in multiple formats & search
@@ -15,10 +15,875 @@
#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)
[[./sdp.org][sdp]] [[./][org/]]
-* 0. header extract (native & sdlang) to Struct :module:sdp:meta_conf_make_meta:
-** module template
+* 0. generic
+** imports
-#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta.d
+#+name: meta_defaults_imports
+#+BEGIN_SRC d
+import
+ std.algorithm,
+ std.array,
+ std.container,
+ std.exception,
+ std.file,
+ std.getopt,
+ std.json,
+ std.path,
+ std.process,
+ std.range,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.uni,
+ std.utf,
+ std.conv : to;
+import sdp.meta.conf_make_meta_structs;
+#+END_SRC
+
+** struct ConfComposite
+
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_structs.d
+module sdp.meta.conf_make_meta_structs;
+import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+<<meta_defaults_template_structs>>
+#+END_SRC
+
+** struct Generic ConfComposite
+
+#+name: meta_defaults_template_structs
+#+BEGIN_SRC d
+struct ConfCompositeMakeStr {
+ string bold = "";
+ string breaks = "";
+ string cover_image = "";
+ string css = "";
+ string emphasis = "";
+ string footer = "";
+ string headings = "";
+ string home_button_image = "";
+ string home_button_text = "";
+ string italics = "";
+ string num_top = "";
+ string num_depth = "";
+ string substitute = "";
+ string texpdf_font = "";
+}
+struct confCompositeMakeBuild {
+ auto bold_rgxmatch(string _mk) {
+ auto _rgxtxt = (_mk.empty)
+ ? `=NULL`
+ : `(` ~ _mk.dup ~ `)`;
+ return (cast(char[]) (_rgxtxt));
+ }
+ auto bold_substitute_abstract() {
+ return "<b>$1</b>";
+ }
+ auto bold_substitute_html() {
+ return "<b>$1</b>";
+ }
+ auto breaks(string _mk) {
+ return _mk;
+ }
+ auto cover_image(string _mk) {
+ return _mk;
+ }
+ auto css(string _mk) {
+ return _mk;
+ }
+ auto emphasis_rgxmatch(string _mk) {
+ auto _rgxtxt = (_mk.empty)
+ ? `=NULL`
+ : `(` ~ _mk.dup ~ `)`;
+ return (cast(char[]) (_rgxtxt));
+ }
+ auto emphasis_substitute_abstract() {
+ return "<em>$1</em>";
+ }
+ auto emphasis_substitute_html() {
+ return "<em>$1</em>";
+ }
+ auto footer(string _mk) {
+ return _mk;
+ }
+ auto headings(string _mk) {
+ return _mk;
+ }
+ auto home_button_image(string _mk) {
+ return _mk;
+ }
+ auto home_button_text(string _mk) {
+ return _mk;
+ }
+ auto italics_rgxmatch(string _mk) {
+ auto _rgxtxt = (_mk.empty)
+ ? `=NULL`
+ : `(` ~ _mk.dup ~ `)`;
+ return (cast(char[]) (_rgxtxt));
+ }
+ auto italics_substitute_abstract() {
+ return "<i>$1</i>";
+ }
+ auto italics_substitute_html() {
+ return "<i>$1</i>";
+ }
+ auto num_top(string _mk) {
+ return _mk;
+ }
+ auto num_depth(string _mk) {
+ return _mk;
+ }
+ auto substitute(string _mk) { // TODO this is different from others
+ return regex(_mk);
+ }
+ auto texpdf_font(string _mk) {
+ return _mk;
+ }
+}
+#+END_SRC
+
+** initialize make & meta
+*** composite make
+
+#+name: meta_defaults_template_structs
+#+BEGIN_SRC d
+struct ConfCompositeMakeInit {
+ char[] bold_rgxmatch = `=NULL`.dup;
+ auto bold_substitute_abstract = "<b>$1</b>";
+ auto bold_substitute_html = "<b>$1</b>";
+ string breaks = "";
+ string cover_image = "";
+ string css = "";
+ char[] emphasis_rgxmatch = `=NULL`.dup;
+ auto emphasis_substitute_abstract = "<em>$1</em>";
+ auto emphasis_substitute_html = "<em>$1</em>";
+ string footer = "";
+ string headings = "";
+ string home_button_image = "";
+ string home_button_text = "";
+ char[] italics_rgxmatch = `=NULL`.dup;
+ auto italics_substitute_abstract = "<i>$1</i>";
+ auto italics_substitute_html = "<i>$1</i>";
+ string num_top = "";
+ string num_depth = "";
+ auto substitute = regex(""); // TODO
+ string texpdf_font = "";
+}
+#+END_SRC
+
+*** conf site local
+
+#+name: meta_defaults_template_structs
+#+BEGIN_SRC d
+struct ConfCompositeSiteLocal {
+ string webserv_url_root = "";
+ string webserv_path = "";
+ string webserv_images = "";
+ string webserv_cgi = "";
+ string webserv_cgi_host = "";
+ string webserv_cgi_host_path = "";
+ string webserv_cgi_port = "";
+ string webserv_cgi_user = "";
+ string webserv_cgi_file_links = "";
+ string processing_path = "";
+ string processing_dir = "";
+ string processing_concord_max = "";
+ string flag_act0 = "";
+ string flag_act1 = "";
+ string flag_act2 = "";
+ string flag_act3 = "";
+ string flag_act4 = "";
+ string flag_act5 = "";
+ string flag_act6 = "";
+ string flag_act7 = "";
+ string flag_act8 = "";
+ string flag_act9 = "";
+ string default_papersize = "";
+ string default_text_wrap = "";
+ string default_emphasis = "";
+ string default_language = "";
+ string default_digest = "";
+ string permission_share_source = "";
+ string search_flag = "";
+ string search_action = "";
+ string search_db = "";
+ string search_title = "";
+}
+#+END_SRC
+
+*** composite meta
+
+#+name: meta_defaults_template_structs
+#+BEGIN_SRC d
+struct MetaComposite {
+ string classify_dewey = "";
+ string classify_keywords = "";
+ string classify_loc = "";
+ string classify_subject = "";
+ string classify_topic_register = "";
+ string creator_author = "";
+ string creator_author_email = "";
+ string creator_illustrator = "";
+ string creator_translator = "";
+ string date_added_to_site = "";
+ string date_available = "";
+ string date_created = "";
+ string date_issued = "";
+ string date_modified = "";
+ string date_published = "";
+ string date_valid = "";
+ string identifier_isbn = "";
+ string identifier_oclc = "";
+ string identifier_pg = "";
+ string language_document = "";
+ string language_document_char = "";
+ string links = "";
+ string notes_abstract = "";
+ string notes_description = "";
+ string original_language = "";
+ string original_language_char = "";
+ string original_publisher = "";
+ string original_source = "";
+ string original_title = "";
+ string publisher = "";
+ string rights_copyright = "";
+ string rights_copyright_audio = "";
+ string rights_copyright_cover = "";
+ string rights_copyright_illustrations = "";
+ string rights_copyright_photographs = "";
+ string rights_copyright_text = "";
+ string rights_copyright_translation = "";
+ string rights_copyright_video = "";
+ string rights_license = "";
+ string title_edition = "";
+ string title_full = "";
+ string title_language = "";
+ string title_main = "";
+ string title_note = "";
+ string title_short = "";
+ string title_sub = "";
+ string title_subtitle = "";
+}
+#+END_SRC
+
+*** composite structs
+
+#+name: meta_defaults_template_structs
+#+BEGIN_SRC d
+struct ConfComposite {
+ MetaComposite meta;
+ ConfCompositeMakeInit make;
+ ConfCompositeSiteLocal conf;
+}
+struct ConfCompositePlus {
+ MetaComposite meta;
+ ConfCompositeMakeInit make;
+ ConfCompositeMakeStr make_str;
+ ConfCompositeSiteLocal conf;
+}
+#+END_SRC
+
+*** metadata associative array indexes :header:
+
+#+name: meta_defaults_template_structs
+#+BEGIN_SRC d
+static auto ptr_head_main
+ = [
+ "classify",
+ "creator",
+ "date",
+ "identifier",
+ "links",
+ "make",
+ "original",
+ "notes",
+ "rights",
+ "title"
+ ];
+static auto ptr_head_sub_classify
+ = [
+ "dewey",
+ "keywords",
+ "loc",
+ "subject",
+ "topic_register"
+ ];
+static auto ptr_head_sub_creator
+ = [
+ "author",
+ "author_email",
+ "cover",
+ "illustrator",
+ "translator"
+ ];
+static auto ptr_head_sub_date
+ = [
+ "added_to_site",
+ "available",
+ "created",
+ "issued",
+ "modified",
+ "published",
+ "valid"
+ ];
+static auto ptr_head_sub_identifier
+ = [
+ "isbn",
+ "oclc",
+ "pg"
+ ];
+/+ make +/
+static auto ptr_head_sub_make
+ = [
+ "cover_image",
+ "home_button_image",
+ "home_button_text",
+ "footer", "headings",
+ "num_top", "num_depth",
+ "breaks",
+ "substitute",
+ "bold",
+ "italics",
+ "emphasis",
+ "texpdf_font",
+ "css"
+ ];
+static auto ptr_head_sub_notes
+ = [
+ "abstract",
+ "description"
+ ];
+static auto ptr_head_sub_original
+ = [
+ "language",
+ "source",
+ "title"
+ ];
+static auto ptr_head_sub_publisher
+ = [ "name" ];
+static auto ptr_head_sub_rights
+ = [
+ "copyright",
+ "cover",
+ "illustrations",
+ "license"
+ ];
+static auto ptr_head_sub_title
+ = [
+ "edition",
+ "full",
+ "language",
+ "main",
+ "note",
+ "sub"
+ ];
+auto config_jsonstr = `{
+}`;
+#+END_SRC
+
+* 1. JSON to SiSUstruct
+** 1. module json :module:sdp:meta_conf_make_meta_json:
+*** 0. module template
+
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_json.d
+/++
+ json headers<BR>
+ extract json header return json
++/
+module sdp.meta.conf_make_meta_json;
+static template contentJSONtoSiSUstruct() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import
+ sdp.meta.conf_make_meta_structs,
+ sdp.meta.conf_make_meta_json,
+ sdp.meta.rgx;
+ ConfCompositePlus _struct_composite;
+ auto contentJSONtoSiSUstruct(C, J)(C _struct_composite, J _json, string _identifier) {
+ mixin SiSUrgxInit;
+ static auto _rgx = Rgx();
+ debug (json) {
+ writeln(">> --------------------------- >>");
+ foreach (tag0; _json.object.byKeyValue) {
+ if (tag0.value.stringof == "string") {
+ writeln(tag0.key, ": ", tag0.value);
+ } else {
+ // writeln(tag0.key, ":");
+ foreach (tag1; tag0.value.object.byKeyValue) {
+ writeln(tag0.key, ":", tag1.key, ": ", tag1.value);
+ }
+ }
+ }
+ writeln("<< --------------------------- <<");
+ }
+ confCompositeMakeBuild _mk;
+ <<json_objects>>
+ return _struct_composite;
+ }
+}
+#+END_SRC
+
+*** make
+
+#+name: json_objects
+#+BEGIN_SRC d
+/+ make ------------------------------------------------------------------- +/
+if ("make" in _json.object) {
+ if ("bold" in _json.object["make"]) {
+ _struct_composite.make_str.bold = _json.object["make"]["bold"].str;
+ }
+ if ("breaks" in _json.object["make"]) {
+ _struct_composite.make_str.breaks = _json.object["make"]["breaks"].str;
+ }
+ if ("cover_image" in _json.object["make"]) {
+ _struct_composite.make_str.cover_image = _json.object["make"]["cover_image"].str;
+ }
+ if ("css" in _json.object["make"]) {
+ _struct_composite.make_str.css = _json.object["make"]["css"].str;
+ }
+ if ("emphasis" in _json.object["make"]) {
+ _struct_composite.make_str.emphasis = _json.object["make"]["emphasis"].str;
+ }
+ if ("footer" in _json.object["make"]) {
+ _struct_composite.make_str.footer = _json.object["make"]["footer"].str;
+ }
+ if ("headings" in _json.object["make"]) {
+ _struct_composite.make_str.headings = _json.object["make"]["headings"].str;
+ }
+ if ("home_button_image" in _json.object["make"]) {
+ _struct_composite.make_str.home_button_image = _json.object["make"]["home_button_image"].str;
+ }
+ if ("home_button_text" in _json.object["make"]) {
+ _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str;
+ }
+ if ("italics" in _json.object["make"]) {
+ _struct_composite.make_str.italics = _json.object["make"]["italics"].str;
+ }
+ if ("num_top" in _json.object["make"]) {
+ _struct_composite.make_str.num_top = _json.object["make"]["num_top"].str;
+ }
+ if ("num_depth" in _json.object["make"]) {
+ _struct_composite.make_str.num_depth = _json.object["num_depth"][""].str;
+ }
+ if ("substitute" in _json.object["make"]) {
+ _struct_composite.make_str.substitute = _json.object["make"]["substitute"].str;
+ }
+ if ("texpdf_font" in _json.object["make"]) {
+ _struct_composite.make_str.texpdf_font = _json.object["make"]["texpdf_font"].str;
+ }
+ _struct_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_struct_composite.make_str.bold);
+ _struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks);
+ _struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image);
+ _struct_composite.make.css = _mk.css(_struct_composite.make_str.css);
+ _struct_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_struct_composite.make_str.emphasis);
+ _struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer);
+ _struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings);
+ _struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image);
+ _struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text);
+ _struct_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_struct_composite.make_str.italics);
+ _struct_composite.make.num_top = _mk.num_top(_struct_composite.make_str.num_top);
+ _struct_composite.make.num_depth = _mk.num_depth(_struct_composite.make_str.num_depth);
+ _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute);
+ _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font);
+}
+#+END_SRC
+
+*** conf
+
+#+name: json_objects
+#+BEGIN_SRC d
+/+ conf ------------------------------------------------------------------- +/
+if ("webserv" in _json.object) {
+ if ("url_root" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_url_root = _json.object["webserv"]["url_root"].str;
+ }
+ if ("path" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_path = _json.object["webserv"]["path"].str;
+ }
+ if ("images" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_images = _json.object["webserv"]["images"].str;
+ }
+ if ("cgi" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi = _json.object["webserv"]["cgi"].str;
+ }
+ if ("cgi_host" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_host = _json.object["webserv"]["cgi_host"].str;
+ }
+ if ("cgi_host_path" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_host_path = _json.object["webserv"]["cgi_host_path"].str;
+ }
+ if ("cgi_port" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_port = _json.object["webserv"]["cgi_port"].str;
+ }
+ if ("cgi_user" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_user = _json.object["webserv"]["cgi_user"].str;
+ }
+ if ("cgi_file_links" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_file_links = _json.object["webserv"]["cgi_file_links"].str;
+ }
+}
+if ("processing" in _json.object) { // TODO check & match logic with sdlang
+ if ("path" in _json.object["processing"]) {
+ _struct_composite.conf.processing_path = _json.object["processing"]["path"].str;
+ }
+ if ("dir" in _json.object["processing"]) {
+ _struct_composite.conf.processing_dir = _json.object["processing"]["dir"].str;
+ }
+ if ("concord_max" in _json.object["processing"]) {
+ _struct_composite.conf.processing_concord_max = _json.object["processing"]["concord_max"].str;
+ }
+}
+if ("flag" in _json.object) {
+ if ("act0" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act0 = _json.object["flag"]["act0"].str;
+ }
+ if ("act1" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act1 = _json.object["flag"]["act1"].str;
+ }
+ if ("act2" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act2 = _json.object["flag"]["act2"].str;
+ }
+ if ("act3" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act3 = _json.object["flag"]["act3"].str;
+ }
+ if ("act4" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act4 = _json.object["flag"]["act4"].str;
+ }
+ if ("act5" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act5 = _json.object["flag"]["act5"].str;
+ }
+ if ("act6" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act6 = _json.object["flag"]["act6"].str;
+ }
+ if ("act7" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act7 = _json.object["flag"]["act7"].str;
+ }
+ if ("act8" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act8 = _json.object["flag"]["act8"].str;
+ }
+ if ("act9" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act9 = _json.object["flag"]["act9"].str;
+ }
+}
+if ("default" in _json.object) {
+ if ("papersize" in _json.object["default"]) {
+ _struct_composite.conf.default_papersize = _json.object["default"]["papersize"].str;
+ }
+ if ("text_wrap" in _json.object["default"]) {
+ _struct_composite.conf.default_text_wrap = _json.object["default"]["text_wrap"].str;
+ }
+ if ("emphasis" in _json.object["default"]) {
+ _struct_composite.conf.default_emphasis = _json.object["default"]["emphasis"].str;
+ }
+ if ("language" in _json.object["default"]) {
+ _struct_composite.conf.default_language = _json.object["default"]["language"].str;
+ }
+ if ("digest" in _json.object["default"]) {
+ _struct_composite.conf.default_digest = _json.object["default"]["digest"].str;
+ }
+}
+if ("search" in _json.object) {
+ if ("flag" in _json.object["search"]) {
+ _struct_composite.conf.search_flag = _json.object["search"]["flag"].str;
+ }
+ if ("action" in _json.object["search"]) {
+ _struct_composite.conf.search_action = _json.object["search"]["action"].str;
+ }
+ if ("db" in _json.object["search"]) {
+ _struct_composite.conf.search_db = _json.object["search"]["db"].str;
+ }
+ if ("title" in _json.object["search"]) {
+ _struct_composite.conf.search_title = _json.object["search"]["title"].str;
+ }
+}
+#+END_SRC
+
+*** meta
+
+#+name: json_objects
+#+BEGIN_SRC d
+/+ meta ------------------------------------------------------------------- +/
+if ("classify" in _json.object) {
+ if ("dewey" in _json.object["classify"]) {
+ _struct_composite.meta.classify_dewey = _json.object["classify"]["dewey"].str;
+ }
+ if ("keywords" in _json.object["classify"]) {
+ _struct_composite.meta.classify_keywords = _json.object["classify"]["keywords"].str;
+ }
+ if ("loc" in _json.object["classify"]) {
+ _struct_composite.meta.classify_loc = _json.object["classify"]["loc"].str;
+ }
+ if ("subject" in _json.object["classify"]) {
+ _struct_composite.meta.classify_subject = _json.object["classify"]["subject"].str;
+ }
+ if ("topic_register" in _json.object["classify"]) {
+ _struct_composite.meta.classify_topic_register = _json.object["classify"]["topic_register"].str;
+ }
+}
+if ("date" in _json.object) {
+ if ("added_to_site" in _json.object["date"]) {
+ _struct_composite.meta.date_added_to_site = _json.object["date"]["added_to_site"].str;
+ }
+ if ("available" in _json.object["date"]) {
+ _struct_composite.meta.date_available = _json.object["date"]["available"].str;
+ }
+ if ("created" in _json.object["date"]) {
+ _struct_composite.meta.date_created = _json.object["date"]["created"].str;
+ }
+ if ("issued" in _json.object["date"]) {
+ _struct_composite.meta.date_issued = _json.object["date"]["issued"].str;
+ }
+ if ("modified" in _json.object["date"]) {
+ _struct_composite.meta.date_modified = _json.object["date"]["modified"].str;
+ }
+ if ("published" in _json.object["date"]) {
+ _struct_composite.meta.date_published = _json.object["date"]["published"].str;
+ }
+ if ("valid" in _json.object["date"]) {
+ _struct_composite.meta.date_valid = _json.object["date"]["valid"].str;
+ }
+}
+if ("links" in _json.object) {
+ // if ("" in _json.object["links"]) {
+ // _struct_composite.meta.links_ = _json.object["links"][""].str;
+ // }
+}
+if ("notes" in _json.object) {
+ if ("abstract" in _json.object["notes"]) {
+ _struct_composite.meta.notes_abstract = _json.object["notes"]["abstract"].str;
+ }
+ if ("description" in _json.object["notes"]) {
+ _struct_composite.meta.notes_description = _json.object["notes"]["description"].str;
+ }
+}
+if ("original" in _json.object) {
+ if ("language" in _json.object["original"]) {
+ _struct_composite.meta.original_language = _json.object["original"]["language"].str;
+ }
+ if ("language_char" in _json.object["original"]) {
+ _struct_composite.meta.original_language_char = _json.object["original"]["language_char"].str;
+ }
+ if ("source" in _json.object["original"]) {
+ _struct_composite.meta.original_source = _json.object["original"]["source"].str;
+ }
+ if ("title" in _json.object["original"]) {
+ _struct_composite.meta.original_title = _json.object["original"]["title"].str;
+ }
+}
+if ("publisher" in _json.object) {
+ // if ("" in _json.object["publisher"]) {
+ // _struct_composite.meta.publisher = _json.object["publisher"][""].str;
+ // }
+}
+if ("rights" in _json.object) {
+ if ("copyright" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright = _json.object["rights"]["copyright"].str;
+ }
+ if ("copyright_text" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_text = _json.object["rights"]["copyright_text"].str;
+ }
+ if ("copyright_audio" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_audio = _json.object["rights"]["copyright_audio"].str;
+ }
+ if ("copyright_cover" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_cover = _json.object["rights"]["copyright_cover"].str;
+ }
+ if ("copyright_illustrations" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_illustrations = _json.object["rights"]["copyright_illustrations"].str;
+ }
+ if ("copyright_photographs" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_photographs = _json.object["rights"]["copyright_photographs"].str;
+ }
+ if ("copyright_translation" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_translation = _json.object["rights"]["copyright_translation"].str;
+ }
+ if ("copyright_video" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_video = _json.object["rights"]["copyright_video"].str;
+ }
+ if ("license" in _json.object["rights"]) {
+ _struct_composite.meta.rights_license = _json.object["rights"]["license"].str;
+ }
+}
+if (_struct_composite.meta.creator_author.empty) {
+ if ("creator" in _json.object) {
+ if ("author" in _json.object["creator"]) {
+ _struct_composite.meta.creator_author = _json.object["creator"]["author"].str;
+ }
+ if ("email" in _json.object["creator"]) {
+ _struct_composite.meta.creator_author_email = _json.object["creator"]["email"].str;
+ }
+ if ("illustrator" in _json.object["creator"]) {
+ _struct_composite.meta.creator_illustrator = _json.object["creator"]["illustrator"].str;
+ }
+ if ("translator" in _json.object["creator"]) {
+ _struct_composite.meta.creator_translator = _json.object["creator"]["translator"].str;
+ }
+ }
+ // dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"];
+ string[] authors_arr;
+ auto authors_raw_arr = _struct_composite.meta.creator_author.split(_rgx.arr_delimiter);
+ foreach (author_raw; authors_raw_arr) {
+ authors_arr ~= author_raw.replace(_rgx.raw_author_munge, "$2 $1");
+ }
+ _struct_composite.meta.creator_author = join(authors_arr, ", ").chomp.chomp;
+}
+if (_struct_composite.meta.title_main.empty) {
+ if ("title" in _json.object) {
+ if ((_json.object["title"].type().to!string) == "STRING") {
+ _struct_composite.meta.title_main = _json.object["title"].str;
+ } else {
+ if ("edition" in _json.object["title"]) {
+ _struct_composite.meta.title_edition = _json.object["title"]["edition"].str;
+ }
+ if ("full" in _json.object["title"]) {
+ // _struct_composite.meta.title_full = _json.object["title"]["full"].str;
+ }
+ if ("language" in _json.object["title"]) {
+ _struct_composite.meta.title_language = _json.object["title"]["language"].str;
+ }
+ if ("main" in _json.object["title"]) {
+ _struct_composite.meta.title_main = _json.object["title"]["main"].str;
+ }
+ if ("note" in _json.object["title"]) {
+ _struct_composite.meta.title_note = _json.object["title"]["note"].str;
+ }
+ if ("sub" in _json.object["title"]) {
+ _struct_composite.meta.title_sub = _json.object["title"]["sub"].str;
+ }
+ if ("subtitle" in _json.object["title"]) {
+ _struct_composite.meta.title_subtitle = _json.object["title"]["subtitle"].str;
+ }
+ }
+ }
+ if ((!(_struct_composite.meta.title_subtitle.empty))
+ && (_struct_composite.meta.title_sub.empty)) {
+ _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle;
+ }
+ _struct_composite.meta.title_full = (_struct_composite.meta.title_sub.empty)
+ ? _struct_composite.meta.title_main
+ : format(
+ "%s - %s",
+ _struct_composite.meta.title_main,
+ _struct_composite.meta.title_sub,
+ );
+}
+#+END_SRC
+
+* 2. TOML returns SiSUstruct (via JSON) :module:sdp:meta_conf_make_meta:
+** 0. parse TOML config return JSON
+
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_toml.d
+/++
+ extract native/orig header return associative array<BR>
+
+ the header is passed as text (lopped off top of a sisu markup file until the
+ required first heading ^A~), determine whether is a native header or sdlang one
+ with a regex check if whether it contains the "native header" required tag/field
+ @title: then process accordingly as a "native header" or "sdlang header"
+ converting the metadata and make instructions to a common json format used by
+ program internally. Moved to associative array.
++/
+module sdp.meta.conf_make_meta_toml;
+static template configParseTOMLreturnJSON() {
+ import
+ toml,
+ toml.json;
+ auto configParseTOMLreturnJSON(T)(
+ T _text
+ ){
+ TOMLDocument _doc;
+ _doc = parseTOML(cast(string)(_text.content));
+ auto _doc_json = toJSON(_doc);
+ return _doc_json;
+ }
+}
+#+END_SRC
+
+** 1. parse TOML config to JSON return SiSUstruct
+
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_toml.d
+static template configParseTOMLreturnSiSUstruct() {
+ import
+ toml,
+ toml.json;
+ import
+ sdp.meta.conf_make_meta_structs,
+ sdp.meta.conf_make_meta_json;
+ mixin contentJSONtoSiSUstruct;
+ auto configParseTOMLreturnSiSUstruct(CCm, T)(
+ CCm _make_and_meta_struct,
+ T _document_struct
+ ){
+ TOMLDocument _doc = parseTOML(cast(string)(_document_struct.content));
+ auto _doc_json = toJSON(_doc);
+ _make_and_meta_struct = contentJSONtoSiSUstruct!()(_make_and_meta_struct, _doc_json, _document_struct.filename); // struct from json
+ return _make_and_meta_struct;
+ }
+}
+#+END_SRC
+
+** 2. parse TOML header to JSON then Struct
+
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_toml.d
+static template docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import
+ toml,
+ toml.json;
+ import
+ sdp.meta.conf_make_meta_structs,
+ sdp.meta.conf_make_meta_json,
+ sdp.meta.rgx;
+ mixin SiSUrgxInit;
+ mixin contentJSONtoSiSUstruct;
+ static auto rgx = Rgx();
+ auto docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct(CCm, Src)(
+ CCm _make_and_meta_struct,
+ Src header_src,
+ ) {
+ TOMLDocument _doc;
+ if (header_src.match(rgx.sdlang_header_meta_title)) {
+ writeln("WARNING >>> document header is sdlang (in wrong location JSON)");
+ } else if (header_src.match(rgx.toml_header_meta_title)) {
+ debug (json) {
+ writeln(">>> document header is toml, convert to JSON");
+ }
+ _doc = parseTOML(cast(string)(header_src));
+ }
+ auto _doc_json = toJSON(_doc);
+ auto _header_and_make_and_meta_struct = contentJSONtoSiSUstruct!()(_make_and_meta_struct, _doc_json, "header");
+ return _header_and_make_and_meta_struct;
+ }
+}
+#+END_SRC
+
+* 3. SDLang to SiSUstruct
+** 1. header extract (sdlang) to Struct :module:sdp:meta_conf_make_meta:
+
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_sdlang.d
/++
extract native/orig header return associative array<BR>
@@ -29,8 +894,8 @@
converting the metadata and make instructions to a common json format used by
program internally. Moved to associative array.
+/
-module sdp.meta.conf_make_meta;
-static template docHeaderMakeAndMetaTupExtractAndConvertToStruct() {
+module sdp.meta.conf_make_meta_sdlang;
+static template docHeaderMakeAndMetaTupSDLangExtractAndConvertToStruct() {
import
std.exception,
std.regex,
@@ -46,11 +911,11 @@ static template docHeaderMakeAndMetaTupExtractAndConvertToStruct() {
mixin SiSUrgxInit;
mixin SiSUextractSDLang;
static auto rgx = Rgx();
- auto docHeaderMakeAndMetaTupExtractAndConvertToStruct(CCm, Src)(
+ auto docHeaderMakeAndMetaTupSDLangExtractAndConvertToStruct(CCm, Src)(
CCm conf_composite_make,
Src header_src,
) {
- auto header_sdlang_tag = (!(header_src.match(rgx.native_header_meta_title)))
+ auto header_sdlang_tag = (header_src.match(rgx.sdlang_header_meta_title))
? extractSDL().docHeaderSDLtagGet(header_src) // sdlang.ast.Tag
: null;
auto header_make_and_meta_struct = extractSDL().docSDLtoStruct(conf_composite_make, header_sdlang_tag);
@@ -59,15 +924,14 @@ static template docHeaderMakeAndMetaTupExtractAndConvertToStruct() {
}
#+END_SRC
-* A. module sdlang :module:sdp:meta_conf_make_meta_sdlang:
-** 0. module template
-
+** 2. module sdlang :module:sdp:meta_conf_make_meta_sdlang:
+*** 0. module template
+**** 1. extract sdlang
#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_sdlang.d
/++
sdlang headers<BR>
extract sdlang header return sdlang
+/
-module sdp.meta.conf_make_meta_sdlang;
static template SiSUextractSDLang() {
import
std.exception,
@@ -79,20 +943,43 @@ static template SiSUextractSDLang() {
std.utf,
std.conv : to;
import
- sdp.meta.defaults,
+ sdp.meta.conf_make_meta_structs,
sdp.meta.rgx;
struct extractSDL {
- mixin SiSUregisters;
+ mixin SiSUmakeMetaStructsSDLang;
mixin SiSUrgxInit;
static auto rgx = Rgx();
- <<meta_conf_make_meta_sdl>>
+ <<meta_conf_make_meta_sdl_extract>>
+ private auto docSDLtoStruct(C,Tag)(C _conf_composite, Tag header_sdlang) { // work on
+ <<meta_conf_make_meta_sdl>>
+ return _conf_composite;
+ }
}
}
#+END_SRC
-** 1. sdlang header _extract root Tag_ :sdlang:root:tag:
+**** 2. extract sdlang
-#+name: meta_conf_make_meta_sdl
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_sdlang.d
+static template parseSDLangConfig() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import sdlang;
+ <<meta_config_file_sdlang_test>>
+}
+#+END_SRC
+
+*** 1. sdlang root tag _extract root Tag_ :sdlang:root:tag:
+**** 1. header
+
+#+name: meta_conf_make_meta_sdl_extract
#+BEGIN_SRC d
private auto docHeaderSDLtagGet(Hs)(Hs src_header) {
debug(asserts){
@@ -145,184 +1032,222 @@ private auto docHeaderSDLtagGet(Hs)(Hs src_header) {
}
#+END_SRC
-** 2a. _sdlang to struct_
+**** 2. conf & make
+
+#+name: meta_config_file_sdlang_test
+#+BEGIN_SRC d
+auto parseSDLangConfig(string configuration, string conf_sdl_filename) {
+ Tag sdl_root_conf;
+ try {
+ sdl_root_conf = parseSource(configuration);
+ }
+ catch(ParseException e) {
+ stderr.writeln("SDLang problem with content for ", conf_sdl_filename);
+ stderr.writeln(e.msg);
+ }
+ return sdl_root_conf;
+}
+#+END_SRC
+
+*** 2. _sdlang to struct_
+**** make
#+name: meta_conf_make_meta_sdl
#+BEGIN_SRC d
-private auto docSDLtoStruct(C,Tag)(C _conf_composite, Tag header_sdlang) {
- mixin SiSUregisters;
- /+ make +/
- if ("make" in header_sdlang.maybe.tags) {
- _conf_composite.make_str.bold = _conf_composite.make.bold = extractSDLangTabOrAttrib(header_sdlang, "make", "bold");
- _conf_composite.make_str.breaks = _conf_composite.make.breaks = extractSDLangTabOrAttrib(header_sdlang, "make", "breaks");
- _conf_composite.make_str.cover_image = _conf_composite.make.cover_image = extractSDLangTabOrAttrib(header_sdlang, "make", "cover_image");
- _conf_composite.make_str.css = _conf_composite.make.css = extractSDLangTabOrAttrib(header_sdlang, "make", "css");
- _conf_composite.make_str.emphasis = _conf_composite.make.emphasis = extractSDLangTabOrAttrib(header_sdlang, "make", "emphasis");
- _conf_composite.make_str.footer = _conf_composite.make.footer = extractSDLangTabOrAttrib(header_sdlang, "make", "footer");
- _conf_composite.make_str.headings = _conf_composite.make.headings = extractSDLangTabOrAttrib(header_sdlang, "make", "headings");
- _conf_composite.make_str.home_button_image = _conf_composite.make.home_button_image = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_image");
- _conf_composite.make_str.home_button_text = _conf_composite.make.home_button_text = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_text");
- _conf_composite.make_str.italics = _conf_composite.make.italics = extractSDLangTabOrAttrib(header_sdlang, "make", "italics");
- _conf_composite.make_str.num_top = _conf_composite.make.num_top = extractSDLangTabOrAttrib(header_sdlang, "make", "num_top");
- _conf_composite.make_str.num_depth = _conf_composite.make.num_depth = extractSDLangTabOrAttrib(header_sdlang, "make", "num_depth");
- _conf_composite.make_str.substitute = _conf_composite.make.substitute = extractSDLangTabOrAttrib(header_sdlang, "make", "substitute");
- _conf_composite.make_str.texpdf_font = _conf_composite.make.texpdf_font = extractSDLangTabOrAttrib(header_sdlang, "make", "texpdf_font");
- }
- /+ conf +/
- if ("webserv" in header_sdlang.maybe.tags) {
- _conf_composite.conf.webserv_url_root = extractSDLangTabOrAttrib(header_sdlang, "webserv", "url_root");
- _conf_composite.conf.webserv_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "path");
- _conf_composite.conf.webserv_images = extractSDLangTabOrAttrib(header_sdlang, "webserv", "images");
- _conf_composite.conf.webserv_cgi = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi");
- _conf_composite.conf.webserv_cgi_host = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host");
- _conf_composite.conf.webserv_cgi_host_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host_path");
- _conf_composite.conf.webserv_cgi_port = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_port");
- _conf_composite.conf.webserv_cgi_user = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_user");
- _conf_composite.conf.webserv_cgi_file_links = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_file_links");
- }
- if ("processing" in header_sdlang.maybe.tags) {
- _conf_composite.conf.processing_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_path");
- _conf_composite.conf.processing_dir = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_dir");
- _conf_composite.conf.processing_concord_max = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_concord_max");
- }
- if("flag" in header_sdlang.maybe.tags) {
- _conf_composite.conf.flag_act0 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act0");
- _conf_composite.conf.flag_act1 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act1");
- _conf_composite.conf.flag_act2 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act2");
- _conf_composite.conf.flag_act3 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act3");
- _conf_composite.conf.flag_act4 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act4");
- _conf_composite.conf.flag_act5 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act5");
- _conf_composite.conf.flag_act6 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act6");
- _conf_composite.conf.flag_act7 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act7");
- _conf_composite.conf.flag_act8 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act8");
- _conf_composite.conf.flag_act9 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act9");
- }
- if ("default" in header_sdlang.maybe.tags) {
- _conf_composite.conf.default_papersize = extractSDLangTabOrAttrib(header_sdlang, "default", "papersize");
- _conf_composite.conf.default_text_wrap = extractSDLangTabOrAttrib(header_sdlang, "default", "text_wrap");
- _conf_composite.conf.default_emphasis = extractSDLangTabOrAttrib(header_sdlang, "default", "emphasis");
- _conf_composite.conf.default_language = extractSDLangTabOrAttrib(header_sdlang, "default", "language");
- _conf_composite.conf.default_digest = extractSDLangTabOrAttrib(header_sdlang, "default", "digest");
- }
- if ("search" in header_sdlang.maybe.tags) {
- _conf_composite.conf.search_flag = extractSDLangTabOrAttrib(header_sdlang, "search", "flag");
- _conf_composite.conf.search_action = extractSDLangTabOrAttrib(header_sdlang, "search", "action");
- _conf_composite.conf.search_db = extractSDLangTabOrAttrib(header_sdlang, "search", "db");
- _conf_composite.conf.search_title = extractSDLangTabOrAttrib(header_sdlang, "search", "title");
- }
- /+ meta +/
- if ("classify" in header_sdlang.maybe.tags) {
- _conf_composite.meta.classify_dewey = extractSDLangTabOrAttrib(header_sdlang, "classify", "dewey");
- _conf_composite.meta.classify_keywords = extractSDLangTabOrAttrib(header_sdlang, "classify", "keywords");
- _conf_composite.meta.classify_loc = extractSDLangTabOrAttrib(header_sdlang, "classify", "loc");
- _conf_composite.meta.classify_subject = extractSDLangTabOrAttrib(header_sdlang, "classify", "subject");
- _conf_composite.meta.classify_topic_register = extractSDLangTabOrAttrib(header_sdlang, "classify", "topic_register");
- }
- if ("date" in header_sdlang.maybe.tags) {
- _conf_composite.meta.date_added_to_site = extractSDLangTabOrAttrib(header_sdlang, "date", "added_to_site");
- _conf_composite.meta.date_available = extractSDLangTabOrAttrib(header_sdlang, "date", "available");
- _conf_composite.meta.date_created = extractSDLangTabOrAttrib(header_sdlang, "date", "created");
- _conf_composite.meta.date_issued = extractSDLangTabOrAttrib(header_sdlang, "date", "issued");
- _conf_composite.meta.date_modified = extractSDLangTabOrAttrib(header_sdlang, "date", "modified");
- _conf_composite.meta.date_published = extractSDLangTabOrAttrib(header_sdlang, "date", "published");
- _conf_composite.meta.date_valid = extractSDLangTabOrAttrib(header_sdlang, "date", "valid");
- }
- if("identifier" in header_sdlang.maybe.tags) {
- _conf_composite.meta.identifier_isbn = extractSDLangTabOrAttrib(header_sdlang, "identifier", "isbn");
- _conf_composite.meta.identifier_oclc = extractSDLangTabOrAttrib(header_sdlang, "identifier", "oclc");
- _conf_composite.meta.identifier_pg = extractSDLangTabOrAttrib(header_sdlang, "identifier", "pg");
- }
- if ("links" in header_sdlang.maybe.tags) {
- // _conf_composite.meta.links = extractSDLangTabOrAttrib(header_sdlang, "links", "");
- }
- if ("notes" in header_sdlang.maybe.tags) {
- _conf_composite.meta.notes_abstract = extractSDLangTabOrAttrib(header_sdlang, "notes", "abstract");
- _conf_composite.meta.notes_description = extractSDLangTabOrAttrib(header_sdlang, "notes", "description");
- }
- if ("original" in header_sdlang.maybe.tags) {
- _conf_composite.meta.original_language = extractSDLangTabOrAttrib(header_sdlang, "original", "language");
- _conf_composite.meta.original_language_char = extractSDLangTabOrAttrib(header_sdlang, "original", "language_char");
- _conf_composite.meta.original_source = extractSDLangTabOrAttrib(header_sdlang, "original", "source");
- _conf_composite.meta.original_title = extractSDLangTabOrAttrib(header_sdlang, "original", "title");
- }
- if ("publisher" in header_sdlang.maybe.tags) {
- // _conf_composite.meta.publisher = extractSDLangTabOrAttrib(header_sdlang, "publisher", "");
- }
- if ("rights" in header_sdlang.maybe.tags) {
- _conf_composite.meta.rights_copyright = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright");
- _conf_composite.meta.rights_copyright_text = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_text");
- _conf_composite.meta.rights_copyright_audio = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_audio");
- _conf_composite.meta.rights_copyright_cover = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_cover");
- _conf_composite.meta.rights_copyright_illustrations = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_illustrations");
- _conf_composite.meta.rights_copyright_photographs = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_photographs");
- _conf_composite.meta.rights_copyright_translation = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_translation");
- _conf_composite.meta.rights_copyright_video = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_video");
- _conf_composite.meta.rights_license = extractSDLangTabOrAttrib(header_sdlang, "rights", "license");
- }
- if (_conf_composite.meta.creator_author.empty) {
- if ("creator" in header_sdlang.maybe.tags) {
- _conf_composite.meta.creator_author = extractSDLangTabOrAttrib(header_sdlang, "creator", "author");
- _conf_composite.meta.creator_author_email = extractSDLangTabOrAttrib(header_sdlang, "creator", "author_email");
- _conf_composite.meta.creator_illustrator = extractSDLangTabOrAttrib(header_sdlang, "creator", "illustrator");
- _conf_composite.meta.creator_translator = extractSDLangTabOrAttrib(header_sdlang, "creator", "translator");
- }
- // dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"];
- string[] authors_arr;
- auto authors_raw_arr = _conf_composite.meta.creator_author.split(rgx.arr_delimiter);
- foreach (author_raw; authors_raw_arr) {
- authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
- }
- _conf_composite.meta.creator_author = join(authors_arr, ", ").chomp.chomp;
+/+ make ------------------------------------------------------------------- +/
+if ("make" in header_sdlang.maybe.tags) {
+ confCompositeMakeBuild _mk;
+ _conf_composite.make_str.bold = extractSDLangTabOrAttrib(header_sdlang, "make", "bold"); // TODO
+ _conf_composite.make_str.breaks = extractSDLangTabOrAttrib(header_sdlang, "make", "breaks");
+ _conf_composite.make_str.cover_image = extractSDLangTabOrAttrib(header_sdlang, "make", "cover_image");
+ _conf_composite.make_str.css = extractSDLangTabOrAttrib(header_sdlang, "make", "css");
+ _conf_composite.make_str.emphasis = extractSDLangTabOrAttrib(header_sdlang, "make", "emphasis"); // TODO
+ _conf_composite.make_str.footer = extractSDLangTabOrAttrib(header_sdlang, "make", "footer");
+ _conf_composite.make_str.headings = extractSDLangTabOrAttrib(header_sdlang, "make", "headings");
+ _conf_composite.make_str.home_button_image = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_image");
+ _conf_composite.make_str.home_button_text = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_text");
+ _conf_composite.make_str.italics = extractSDLangTabOrAttrib(header_sdlang, "make", "italics"); // TODO
+ _conf_composite.make_str.num_top = extractSDLangTabOrAttrib(header_sdlang, "make", "num_top");
+ _conf_composite.make_str.num_depth = extractSDLangTabOrAttrib(header_sdlang, "make", "num_depth");
+ _conf_composite.make_str.substitute = extractSDLangTabOrAttrib(header_sdlang, "make", "substitute"); // TODO
+ _conf_composite.make_str.texpdf_font = extractSDLangTabOrAttrib(header_sdlang, "make", "texpdf_font");
+ _conf_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_conf_composite.make_str.bold);
+ _conf_composite.make.breaks = _mk.breaks(_conf_composite.make_str.breaks);
+ _conf_composite.make.cover_image = _mk.cover_image(_conf_composite.make_str.cover_image);
+ _conf_composite.make.css = _mk.css(_conf_composite.make_str.css);
+ _conf_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_conf_composite.make_str.emphasis);
+ _conf_composite.make.footer = _mk.footer(_conf_composite.make_str.footer);
+ _conf_composite.make.headings = _mk.headings(_conf_composite.make_str.headings);
+ _conf_composite.make.home_button_image = _mk.home_button_image(_conf_composite.make_str.home_button_image);
+ _conf_composite.make.home_button_text = _mk.home_button_text(_conf_composite.make_str.home_button_text);
+ _conf_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_conf_composite.make_str.italics);
+ _conf_composite.make.num_top = _mk.num_top(_conf_composite.make_str.num_top);
+ _conf_composite.make.num_depth = _mk.num_depth(_conf_composite.make_str.num_depth);
+ _conf_composite.make.substitute = _mk.substitute(_conf_composite.make_str.substitute);
+ _conf_composite.make.texpdf_font = _mk.texpdf_font(_conf_composite.make_str.texpdf_font);
+}
+#+END_SRC
+
+**** conf
+
+#+name: meta_conf_make_meta_sdl
+#+BEGIN_SRC d
+/+ conf ------------------------------------------------------------------- +/
+if ("webserv" in header_sdlang.maybe.tags) {
+ _conf_composite.conf.webserv_url_root = extractSDLangTabOrAttrib(header_sdlang, "webserv", "url_root");
+ _conf_composite.conf.webserv_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "path");
+ _conf_composite.conf.webserv_images = extractSDLangTabOrAttrib(header_sdlang, "webserv", "images");
+ _conf_composite.conf.webserv_cgi = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi");
+ _conf_composite.conf.webserv_cgi_host = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host");
+ _conf_composite.conf.webserv_cgi_host_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host_path");
+ _conf_composite.conf.webserv_cgi_port = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_port");
+ _conf_composite.conf.webserv_cgi_user = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_user");
+ _conf_composite.conf.webserv_cgi_file_links = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_file_links");
+}
+if ("processing" in header_sdlang.maybe.tags) {
+ _conf_composite.conf.processing_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_path");
+ _conf_composite.conf.processing_dir = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_dir");
+ _conf_composite.conf.processing_concord_max = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_concord_max");
+}
+if ("flag" in header_sdlang.maybe.tags) {
+ _conf_composite.conf.flag_act0 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act0");
+ _conf_composite.conf.flag_act1 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act1");
+ _conf_composite.conf.flag_act2 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act2");
+ _conf_composite.conf.flag_act3 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act3");
+ _conf_composite.conf.flag_act4 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act4");
+ _conf_composite.conf.flag_act5 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act5");
+ _conf_composite.conf.flag_act6 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act6");
+ _conf_composite.conf.flag_act7 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act7");
+ _conf_composite.conf.flag_act8 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act8");
+ _conf_composite.conf.flag_act9 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act9");
+}
+if ("default" in header_sdlang.maybe.tags) {
+ _conf_composite.conf.default_papersize = extractSDLangTabOrAttrib(header_sdlang, "default", "papersize");
+ _conf_composite.conf.default_text_wrap = extractSDLangTabOrAttrib(header_sdlang, "default", "text_wrap");
+ _conf_composite.conf.default_emphasis = extractSDLangTabOrAttrib(header_sdlang, "default", "emphasis");
+ _conf_composite.conf.default_language = extractSDLangTabOrAttrib(header_sdlang, "default", "language");
+ _conf_composite.conf.default_digest = extractSDLangTabOrAttrib(header_sdlang, "default", "digest");
+}
+if ("search" in header_sdlang.maybe.tags) {
+ _conf_composite.conf.search_flag = extractSDLangTabOrAttrib(header_sdlang, "search", "flag");
+ _conf_composite.conf.search_action = extractSDLangTabOrAttrib(header_sdlang, "search", "action");
+ _conf_composite.conf.search_db = extractSDLangTabOrAttrib(header_sdlang, "search", "db");
+ _conf_composite.conf.search_title = extractSDLangTabOrAttrib(header_sdlang, "search", "title");
+}
+#+END_SRC
+
+**** meta
+
+#+name: meta_conf_make_meta_sdl
+#+BEGIN_SRC d
+/+ meta ------------------------------------------------------------------- +/
+if ("classify" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.classify_dewey = extractSDLangTabOrAttrib(header_sdlang, "classify", "dewey");
+ _conf_composite.meta.classify_keywords = extractSDLangTabOrAttrib(header_sdlang, "classify", "keywords");
+ _conf_composite.meta.classify_loc = extractSDLangTabOrAttrib(header_sdlang, "classify", "loc");
+ _conf_composite.meta.classify_subject = extractSDLangTabOrAttrib(header_sdlang, "classify", "subject");
+ _conf_composite.meta.classify_topic_register = extractSDLangTabOrAttrib(header_sdlang, "classify", "topic_register");
+}
+if ("date" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.date_added_to_site = extractSDLangTabOrAttrib(header_sdlang, "date", "added_to_site");
+ _conf_composite.meta.date_available = extractSDLangTabOrAttrib(header_sdlang, "date", "available");
+ _conf_composite.meta.date_created = extractSDLangTabOrAttrib(header_sdlang, "date", "created");
+ _conf_composite.meta.date_issued = extractSDLangTabOrAttrib(header_sdlang, "date", "issued");
+ _conf_composite.meta.date_modified = extractSDLangTabOrAttrib(header_sdlang, "date", "modified");
+ _conf_composite.meta.date_published = extractSDLangTabOrAttrib(header_sdlang, "date", "published");
+ _conf_composite.meta.date_valid = extractSDLangTabOrAttrib(header_sdlang, "date", "valid");
+}
+if ("identifier" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.identifier_isbn = extractSDLangTabOrAttrib(header_sdlang, "identifier", "isbn");
+ _conf_composite.meta.identifier_oclc = extractSDLangTabOrAttrib(header_sdlang, "identifier", "oclc");
+ _conf_composite.meta.identifier_pg = extractSDLangTabOrAttrib(header_sdlang, "identifier", "pg");
+}
+if ("links" in header_sdlang.maybe.tags) {
+ // _conf_composite.meta.links = extractSDLangTabOrAttrib(header_sdlang, "links", "");
+}
+if ("notes" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.notes_abstract = extractSDLangTabOrAttrib(header_sdlang, "notes", "abstract");
+ _conf_composite.meta.notes_description = extractSDLangTabOrAttrib(header_sdlang, "notes", "description");
+}
+if ("original" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.original_language = extractSDLangTabOrAttrib(header_sdlang, "original", "language");
+ _conf_composite.meta.original_language_char = extractSDLangTabOrAttrib(header_sdlang, "original", "language_char");
+ _conf_composite.meta.original_source = extractSDLangTabOrAttrib(header_sdlang, "original", "source");
+ _conf_composite.meta.original_title = extractSDLangTabOrAttrib(header_sdlang, "original", "title");
+}
+if ("publisher" in header_sdlang.maybe.tags) {
+ // _conf_composite.meta.publisher = extractSDLangTabOrAttrib(header_sdlang, "publisher", "");
+}
+if ("rights" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.rights_copyright = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright");
+ _conf_composite.meta.rights_copyright_text = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_text");
+ _conf_composite.meta.rights_copyright_audio = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_audio");
+ _conf_composite.meta.rights_copyright_cover = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_cover");
+ _conf_composite.meta.rights_copyright_illustrations = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_illustrations");
+ _conf_composite.meta.rights_copyright_photographs = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_photographs");
+ _conf_composite.meta.rights_copyright_translation = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_translation");
+ _conf_composite.meta.rights_copyright_video = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright_video");
+ _conf_composite.meta.rights_license = extractSDLangTabOrAttrib(header_sdlang, "rights", "license");
+}
+if (_conf_composite.meta.creator_author.empty) {
+ if ("creator" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.creator_author = extractSDLangTabOrAttrib(header_sdlang, "creator", "author");
+ _conf_composite.meta.creator_author_email = extractSDLangTabOrAttrib(header_sdlang, "creator", "author_email");
+ _conf_composite.meta.creator_illustrator = extractSDLangTabOrAttrib(header_sdlang, "creator", "illustrator");
+ _conf_composite.meta.creator_translator = extractSDLangTabOrAttrib(header_sdlang, "creator", "translator");
+ }
+ // dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"];
+ string[] authors_arr;
+ auto authors_raw_arr = _conf_composite.meta.creator_author.split(rgx.arr_delimiter);
+ foreach (author_raw; authors_raw_arr) {
+ authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
+ }
+ _conf_composite.meta.creator_author = join(authors_arr, ", ").chomp.chomp;
+}
+if (_conf_composite.meta.title_main.empty) {
+ if ("title" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.title_edition = extractSDLangTabOrAttrib(header_sdlang, "title", "edition");
+ // _conf_composite.meta.title_full = extractSDLangTabOrAttrib(header_sdlang, "title", "full");
+ _conf_composite.meta.title_language = extractSDLangTabOrAttrib(header_sdlang, "title", "language");
+ _conf_composite.meta.title_main = extractSDLangTabOrAttrib(header_sdlang, "title", "main");
+ _conf_composite.meta.title_note = extractSDLangTabOrAttrib(header_sdlang, "title", "note");
+ _conf_composite.meta.title_sub = extractSDLangTabOrAttrib(header_sdlang, "title", "sub");
+ _conf_composite.meta.title_subtitle = extractSDLangTabOrAttrib(header_sdlang, "title", "subtitle");
}
if (_conf_composite.meta.title_main.empty) {
- if ("title" in header_sdlang.maybe.tags) {
- _conf_composite.meta.title_edition = extractSDLangTabOrAttrib(header_sdlang, "title", "edition");
- _conf_composite.meta.title_language = extractSDLangTabOrAttrib(header_sdlang, "title", "language");
- _conf_composite.meta.title_main = extractSDLangTabOrAttrib(header_sdlang, "title", "main");
- _conf_composite.meta.title_note = extractSDLangTabOrAttrib(header_sdlang, "title", "note");
- _conf_composite.meta.title_sub = extractSDLangTabOrAttrib(header_sdlang, "title", "sub");
- _conf_composite.meta.title_subtitle = extractSDLangTabOrAttrib(header_sdlang, "title", "subtitle");
- }
- if (_conf_composite.meta.title_main.empty) {
- Tag _maintag = header_sdlang.getTag("title");
- if (_maintag !is null) {
- if ("main" in _maintag.maybe.tags) {
- _conf_composite.meta.title_main
- = to!string(_maintag.getTagValues("main"));
- } else if ("main" !in _maintag.maybe.attributes) {
- writeln(_maintag.values[0]); // document title
- _conf_composite.meta.title_main
- = (_maintag.values[0]).to!string; // test that this exists
- }
+ Tag _maintag = header_sdlang.getTag("title");
+ if (_maintag !is null) {
+ if ("main" in _maintag.maybe.tags) {
+ _conf_composite.meta.title_main
+ = to!string(_maintag.getTagValues("main"));
+ } else if ("main" !in _maintag.maybe.attributes) {
+ _conf_composite.meta.title_main
+ = (_maintag.values[0]).to!string; // test that this exists
}
}
- if ((!(_conf_composite.meta.title_subtitle.empty))
- && (_conf_composite.meta.title_sub.empty)) {
- _conf_composite.meta.title_sub = _conf_composite.meta.title_subtitle;
- }
- if (_conf_composite.meta.title_sub.empty) {
- _conf_composite.meta.title_full = _conf_composite.meta.title_main;
- } else {
- _conf_composite.meta.title_full = format(
- "%s - %s",
- _conf_composite.meta.title_main,
- _conf_composite.meta.title_sub,
- );
- }
}
- return _conf_composite;
+ if ((!(_conf_composite.meta.title_subtitle.empty))
+ && (_conf_composite.meta.title_sub.empty)) {
+ _conf_composite.meta.title_sub = _conf_composite.meta.title_subtitle;
+ }
+ _conf_composite.meta.title_full = (_conf_composite.meta.title_sub.empty)
+ ? _conf_composite.meta.title_main
+ : format(
+ "%s - %s",
+ _conf_composite.meta.title_main,
+ _conf_composite.meta.title_sub,
+ );
}
#+END_SRC
-* C. module conf files make composite
-** TODO 0. module template
+** 3. module conf files make composite
+*** TODO 0. module template
-#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_composite.d
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_sdlang.d
/++
return composite make from config files
+/
-module sdp.meta.conf_make_meta_composite;
-<<meta_conf_make_meta_composite_struct>>
+<<meta_conf_make_meta_sdl_to_composite_struct>>
template confFilesSDLtoStruct() {
import
std.exception,
@@ -334,48 +1259,255 @@ template confFilesSDLtoStruct() {
std.utf,
std.conv : to;
import
- sdp.meta.defaults,
+ sdp.meta.conf_make_meta_structs,
sdp.meta.rgx;
- <<meta_conf_make_meta_composite>>
+ <<meta_conf_make_meta_sdl_to_composite>>
}
#+END_SRC
-** module template
+*** _sdlang to parse_ composite make
-#+name: meta_conf_make_meta_composite
+#+name: meta_conf_make_meta_sdl_to_composite
+#+BEGIN_SRC d
+auto configParseSDL(T)(
+ T _text
+){
+ Tag sdl_root;
+ try {
+ sdl_root = parseSource(_text.to!string);
+ }
+ catch(ParseException e) {
+ stderr.writeln("SDLang problem with this document header:");
+ stderr.writeln(_src_header);
+ // Error messages of the form:
+ // myFile.sdl(5:28): Error: Invalid integer suffix.
+ stderr.writeln(e.msg);
+ }
+ debug(sdlang) {
+ writeln("header SDL:");
+ writeln(__LINE__, ": ", sdl_root.toSDLDocument());
+ writeln(__LINE__, ": ", sdl_root.maybe.namespaces);
+ writeln("header make sdlang: ", sdl_root.toSDLDocument());
+ writeln(__LINE__, ": ", sdl_root.getTagValues("title"));
+ writeln(__LINE__, ": ", sdl_root.getTagValues("creator"));
+ Tag creator = sdl_root.getTag("creator");
+ if (creator !is null) {
+ if ("author" in creator.maybe.tags) {
+ writeln(__LINE__, ": ", creator.getTagValues("author"));
+ } else if ("author" in creator.maybe.attributes) {
+ writeln(__LINE__, ": ", creator.maybe.attributes["author"][0].value);
+ }
+ }
+ }
+ return sdl_root; // sdlang.ast.Tag
+}
+#+END_SRC
+
+*** _sdlang to struct_ composite make
+
+#+name: meta_conf_make_meta_sdl_to_composite
#+BEGIN_SRC d
auto confFilesSDLtoStruct(S,L)(
S sdl_root_config_share,
L sdl_root_config_local,
){
- mixin SiSUregisters;
+ mixin SiSUmakeMetaStructsSDLang;
ConfCompositePlus _conf_composite;
foreach (conf_sdlang; [sdl_root_config_share, sdl_root_config_local]) {
if ("make" in conf_sdlang.maybe.tags) {
- _conf_composite.make_str.bold = _conf_composite.make.bold = extractSDLangTabOrAttrib(conf_sdlang, "make", "bold");
- _conf_composite.make_str.breaks = _conf_composite.make.breaks = extractSDLangTabOrAttrib(conf_sdlang, "make", "breaks");
- _conf_composite.make_str.cover_image = _conf_composite.make.cover_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "cover_image");
- _conf_composite.make_str.css = _conf_composite.make.css = extractSDLangTabOrAttrib(conf_sdlang, "make", "css");
- _conf_composite.make_str.emphasis = _conf_composite.make.emphasis = extractSDLangTabOrAttrib(conf_sdlang, "make", "emphasis");
- _conf_composite.make_str.footer = _conf_composite.make.footer = extractSDLangTabOrAttrib(conf_sdlang, "make", "footer");
- _conf_composite.make_str.headings = _conf_composite.make.headings = extractSDLangTabOrAttrib(conf_sdlang, "make", "headings");
- _conf_composite.make_str.home_button_image = _conf_composite.make.home_button_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_image");
- _conf_composite.make_str.home_button_text = _conf_composite.make.home_button_text = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_text");
- _conf_composite.make_str.italics = _conf_composite.make.italics = extractSDLangTabOrAttrib(conf_sdlang, "make", "italics");
- _conf_composite.make_str.num_top = _conf_composite.make.num_top = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_top");
- _conf_composite.make_str.num_depth = _conf_composite.make.num_depth = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_depth");
- _conf_composite.make_str.substitute = _conf_composite.make.substitute = extractSDLangTabOrAttrib(conf_sdlang, "make", "substitute");
- _conf_composite.make_str.texpdf_font = _conf_composite.make.texpdf_font = extractSDLangTabOrAttrib(conf_sdlang, "make", "texpdf_font");
+ confCompositeMakeBuild _mk;
+ _conf_composite.make_str.bold = extractSDLangTabOrAttrib(conf_sdlang, "make", "bold"); // TODO
+ _conf_composite.make_str.breaks = extractSDLangTabOrAttrib(conf_sdlang, "make", "breaks");
+ _conf_composite.make_str.cover_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "cover_image");
+ _conf_composite.make_str.css = extractSDLangTabOrAttrib(conf_sdlang, "make", "css");
+ _conf_composite.make_str.emphasis = extractSDLangTabOrAttrib(conf_sdlang, "make", "emphasis"); // TODO
+ _conf_composite.make_str.footer = extractSDLangTabOrAttrib(conf_sdlang, "make", "footer");
+ _conf_composite.make_str.headings = extractSDLangTabOrAttrib(conf_sdlang, "make", "headings");
+ _conf_composite.make_str.home_button_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_image");
+ _conf_composite.make_str.home_button_text = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_text");
+ _conf_composite.make_str.italics = extractSDLangTabOrAttrib(conf_sdlang, "make", "italics"); // TODO
+ _conf_composite.make_str.num_top = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_top");
+ _conf_composite.make_str.num_depth = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_depth");
+ _conf_composite.make_str.substitute = extractSDLangTabOrAttrib(conf_sdlang, "make", "substitute"); // TODO
+ _conf_composite.make_str.texpdf_font = extractSDLangTabOrAttrib(conf_sdlang, "make", "texpdf_font");
+ _conf_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_conf_composite.make_str.bold); //
+ _conf_composite.make.breaks = _mk.breaks(_conf_composite.make_str.breaks);
+ _conf_composite.make.cover_image = _mk.cover_image(_conf_composite.make_str.cover_image);
+ _conf_composite.make.css = _mk.css(_conf_composite.make_str.css);
+ _conf_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_conf_composite.make_str.emphasis);
+ _conf_composite.make.footer = _mk.footer(_conf_composite.make_str.footer);
+ _conf_composite.make.headings = _mk.headings(_conf_composite.make_str.headings);
+ _conf_composite.make.home_button_image = _mk.home_button_image(_conf_composite.make_str.home_button_image);
+ _conf_composite.make.home_button_text = _mk.home_button_text(_conf_composite.make_str.home_button_text);
+ _conf_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_conf_composite.make_str.italics);
+ _conf_composite.make.num_top = _mk.num_top(_conf_composite.make_str.num_top);
+ _conf_composite.make.num_depth = _mk.num_depth(_conf_composite.make_str.num_depth);
+ _conf_composite.make.substitute = _mk.substitute(_conf_composite.make_str.substitute); // TODO
+ _conf_composite.make.texpdf_font = _mk.texpdf_font(_conf_composite.make_str.texpdf_font);
}
}
return _conf_composite;
}
#+END_SRC
-** initialize / imports
+** 4. SDLang default make meta structs :module:sdp:meta_defaults:
+
+#+name: tangle_defaults
+#+BEGIN_SRC d :tangle ../src/sdp/meta/conf_make_meta_sdlang.d
+/++
+ default settings
++/
+template SiSUmakeMetaStructsSDLang() {
+ <<meta_defaults_imports>>
+ string extractSDLangTabOrAttrib(S)(
+ S conf_sdlang,
+ string maintab,
+ string atab
+ ) {
+ string _conf_composite_string = "";
+ if (maintab in conf_sdlang.maybe.tags) {
+ auto _maintag = conf_sdlang.getTag(maintab);
+ if (
+ (atab in _maintag.maybe.tags)
+ && (_maintag.getTagValues(atab).length > 0)
+ ) {
+ debug(configsdlang) {
+ writeln(
+ " ", __LINE__,
+ ": sdl tag, ",
+ maintab, ":", atab, ": ",
+ _maintag.getTagValues(atab)[0]
+ );
+ }
+ if (_maintag.getTagValues(atab).length == 1) {
+ writeln((_maintag.getTagValues(atab)[0]).to!string);
+ _conf_composite_string
+ = (_maintag.getTagValues(atab)[0]).to!string;
+ } else if (_maintag.getTagValues(atab).length > 1) {
+ string _tmp = "";
+ foreach (st; _maintag.getTagValues(atab)) {
+ writeln(st.to!string, ";");
+ _tmp ~= st.to!string ~ ";";
+ }
+ _conf_composite_string = _tmp;
+ }
+ } else if (
+ (atab in _maintag.maybe.attributes)
+ && (_maintag.attributes[atab][0].value.length > 0)
+ ) {
+ debug(configsdlang) {
+ writeln(
+ " ", __LINE__,
+ ": sdl attrib, ",
+ maintab, ":", atab, ": ",
+ _maintag.attributes[atab][0].value
+ );
+ }
+ _conf_composite_string
+ = (_maintag.attributes[atab][0].value).to!string;
+ }
+ }
+ return _conf_composite_string;
+ }
+}
+#+END_SRC
+
+* __END__
+** notes headers
-#+name: imports
#+BEGIN_SRC d
-import sdp.meta;
-import std.array;
+/+
+ /+
+ unify internal representation of header info for native & sdlang document headers
+ represent either using struct, hashes or possibly json
+ sdp internal representation should be identical for native & sdlang variants
+ +/
+header.
+ ├── make // make instructions
+ │   ├── bold
+ │   ├── breaks
+ │   ├── cover_image
+ │   ├── css
+ │   ├── emphasis
+ │   ├── footer
+ │   ├── headings
+ │   ├── home_button_image
+ │   ├── home_button_text
+ │   ├── italics
+ │   ├── num_top
+ │   ├── substitute
+ │   └── texpdf_font
+ └── meta // metadata
+    ├── author // move author to creator:author
+    ├── classify
+    │   ├── dewey
+    │   ├── keyword
+    │   ├── loc
+    │   ├── subject
+    │   └── topic_register
+    ├── creator
+    │   ├── author
+ │ │ ├── [ [first_name: x0, last_name: y0], [first_name: x1, last_name: y1] ]
+ │ │ └── [ full_name0, full_name1 ]
+    │   ├── author_email
+    │   ├── illustrator
+    │   └── translator
+    ├── date
+    │   ├── added_to_site
+    │   ├── available
+    │   ├── created
+    │   ├── issued
+    │   ├── modified
+    │   ├── published
+    │   └── valid
+    ├── identifier
+    │   ├── isbn
+    │   ├── oclc
+    │   └── pg
+    ├── links
+    ├── notes
+    │   ├── abstract
+    │   └── description
+    ├── original
+    │   ├── language
+    │   ├── source
+    │   └── title
+    ├── publisher
+    │   └── name
+    ├── rights
+    │   ├── copyright
+    │   ├── cover
+    │   ├── illustrations
+    │   └── license
+    └── title // move title: to title:main
+    ├── edition
+    ├── [ full (main + sub) ]
+    ├── language
+    ├── main
+    ├── note
+    ├── sub
+    └── subtitle // move title:subtitle to title:sub
+
+61 leaves
++/
+#+END_SRC
+
+** dlang rgx example
+
+#+BEGIN_SRC d
+import std.conv, std.regex, std.range, std.file, std.stdio;
+import std.string : format;
+void main(string[] argv) {
+ immutable ratio = 1.5824; // UK pounds to US dollar as of this writing
+ auto toDollars(Captures!string price) {
+ real value = to!real(price["integer"]);
+ if (!price["fraction"].empty)
+ value += 0.01*to!real(price["fraction"]);
+ return format("$%.2f",value * ratio);
+ }
+ string text = std.file.readText(argv[1]);
+ auto converted = replaceAll!toDollars(text,
+ regex(r"£\s*(?P<integer>[0-9]+)(\.(?P<fraction>[0-9]{2}))?","g"));
+ write(converted);
+}
#+END_SRC
diff --git a/org/meta_debugs.org b/org/meta_debugs.org
index d11b64b..e624181 100644
--- a/org/meta_debugs.org
+++ b/org/meta_debugs.org
@@ -111,8 +111,7 @@ debug(parent) {
#+BEGIN_SRC d
debug(dumpdoc) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
@@ -478,8 +477,7 @@ debug(blurb_section) {
#+BEGIN_SRC d
debug(objects) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
@@ -662,8 +660,7 @@ debug(headermetadatajson) {
#+BEGIN_SRC d
debug(anchor) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
@@ -711,8 +708,7 @@ debug(heading) { // heading
#+BEGIN_SRC d
debug(headings) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
diff --git a/org/meta_read_source_files.org b/org/meta_read_source_files.org
index 3bf02b1..b97eb36 100644
--- a/org/meta_read_source_files.org
+++ b/org/meta_read_source_files.org
@@ -38,19 +38,126 @@ import
module sdp.meta.read_config_files;
<<meta_config_file_in>>
<<meta_config_file_sdl>>
+<<meta_config_file_toml>>
<<meta_config_file_hub>>
#+END_SRC
-** 1. read config file, (conf.sdl & sisu_document_make) :file:config:
+*** 0. read config files (config_local_site & sisu_document_make) toml or sdlang
+**** 1. site configuration
+
+#+name: meta_config_file_hub
+#+BEGIN_SRC d
+static template readConfigSite() {
+ <<imports_std>>
+ final auto readConfigSite(M,E)(M _manifest, E _env) {
+ string config_file_str;
+ string conf_filename = "NONE";
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site;
+ foreach(conf_fn; [_conf_file_details.config_filename_site_toml, _conf_file_details.config_filename_site_sdl]) {
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array;
+ conf_filename = conf_fn;
+ if (config_file_str.length > 0) {
+ // conf_filename = conf_fn;
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ // writeln(__LINE__, ": found: ", conf_file, " in ", pth);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ if (config_file_str.length > 0) { break; }
+ }
+ struct _ConfContent {
+ string filename() {
+ return conf_filename;
+ }
+ string filetype() {
+ return conf_filename.extension.chompPrefix(".");
+ }
+ auto content() {
+ return config_file_str;
+ }
+ }
+ return _ConfContent();
+ }
+}
+#+END_SRC
+
+**** 2. document make/config
+
+#+name: meta_config_file_hub
+#+BEGIN_SRC d
+static template readConfigDoc() {
+ <<imports_std>>
+ final auto readConfigDoc(M,E)(M _manifest, E _env) {
+ string config_file_str;
+ string conf_filename = "NONE";
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.sisu_document_make;
+ foreach(conf_fn; [_conf_file_details.config_filename_document_toml, _conf_file_details.config_filename_document_sdl]) {
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array;
+ conf_filename = conf_fn;
+ if (config_file_str.length > 0) {
+ // conf_filename = conf_fn;
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ if (config_file_str.length > 0) { break; }
+ }
+ struct _ConfContent {
+ string filename() {
+ return conf_filename;
+ }
+ string filetype() {
+ return conf_filename.extension.chompPrefix(".");
+ }
+ auto content() {
+ return config_file_str;
+ }
+ }
+ return _ConfContent();
+ }
+}
+#+END_SRC
+
+** A. SDLang
+*** 1. SDLang read config files (config_local_site & sisu_document_make) :file:config:
+**** SDLang config_local_site
#+name: meta_config_file_in
#+BEGIN_SRC d
-static template configInSite() {
+static template configReadInSiteSDL() {
<<imports_std>>
- final string configInSite(M,E)(M manifest, E env) {
+ final string configReadInSiteSDL(M,E)(M manifest, E env) {
auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.possible_config_path_locations.config_filename_site;
- auto possible_config_path_locations = conf_file_details.possible_config_path_locations.local_site;
+ string conf_sdl = conf_file_details.config_filename_site_sdl;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.config_local_site;
string config_file_str;
debug(io) {
writeln("WARNING (io debug) in config filename: ", conf_sdl);
@@ -80,14 +187,16 @@ static template configInSite() {
}
#+END_SRC
+**** SDLang sisu_document_make
+
#+name: meta_config_file_in
#+BEGIN_SRC d
-static template configInDoc() {
+static template configReadInDocSDL() {
<<imports_std>>
- final string configInDoc(M,E)(M manifest, E env) {
+ final string configReadInDocSDL(M,E)(M manifest, E env) {
auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_document;
- auto possible_config_path_locations = conf_file_details.possible_config_path_locations.document;
+ string conf_sdl = conf_file_details.config_filename_document_sdl;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.sisu_document_make;
string config_file_str;
debug(io) {
writeln("WARNING (io debug) in config filename: ", conf_sdl);
@@ -117,85 +226,181 @@ static template configInDoc() {
}
#+END_SRC
-** 2. config files get sdlang root tag
-*** 0. template
+*** 2. SDLang config files get (sdlang root tag)
+
#+name: meta_config_file_sdl
#+BEGIN_SRC d
-/+
-
-+/
-static template ConfigSDLang() {
+static template configSDLang() {
import sdlang;
<<imports_std>>
- <<meta_config_file_sdlang>>
+ auto configSDLang(string configuration, string conf_sdl_filename) {
+ Tag sdl_root_conf;
+ try {
+ sdl_root_conf = parseSource(configuration);
+ }
+ catch(ParseException e) {
+ stderr.writeln("SDLang problem with content for ", conf_sdl_filename);
+ stderr.writeln(e.msg);
+ }
+ return sdl_root_conf;
+ }
}
#+END_SRC
-*** config file get sdl root tag :file:conf:sdlang:
+*** 3. SDLang config (config_local_site & sisu_document_make) :file:config:hub:
-#+name: meta_config_file_sdlang
+#+name: meta_config_file_hub
#+BEGIN_SRC d
-auto ConfigSDLang(string configuration, string conf_sdl_filename) {
- Tag sdl_root_conf;
- try {
- sdl_root_conf = parseSource(configuration);
+static template configReadSiteSDLang() {
+ <<imports_std>>
+ import sdlang;
+ final auto configReadSiteSDLang(M,E)(M manifest, E env) {
+ auto configuration = configReadInSiteSDL!()(manifest, env);
+ auto conf_file_details = ConfigFilePaths!()(manifest, env);
+ string conf_sdl = conf_file_details.config_filename_site_sdl;
+ auto sdl_root = configSDLang!()(configuration, conf_sdl);
+ return sdl_root;
}
- catch(ParseException e) {
- stderr.writeln("SDLang problem with content for ", conf_sdl_filename);
- stderr.writeln(e.msg);
+}
+static template configReadDocSDLang() {
+ <<imports_std>>
+ import sdlang;
+ final auto configReadDocSDLang(M,E)(M manifest, E env) {
+ auto configuration = configReadInDocSDL!()(manifest, env);
+ auto conf_file_details = ConfigFilePaths!()(manifest, env);
+ string conf_sdl = conf_file_details.config_filename_document_sdl;
+ auto sdl_root = configSDLang!()(configuration, conf_sdl);
+ return sdl_root;
}
- return sdl_root_conf;
}
#+END_SRC
-** 3. config file (conf.sdl & sisu_document_make) :file:config:hub:
-*** 0. template
+** B. TOML
+*** 1. TOML read config files (config_local_site & sisu_document_make) :file:config:
+**** TOML config_local_site
-#+name: meta_config_file_hub
+#+name: meta_config_file_in
#+BEGIN_SRC d
-/+
-+/
-static template configReadSite() {
- <<imports_std>>
- <<meta_config_file_import_sdlang>>
- <<meta_config_file_sdlang_hub_site>>
-}
-static template configReadDoc() {
+static template configReadInSiteTOML() {
<<imports_std>>
- <<meta_config_file_import_sdlang>>
- <<meta_config_file_sdlang_hub_doc>>
+ final string configReadInSiteTOML(M,E)(M manifest, E env) {
+ auto conf_file_details = ConfigFilePaths!()(manifest, env);
+ string conf_toml = conf_file_details.config_filename_site_toml;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.config_local_site;
+ string config_file_str;
+ debug(io) {
+ writeln("WARNING (io debug) in config filename: ", conf_toml);
+ writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations);
+ }
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array;
+ if (config_file_str.length > 0) {
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ return config_file_str;
+ }
}
#+END_SRC
-*** config hub _import sdlang_
-#+name: meta_config_file_import_mixin
+**** TOML sisu_document_make
+
+#+name: meta_config_file_in
#+BEGIN_SRC d
-import sdlang;
+static template configReadInDocTOML() {
+ <<imports_std>>
+ final string configReadInDocTOML(M,E)(M manifest, E env) {
+ auto conf_file_details = ConfigFilePaths!()(manifest, env);
+ string conf_toml = conf_file_details.config_filename_document_toml;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.sisu_document_make;
+ string config_file_str;
+ debug(io) {
+ writeln("WARNING (io debug) in config filename: ", conf_toml);
+ writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations);
+ }
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array;
+ if (config_file_str.length > 0) {
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ return config_file_str;
+ }
+}
#+END_SRC
-*** config hub function read makes for site & doc
-
-Read in sdl config file name given, and return sdl root
+*** 2. TOML config files get
-#+name: meta_config_file_sdlang_hub_site
+#+name: meta_config_file_toml
#+BEGIN_SRC d
-final auto configReadSite(M,E)(M manifest, E env) {
- auto configuration = configInSite!()(manifest, env);
- auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.possible_config_path_locations.config_filename_site;
- auto sdl_root = ConfigSDLang!()(configuration, conf_sdl);
- return sdl_root;
+static template configTOML() {
+ import toml; //
+ <<imports_std>>
+ auto configTOML(string configuration, string conf_toml_filename) {
+ TOMLDocument _toml_conf;
+ try {
+ _toml_conf = parseTOML(configuration); // parseTOML(cast(string)(configuration));
+ }
+ catch(ErrnoException e) {
+ stderr.writeln("Toml problem with content for ", conf_toml_filename);
+ stderr.writeln(e.msg);
+ }
+ return _toml_conf;
+ }
}
#+END_SRC
-#+name: meta_config_file_sdlang_hub_doc
+*** 3. TOML config (config_local_site & sisu_document_make) :file:config:hub:
+
+#+name: meta_config_file_hub
#+BEGIN_SRC d
-final auto configReadDoc(M,E)(M manifest, E env) {
- auto configuration = configInDoc!()(manifest, env);
- auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_document;
- auto sdl_root = ConfigSDLang!()(configuration, conf_sdl);
- return sdl_root;
+static template configReadSiteTOML() {
+ <<imports_std>>
+ import toml;
+ final auto configReadSiteTOML(M,E)(M _manifest, E _env) {
+ auto _configuration = configReadInSiteTOML!()(_manifest, _env);
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ string _conf_toml = _conf_file_details.config_filename_site_toml;
+ auto _toml_conf = configTOML!()(_configuration, _conf_toml);
+ return _toml_conf;
+ }
+}
+static template configReadDocTOML() {
+ <<imports_std>>
+ import toml;
+ final auto configReadDocTOML(M,E)(M _manifest, E _env) {
+ auto _configuration = configReadInDocTOML!()(_manifest, _env);
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ string _conf_toml = _conf_file_details.config_filename_document_toml;
+ auto _toml_conf = configTOML!()(_configuration, _conf_toml);
+ return _toml_conf;
+ }
}
#+END_SRC
@@ -280,7 +485,7 @@ static template SiSUrawMarkupContent() {
<<meta_markup_source_raw_get_insert_source_line_array>>
}
struct Inserts {
- import sdp.meta.defaults;
+ import sdp.meta.conf_make_meta_sdlang;
auto scan_subdoc_source(O)(
O _opt_action,
char[][] markup_sourcefile_insert_content,
@@ -311,7 +516,7 @@ static template SiSUrawMarkupContent() {
#+END_SRC
** get markup source, read file :source:markup:
-*** [#A] read file, source string :string:
+*** read file, source string :string:
#+name: meta_markup_source_raw_read_file_source_string
#+BEGIN_SRC d
@@ -343,12 +548,7 @@ final private string readInMarkupSource(in char[] fn_src) {
}
#+END_SRC
-**** notes
-source_txt_str = readText(fn_src); // ok
-catch (ErrnoException ex) {
-}
-
-*** [#A] document header & content, array.length == 2 :array:
+*** document header & content, array.length == 2 :array:
here you split document header and body, an array.length == 2
split is on first match of level A~ (which is required)
@@ -599,10 +799,6 @@ if (type["curly_code"] == 1) {
insert_file_list ~= to!string(fn_src_insert);
auto raw = MarkupRawUnit();
/+ TODO +/
- if (auto ma = line.match(rgx.src_fn_text)) {
- /+ .sst when inserted, not used: headers and heading level ^:?A~ so remove +/
- writeln(__LINE__); writeln(ma);
- }
auto markup_sourcefile_insert_content
= raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts);
debug(insert_file) {
diff --git a/org/output_sisupod.org b/org/output_sisupod.org
index 82e654b..7af3573 100644
--- a/org/output_sisupod.org
+++ b/org/output_sisupod.org
@@ -152,34 +152,36 @@ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod;
}
}
} { /+ bundle sisu_document_make +/
- auto fn_src_in = ((doc_matters.src.is_pod)
- ? doc_matters.src.conf_dir_path
- : pth_sisudoc_src.conf_root).to!string
- ~ "/" ~ "sisu_document_make";
- auto fn_src_out_sisupod_zip_base
- = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
- auto fn_src_out_filesystem
- = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
- ~ "/" ~ "sisu_document_make"; // TODO
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("WARNING (io debug) src out found: ", fn_src_in);
- }
- if (doc_matters.opt.action.source) {
- fn_src_in.copy(fn_src_out_filesystem);
- }
- if (doc_matters.opt.action.sisupod) {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
- auto zip_data = new OutBuffer();
- zip_data.write((fn_src_in).readText);
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- }
- } else {
- if (doc_matters.opt.action.verbose
- || doc_matters.opt.action.debug_do) {
- writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
+ foreach (extension; [".sdl", ".toml"]) {
+ auto fn_src_in = ((doc_matters.src.is_pod)
+ ? doc_matters.src.conf_dir_path
+ : pth_sisudoc_src.conf_root).to!string
+ ~ "/" ~ "sisu_document_make" ~ extension;
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src_out_filesystem
+ = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ "sisu_document_make" ~ extension; // TODO
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("WARNING (io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.sisupod) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
+ auto zip_data = new OutBuffer();
+ zip_data.write((fn_src_in).readText);
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ }
+ } else {
+ if (doc_matters.opt.action.verbose
+ || doc_matters.opt.action.debug_do) {
+ writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
+ }
}
}
} { /+ TODO bundle primary file +/
diff --git a/org/sdp.org b/org/sdp.org
index d277ec0..dbc5cda 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -26,7 +26,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 23, 3);
+enum ver = Version(0, 24, 0);
#+END_SRC
** compilation restrictions (supported compilers)
@@ -116,10 +116,10 @@ import
sdp.meta,
sdp.meta.metadoc_summary,
sdp.meta.metadoc_from_src,
- sdp.meta.conf_make_meta,
- // sdp.meta.conf_make_meta_native,
+ sdp.meta.conf_make_meta_structs,
sdp.meta.conf_make_meta_sdlang,
- sdp.meta.conf_make_meta_composite,
+ sdp.meta.conf_make_meta_toml,
+ sdp.meta.conf_make_meta_json,
sdp.meta.defaults,
sdp.meta.doc_debugs,
sdp.meta.read_config_files,
@@ -160,6 +160,10 @@ sdlang.exceptions;
std.conv,
std.variant,
+- https://code.dlang.org/packages/toml
+- https://github.com/toml-lang/toml
+- https://github.com/toml-lang/toml/blob/master/README.md
+
**** mixins :mixin:
***** version.txt :version:
@@ -179,8 +183,9 @@ mixin CompileTimeInfo;
#+NAME: sdp_mixin
#+BEGIN_SRC d
mixin SiSUrgxInit;
-mixin SiSUregisters;
+mixin SiSUmakeMetaStructsSDLang;
mixin SiSUextractSDLang;
+mixin contentJSONtoSiSUstruct;
mixin SiSUnode;
mixin SiSUbiblio;
mixin SiSUrgxInitFlags;
@@ -270,6 +275,7 @@ bool[string] opts = [
];
string[string] settings = [
"output-dir" : "",
+ "site-config-dir" : "",
"lang" : "all",
];
auto helpInfo = getopt(args,
@@ -313,6 +319,7 @@ auto helpInfo = getopt(args,
"backmatter", "--section-backmatter process document backmatter (default)", &opts["backmatter"],
"skip-output", "--skip-output", &opts["skip-output"],
"output-dir", "--output-dir=[dir path]", &settings["output-dir"],
+ "site-config-dir", "--site-config-dir=[dir path]", &settings["site-config-dir"],
"lang", "--lang=[lang code e.g. =en or =en,es]", &settings["lang"],
);
if (helpInfo.helpWanted) {
@@ -522,13 +529,26 @@ foreach(arg; args[1..$]) {
}
#+END_SRC
-**** TODO config files (load & read) (so far only SDLang) :config:files:
+**** config files load & read (toml or sdlang)
#+NAME: sdp_conf_files
#+BEGIN_SRC d
-auto sdl_root_config_document = configReadDoc!()(_manifest, _env); // document config file
-auto sdl_root_config_local_site = configReadSite!()(_manifest, _env); // local site config
-auto conf_files_composite_make = confFilesSDLtoStruct!()(sdl_root_config_document, sdl_root_config_local_site);
+auto _config_document_struct = readConfigDoc!()(_manifest, _env); // document config file
+auto _config_local_site_struct = readConfigSite!()(_manifest, _env); // local site config
+ConfCompositePlus _make_and_meta_struct;
+switch (_config_local_site_struct.filetype) {
+case "toml" :
+ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_document_struct);
+ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_local_site_struct);
+ break;
+case "sdl" :
+ auto sdl_root_config_document = parseSDLangConfig!()(_config_document_struct.content, _config_document_struct.filename);
+ auto sdl_root_config_local_site = parseSDLangConfig!()(_config_local_site_struct.content, _config_local_site_struct.filename);
+ _make_and_meta_struct = confFilesSDLtoStruct!()(sdl_root_config_document, sdl_root_config_local_site);
+ break;
+default :
+ break;
+}
#+END_SRC
** 2a. actions independent of processing files
@@ -731,7 +751,8 @@ debug(header_and_body) {
}
#+END_SRC
-** 2. _document metadata_ & _make instructions_ :doc:header:metadata:make:
+** 2. _document metadata_ & _make instructions_ (struct from toml or sdlang) >>
+header: toml or sdlang
- [[./meta_conf_make_meta.org][meta_conf_make_meta]]
- read _document header_, split into:
@@ -750,9 +771,14 @@ debug(header_and_body) {
debug(steps) {
writeln("step2 commence → (read document header - toml or sdlang, return struct)");
}
-auto _make_and_meta_struct
- = docHeaderMakeAndMetaTupExtractAndConvertToStruct!()(
- conf_files_composite_make,
+_make_and_meta_struct =
+((_header_body_insertfilelist_imagelist[headBody.header]).match(rgx.toml_header_meta_title))
+? docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
+ _make_and_meta_struct,
+ _header_body_insertfilelist_imagelist[headBody.header]
+ )
+: docHeaderMakeAndMetaTupSDLangExtractAndConvertToStruct!()(
+ _make_and_meta_struct,
_header_body_insertfilelist_imagelist[headBody.header]
);
debug(steps) {
diff --git a/src/sdp/meta/conf_make_meta.d b/src/sdp/meta/conf_make_meta.d
deleted file mode 100644
index 27c03bb..0000000
--- a/src/sdp/meta/conf_make_meta.d
+++ /dev/null
@@ -1,38 +0,0 @@
-/++
- extract native/orig header return associative array<BR>
-
- the header is passed as text (lopped off top of a sisu markup file until the
- required first heading ^A~), determine whether is a native header or sdlang one
- with a regex check if whether it contains the "native header" required tag/field
- @title: then process accordingly as a "native header" or "sdlang header"
- converting the metadata and make instructions to a common json format used by
- program internally. Moved to associative array.
-+/
-module sdp.meta.conf_make_meta;
-static template docHeaderMakeAndMetaTupExtractAndConvertToStruct() {
- import
- std.exception,
- std.regex,
- std.stdio,
- std.traits,
- std.typecons,
- std.utf,
- std.conv : to;
- import sdlang;
- import
- sdp.meta.conf_make_meta_sdlang,
- sdp.meta.rgx;
- mixin SiSUrgxInit;
- mixin SiSUextractSDLang;
- static auto rgx = Rgx();
- auto docHeaderMakeAndMetaTupExtractAndConvertToStruct(CCm, Src)(
- CCm conf_composite_make,
- Src header_src,
- ) {
- auto header_sdlang_tag = (!(header_src.match(rgx.native_header_meta_title)))
- ? extractSDL().docHeaderSDLtagGet(header_src) // sdlang.ast.Tag
- : null;
- auto header_make_and_meta_struct = extractSDL().docSDLtoStruct(conf_composite_make, header_sdlang_tag);
- return header_make_and_meta_struct;
- }
-}
diff --git a/src/sdp/meta/conf_make_meta_composite.d b/src/sdp/meta/conf_make_meta_composite.d
deleted file mode 100644
index 51e81ec..0000000
--- a/src/sdp/meta/conf_make_meta_composite.d
+++ /dev/null
@@ -1,45 +0,0 @@
-/++
- return composite make from config files
-+/
-module sdp.meta.conf_make_meta_composite;
-
-template confFilesSDLtoStruct() {
- import
- std.exception,
- std.regex,
- std.stdio,
- std.string,
- std.traits,
- std.typecons,
- std.utf,
- std.conv : to;
- import
- sdp.meta.defaults,
- sdp.meta.rgx;
- auto confFilesSDLtoStruct(S,L)(
- S sdl_root_config_share,
- L sdl_root_config_local,
- ){
- mixin SiSUregisters;
- ConfCompositePlus _conf_composite;
- foreach (conf_sdlang; [sdl_root_config_share, sdl_root_config_local]) {
- if ("make" in conf_sdlang.maybe.tags) {
- _conf_composite.make_str.bold = _conf_composite.make.bold = extractSDLangTabOrAttrib(conf_sdlang, "make", "bold");
- _conf_composite.make_str.breaks = _conf_composite.make.breaks = extractSDLangTabOrAttrib(conf_sdlang, "make", "breaks");
- _conf_composite.make_str.cover_image = _conf_composite.make.cover_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "cover_image");
- _conf_composite.make_str.css = _conf_composite.make.css = extractSDLangTabOrAttrib(conf_sdlang, "make", "css");
- _conf_composite.make_str.emphasis = _conf_composite.make.emphasis = extractSDLangTabOrAttrib(conf_sdlang, "make", "emphasis");
- _conf_composite.make_str.footer = _conf_composite.make.footer = extractSDLangTabOrAttrib(conf_sdlang, "make", "footer");
- _conf_composite.make_str.headings = _conf_composite.make.headings = extractSDLangTabOrAttrib(conf_sdlang, "make", "headings");
- _conf_composite.make_str.home_button_image = _conf_composite.make.home_button_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_image");
- _conf_composite.make_str.home_button_text = _conf_composite.make.home_button_text = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_text");
- _conf_composite.make_str.italics = _conf_composite.make.italics = extractSDLangTabOrAttrib(conf_sdlang, "make", "italics");
- _conf_composite.make_str.num_top = _conf_composite.make.num_top = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_top");
- _conf_composite.make_str.num_depth = _conf_composite.make.num_depth = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_depth");
- _conf_composite.make_str.substitute = _conf_composite.make.substitute = extractSDLangTabOrAttrib(conf_sdlang, "make", "substitute");
- _conf_composite.make_str.texpdf_font = _conf_composite.make.texpdf_font = extractSDLangTabOrAttrib(conf_sdlang, "make", "texpdf_font");
- }
- }
- return _conf_composite;
- }
-}
diff --git a/src/sdp/meta/conf_make_meta_json.d b/src/sdp/meta/conf_make_meta_json.d
new file mode 100644
index 0000000..88e24da
--- /dev/null
+++ b/src/sdp/meta/conf_make_meta_json.d
@@ -0,0 +1,369 @@
+/++
+ json headers<BR>
+ extract json header return json
++/
+module sdp.meta.conf_make_meta_json;
+static template contentJSONtoSiSUstruct() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import
+ sdp.meta.conf_make_meta_structs,
+ sdp.meta.conf_make_meta_json,
+ sdp.meta.rgx;
+ ConfCompositePlus _struct_composite;
+ auto contentJSONtoSiSUstruct(C, J)(C _struct_composite, J _json, string _identifier) {
+ mixin SiSUrgxInit;
+ static auto _rgx = Rgx();
+ debug (json) {
+ writeln(">> --------------------------- >>");
+ foreach (tag0; _json.object.byKeyValue) {
+ if (tag0.value.stringof == "string") {
+ writeln(tag0.key, ": ", tag0.value);
+ } else {
+ // writeln(tag0.key, ":");
+ foreach (tag1; tag0.value.object.byKeyValue) {
+ writeln(tag0.key, ":", tag1.key, ": ", tag1.value);
+ }
+ }
+ }
+ writeln("<< --------------------------- <<");
+ }
+ confCompositeMakeBuild _mk;
+ /+ make ------------------------------------------------------------------- +/
+ if ("make" in _json.object) {
+ if ("bold" in _json.object["make"]) {
+ _struct_composite.make_str.bold = _json.object["make"]["bold"].str;
+ }
+ if ("breaks" in _json.object["make"]) {
+ _struct_composite.make_str.breaks = _json.object["make"]["breaks"].str;
+ }
+ if ("cover_image" in _json.object["make"]) {
+ _struct_composite.make_str.cover_image = _json.object["make"]["cover_image"].str;
+ }
+ if ("css" in _json.object["make"]) {
+ _struct_composite.make_str.css = _json.object["make"]["css"].str;
+ }
+ if ("emphasis" in _json.object["make"]) {
+ _struct_composite.make_str.emphasis = _json.object["make"]["emphasis"].str;
+ }
+ if ("footer" in _json.object["make"]) {
+ _struct_composite.make_str.footer = _json.object["make"]["footer"].str;
+ }
+ if ("headings" in _json.object["make"]) {
+ _struct_composite.make_str.headings = _json.object["make"]["headings"].str;
+ }
+ if ("home_button_image" in _json.object["make"]) {
+ _struct_composite.make_str.home_button_image = _json.object["make"]["home_button_image"].str;
+ }
+ if ("home_button_text" in _json.object["make"]) {
+ _struct_composite.make_str.home_button_text = _json.object["make"]["home_button_text"].str;
+ }
+ if ("italics" in _json.object["make"]) {
+ _struct_composite.make_str.italics = _json.object["make"]["italics"].str;
+ }
+ if ("num_top" in _json.object["make"]) {
+ _struct_composite.make_str.num_top = _json.object["make"]["num_top"].str;
+ }
+ if ("num_depth" in _json.object["make"]) {
+ _struct_composite.make_str.num_depth = _json.object["num_depth"][""].str;
+ }
+ if ("substitute" in _json.object["make"]) {
+ _struct_composite.make_str.substitute = _json.object["make"]["substitute"].str;
+ }
+ if ("texpdf_font" in _json.object["make"]) {
+ _struct_composite.make_str.texpdf_font = _json.object["make"]["texpdf_font"].str;
+ }
+ _struct_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_struct_composite.make_str.bold);
+ _struct_composite.make.breaks = _mk.breaks(_struct_composite.make_str.breaks);
+ _struct_composite.make.cover_image = _mk.cover_image(_struct_composite.make_str.cover_image);
+ _struct_composite.make.css = _mk.css(_struct_composite.make_str.css);
+ _struct_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_struct_composite.make_str.emphasis);
+ _struct_composite.make.footer = _mk.footer(_struct_composite.make_str.footer);
+ _struct_composite.make.headings = _mk.headings(_struct_composite.make_str.headings);
+ _struct_composite.make.home_button_image = _mk.home_button_image(_struct_composite.make_str.home_button_image);
+ _struct_composite.make.home_button_text = _mk.home_button_text(_struct_composite.make_str.home_button_text);
+ _struct_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_struct_composite.make_str.italics);
+ _struct_composite.make.num_top = _mk.num_top(_struct_composite.make_str.num_top);
+ _struct_composite.make.num_depth = _mk.num_depth(_struct_composite.make_str.num_depth);
+ _struct_composite.make.substitute = _mk.substitute(_struct_composite.make_str.substitute);
+ _struct_composite.make.texpdf_font = _mk.texpdf_font(_struct_composite.make_str.texpdf_font);
+ }
+ /+ conf ------------------------------------------------------------------- +/
+ if ("webserv" in _json.object) {
+ if ("url_root" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_url_root = _json.object["webserv"]["url_root"].str;
+ }
+ if ("path" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_path = _json.object["webserv"]["path"].str;
+ }
+ if ("images" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_images = _json.object["webserv"]["images"].str;
+ }
+ if ("cgi" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi = _json.object["webserv"]["cgi"].str;
+ }
+ if ("cgi_host" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_host = _json.object["webserv"]["cgi_host"].str;
+ }
+ if ("cgi_host_path" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_host_path = _json.object["webserv"]["cgi_host_path"].str;
+ }
+ if ("cgi_port" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_port = _json.object["webserv"]["cgi_port"].str;
+ }
+ if ("cgi_user" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_user = _json.object["webserv"]["cgi_user"].str;
+ }
+ if ("cgi_file_links" in _json.object["webserv"]) {
+ _struct_composite.conf.webserv_cgi_file_links = _json.object["webserv"]["cgi_file_links"].str;
+ }
+ }
+ if ("processing" in _json.object) { // TODO check & match logic with sdlang
+ if ("path" in _json.object["processing"]) {
+ _struct_composite.conf.processing_path = _json.object["processing"]["path"].str;
+ }
+ if ("dir" in _json.object["processing"]) {
+ _struct_composite.conf.processing_dir = _json.object["processing"]["dir"].str;
+ }
+ if ("concord_max" in _json.object["processing"]) {
+ _struct_composite.conf.processing_concord_max = _json.object["processing"]["concord_max"].str;
+ }
+ }
+ if ("flag" in _json.object) {
+ if ("act0" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act0 = _json.object["flag"]["act0"].str;
+ }
+ if ("act1" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act1 = _json.object["flag"]["act1"].str;
+ }
+ if ("act2" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act2 = _json.object["flag"]["act2"].str;
+ }
+ if ("act3" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act3 = _json.object["flag"]["act3"].str;
+ }
+ if ("act4" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act4 = _json.object["flag"]["act4"].str;
+ }
+ if ("act5" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act5 = _json.object["flag"]["act5"].str;
+ }
+ if ("act6" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act6 = _json.object["flag"]["act6"].str;
+ }
+ if ("act7" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act7 = _json.object["flag"]["act7"].str;
+ }
+ if ("act8" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act8 = _json.object["flag"]["act8"].str;
+ }
+ if ("act9" in _json.object["flag"]) {
+ _struct_composite.conf.flag_act9 = _json.object["flag"]["act9"].str;
+ }
+ }
+ if ("default" in _json.object) {
+ if ("papersize" in _json.object["default"]) {
+ _struct_composite.conf.default_papersize = _json.object["default"]["papersize"].str;
+ }
+ if ("text_wrap" in _json.object["default"]) {
+ _struct_composite.conf.default_text_wrap = _json.object["default"]["text_wrap"].str;
+ }
+ if ("emphasis" in _json.object["default"]) {
+ _struct_composite.conf.default_emphasis = _json.object["default"]["emphasis"].str;
+ }
+ if ("language" in _json.object["default"]) {
+ _struct_composite.conf.default_language = _json.object["default"]["language"].str;
+ }
+ if ("digest" in _json.object["default"]) {
+ _struct_composite.conf.default_digest = _json.object["default"]["digest"].str;
+ }
+ }
+ if ("search" in _json.object) {
+ if ("flag" in _json.object["search"]) {
+ _struct_composite.conf.search_flag = _json.object["search"]["flag"].str;
+ }
+ if ("action" in _json.object["search"]) {
+ _struct_composite.conf.search_action = _json.object["search"]["action"].str;
+ }
+ if ("db" in _json.object["search"]) {
+ _struct_composite.conf.search_db = _json.object["search"]["db"].str;
+ }
+ if ("title" in _json.object["search"]) {
+ _struct_composite.conf.search_title = _json.object["search"]["title"].str;
+ }
+ }
+ /+ meta ------------------------------------------------------------------- +/
+ if ("classify" in _json.object) {
+ if ("dewey" in _json.object["classify"]) {
+ _struct_composite.meta.classify_dewey = _json.object["classify"]["dewey"].str;
+ }
+ if ("keywords" in _json.object["classify"]) {
+ _struct_composite.meta.classify_keywords = _json.object["classify"]["keywords"].str;
+ }
+ if ("loc" in _json.object["classify"]) {
+ _struct_composite.meta.classify_loc = _json.object["classify"]["loc"].str;
+ }
+ if ("subject" in _json.object["classify"]) {
+ _struct_composite.meta.classify_subject = _json.object["classify"]["subject"].str;
+ }
+ if ("topic_register" in _json.object["classify"]) {
+ _struct_composite.meta.classify_topic_register = _json.object["classify"]["topic_register"].str;
+ }
+ }
+ if ("date" in _json.object) {
+ if ("added_to_site" in _json.object["date"]) {
+ _struct_composite.meta.date_added_to_site = _json.object["date"]["added_to_site"].str;
+ }
+ if ("available" in _json.object["date"]) {
+ _struct_composite.meta.date_available = _json.object["date"]["available"].str;
+ }
+ if ("created" in _json.object["date"]) {
+ _struct_composite.meta.date_created = _json.object["date"]["created"].str;
+ }
+ if ("issued" in _json.object["date"]) {
+ _struct_composite.meta.date_issued = _json.object["date"]["issued"].str;
+ }
+ if ("modified" in _json.object["date"]) {
+ _struct_composite.meta.date_modified = _json.object["date"]["modified"].str;
+ }
+ if ("published" in _json.object["date"]) {
+ _struct_composite.meta.date_published = _json.object["date"]["published"].str;
+ }
+ if ("valid" in _json.object["date"]) {
+ _struct_composite.meta.date_valid = _json.object["date"]["valid"].str;
+ }
+ }
+ if ("links" in _json.object) {
+ // if ("" in _json.object["links"]) {
+ // _struct_composite.meta.links_ = _json.object["links"][""].str;
+ // }
+ }
+ if ("notes" in _json.object) {
+ if ("abstract" in _json.object["notes"]) {
+ _struct_composite.meta.notes_abstract = _json.object["notes"]["abstract"].str;
+ }
+ if ("description" in _json.object["notes"]) {
+ _struct_composite.meta.notes_description = _json.object["notes"]["description"].str;
+ }
+ }
+ if ("original" in _json.object) {
+ if ("language" in _json.object["original"]) {
+ _struct_composite.meta.original_language = _json.object["original"]["language"].str;
+ }
+ if ("language_char" in _json.object["original"]) {
+ _struct_composite.meta.original_language_char = _json.object["original"]["language_char"].str;
+ }
+ if ("source" in _json.object["original"]) {
+ _struct_composite.meta.original_source = _json.object["original"]["source"].str;
+ }
+ if ("title" in _json.object["original"]) {
+ _struct_composite.meta.original_title = _json.object["original"]["title"].str;
+ }
+ }
+ if ("publisher" in _json.object) {
+ // if ("" in _json.object["publisher"]) {
+ // _struct_composite.meta.publisher = _json.object["publisher"][""].str;
+ // }
+ }
+ if ("rights" in _json.object) {
+ if ("copyright" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright = _json.object["rights"]["copyright"].str;
+ }
+ if ("copyright_text" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_text = _json.object["rights"]["copyright_text"].str;
+ }
+ if ("copyright_audio" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_audio = _json.object["rights"]["copyright_audio"].str;
+ }
+ if ("copyright_cover" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_cover = _json.object["rights"]["copyright_cover"].str;
+ }
+ if ("copyright_illustrations" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_illustrations = _json.object["rights"]["copyright_illustrations"].str;
+ }
+ if ("copyright_photographs" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_photographs = _json.object["rights"]["copyright_photographs"].str;
+ }
+ if ("copyright_translation" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_translation = _json.object["rights"]["copyright_translation"].str;
+ }
+ if ("copyright_video" in _json.object["rights"]) {
+ _struct_composite.meta.rights_copyright_video = _json.object["rights"]["copyright_video"].str;
+ }
+ if ("license" in _json.object["rights"]) {
+ _struct_composite.meta.rights_license = _json.object["rights"]["license"].str;
+ }
+ }
+ if (_struct_composite.meta.creator_author.empty) {
+ if ("creator" in _json.object) {
+ if ("author" in _json.object["creator"]) {
+ _struct_composite.meta.creator_author = _json.object["creator"]["author"].str;
+ }
+ if ("email" in _json.object["creator"]) {
+ _struct_composite.meta.creator_author_email = _json.object["creator"]["email"].str;
+ }
+ if ("illustrator" in _json.object["creator"]) {
+ _struct_composite.meta.creator_illustrator = _json.object["creator"]["illustrator"].str;
+ }
+ if ("translator" in _json.object["creator"]) {
+ _struct_composite.meta.creator_translator = _json.object["creator"]["translator"].str;
+ }
+ }
+ // dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"];
+ string[] authors_arr;
+ auto authors_raw_arr = _struct_composite.meta.creator_author.split(_rgx.arr_delimiter);
+ foreach (author_raw; authors_raw_arr) {
+ authors_arr ~= author_raw.replace(_rgx.raw_author_munge, "$2 $1");
+ }
+ _struct_composite.meta.creator_author = join(authors_arr, ", ").chomp.chomp;
+ }
+ if (_struct_composite.meta.title_main.empty) {
+ if ("title" in _json.object) {
+ if ((_json.object["title"].type().to!string) == "STRING") {
+ _struct_composite.meta.title_main = _json.object["title"].str;
+ } else {
+ if ("edition" in _json.object["title"]) {
+ _struct_composite.meta.title_edition = _json.object["title"]["edition"].str;
+ }
+ if ("full" in _json.object["title"]) {
+ // _struct_composite.meta.title_full = _json.object["title"]["full"].str;
+ }
+ if ("language" in _json.object["title"]) {
+ _struct_composite.meta.title_language = _json.object["title"]["language"].str;
+ }
+ if ("main" in _json.object["title"]) {
+ _struct_composite.meta.title_main = _json.object["title"]["main"].str;
+ }
+ if ("note" in _json.object["title"]) {
+ _struct_composite.meta.title_note = _json.object["title"]["note"].str;
+ }
+ if ("sub" in _json.object["title"]) {
+ _struct_composite.meta.title_sub = _json.object["title"]["sub"].str;
+ }
+ if ("subtitle" in _json.object["title"]) {
+ _struct_composite.meta.title_subtitle = _json.object["title"]["subtitle"].str;
+ }
+ }
+ }
+ if ((!(_struct_composite.meta.title_subtitle.empty))
+ && (_struct_composite.meta.title_sub.empty)) {
+ _struct_composite.meta.title_sub = _struct_composite.meta.title_subtitle;
+ }
+ _struct_composite.meta.title_full = (_struct_composite.meta.title_sub.empty)
+ ? _struct_composite.meta.title_main
+ : format(
+ "%s - %s",
+ _struct_composite.meta.title_main,
+ _struct_composite.meta.title_sub,
+ );
+ }
+ return _struct_composite;
+ }
+}
diff --git a/src/sdp/meta/conf_make_meta_sdlang.d b/src/sdp/meta/conf_make_meta_sdlang.d
index ef395d0..4ebe960 100644
--- a/src/sdp/meta/conf_make_meta_sdlang.d
+++ b/src/sdp/meta/conf_make_meta_sdlang.d
@@ -1,8 +1,45 @@
/++
+ extract native/orig header return associative array<BR>
+
+ the header is passed as text (lopped off top of a sisu markup file until the
+ required first heading ^A~), determine whether is a native header or sdlang one
+ with a regex check if whether it contains the "native header" required tag/field
+ @title: then process accordingly as a "native header" or "sdlang header"
+ converting the metadata and make instructions to a common json format used by
+ program internally. Moved to associative array.
++/
+module sdp.meta.conf_make_meta_sdlang;
+static template docHeaderMakeAndMetaTupSDLangExtractAndConvertToStruct() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import sdlang;
+ import
+ sdp.meta.conf_make_meta_sdlang,
+ sdp.meta.rgx;
+ mixin SiSUrgxInit;
+ mixin SiSUextractSDLang;
+ static auto rgx = Rgx();
+ auto docHeaderMakeAndMetaTupSDLangExtractAndConvertToStruct(CCm, Src)(
+ CCm conf_composite_make,
+ Src header_src,
+ ) {
+ auto header_sdlang_tag = (header_src.match(rgx.sdlang_header_meta_title))
+ ? extractSDL().docHeaderSDLtagGet(header_src) // sdlang.ast.Tag
+ : null;
+ auto header_make_and_meta_struct = extractSDL().docSDLtoStruct(conf_composite_make, header_sdlang_tag);
+ return header_make_and_meta_struct;
+ }
+}
+/++
sdlang headers<BR>
extract sdlang header return sdlang
+/
-module sdp.meta.conf_make_meta_sdlang;
static template SiSUextractSDLang() {
import
std.exception,
@@ -14,10 +51,10 @@ static template SiSUextractSDLang() {
std.utf,
std.conv : to;
import
- sdp.meta.defaults,
+ sdp.meta.conf_make_meta_structs,
sdp.meta.rgx;
struct extractSDL {
- mixin SiSUregisters;
+ mixin SiSUmakeMetaStructsSDLang;
mixin SiSUrgxInit;
static auto rgx = Rgx();
private auto docHeaderSDLtagGet(Hs)(Hs src_header) {
@@ -69,104 +106,118 @@ static template SiSUextractSDLang() {
}
return sdl_root_header; // sdlang.ast.Tag
}
- private auto docSDLtoStruct(C,Tag)(C _conf_composite, Tag header_sdlang) {
- mixin SiSUregisters;
- /+ make +/
+ private auto docSDLtoStruct(C,Tag)(C _conf_composite, Tag header_sdlang) { // work on
+ /+ make ------------------------------------------------------------------- +/
if ("make" in header_sdlang.maybe.tags) {
- _conf_composite.make_str.bold = _conf_composite.make.bold = extractSDLangTabOrAttrib(header_sdlang, "make", "bold");
- _conf_composite.make_str.breaks = _conf_composite.make.breaks = extractSDLangTabOrAttrib(header_sdlang, "make", "breaks");
- _conf_composite.make_str.cover_image = _conf_composite.make.cover_image = extractSDLangTabOrAttrib(header_sdlang, "make", "cover_image");
- _conf_composite.make_str.css = _conf_composite.make.css = extractSDLangTabOrAttrib(header_sdlang, "make", "css");
- _conf_composite.make_str.emphasis = _conf_composite.make.emphasis = extractSDLangTabOrAttrib(header_sdlang, "make", "emphasis");
- _conf_composite.make_str.footer = _conf_composite.make.footer = extractSDLangTabOrAttrib(header_sdlang, "make", "footer");
- _conf_composite.make_str.headings = _conf_composite.make.headings = extractSDLangTabOrAttrib(header_sdlang, "make", "headings");
- _conf_composite.make_str.home_button_image = _conf_composite.make.home_button_image = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_image");
- _conf_composite.make_str.home_button_text = _conf_composite.make.home_button_text = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_text");
- _conf_composite.make_str.italics = _conf_composite.make.italics = extractSDLangTabOrAttrib(header_sdlang, "make", "italics");
- _conf_composite.make_str.num_top = _conf_composite.make.num_top = extractSDLangTabOrAttrib(header_sdlang, "make", "num_top");
- _conf_composite.make_str.num_depth = _conf_composite.make.num_depth = extractSDLangTabOrAttrib(header_sdlang, "make", "num_depth");
- _conf_composite.make_str.substitute = _conf_composite.make.substitute = extractSDLangTabOrAttrib(header_sdlang, "make", "substitute");
- _conf_composite.make_str.texpdf_font = _conf_composite.make.texpdf_font = extractSDLangTabOrAttrib(header_sdlang, "make", "texpdf_font");
- }
- /+ conf +/
+ confCompositeMakeBuild _mk;
+ _conf_composite.make_str.bold = extractSDLangTabOrAttrib(header_sdlang, "make", "bold"); // TODO
+ _conf_composite.make_str.breaks = extractSDLangTabOrAttrib(header_sdlang, "make", "breaks");
+ _conf_composite.make_str.cover_image = extractSDLangTabOrAttrib(header_sdlang, "make", "cover_image");
+ _conf_composite.make_str.css = extractSDLangTabOrAttrib(header_sdlang, "make", "css");
+ _conf_composite.make_str.emphasis = extractSDLangTabOrAttrib(header_sdlang, "make", "emphasis"); // TODO
+ _conf_composite.make_str.footer = extractSDLangTabOrAttrib(header_sdlang, "make", "footer");
+ _conf_composite.make_str.headings = extractSDLangTabOrAttrib(header_sdlang, "make", "headings");
+ _conf_composite.make_str.home_button_image = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_image");
+ _conf_composite.make_str.home_button_text = extractSDLangTabOrAttrib(header_sdlang, "make", "home_button_text");
+ _conf_composite.make_str.italics = extractSDLangTabOrAttrib(header_sdlang, "make", "italics"); // TODO
+ _conf_composite.make_str.num_top = extractSDLangTabOrAttrib(header_sdlang, "make", "num_top");
+ _conf_composite.make_str.num_depth = extractSDLangTabOrAttrib(header_sdlang, "make", "num_depth");
+ _conf_composite.make_str.substitute = extractSDLangTabOrAttrib(header_sdlang, "make", "substitute"); // TODO
+ _conf_composite.make_str.texpdf_font = extractSDLangTabOrAttrib(header_sdlang, "make", "texpdf_font");
+ _conf_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_conf_composite.make_str.bold);
+ _conf_composite.make.breaks = _mk.breaks(_conf_composite.make_str.breaks);
+ _conf_composite.make.cover_image = _mk.cover_image(_conf_composite.make_str.cover_image);
+ _conf_composite.make.css = _mk.css(_conf_composite.make_str.css);
+ _conf_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_conf_composite.make_str.emphasis);
+ _conf_composite.make.footer = _mk.footer(_conf_composite.make_str.footer);
+ _conf_composite.make.headings = _mk.headings(_conf_composite.make_str.headings);
+ _conf_composite.make.home_button_image = _mk.home_button_image(_conf_composite.make_str.home_button_image);
+ _conf_composite.make.home_button_text = _mk.home_button_text(_conf_composite.make_str.home_button_text);
+ _conf_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_conf_composite.make_str.italics);
+ _conf_composite.make.num_top = _mk.num_top(_conf_composite.make_str.num_top);
+ _conf_composite.make.num_depth = _mk.num_depth(_conf_composite.make_str.num_depth);
+ _conf_composite.make.substitute = _mk.substitute(_conf_composite.make_str.substitute);
+ _conf_composite.make.texpdf_font = _mk.texpdf_font(_conf_composite.make_str.texpdf_font);
+ }
+ /+ conf ------------------------------------------------------------------- +/
if ("webserv" in header_sdlang.maybe.tags) {
- _conf_composite.conf.webserv_url_root = extractSDLangTabOrAttrib(header_sdlang, "webserv", "url_root");
- _conf_composite.conf.webserv_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "path");
- _conf_composite.conf.webserv_images = extractSDLangTabOrAttrib(header_sdlang, "webserv", "images");
- _conf_composite.conf.webserv_cgi = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi");
- _conf_composite.conf.webserv_cgi_host = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host");
- _conf_composite.conf.webserv_cgi_host_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host_path");
- _conf_composite.conf.webserv_cgi_port = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_port");
- _conf_composite.conf.webserv_cgi_user = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_user");
- _conf_composite.conf.webserv_cgi_file_links = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_file_links");
+ _conf_composite.conf.webserv_url_root = extractSDLangTabOrAttrib(header_sdlang, "webserv", "url_root");
+ _conf_composite.conf.webserv_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "path");
+ _conf_composite.conf.webserv_images = extractSDLangTabOrAttrib(header_sdlang, "webserv", "images");
+ _conf_composite.conf.webserv_cgi = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi");
+ _conf_composite.conf.webserv_cgi_host = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host");
+ _conf_composite.conf.webserv_cgi_host_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_host_path");
+ _conf_composite.conf.webserv_cgi_port = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_port");
+ _conf_composite.conf.webserv_cgi_user = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_user");
+ _conf_composite.conf.webserv_cgi_file_links = extractSDLangTabOrAttrib(header_sdlang, "webserv", "cgi_file_links");
}
if ("processing" in header_sdlang.maybe.tags) {
- _conf_composite.conf.processing_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_path");
- _conf_composite.conf.processing_dir = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_dir");
- _conf_composite.conf.processing_concord_max = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_concord_max");
- }
- if("flag" in header_sdlang.maybe.tags) {
- _conf_composite.conf.flag_act0 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act0");
- _conf_composite.conf.flag_act1 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act1");
- _conf_composite.conf.flag_act2 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act2");
- _conf_composite.conf.flag_act3 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act3");
- _conf_composite.conf.flag_act4 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act4");
- _conf_composite.conf.flag_act5 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act5");
- _conf_composite.conf.flag_act6 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act6");
- _conf_composite.conf.flag_act7 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act7");
- _conf_composite.conf.flag_act8 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act8");
- _conf_composite.conf.flag_act9 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act9");
+ _conf_composite.conf.processing_path = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_path");
+ _conf_composite.conf.processing_dir = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_dir");
+ _conf_composite.conf.processing_concord_max = extractSDLangTabOrAttrib(header_sdlang, "webserv", "processing_concord_max");
+ }
+ if ("flag" in header_sdlang.maybe.tags) {
+ _conf_composite.conf.flag_act0 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act0");
+ _conf_composite.conf.flag_act1 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act1");
+ _conf_composite.conf.flag_act2 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act2");
+ _conf_composite.conf.flag_act3 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act3");
+ _conf_composite.conf.flag_act4 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act4");
+ _conf_composite.conf.flag_act5 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act5");
+ _conf_composite.conf.flag_act6 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act6");
+ _conf_composite.conf.flag_act7 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act7");
+ _conf_composite.conf.flag_act8 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act8");
+ _conf_composite.conf.flag_act9 = extractSDLangTabOrAttrib(header_sdlang, "flag", "act9");
}
if ("default" in header_sdlang.maybe.tags) {
- _conf_composite.conf.default_papersize = extractSDLangTabOrAttrib(header_sdlang, "default", "papersize");
- _conf_composite.conf.default_text_wrap = extractSDLangTabOrAttrib(header_sdlang, "default", "text_wrap");
- _conf_composite.conf.default_emphasis = extractSDLangTabOrAttrib(header_sdlang, "default", "emphasis");
- _conf_composite.conf.default_language = extractSDLangTabOrAttrib(header_sdlang, "default", "language");
- _conf_composite.conf.default_digest = extractSDLangTabOrAttrib(header_sdlang, "default", "digest");
+ _conf_composite.conf.default_papersize = extractSDLangTabOrAttrib(header_sdlang, "default", "papersize");
+ _conf_composite.conf.default_text_wrap = extractSDLangTabOrAttrib(header_sdlang, "default", "text_wrap");
+ _conf_composite.conf.default_emphasis = extractSDLangTabOrAttrib(header_sdlang, "default", "emphasis");
+ _conf_composite.conf.default_language = extractSDLangTabOrAttrib(header_sdlang, "default", "language");
+ _conf_composite.conf.default_digest = extractSDLangTabOrAttrib(header_sdlang, "default", "digest");
}
if ("search" in header_sdlang.maybe.tags) {
- _conf_composite.conf.search_flag = extractSDLangTabOrAttrib(header_sdlang, "search", "flag");
- _conf_composite.conf.search_action = extractSDLangTabOrAttrib(header_sdlang, "search", "action");
- _conf_composite.conf.search_db = extractSDLangTabOrAttrib(header_sdlang, "search", "db");
- _conf_composite.conf.search_title = extractSDLangTabOrAttrib(header_sdlang, "search", "title");
+ _conf_composite.conf.search_flag = extractSDLangTabOrAttrib(header_sdlang, "search", "flag");
+ _conf_composite.conf.search_action = extractSDLangTabOrAttrib(header_sdlang, "search", "action");
+ _conf_composite.conf.search_db = extractSDLangTabOrAttrib(header_sdlang, "search", "db");
+ _conf_composite.conf.search_title = extractSDLangTabOrAttrib(header_sdlang, "search", "title");
}
- /+ meta +/
+ /+ meta ------------------------------------------------------------------- +/
if ("classify" in header_sdlang.maybe.tags) {
- _conf_composite.meta.classify_dewey = extractSDLangTabOrAttrib(header_sdlang, "classify", "dewey");
- _conf_composite.meta.classify_keywords = extractSDLangTabOrAttrib(header_sdlang, "classify", "keywords");
- _conf_composite.meta.classify_loc = extractSDLangTabOrAttrib(header_sdlang, "classify", "loc");
- _conf_composite.meta.classify_subject = extractSDLangTabOrAttrib(header_sdlang, "classify", "subject");
- _conf_composite.meta.classify_topic_register = extractSDLangTabOrAttrib(header_sdlang, "classify", "topic_register");
+ _conf_composite.meta.classify_dewey = extractSDLangTabOrAttrib(header_sdlang, "classify", "dewey");
+ _conf_composite.meta.classify_keywords = extractSDLangTabOrAttrib(header_sdlang, "classify", "keywords");
+ _conf_composite.meta.classify_loc = extractSDLangTabOrAttrib(header_sdlang, "classify", "loc");
+ _conf_composite.meta.classify_subject = extractSDLangTabOrAttrib(header_sdlang, "classify", "subject");
+ _conf_composite.meta.classify_topic_register = extractSDLangTabOrAttrib(header_sdlang, "classify", "topic_register");
}
if ("date" in header_sdlang.maybe.tags) {
- _conf_composite.meta.date_added_to_site = extractSDLangTabOrAttrib(header_sdlang, "date", "added_to_site");
- _conf_composite.meta.date_available = extractSDLangTabOrAttrib(header_sdlang, "date", "available");
- _conf_composite.meta.date_created = extractSDLangTabOrAttrib(header_sdlang, "date", "created");
- _conf_composite.meta.date_issued = extractSDLangTabOrAttrib(header_sdlang, "date", "issued");
- _conf_composite.meta.date_modified = extractSDLangTabOrAttrib(header_sdlang, "date", "modified");
- _conf_composite.meta.date_published = extractSDLangTabOrAttrib(header_sdlang, "date", "published");
- _conf_composite.meta.date_valid = extractSDLangTabOrAttrib(header_sdlang, "date", "valid");
- }
- if("identifier" in header_sdlang.maybe.tags) {
- _conf_composite.meta.identifier_isbn = extractSDLangTabOrAttrib(header_sdlang, "identifier", "isbn");
- _conf_composite.meta.identifier_oclc = extractSDLangTabOrAttrib(header_sdlang, "identifier", "oclc");
- _conf_composite.meta.identifier_pg = extractSDLangTabOrAttrib(header_sdlang, "identifier", "pg");
+ _conf_composite.meta.date_added_to_site = extractSDLangTabOrAttrib(header_sdlang, "date", "added_to_site");
+ _conf_composite.meta.date_available = extractSDLangTabOrAttrib(header_sdlang, "date", "available");
+ _conf_composite.meta.date_created = extractSDLangTabOrAttrib(header_sdlang, "date", "created");
+ _conf_composite.meta.date_issued = extractSDLangTabOrAttrib(header_sdlang, "date", "issued");
+ _conf_composite.meta.date_modified = extractSDLangTabOrAttrib(header_sdlang, "date", "modified");
+ _conf_composite.meta.date_published = extractSDLangTabOrAttrib(header_sdlang, "date", "published");
+ _conf_composite.meta.date_valid = extractSDLangTabOrAttrib(header_sdlang, "date", "valid");
+ }
+ if ("identifier" in header_sdlang.maybe.tags) {
+ _conf_composite.meta.identifier_isbn = extractSDLangTabOrAttrib(header_sdlang, "identifier", "isbn");
+ _conf_composite.meta.identifier_oclc = extractSDLangTabOrAttrib(header_sdlang, "identifier", "oclc");
+ _conf_composite.meta.identifier_pg = extractSDLangTabOrAttrib(header_sdlang, "identifier", "pg");
}
if ("links" in header_sdlang.maybe.tags) {
- // _conf_composite.meta.links = extractSDLangTabOrAttrib(header_sdlang, "links", "");
+ // _conf_composite.meta.links = extractSDLangTabOrAttrib(header_sdlang, "links", "");
}
if ("notes" in header_sdlang.maybe.tags) {
- _conf_composite.meta.notes_abstract = extractSDLangTabOrAttrib(header_sdlang, "notes", "abstract");
- _conf_composite.meta.notes_description = extractSDLangTabOrAttrib(header_sdlang, "notes", "description");
+ _conf_composite.meta.notes_abstract = extractSDLangTabOrAttrib(header_sdlang, "notes", "abstract");
+ _conf_composite.meta.notes_description = extractSDLangTabOrAttrib(header_sdlang, "notes", "description");
}
if ("original" in header_sdlang.maybe.tags) {
- _conf_composite.meta.original_language = extractSDLangTabOrAttrib(header_sdlang, "original", "language");
- _conf_composite.meta.original_language_char = extractSDLangTabOrAttrib(header_sdlang, "original", "language_char");
- _conf_composite.meta.original_source = extractSDLangTabOrAttrib(header_sdlang, "original", "source");
- _conf_composite.meta.original_title = extractSDLangTabOrAttrib(header_sdlang, "original", "title");
+ _conf_composite.meta.original_language = extractSDLangTabOrAttrib(header_sdlang, "original", "language");
+ _conf_composite.meta.original_language_char = extractSDLangTabOrAttrib(header_sdlang, "original", "language_char");
+ _conf_composite.meta.original_source = extractSDLangTabOrAttrib(header_sdlang, "original", "source");
+ _conf_composite.meta.original_title = extractSDLangTabOrAttrib(header_sdlang, "original", "title");
}
if ("publisher" in header_sdlang.maybe.tags) {
- // _conf_composite.meta.publisher = extractSDLangTabOrAttrib(header_sdlang, "publisher", "");
+ // _conf_composite.meta.publisher = extractSDLangTabOrAttrib(header_sdlang, "publisher", "");
}
if ("rights" in header_sdlang.maybe.tags) {
_conf_composite.meta.rights_copyright = extractSDLangTabOrAttrib(header_sdlang, "rights", "copyright");
@@ -181,10 +232,10 @@ static template SiSUextractSDLang() {
}
if (_conf_composite.meta.creator_author.empty) {
if ("creator" in header_sdlang.maybe.tags) {
- _conf_composite.meta.creator_author = extractSDLangTabOrAttrib(header_sdlang, "creator", "author");
- _conf_composite.meta.creator_author_email = extractSDLangTabOrAttrib(header_sdlang, "creator", "author_email");
- _conf_composite.meta.creator_illustrator = extractSDLangTabOrAttrib(header_sdlang, "creator", "illustrator");
- _conf_composite.meta.creator_translator = extractSDLangTabOrAttrib(header_sdlang, "creator", "translator");
+ _conf_composite.meta.creator_author = extractSDLangTabOrAttrib(header_sdlang, "creator", "author");
+ _conf_composite.meta.creator_author_email = extractSDLangTabOrAttrib(header_sdlang, "creator", "author_email");
+ _conf_composite.meta.creator_illustrator = extractSDLangTabOrAttrib(header_sdlang, "creator", "illustrator");
+ _conf_composite.meta.creator_translator = extractSDLangTabOrAttrib(header_sdlang, "creator", "translator");
}
// dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"];
string[] authors_arr;
@@ -196,12 +247,13 @@ static template SiSUextractSDLang() {
}
if (_conf_composite.meta.title_main.empty) {
if ("title" in header_sdlang.maybe.tags) {
- _conf_composite.meta.title_edition = extractSDLangTabOrAttrib(header_sdlang, "title", "edition");
- _conf_composite.meta.title_language = extractSDLangTabOrAttrib(header_sdlang, "title", "language");
- _conf_composite.meta.title_main = extractSDLangTabOrAttrib(header_sdlang, "title", "main");
- _conf_composite.meta.title_note = extractSDLangTabOrAttrib(header_sdlang, "title", "note");
- _conf_composite.meta.title_sub = extractSDLangTabOrAttrib(header_sdlang, "title", "sub");
- _conf_composite.meta.title_subtitle = extractSDLangTabOrAttrib(header_sdlang, "title", "subtitle");
+ _conf_composite.meta.title_edition = extractSDLangTabOrAttrib(header_sdlang, "title", "edition");
+ // _conf_composite.meta.title_full = extractSDLangTabOrAttrib(header_sdlang, "title", "full");
+ _conf_composite.meta.title_language = extractSDLangTabOrAttrib(header_sdlang, "title", "language");
+ _conf_composite.meta.title_main = extractSDLangTabOrAttrib(header_sdlang, "title", "main");
+ _conf_composite.meta.title_note = extractSDLangTabOrAttrib(header_sdlang, "title", "note");
+ _conf_composite.meta.title_sub = extractSDLangTabOrAttrib(header_sdlang, "title", "sub");
+ _conf_composite.meta.title_subtitle = extractSDLangTabOrAttrib(header_sdlang, "title", "subtitle");
}
if (_conf_composite.meta.title_main.empty) {
Tag _maintag = header_sdlang.getTag("title");
@@ -210,7 +262,6 @@ static template SiSUextractSDLang() {
_conf_composite.meta.title_main
= to!string(_maintag.getTagValues("main"));
} else if ("main" !in _maintag.maybe.attributes) {
- writeln(_maintag.values[0]); // document title
_conf_composite.meta.title_main
= (_maintag.values[0]).to!string; // test that this exists
}
@@ -220,17 +271,204 @@ static template SiSUextractSDLang() {
&& (_conf_composite.meta.title_sub.empty)) {
_conf_composite.meta.title_sub = _conf_composite.meta.title_subtitle;
}
- if (_conf_composite.meta.title_sub.empty) {
- _conf_composite.meta.title_full = _conf_composite.meta.title_main;
- } else {
- _conf_composite.meta.title_full = format(
+ _conf_composite.meta.title_full = (_conf_composite.meta.title_sub.empty)
+ ? _conf_composite.meta.title_main
+ : format(
"%s - %s",
_conf_composite.meta.title_main,
_conf_composite.meta.title_sub,
);
- }
}
return _conf_composite;
}
}
}
+static template parseSDLangConfig() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import sdlang;
+ auto parseSDLangConfig(string configuration, string conf_sdl_filename) {
+ Tag sdl_root_conf;
+ try {
+ sdl_root_conf = parseSource(configuration);
+ }
+ catch(ParseException e) {
+ stderr.writeln("SDLang problem with content for ", conf_sdl_filename);
+ stderr.writeln(e.msg);
+ }
+ return sdl_root_conf;
+ }
+}
+/++
+ return composite make from config files
++/
+
+template confFilesSDLtoStruct() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import
+ sdp.meta.conf_make_meta_structs,
+ sdp.meta.rgx;
+ auto configParseSDL(T)(
+ T _text
+ ){
+ Tag sdl_root;
+ try {
+ sdl_root = parseSource(_text.to!string);
+ }
+ catch(ParseException e) {
+ stderr.writeln("SDLang problem with this document header:");
+ stderr.writeln(_src_header);
+ // Error messages of the form:
+ // myFile.sdl(5:28): Error: Invalid integer suffix.
+ stderr.writeln(e.msg);
+ }
+ debug(sdlang) {
+ writeln("header SDL:");
+ writeln(__LINE__, ": ", sdl_root.toSDLDocument());
+ writeln(__LINE__, ": ", sdl_root.maybe.namespaces);
+ writeln("header make sdlang: ", sdl_root.toSDLDocument());
+ writeln(__LINE__, ": ", sdl_root.getTagValues("title"));
+ writeln(__LINE__, ": ", sdl_root.getTagValues("creator"));
+ Tag creator = sdl_root.getTag("creator");
+ if (creator !is null) {
+ if ("author" in creator.maybe.tags) {
+ writeln(__LINE__, ": ", creator.getTagValues("author"));
+ } else if ("author" in creator.maybe.attributes) {
+ writeln(__LINE__, ": ", creator.maybe.attributes["author"][0].value);
+ }
+ }
+ }
+ return sdl_root; // sdlang.ast.Tag
+ }
+ auto confFilesSDLtoStruct(S,L)(
+ S sdl_root_config_share,
+ L sdl_root_config_local,
+ ){
+ mixin SiSUmakeMetaStructsSDLang;
+ ConfCompositePlus _conf_composite;
+ foreach (conf_sdlang; [sdl_root_config_share, sdl_root_config_local]) {
+ if ("make" in conf_sdlang.maybe.tags) {
+ confCompositeMakeBuild _mk;
+ _conf_composite.make_str.bold = extractSDLangTabOrAttrib(conf_sdlang, "make", "bold"); // TODO
+ _conf_composite.make_str.breaks = extractSDLangTabOrAttrib(conf_sdlang, "make", "breaks");
+ _conf_composite.make_str.cover_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "cover_image");
+ _conf_composite.make_str.css = extractSDLangTabOrAttrib(conf_sdlang, "make", "css");
+ _conf_composite.make_str.emphasis = extractSDLangTabOrAttrib(conf_sdlang, "make", "emphasis"); // TODO
+ _conf_composite.make_str.footer = extractSDLangTabOrAttrib(conf_sdlang, "make", "footer");
+ _conf_composite.make_str.headings = extractSDLangTabOrAttrib(conf_sdlang, "make", "headings");
+ _conf_composite.make_str.home_button_image = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_image");
+ _conf_composite.make_str.home_button_text = extractSDLangTabOrAttrib(conf_sdlang, "make", "home_button_text");
+ _conf_composite.make_str.italics = extractSDLangTabOrAttrib(conf_sdlang, "make", "italics"); // TODO
+ _conf_composite.make_str.num_top = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_top");
+ _conf_composite.make_str.num_depth = extractSDLangTabOrAttrib(conf_sdlang, "make", "num_depth");
+ _conf_composite.make_str.substitute = extractSDLangTabOrAttrib(conf_sdlang, "make", "substitute"); // TODO
+ _conf_composite.make_str.texpdf_font = extractSDLangTabOrAttrib(conf_sdlang, "make", "texpdf_font");
+ _conf_composite.make.bold_rgxmatch = _mk.bold_rgxmatch(_conf_composite.make_str.bold); //
+ _conf_composite.make.breaks = _mk.breaks(_conf_composite.make_str.breaks);
+ _conf_composite.make.cover_image = _mk.cover_image(_conf_composite.make_str.cover_image);
+ _conf_composite.make.css = _mk.css(_conf_composite.make_str.css);
+ _conf_composite.make.emphasis_rgxmatch = _mk.emphasis_rgxmatch(_conf_composite.make_str.emphasis);
+ _conf_composite.make.footer = _mk.footer(_conf_composite.make_str.footer);
+ _conf_composite.make.headings = _mk.headings(_conf_composite.make_str.headings);
+ _conf_composite.make.home_button_image = _mk.home_button_image(_conf_composite.make_str.home_button_image);
+ _conf_composite.make.home_button_text = _mk.home_button_text(_conf_composite.make_str.home_button_text);
+ _conf_composite.make.italics_rgxmatch = _mk.italics_rgxmatch(_conf_composite.make_str.italics);
+ _conf_composite.make.num_top = _mk.num_top(_conf_composite.make_str.num_top);
+ _conf_composite.make.num_depth = _mk.num_depth(_conf_composite.make_str.num_depth);
+ _conf_composite.make.substitute = _mk.substitute(_conf_composite.make_str.substitute); // TODO
+ _conf_composite.make.texpdf_font = _mk.texpdf_font(_conf_composite.make_str.texpdf_font);
+ }
+ }
+ return _conf_composite;
+ }
+}
+/++
+ default settings
++/
+template SiSUmakeMetaStructsSDLang() {
+ import
+ std.algorithm,
+ std.array,
+ std.container,
+ std.exception,
+ std.file,
+ std.getopt,
+ std.json,
+ std.path,
+ std.process,
+ std.range,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.uni,
+ std.utf,
+ std.conv : to;
+ import sdp.meta.conf_make_meta_structs;
+ string extractSDLangTabOrAttrib(S)(
+ S conf_sdlang,
+ string maintab,
+ string atab
+ ) {
+ string _conf_composite_string = "";
+ if (maintab in conf_sdlang.maybe.tags) {
+ auto _maintag = conf_sdlang.getTag(maintab);
+ if (
+ (atab in _maintag.maybe.tags)
+ && (_maintag.getTagValues(atab).length > 0)
+ ) {
+ debug(configsdlang) {
+ writeln(
+ " ", __LINE__,
+ ": sdl tag, ",
+ maintab, ":", atab, ": ",
+ _maintag.getTagValues(atab)[0]
+ );
+ }
+ if (_maintag.getTagValues(atab).length == 1) {
+ writeln((_maintag.getTagValues(atab)[0]).to!string);
+ _conf_composite_string
+ = (_maintag.getTagValues(atab)[0]).to!string;
+ } else if (_maintag.getTagValues(atab).length > 1) {
+ string _tmp = "";
+ foreach (st; _maintag.getTagValues(atab)) {
+ writeln(st.to!string, ";");
+ _tmp ~= st.to!string ~ ";";
+ }
+ _conf_composite_string = _tmp;
+ }
+ } else if (
+ (atab in _maintag.maybe.attributes)
+ && (_maintag.attributes[atab][0].value.length > 0)
+ ) {
+ debug(configsdlang) {
+ writeln(
+ " ", __LINE__,
+ ": sdl attrib, ",
+ maintab, ":", atab, ": ",
+ _maintag.attributes[atab][0].value
+ );
+ }
+ _conf_composite_string
+ = (_maintag.attributes[atab][0].value).to!string;
+ }
+ }
+ return _conf_composite_string;
+ }
+}
diff --git a/src/sdp/meta/conf_make_meta_structs.d b/src/sdp/meta/conf_make_meta_structs.d
new file mode 100644
index 0000000..211d2c0
--- /dev/null
+++ b/src/sdp/meta/conf_make_meta_structs.d
@@ -0,0 +1,305 @@
+module sdp.meta.conf_make_meta_structs;
+import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+struct ConfCompositeMakeStr {
+ string bold = "";
+ string breaks = "";
+ string cover_image = "";
+ string css = "";
+ string emphasis = "";
+ string footer = "";
+ string headings = "";
+ string home_button_image = "";
+ string home_button_text = "";
+ string italics = "";
+ string num_top = "";
+ string num_depth = "";
+ string substitute = "";
+ string texpdf_font = "";
+}
+struct confCompositeMakeBuild {
+ auto bold_rgxmatch(string _mk) {
+ auto _rgxtxt = (_mk.empty)
+ ? `=NULL`
+ : `(` ~ _mk.dup ~ `)`;
+ return (cast(char[]) (_rgxtxt));
+ }
+ auto bold_substitute_abstract() {
+ return "<b>$1</b>";
+ }
+ auto bold_substitute_html() {
+ return "<b>$1</b>";
+ }
+ auto breaks(string _mk) {
+ return _mk;
+ }
+ auto cover_image(string _mk) {
+ return _mk;
+ }
+ auto css(string _mk) {
+ return _mk;
+ }
+ auto emphasis_rgxmatch(string _mk) {
+ auto _rgxtxt = (_mk.empty)
+ ? `=NULL`
+ : `(` ~ _mk.dup ~ `)`;
+ return (cast(char[]) (_rgxtxt));
+ }
+ auto emphasis_substitute_abstract() {
+ return "<em>$1</em>";
+ }
+ auto emphasis_substitute_html() {
+ return "<em>$1</em>";
+ }
+ auto footer(string _mk) {
+ return _mk;
+ }
+ auto headings(string _mk) {
+ return _mk;
+ }
+ auto home_button_image(string _mk) {
+ return _mk;
+ }
+ auto home_button_text(string _mk) {
+ return _mk;
+ }
+ auto italics_rgxmatch(string _mk) {
+ auto _rgxtxt = (_mk.empty)
+ ? `=NULL`
+ : `(` ~ _mk.dup ~ `)`;
+ return (cast(char[]) (_rgxtxt));
+ }
+ auto italics_substitute_abstract() {
+ return "<i>$1</i>";
+ }
+ auto italics_substitute_html() {
+ return "<i>$1</i>";
+ }
+ auto num_top(string _mk) {
+ return _mk;
+ }
+ auto num_depth(string _mk) {
+ return _mk;
+ }
+ auto substitute(string _mk) { // TODO this is different from others
+ return regex(_mk);
+ }
+ auto texpdf_font(string _mk) {
+ return _mk;
+ }
+}
+struct ConfCompositeMakeInit {
+ char[] bold_rgxmatch = `=NULL`.dup;
+ auto bold_substitute_abstract = "<b>$1</b>";
+ auto bold_substitute_html = "<b>$1</b>";
+ string breaks = "";
+ string cover_image = "";
+ string css = "";
+ char[] emphasis_rgxmatch = `=NULL`.dup;
+ auto emphasis_substitute_abstract = "<em>$1</em>";
+ auto emphasis_substitute_html = "<em>$1</em>";
+ string footer = "";
+ string headings = "";
+ string home_button_image = "";
+ string home_button_text = "";
+ char[] italics_rgxmatch = `=NULL`.dup;
+ auto italics_substitute_abstract = "<i>$1</i>";
+ auto italics_substitute_html = "<i>$1</i>";
+ string num_top = "";
+ string num_depth = "";
+ auto substitute = regex(""); // TODO
+ string texpdf_font = "";
+}
+struct ConfCompositeSiteLocal {
+ string webserv_url_root = "";
+ string webserv_path = "";
+ string webserv_images = "";
+ string webserv_cgi = "";
+ string webserv_cgi_host = "";
+ string webserv_cgi_host_path = "";
+ string webserv_cgi_port = "";
+ string webserv_cgi_user = "";
+ string webserv_cgi_file_links = "";
+ string processing_path = "";
+ string processing_dir = "";
+ string processing_concord_max = "";
+ string flag_act0 = "";
+ string flag_act1 = "";
+ string flag_act2 = "";
+ string flag_act3 = "";
+ string flag_act4 = "";
+ string flag_act5 = "";
+ string flag_act6 = "";
+ string flag_act7 = "";
+ string flag_act8 = "";
+ string flag_act9 = "";
+ string default_papersize = "";
+ string default_text_wrap = "";
+ string default_emphasis = "";
+ string default_language = "";
+ string default_digest = "";
+ string permission_share_source = "";
+ string search_flag = "";
+ string search_action = "";
+ string search_db = "";
+ string search_title = "";
+}
+struct MetaComposite {
+ string classify_dewey = "";
+ string classify_keywords = "";
+ string classify_loc = "";
+ string classify_subject = "";
+ string classify_topic_register = "";
+ string creator_author = "";
+ string creator_author_email = "";
+ string creator_illustrator = "";
+ string creator_translator = "";
+ string date_added_to_site = "";
+ string date_available = "";
+ string date_created = "";
+ string date_issued = "";
+ string date_modified = "";
+ string date_published = "";
+ string date_valid = "";
+ string identifier_isbn = "";
+ string identifier_oclc = "";
+ string identifier_pg = "";
+ string language_document = "";
+ string language_document_char = "";
+ string links = "";
+ string notes_abstract = "";
+ string notes_description = "";
+ string original_language = "";
+ string original_language_char = "";
+ string original_publisher = "";
+ string original_source = "";
+ string original_title = "";
+ string publisher = "";
+ string rights_copyright = "";
+ string rights_copyright_audio = "";
+ string rights_copyright_cover = "";
+ string rights_copyright_illustrations = "";
+ string rights_copyright_photographs = "";
+ string rights_copyright_text = "";
+ string rights_copyright_translation = "";
+ string rights_copyright_video = "";
+ string rights_license = "";
+ string title_edition = "";
+ string title_full = "";
+ string title_language = "";
+ string title_main = "";
+ string title_note = "";
+ string title_short = "";
+ string title_sub = "";
+ string title_subtitle = "";
+}
+struct ConfComposite {
+ MetaComposite meta;
+ ConfCompositeMakeInit make;
+ ConfCompositeSiteLocal conf;
+}
+struct ConfCompositePlus {
+ MetaComposite meta;
+ ConfCompositeMakeInit make;
+ ConfCompositeMakeStr make_str;
+ ConfCompositeSiteLocal conf;
+}
+static auto ptr_head_main
+ = [
+ "classify",
+ "creator",
+ "date",
+ "identifier",
+ "links",
+ "make",
+ "original",
+ "notes",
+ "rights",
+ "title"
+ ];
+static auto ptr_head_sub_classify
+ = [
+ "dewey",
+ "keywords",
+ "loc",
+ "subject",
+ "topic_register"
+ ];
+static auto ptr_head_sub_creator
+ = [
+ "author",
+ "author_email",
+ "cover",
+ "illustrator",
+ "translator"
+ ];
+static auto ptr_head_sub_date
+ = [
+ "added_to_site",
+ "available",
+ "created",
+ "issued",
+ "modified",
+ "published",
+ "valid"
+ ];
+static auto ptr_head_sub_identifier
+ = [
+ "isbn",
+ "oclc",
+ "pg"
+ ];
+/+ make +/
+static auto ptr_head_sub_make
+ = [
+ "cover_image",
+ "home_button_image",
+ "home_button_text",
+ "footer", "headings",
+ "num_top", "num_depth",
+ "breaks",
+ "substitute",
+ "bold",
+ "italics",
+ "emphasis",
+ "texpdf_font",
+ "css"
+ ];
+static auto ptr_head_sub_notes
+ = [
+ "abstract",
+ "description"
+ ];
+static auto ptr_head_sub_original
+ = [
+ "language",
+ "source",
+ "title"
+ ];
+static auto ptr_head_sub_publisher
+ = [ "name" ];
+static auto ptr_head_sub_rights
+ = [
+ "copyright",
+ "cover",
+ "illustrations",
+ "license"
+ ];
+static auto ptr_head_sub_title
+ = [
+ "edition",
+ "full",
+ "language",
+ "main",
+ "note",
+ "sub"
+ ];
+auto config_jsonstr = `{
+}`;
diff --git a/src/sdp/meta/conf_make_meta_toml.d b/src/sdp/meta/conf_make_meta_toml.d
new file mode 100644
index 0000000..4390c5c
--- /dev/null
+++ b/src/sdp/meta/conf_make_meta_toml.d
@@ -0,0 +1,79 @@
+/++
+ extract native/orig header return associative array<BR>
+
+ the header is passed as text (lopped off top of a sisu markup file until the
+ required first heading ^A~), determine whether is a native header or sdlang one
+ with a regex check if whether it contains the "native header" required tag/field
+ @title: then process accordingly as a "native header" or "sdlang header"
+ converting the metadata and make instructions to a common json format used by
+ program internally. Moved to associative array.
++/
+module sdp.meta.conf_make_meta_toml;
+static template configParseTOMLreturnJSON() {
+ import
+ toml,
+ toml.json;
+ auto configParseTOMLreturnJSON(T)(
+ T _text
+ ){
+ TOMLDocument _doc;
+ _doc = parseTOML(cast(string)(_text.content));
+ auto _doc_json = toJSON(_doc);
+ return _doc_json;
+ }
+}
+static template configParseTOMLreturnSiSUstruct() {
+ import
+ toml,
+ toml.json;
+ import
+ sdp.meta.conf_make_meta_structs,
+ sdp.meta.conf_make_meta_json;
+ mixin contentJSONtoSiSUstruct;
+ auto configParseTOMLreturnSiSUstruct(CCm, T)(
+ CCm _make_and_meta_struct,
+ T _document_struct
+ ){
+ TOMLDocument _doc = parseTOML(cast(string)(_document_struct.content));
+ auto _doc_json = toJSON(_doc);
+ _make_and_meta_struct = contentJSONtoSiSUstruct!()(_make_and_meta_struct, _doc_json, _document_struct.filename); // struct from json
+ return _make_and_meta_struct;
+ }
+}
+static template docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct() {
+ import
+ std.exception,
+ std.regex,
+ std.stdio,
+ std.traits,
+ std.typecons,
+ std.utf,
+ std.conv : to;
+ import
+ toml,
+ toml.json;
+ import
+ sdp.meta.conf_make_meta_structs,
+ sdp.meta.conf_make_meta_json,
+ sdp.meta.rgx;
+ mixin SiSUrgxInit;
+ mixin contentJSONtoSiSUstruct;
+ static auto rgx = Rgx();
+ auto docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct(CCm, Src)(
+ CCm _make_and_meta_struct,
+ Src header_src,
+ ) {
+ TOMLDocument _doc;
+ if (header_src.match(rgx.sdlang_header_meta_title)) {
+ writeln("WARNING >>> document header is sdlang (in wrong location JSON)");
+ } else if (header_src.match(rgx.toml_header_meta_title)) {
+ debug (json) {
+ writeln(">>> document header is toml, convert to JSON");
+ }
+ _doc = parseTOML(cast(string)(header_src));
+ }
+ auto _doc_json = toJSON(_doc);
+ auto _header_and_make_and_meta_struct = contentJSONtoSiSUstruct!()(_make_and_meta_struct, _doc_json, "header");
+ return _header_and_make_and_meta_struct;
+ }
+}
diff --git a/src/sdp/meta/defaults.d b/src/sdp/meta/defaults.d
index 7f0586e..13bf312 100644
--- a/src/sdp/meta/defaults.d
+++ b/src/sdp/meta/defaults.d
@@ -2,275 +2,6 @@
default settings
+/
module sdp.meta.defaults;
-template SiSUregisters() {
- import
- std.algorithm,
- std.array,
- std.container,
- std.exception,
- std.file,
- std.getopt,
- std.json,
- std.path,
- std.process,
- std.range,
- std.regex,
- std.stdio,
- std.string,
- std.traits,
- std.typecons,
- std.uni,
- std.utf,
- std.conv : to;
- struct ConfCompositeMake {
- string bold = "";
- string breaks = "";
- string cover_image = "";
- string css = "";
- string emphasis = "";
- string footer = "";
- string headings = "";
- string home_button_image = "";
- string home_button_text = "";
- string italics = "";
- string num_top = "";
- string num_depth = "";
- string substitute = "";
- string texpdf_font = "";
- }
- struct ConfCompositeMakeStr {
- string bold = "";
- string breaks = "";
- string cover_image = "";
- string css = "";
- string emphasis = "";
- string footer = "";
- string headings = "";
- string home_button_image = "";
- string home_button_text = "";
- string italics = "";
- string num_top = "";
- string num_depth = "";
- string substitute = "";
- string texpdf_font = "";
- }
- struct ConfCompositeSiteLocal {
- string webserv_url_root = "";
- string webserv_path = "";
- string webserv_images = "";
- string webserv_cgi = "";
- string webserv_cgi_host = "";
- string webserv_cgi_host_path = "";
- string webserv_cgi_port = "";
- string webserv_cgi_user = "";
- string webserv_cgi_file_links = "";
- string processing_path = "";
- string processing_dir = "";
- string processing_concord_max = "";
- string flag_act0 = "";
- string flag_act1 = "";
- string flag_act2 = "";
- string flag_act3 = "";
- string flag_act4 = "";
- string flag_act5 = "";
- string flag_act6 = "";
- string flag_act7 = "";
- string flag_act8 = "";
- string flag_act9 = "";
- string default_papersize = "";
- string default_text_wrap = "";
- string default_emphasis = "";
- string default_language = "";
- string default_digest = "";
- string permission_share_source = "";
- string search_flag = "";
- string search_action = "";
- string search_db = "";
- string search_title = "";
- }
- struct MetaComposite {
- string classify_dewey = "";
- string classify_keywords = "";
- string classify_loc = "";
- string classify_subject = "";
- string classify_topic_register = "";
- string creator_author = "";
- string creator_author_email = "";
- string creator_illustrator = "";
- string creator_translator = "";
- string date_added_to_site = "";
- string date_available = "";
- string date_created = "";
- string date_issued = "";
- string date_modified = "";
- string date_published = "";
- string date_valid = "";
- string identifier_isbn = "";
- string identifier_oclc = "";
- string identifier_pg = "";
- string language_document = "";
- string language_document_char = "";
- string links = "";
- string notes_abstract = "";
- string notes_description = "";
- string original_language = "";
- string original_language_char = "";
- string original_publisher = "";
- string original_source = "";
- string original_title = "";
- string publisher = "";
- string rights_copyright = "";
- string rights_copyright_audio = "";
- string rights_copyright_cover = "";
- string rights_copyright_illustrations = "";
- string rights_copyright_photographs = "";
- string rights_copyright_text = "";
- string rights_copyright_translation = "";
- string rights_copyright_video = "";
- string rights_license = "";
- string title_edition = "";
- string title_full = "";
- string title_language = "";
- string title_main = "";
- string title_note = "";
- string title_short = "";
- string title_sub = "";
- string title_subtitle = "";
- }
- struct ConfComposite {
- MetaComposite meta;
- ConfCompositeMake make;
- ConfCompositeSiteLocal conf;
- }
- struct ConfCompositePlus {
- MetaComposite meta;
- ConfCompositeMake make;
- ConfCompositeMakeStr make_str;
- ConfCompositeSiteLocal conf;
- }
- string extractSDLangTabOrAttrib(S)(S conf_sdlang, string maintab, string atab) {
- string _conf_composite_string = "";
- if (maintab in conf_sdlang.maybe.tags) {
- auto _maintag = conf_sdlang.getTag(maintab);
- if ((atab in _maintag.maybe.tags)
- && (_maintag.getTagValues(atab).length > 0)) {
- debug(configsdlang) {
- writeln(__LINE__, ": make:", atab, ": ", _maintag.getTagValues(atab)[0]);
- }
- if (_maintag.getTagValues(atab).length == 1) {
- writeln((_maintag.getTagValues(atab)[0]).to!string);
- _conf_composite_string = (_maintag.getTagValues(atab)[0]).to!string;
- } else if (_maintag.getTagValues(atab).length > 1) {
- string _tmp = "";
- foreach (st; _maintag.getTagValues(atab)) {
- writeln(st.to!string, ";");
- _tmp ~= st.to!string ~ ";";
- }
- _conf_composite_string = _tmp;
- }
- } else if ((atab in _maintag.maybe.attributes)
- && (_maintag.maybe.attributes[atab][0].value.length > 0)) {
- debug(configsdlang) {
- writeln(__LINE__, ": make:", atab, ": ", conf_sdlang.tags[maintag][0].attributes[atab][0].value);
- }
- _conf_composite_string = (_maintag.attributes[atab][0].value).to!string;
- }
- }
- return _conf_composite_string;
- }
- static auto ptr_head_main
- = [
- "classify",
- "creator",
- "date",
- "identifier",
- "links",
- "make",
- "original",
- "notes",
- "rights",
- "title"
- ];
- static auto ptr_head_sub_classify
- = [
- "dewey",
- "keywords",
- "loc",
- "subject",
- "topic_register"
- ];
- static auto ptr_head_sub_creator
- = [
- "author",
- "author_email",
- "cover",
- "illustrator",
- "translator"
- ];
- static auto ptr_head_sub_date
- = [
- "added_to_site",
- "available",
- "created",
- "issued",
- "modified",
- "published",
- "valid"
- ];
- static auto ptr_head_sub_identifier
- = [
- "isbn",
- "oclc",
- "pg"
- ];
- /+ make +/
- static auto ptr_head_sub_make
- = [
- "cover_image",
- "home_button_image",
- "home_button_text",
- "footer", "headings",
- "num_top", "num_depth",
- "breaks",
- "substitute",
- "bold",
- "italics",
- "emphasis",
- "texpdf_font",
- "css"
- ];
- static auto ptr_head_sub_notes
- = [
- "abstract",
- "description"
- ];
- static auto ptr_head_sub_original
- = [
- "language",
- "source",
- "title"
- ];
- static auto ptr_head_sub_publisher
- = [ "name" ];
- static auto ptr_head_sub_rights
- = [
- "copyright",
- "cover",
- "illustrations",
- "license"
- ];
- static auto ptr_head_sub_title
- = [
- "edition",
- "full",
- "language",
- "main",
- "note",
- "sub"
- ];
- auto config_jsonstr = `{
- }`;
-}
template SiSUrgxInitFlags() {
/+ regex flags +/
static int[string] flags_type_init() {
diff --git a/src/sdp/meta/doc_debugs.d b/src/sdp/meta/doc_debugs.d
index 255ea92..18f50ad 100644
--- a/src/sdp/meta/doc_debugs.d
+++ b/src/sdp/meta/doc_debugs.d
@@ -55,8 +55,7 @@ template SiSUdebugs() {
}
debug(dumpdoc) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
@@ -232,8 +231,7 @@ template SiSUdebugs() {
}
debug(objects) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
@@ -398,8 +396,7 @@ template SiSUdebugs() {
}
debug(anchor) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
@@ -435,8 +432,7 @@ template SiSUdebugs() {
}
debug(headings) {
writefln(
- "%s\n%s:%s",
- "-------------------------------",
+ "> %s:%s",
__FILE__,
__LINE__,
);
diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d
index cbc5d51..8223029 100644
--- a/src/sdp/meta/metadoc.d
+++ b/src/sdp/meta/metadoc.d
@@ -9,10 +9,10 @@ template SiSUabstraction() {
sdp.meta,
sdp.meta.metadoc_summary,
sdp.meta.metadoc_from_src,
- sdp.meta.conf_make_meta,
- // sdp.meta.conf_make_meta_native,
+ sdp.meta.conf_make_meta_structs,
sdp.meta.conf_make_meta_sdlang,
- sdp.meta.conf_make_meta_composite,
+ sdp.meta.conf_make_meta_toml,
+ sdp.meta.conf_make_meta_json,
sdp.meta.defaults,
sdp.meta.doc_debugs,
sdp.meta.read_config_files,
@@ -21,8 +21,9 @@ template SiSUabstraction() {
sdp.output.hub,
sdp.output.paths_source;
mixin SiSUrgxInit;
- mixin SiSUregisters;
+ mixin SiSUmakeMetaStructsSDLang;
mixin SiSUextractSDLang;
+ mixin contentJSONtoSiSUstruct;
mixin SiSUnode;
mixin SiSUbiblio;
mixin SiSUrgxInitFlags;
@@ -36,9 +37,22 @@ template SiSUabstraction() {
O _opt_action,
M _manifest,
){
- auto sdl_root_config_document = configReadDoc!()(_manifest, _env); // document config file
- auto sdl_root_config_local_site = configReadSite!()(_manifest, _env); // local site config
- auto conf_files_composite_make = confFilesSDLtoStruct!()(sdl_root_config_document, sdl_root_config_local_site);
+ auto _config_document_struct = readConfigDoc!()(_manifest, _env); // document config file
+ auto _config_local_site_struct = readConfigSite!()(_manifest, _env); // local site config
+ ConfCompositePlus _make_and_meta_struct;
+ switch (_config_local_site_struct.filetype) {
+ case "toml" :
+ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_document_struct);
+ _make_and_meta_struct = configParseTOMLreturnSiSUstruct!()(_make_and_meta_struct, _config_local_site_struct);
+ break;
+ case "sdl" :
+ auto sdl_root_config_document = parseSDLangConfig!()(_config_document_struct.content, _config_document_struct.filename);
+ auto sdl_root_config_local_site = parseSDLangConfig!()(_config_local_site_struct.content, _config_local_site_struct.filename);
+ _make_and_meta_struct = confFilesSDLtoStruct!()(sdl_root_config_document, sdl_root_config_local_site);
+ break;
+ default :
+ break;
+ }
/+ ↓ read file (filename with path) +/
/+ ↓ file tuple of header and content +/
debug(steps) {
@@ -61,9 +75,14 @@ template SiSUabstraction() {
debug(steps) {
writeln("step2 commence → (read document header - toml or sdlang, return struct)");
}
- auto _make_and_meta_struct
- = docHeaderMakeAndMetaTupExtractAndConvertToStruct!()(
- conf_files_composite_make,
+ _make_and_meta_struct =
+ ((_header_body_insertfilelist_imagelist[headBody.header]).match(rgx.toml_header_meta_title))
+ ? docHeaderMakeAndMetaTupTomlExtractAndConvertToStruct!()(
+ _make_and_meta_struct,
+ _header_body_insertfilelist_imagelist[headBody.header]
+ )
+ : docHeaderMakeAndMetaTupSDLangExtractAndConvertToStruct!()(
+ _make_and_meta_struct,
_header_body_insertfilelist_imagelist[headBody.header]
);
debug(steps) {
diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d
index a8014e3..d0ee599 100644
--- a/src/sdp/meta/metadoc_from_src.d
+++ b/src/sdp/meta/metadoc_from_src.d
@@ -1396,7 +1396,8 @@ template SiSUdocAbstraction() {
segnames_0_4 ~= obj.segment_anchor_tag;
if (obj.heading_lev_markup == 4) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1425,7 +1426,8 @@ template SiSUdocAbstraction() {
segnames_0_4 ~= obj.segment_anchor_tag;
if (obj.heading_lev_markup == 4) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
if ((opt_action.html)
@@ -1454,7 +1456,8 @@ template SiSUdocAbstraction() {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1496,7 +1499,8 @@ template SiSUdocAbstraction() {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1531,7 +1535,8 @@ template SiSUdocAbstraction() {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1570,7 +1575,8 @@ template SiSUdocAbstraction() {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1614,7 +1620,8 @@ template SiSUdocAbstraction() {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1653,7 +1660,8 @@ template SiSUdocAbstraction() {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -1696,7 +1704,8 @@ template SiSUdocAbstraction() {
if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames],
+ obj.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr_html_segnames]);
}
}
/+ dom structure (marked up & collapsed) +/
@@ -2963,7 +2972,7 @@ template SiSUdocAbstraction() {
comp_obj_block = comp_obj_block.init;
obj_cite_digits = ocn_emit(OCNstatus.on);
an_object["bookindex_nugget"]
- =("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
+ = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes
= bookindex_extract_hash.bookindex_nugget_hash(
an_object["bookindex_nugget"],
diff --git a/src/sdp/meta/read_config_files.d b/src/sdp/meta/read_config_files.d
index 15a7a67..554f740 100644
--- a/src/sdp/meta/read_config_files.d
+++ b/src/sdp/meta/read_config_files.d
@@ -4,16 +4,16 @@
meta_config_files.d
+/
module sdp.meta.read_config_files;
-static template configInSite() {
+static template configReadInSiteSDL() {
import
sdp.meta,
sdp.output.paths_source,
std.file,
std.path;
- final string configInSite(M,E)(M manifest, E env) {
+ final string configReadInSiteSDL(M,E)(M manifest, E env) {
auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.possible_config_path_locations.config_filename_site;
- auto possible_config_path_locations = conf_file_details.possible_config_path_locations.local_site;
+ string conf_sdl = conf_file_details.config_filename_site_sdl;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.config_local_site;
string config_file_str;
debug(io) {
writeln("WARNING (io debug) in config filename: ", conf_sdl);
@@ -41,16 +41,16 @@ static template configInSite() {
return config_file_str;
}
}
-static template configInDoc() {
+static template configReadInDocSDL() {
import
sdp.meta,
sdp.output.paths_source,
std.file,
std.path;
- final string configInDoc(M,E)(M manifest, E env) {
+ final string configReadInDocSDL(M,E)(M manifest, E env) {
auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_document;
- auto possible_config_path_locations = conf_file_details.possible_config_path_locations.document;
+ string conf_sdl = conf_file_details.config_filename_document_sdl;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.sisu_document_make;
string config_file_str;
debug(io) {
writeln("WARNING (io debug) in config filename: ", conf_sdl);
@@ -78,17 +78,88 @@ static template configInDoc() {
return config_file_str;
}
}
-/+
-
-+/
-static template ConfigSDLang() {
+static template configReadInSiteTOML() {
+ import
+ sdp.meta,
+ sdp.output.paths_source,
+ std.file,
+ std.path;
+ final string configReadInSiteTOML(M,E)(M manifest, E env) {
+ auto conf_file_details = ConfigFilePaths!()(manifest, env);
+ string conf_toml = conf_file_details.config_filename_site_toml;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.config_local_site;
+ string config_file_str;
+ debug(io) {
+ writeln("WARNING (io debug) in config filename: ", conf_toml);
+ writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations);
+ }
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array;
+ if (config_file_str.length > 0) {
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ return config_file_str;
+ }
+}
+static template configReadInDocTOML() {
+ import
+ sdp.meta,
+ sdp.output.paths_source,
+ std.file,
+ std.path;
+ final string configReadInDocTOML(M,E)(M manifest, E env) {
+ auto conf_file_details = ConfigFilePaths!()(manifest, env);
+ string conf_toml = conf_file_details.config_filename_document_toml;
+ auto possible_config_path_locations = conf_file_details.possible_config_path_locations.sisu_document_make;
+ string config_file_str;
+ debug(io) {
+ writeln("WARNING (io debug) in config filename: ", conf_toml);
+ writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations);
+ }
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_toml)).array;
+ if (config_file_str.length > 0) {
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ return config_file_str;
+ }
+}
+static template configSDLang() {
import sdlang;
import
sdp.meta,
sdp.output.paths_source,
std.file,
std.path;
- auto ConfigSDLang(string configuration, string conf_sdl_filename) {
+ auto configSDLang(string configuration, string conf_sdl_filename) {
Tag sdl_root_conf;
try {
sdl_root_conf = parseSource(configuration);
@@ -100,35 +171,181 @@ static template ConfigSDLang() {
return sdl_root_conf;
}
}
-/+
-+/
-static template configReadSite() {
+static template configTOML() {
+ import toml; //
import
sdp.meta,
sdp.output.paths_source,
std.file,
std.path;
-
- final auto configReadSite(M,E)(M manifest, E env) {
- auto configuration = configInSite!()(manifest, env);
+ auto configTOML(string configuration, string conf_toml_filename) {
+ TOMLDocument _toml_conf;
+ try {
+ _toml_conf = parseTOML(configuration); // parseTOML(cast(string)(configuration));
+ }
+ catch(ErrnoException e) {
+ stderr.writeln("Toml problem with content for ", conf_toml_filename);
+ stderr.writeln(e.msg);
+ }
+ return _toml_conf;
+ }
+}
+static template readConfigSite() {
+ import
+ sdp.meta,
+ sdp.output.paths_source,
+ std.file,
+ std.path;
+ final auto readConfigSite(M,E)(M _manifest, E _env) {
+ string config_file_str;
+ string conf_filename = "NONE";
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site;
+ foreach(conf_fn; [_conf_file_details.config_filename_site_toml, _conf_file_details.config_filename_site_sdl]) {
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array;
+ conf_filename = conf_fn;
+ if (config_file_str.length > 0) {
+ // conf_filename = conf_fn;
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ // writeln(__LINE__, ": found: ", conf_file, " in ", pth);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ if (config_file_str.length > 0) { break; }
+ }
+ struct _ConfContent {
+ string filename() {
+ return conf_filename;
+ }
+ string filetype() {
+ return conf_filename.extension.chompPrefix(".");
+ }
+ auto content() {
+ return config_file_str;
+ }
+ }
+ return _ConfContent();
+ }
+}
+static template readConfigDoc() {
+ import
+ sdp.meta,
+ sdp.output.paths_source,
+ std.file,
+ std.path;
+ final auto readConfigDoc(M,E)(M _manifest, E _env) {
+ string config_file_str;
+ string conf_filename = "NONE";
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ auto possible_config_path_locations = _conf_file_details.possible_config_path_locations.sisu_document_make;
+ foreach(conf_fn; [_conf_file_details.config_filename_document_toml, _conf_file_details.config_filename_document_sdl]) {
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_fn)).array;
+ conf_filename = conf_fn;
+ if (config_file_str.length > 0) {
+ // conf_filename = conf_fn;
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(io) {
+ writeln("WARNING (io debug) in config file found: ", conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ if (config_file_str.length > 0) { break; }
+ }
+ struct _ConfContent {
+ string filename() {
+ return conf_filename;
+ }
+ string filetype() {
+ return conf_filename.extension.chompPrefix(".");
+ }
+ auto content() {
+ return config_file_str;
+ }
+ }
+ return _ConfContent();
+ }
+}
+static template configReadSiteSDLang() {
+ import
+ sdp.meta,
+ sdp.output.paths_source,
+ std.file,
+ std.path;
+ import sdlang;
+ final auto configReadSiteSDLang(M,E)(M manifest, E env) {
+ auto configuration = configReadInSiteSDL!()(manifest, env);
auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.possible_config_path_locations.config_filename_site;
- auto sdl_root = ConfigSDLang!()(configuration, conf_sdl);
+ string conf_sdl = conf_file_details.config_filename_site_sdl;
+ auto sdl_root = configSDLang!()(configuration, conf_sdl);
return sdl_root;
}
}
-static template configReadDoc() {
+static template configReadDocSDLang() {
import
sdp.meta,
sdp.output.paths_source,
std.file,
std.path;
-
- final auto configReadDoc(M,E)(M manifest, E env) {
- auto configuration = configInDoc!()(manifest, env);
+ import sdlang;
+ final auto configReadDocSDLang(M,E)(M manifest, E env) {
+ auto configuration = configReadInDocSDL!()(manifest, env);
auto conf_file_details = ConfigFilePaths!()(manifest, env);
- string conf_sdl = conf_file_details.config_filename_document;
- auto sdl_root = ConfigSDLang!()(configuration, conf_sdl);
+ string conf_sdl = conf_file_details.config_filename_document_sdl;
+ auto sdl_root = configSDLang!()(configuration, conf_sdl);
return sdl_root;
}
}
+static template configReadSiteTOML() {
+ import
+ sdp.meta,
+ sdp.output.paths_source,
+ std.file,
+ std.path;
+ import toml;
+ final auto configReadSiteTOML(M,E)(M _manifest, E _env) {
+ auto _configuration = configReadInSiteTOML!()(_manifest, _env);
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ string _conf_toml = _conf_file_details.config_filename_site_toml;
+ auto _toml_conf = configTOML!()(_configuration, _conf_toml);
+ return _toml_conf;
+ }
+}
+static template configReadDocTOML() {
+ import
+ sdp.meta,
+ sdp.output.paths_source,
+ std.file,
+ std.path;
+ import toml;
+ final auto configReadDocTOML(M,E)(M _manifest, E _env) {
+ auto _configuration = configReadInDocTOML!()(_manifest, _env);
+ auto _conf_file_details = ConfigFilePaths!()(_manifest, _env);
+ string _conf_toml = _conf_file_details.config_filename_document_toml;
+ auto _toml_conf = configTOML!()(_configuration, _conf_toml);
+ return _toml_conf;
+ }
+}
diff --git a/src/sdp/meta/read_source_files.d b/src/sdp/meta/read_source_files.d
index 0e53e73..cd4a253 100644
--- a/src/sdp/meta/read_source_files.d
+++ b/src/sdp/meta/read_source_files.d
@@ -155,7 +155,7 @@ static template SiSUrawMarkupContent() {
}
}
struct Inserts {
- import sdp.meta.defaults;
+ import sdp.meta.conf_make_meta_sdlang;
auto scan_subdoc_source(O)(
O _opt_action,
char[][] markup_sourcefile_insert_content,
@@ -293,10 +293,6 @@ static template SiSUrawMarkupContent() {
insert_file_list ~= to!string(fn_src_insert);
auto raw = MarkupRawUnit();
/+ TODO +/
- if (auto ma = line.match(rgx.src_fn_text)) {
- /+ .sst when inserted, not used: headers and heading level ^:?A~ so remove +/
- writeln(__LINE__); writeln(ma);
- }
auto markup_sourcefile_insert_content
= raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts);
debug(insert_file) {
diff --git a/src/sdp/meta/rgx.d b/src/sdp/meta/rgx.d
index fe9e36d..35d6970 100644
--- a/src/sdp/meta/rgx.d
+++ b/src/sdp/meta/rgx.d
@@ -53,6 +53,8 @@ static template SiSUrgxInit() {
static variable_doc_title = ctRegex!(`@title`);
static variable_doc_author = ctRegex!(`@author|@creator`);
static raw_author_munge = ctRegex!(`(\S.+?),\s+(.+)`,"i");
+ static sdlang_header_meta_title = ctRegex!(`^\s*title\s+["\\]`, "m");
+ static toml_header_meta_title = ctRegex!(`^\s*(title\s*=\s*"|\[title\])`, "m");
/+ head +/
static native_subhead_creator = ctRegex!(`^(?:author|translator|illustrator)$`, "m");
static native_subhead_title = ctRegex!(`^(?:main|sub(?:title)?|full|language|edition|note)$`, "m");
@@ -171,6 +173,7 @@ static template SiSUrgxInit() {
static break_page_line_across = ctRegex!(`^=[.]{2}=$`);
static break_string = ctRegex!(`』`);
static parent = ctRegex!(`([0-7]):([0-9]+)`);
+ static header_regex_content = ctRegex!(`([0-7]):([0-9]+)`);
/+ json +/
static tailing_comma = ctRegex!(`,$`, "m");
/+ biblio tags +/
@@ -197,7 +200,9 @@ static template SiSUrgxInit() {
static nbsp_and_space = ctRegex!(`&nbsp;[ ]`, "mg");
static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg");
static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
+ static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+)/sisupod[.]manifest$`);
+ static src_pth_pod_root = ctRegex!(`^(?P<podroot>(?:[/]?(?:[a-zA-Z0-9._-]+/)*)(sisupod))$`);
static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`);
static src_pth_unzip_pod = ctRegex!(`^(?P<path>media/text/[a-z]{2}/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
static src_pth_types =
@@ -212,7 +217,8 @@ static template SiSUrgxInit() {
static src_fn_find_inserts = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`);
static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
- static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalized dir structure
+ static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
+ static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
/+ inline markup footnotes endnotes +/
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
@@ -258,6 +264,7 @@ static template SiSUrgxInit() {
static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg");
+ static no_header_rgx = ctRegex!(`^=NULL$`);
/+ table delimiters +/
static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg");
static table_delimiter_row = ctRegex!("[ ]*\n", "mg");
diff --git a/src/sdp/output/paths_output.d b/src/sdp/output/paths_output.d
index 537de45..1db74d9 100644
--- a/src/sdp/output/paths_output.d
+++ b/src/sdp/output/paths_output.d
@@ -185,7 +185,7 @@ template SiSUpathsSQLiteDiscrete() {
return fn_src.baseName.stripExtension;
}
string base() {
- return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array;
+ return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array;
}
string seg(string fn_src) {
return asNormalizedPath(base.chainPath(base_filename(fn_src))).array;
diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d
index 731fff3..3292e6f 100644
--- a/src/sdp/output/paths_source.d
+++ b/src/sdp/output/paths_source.d
@@ -29,9 +29,15 @@ template PodManifest() {
&& (_pth.chainPath(pod_manifest_filename).array).isFile)) {
_manifest_path = _pth;
} else if (_pth.match(rgx.src_pth_contents)
- && exists(_pth)!=0 && _pth.isDir && (_pth.isFile)) {
+ && exists(_pth)!=0 && _pth.isDir) {
_manifest_path = dirName(_pth);
+ } else if (_pth.match(rgx.src_pth_pod_sst_or_ssm)
+ && exists(_pth)!=0 && (_pth.isFile)) {
+ if (auto m = _pth.match(rgx.src_pth_pod_sst_or_ssm)) {
+ _manifest_path = m.captures["podpath"];
+ }
} else {
+ writeln("WARNING, issue with manifest_path: ", _pth);
_manifest_path = _pth; // _manifest_path = null;
}
return _manifest_path;
@@ -94,6 +100,15 @@ template PathMatters() {
auto _src_is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false;
return _src_is_pod;
}
+ auto collection_root() {
+ auto _collection_root = asNormalizedPath(chainPath(_manifest.pod_manifest_path, "..")).array;
+ if (auto m = (_collection_root).match(rgx.src_pth_pod_root)) {
+ // consider testing for last dir in path name being sisupod, and giving warning if not
+ } else {
+ writeln("WARNING, collection_root not named \"sisupod\"");
+ }
+ return _collection_root;
+ }
auto manifest_filename() {
return _manifest.pod_manifest_filename;
}
@@ -103,7 +118,11 @@ template PathMatters() {
auto manifest_file_with_path() {
return _manifest.pod_manifest_file_with_path;
}
- auto config_dirs() { // TODO
+ auto config_sisu_document_make_dirs() { // TODO sisu_document_make
+ string[] _config_dirs;
+ return _config_dirs;
+ }
+ auto config_local_site_dirs() { // TODO sisu_document_make
string[] _config_dirs;
return _config_dirs;
}
@@ -292,12 +311,21 @@ template ConfigFilePaths() {
E _env,
) {
struct ConfFilePaths {
- auto config_filename_document() {
- return "config_document";
+ auto config_filename_document_sdl() {
+ return "sisu_document_make.sdl";
+ }
+ auto config_filename_site_sdl() {
+ return "config_local_site.sdl";
+ }
+ auto config_filename_document_toml() {
+ return "sisu_document_make.toml";
+ }
+ auto config_filename_site_toml() {
+ return "config_local_site.toml";
}
auto possible_config_path_locations() {
struct _ConfFilePaths {
- auto document() {
+ auto sisu_document_make() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
/+ return paths +/
@@ -340,10 +368,7 @@ template ConfigFilePaths() {
+/
return _possible_config_path_locations;
}
- auto config_filename_site() {
- return "config_local_site";
- }
- auto local_site() {
+ auto config_local_site() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
string _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".sisu")).array;
@@ -352,11 +377,15 @@ template ConfigFilePaths() {
/+ return paths +/
string[] _possible_config_path_locations;
if (_manifest.src.is_pod) {
+ string _collection_root_a = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), ".sisu")).array;
+ string _collection_root_b = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), "_sisu")).array;
_possible_config_path_locations = [
_dot_pwd,
_underscore_pwd,
_dot_home,
- "/etc/sisu"
+ "/etc/sisu",
+ _collection_root_a, // set priority higher?
+ _collection_root_b // set priority higher?
];
} else {
/+ config document (& or local site) on filesystem +/
diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d
index c962937..c125b7e 100644
--- a/src/sdp/output/rgx.d
+++ b/src/sdp/output/rgx.d
@@ -16,7 +16,9 @@ static template SiSUoutputRgxInit() {
static nbsp_and_space = ctRegex!(`&nbsp;[ ]`, "mg");
static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg");
static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
+ static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`);
static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+)/sisupod[.]manifest$`);
+ static src_pth_pod_root = ctRegex!(`^(?P<podroot>(?:[/]?(?:[a-zA-Z0-9._-]+/)*)(sisupod))$`);
static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`);
static src_pth_unzip_pod = ctRegex!(`^(?P<path>media/text/[a-z]{2}/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
static src_pth_types =
@@ -31,7 +33,8 @@ static template SiSUoutputRgxInit() {
static src_fn_find_inserts = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`);
static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
- static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalized dir structure
+ static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
+ static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
/+ inline markup footnotes endnotes +/
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
@@ -77,6 +80,7 @@ static template SiSUoutputRgxInit() {
static inline_italics_line = ctRegex!(`^/_ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_underscore_line = ctRegex!(`^__ (?P<text>.+?)((?: [\\]{2}|[~]#){0,2}$)`);
static inline_fontface_clean = ctRegex!(`[*!_/^,+#■"-]\{|\}[*!_/^,+#■"-]`, "mg");
+ static no_header_rgx = ctRegex!(`^=NULL$`);
/+ table delimiters +/
static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg");
static table_delimiter_row = ctRegex!("[ ]*\n", "mg");
diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d
index 4e3bfc1..3f95b62 100644
--- a/src/sdp/output/source_sisupod.d
+++ b/src/sdp/output/source_sisupod.d
@@ -97,34 +97,36 @@ template SiSUpod() {
}
}
} { /+ bundle sisu_document_make +/
- auto fn_src_in = ((doc_matters.src.is_pod)
- ? doc_matters.src.conf_dir_path
- : pth_sisudoc_src.conf_root).to!string
- ~ "/" ~ "sisu_document_make";
- auto fn_src_out_sisupod_zip_base
- = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
- auto fn_src_out_filesystem
- = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
- ~ "/" ~ "sisu_document_make"; // TODO
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("WARNING (io debug) src out found: ", fn_src_in);
- }
- if (doc_matters.opt.action.source) {
- fn_src_in.copy(fn_src_out_filesystem);
- }
- if (doc_matters.opt.action.sisupod) {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
- auto zip_data = new OutBuffer();
- zip_data.write((fn_src_in).readText);
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- }
- } else {
- if (doc_matters.opt.action.verbose
- || doc_matters.opt.action.debug_do) {
- writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
+ foreach (extension; [".sdl", ".toml"]) {
+ auto fn_src_in = ((doc_matters.src.is_pod)
+ ? doc_matters.src.conf_dir_path
+ : pth_sisudoc_src.conf_root).to!string
+ ~ "/" ~ "sisu_document_make" ~ extension;
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src_out_filesystem
+ = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ "sisu_document_make" ~ extension; // TODO
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("WARNING (io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.sisupod) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
+ auto zip_data = new OutBuffer();
+ zip_data.write((fn_src_in).readText);
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ }
+ } else {
+ if (doc_matters.opt.action.verbose
+ || doc_matters.opt.action.debug_do) {
+ writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
+ }
}
}
} { /+ TODO bundle primary file +/
diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d
index b0e75e6..e4bf4a9 100755
--- a/src/sdp/sdp.d
+++ b/src/sdp/sdp.d
@@ -12,10 +12,10 @@ import
sdp.meta,
sdp.meta.metadoc_summary,
sdp.meta.metadoc_from_src,
- sdp.meta.conf_make_meta,
- // sdp.meta.conf_make_meta_native,
+ sdp.meta.conf_make_meta_structs,
sdp.meta.conf_make_meta_sdlang,
- sdp.meta.conf_make_meta_composite,
+ sdp.meta.conf_make_meta_toml,
+ sdp.meta.conf_make_meta_json,
sdp.meta.defaults,
sdp.meta.doc_debugs,
sdp.meta.read_config_files,
@@ -32,8 +32,9 @@ homepage "http://sisudoc.org"
+/
void main(string[] args) {
mixin SiSUrgxInit;
- mixin SiSUregisters;
+ mixin SiSUmakeMetaStructsSDLang;
mixin SiSUextractSDLang;
+ mixin contentJSONtoSiSUstruct;
mixin SiSUnode;
mixin SiSUbiblio;
mixin SiSUrgxInitFlags;
@@ -98,6 +99,7 @@ void main(string[] args) {
];
string[string] settings = [
"output-dir" : "",
+ "site-config-dir" : "",
"lang" : "all",
];
auto helpInfo = getopt(args,
@@ -141,6 +143,7 @@ void main(string[] args) {
"backmatter", "--section-backmatter process document backmatter (default)", &opts["backmatter"],
"skip-output", "--skip-output", &opts["skip-output"],
"output-dir", "--output-dir=[dir path]", &settings["output-dir"],
+ "site-config-dir", "--site-config-dir=[dir path]", &settings["site-config-dir"],
"lang", "--lang=[lang code e.g. =en or =en,es]", &settings["lang"],
);
if (helpInfo.helpWanted) {
diff --git a/views/version.txt b/views/version.txt
index 5db1866..6f8094d 100644
--- a/views/version.txt
+++ b/views/version.txt
@@ -4,7 +4,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 23, 3);
+enum ver = Version(0, 24, 0);
version (Posix) {
version (DigitalMars) {
} else version (LDC) {