aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ekdosis.dtx47
= ekdosis SHELL = bash PWD = $(shell pwd) VERS = $(shell ltxfileinfo -v $(NAME).dtx|sed -e 's/^v//') LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) UTREE = $(shell kpsewhich --var-value TEXMFHOME) all: $(NAME).pdf test -e README.txt && mv README.txt README || exit 0 $(NAME).pdf: $(NAME).dtx lualatex --shell-escape -recorder -interaction=batchmode $(NAME).dtx >/dev/null if [ -f $(NAME).glo ]; then makeindex -q -s gglo.ist -o $(NAME).gls $(NAME).glo; fi if [ -f $(NAME).idx ]; then makeindex -q -s gind.ist -o $(NAME).ind $(NAME).idx; fi lualatex --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null lualatex --shell-escape --recorder --interaction=nonstopmode $(NAME).dtx > /dev/null clean: rm -f $(NAME).{aux,fls,glo,gls,hd,idx,ilg,ind,log,out,toc} rm -f *~ rm -rf auto/ # rm -f $(NAME)_*.{bib,lua} distclean: clean uninst rm -rf _minted-* rm -f $(NAME).{pdf,sty,lua} README* rm -f *.zip *.tar.gz uninst: rm -rf $(UTREE)/{tex,source,doc}/lualatex/$(NAME) inst: uninst all mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) cp $(NAME).dtx $(UTREE)/source/lualatex/$(NAME) cp $(NAME).sty $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).lua $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).pdf $(UTREE)/doc/lualatex/$(NAME) local: uninst lualatex $(NAME).ins mkdir -p $(UTREE)/{tex,source,doc}/lualatex/$(NAME) cp $(NAME).sty $(UTREE)/tex/lualatex/$(NAME) cp $(NAME).lua $(UTREE)/tex/lualatex/$(NAME) #install: all # sudo mkdir -p $(LOCAL)/{tex,source,doc}/lualatex/$(NAME) # sudo cp $(NAME).dtx $(LOCAL)/source/lualatex/$(NAME) # sudo cp $(NAME).sty $(LOCAL)/tex/lualatex/$(NAME) # sudo cp $(NAME).pdf $(LOCAL)/doc/lualatex/$(NAME) zip: all ln -sf . $(NAME) zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)/{README,$(NAME).{pdf,sty,lua}} rm $(NAME) package: distclean all mkdir $(NAME)/ cp README *.dtx *.pdf $(NAME)/ mkdir -p tex/lualatex/$(NAME)/ cp *.lua *.sty tex/lualatex/$(NAME)/ mkdir -p doc/lualatex/$(NAME)/ cp *.pdf doc/lualatex/$(NAME)/ mkdir -p source/lualatex/$(NAME)/ cp Makefile *.dtx source/lualatex/$(NAME)/ zip -r $(NAME).tds.zip tex doc source rm -rf tex/ source/ doc/ tar czf $(NAME)-$(VERS).tar.gz $(NAME).tds.zip $(NAME)/ rm -rf $(NAME)/
lid = id, abbr = siglum, handNote = description}
750 if listWit[indexwit].handDesc == nil 757 if listWit[indexwit].handDesc == nil
751 then 758 then
752 listWit[indexwit].handDesc = {} 759 listWit[indexwit].handDesc = {}
753 else 760 else
754 end 761 end
755 table.insert(listWit[indexwit].handDesc, {xmlid = id, head = siglum, handNote = description}) 762 table.insert(listWit[indexwit].handDesc, {xmlid = id, abbr = siglum, handNote = description})
763 end
764 return true
765end
766
767function ekdosis.newshorthand(id, rend, xmlids)
768 if isintable(shorthands, id)
769 then
770 tex.print([[\unexpanded{\PackageWarning{ekdosis}{"]]
771 ..id..
772 [[" already exists as a shorthand. ]]
773 ..
774 [[Please pick another shorthand.}}]])
775 else
776 table.insert(shorthands, { a = id, b = rend, c = xmlids })
777 table.sort(shorthands, function(a ,b) return(#a.a > #b.a) end)
778 table.insert(idsRend, {xmlid = id, abbr = rend})
779 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
756 end 780 end
757 return true 781 return true
758end 782end
@@ -775,7 +799,7 @@ function ekdosis.newscholar(id, siglum)
775 else 799 else
776 table.insert(xmlids, {xmlid = id}) 800 table.insert(xmlids, {xmlid = id})
777 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end) 801 table.sort(xmlids, function(a ,b) return(#a.xmlid > #b.xmlid) end)
778 table.insert(idsRend, {xmlid = id, head = siglum}) 802 table.insert(idsRend, {xmlid = id, abbr = siglum})
779 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end) 803 table.sort(idsRend, function(a ,b) return(#a.xmlid > #b.xmlid) end)
780 end 804 end
781 return true 805 return true
@@ -786,6 +810,9 @@ function ekdosis.getsiglum(str, opt)
786 str = string.gsub(str, "%s-(%,)", "%1") 810 str = string.gsub(str, "%s-(%,)", "%1")
787 ctrl = str 811 ctrl = str
788 if opt == "tei" then 812 if opt == "tei" then
813 for i = 1,#shorthands do
814 str = string.gsub(str, shorthands[i].a, shorthands[i].c)
815 end
789 for i = 1,#idsRend do 816 for i = 1,#idsRend do
790 str = string.gsub(str, "(%f[%w])"..idsRend[i].xmlid.."(%,)", "%1#"..idsRend[i].xmlid.."%2") 817 str = string.gsub(str, "(%f[%w])"..idsRend[i].xmlid.."(%,)", "%1#"..idsRend[i].xmlid.."%2")
791 ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "") 818 ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "")
@@ -794,7 +821,7 @@ function ekdosis.getsiglum(str, opt)
794 str = string.gsub(str, "%,$", "") 821 str = string.gsub(str, "%,$", "")
795 else 822 else
796 for i = 1,#idsRend do 823 for i = 1,#idsRend do
797 str = string.gsub(str, idsRend[i].xmlid.."%,", idsRend[i].head) 824 str = string.gsub(str, idsRend[i].xmlid.."%,", idsRend[i].abbr)
798 ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "") 825 ctrl = string.gsub(ctrl, idsRend[i].xmlid.."%,", "")
799 end 826 end
800 end 827 end
@@ -918,7 +945,7 @@ function ekdosis.openteistream()
918 f:write("<listWit>", "\n") 945 f:write("<listWit>", "\n")
919 for i = 1,#listWit do 946 for i = 1,#listWit do
920 f:write("<msDesc xml:id=\"", listWit[i].xmlid, "\">", "\n") 947 f:write("<msDesc xml:id=\"", listWit[i].xmlid, "\">", "\n")
921 f:write("<head>", ekdosis.textotei(listWit[i].head), "</head>", "\n") 948 f:write("<abbr>", ekdosis.textotei(listWit[i].abbr), "</abbr>", "\n")
922 if listWit[i].msIdentifier.settlement == "" 949 if listWit[i].msIdentifier.settlement == ""
923 and listWit[i].msIdentifier.repository == "" 950 and listWit[i].msIdentifier.repository == ""
924 and listWit[i].msIdentifier.idno == "" 951 and listWit[i].msIdentifier.idno == ""
@@ -947,7 +974,7 @@ function ekdosis.openteistream()
947 while listWit[i].handDesc[j] 974 while listWit[i].handDesc[j]
948 do 975 do
949 f:write("<handDesc xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n") 976 f:write("<handDesc xml:id=\"", listWit[i].handDesc[j].xmlid, "\">", "\n")
950 f:write("<head>", ekdosis.textotei(listWit[i].handDesc[j].head), "</head>", "\n") 977 f:write("<abbr>", ekdosis.textotei(listWit[i].handDesc[j].abbr), "</abbr>", "\n")
951 if listWit[i].handDesc[j].handNote == "" then else 978 if listWit[i].handDesc[j].handNote == "" then else
952 f:write("<handNote>\n<p>", ekdosis.textotei(listWit[i].handDesc[j].handNote), "</p>\n</handNote>", "\n") 979 f:write("<handNote>\n<p>", ekdosis.textotei(listWit[i].handDesc[j].handNote), "</p>\n</handNote>", "\n")
953 end 980 end
@@ -1022,7 +1049,7 @@ end
1022-- begin basic TeX Conspectus siglorum 1049-- begin basic TeX Conspectus siglorum
1023function ekdosis.basic_cs(msid) 1050function ekdosis.basic_cs(msid)
1024 local indexwit = getindex(msid, listWit) 1051 local indexwit = getindex(msid, listWit)
1025 siglum = listWit[indexwit].head 1052 siglum = listWit[indexwit].abbr
1026 if listWit[indexwit].detailsDesc == "" 1053 if listWit[indexwit].detailsDesc == ""
1027 then 1054 then
1028 name = listWit[indexwit].msIdentifier.msName 1055 name = listWit[indexwit].msIdentifier.msName