Commits

Anonymous committed d238a9c

[parser] comment fix; [fitbox] fontsize hack for switchtobodyfontenvironment

  • Participants
  • Parent commits bbf96b5

Comments (0)

Files changed (4)

File makedummy.lua

 -- strings
 ------------------------------------------------------------------------
 
-local long_lorem = [[
--l: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+local lorems = {
+[[text-l: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
+minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
+voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
+sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
+mollit anim id est laborum.
+
+]],
+[[text-l: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
+minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
+voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
+sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
+mollit anim id est laborum.
+
+]],
+[[text-l: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
 eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
 minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
 ex ea commodo consequat.
 
-]]
-local short_lorem = [[
-text: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
+]],
+[[text: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
 eiusmod
 
-]]
+]],
+}
 
 local strings = { }
 strings["en"] = {
   end
 end
 
+local nlorems = #lorems
+
 local do_main = function (outlang, times)
   for i=1, times do
       if i ~= 1 then iowrite(separator .. "\n") end
       end
 
       random_comment()
-      if rands[3] == 1 then -- standard
-          iowrite(short_lorem)
-      else
-          iowrite(strings[outlang]["text"] .. long_lorem)
-      end
+
+      iowrite(lorems[mathrandom(nlorems)])
+      --if rands[3] == 1 then -- standard
+      --    iowrite(short_lorem)
+      --else
+      --    iowrite(strings[outlang]["text"] .. long_lorem)
+      --end
       random_comment()
 
       iowrite(strings[outlang]["keys"] .. ": " .. makekeys() .. "\n\n")

File testfile.tex

+\tracefontdefinitions
 \setuppapersize[A4,landscape][A4,landscape]
 \showframe
 \setuplayout[page]

File tex/context/third/bstellen/bibelstellen.lua

         local newkeys = { }
         for i=1, #keys do
             local keyword = stringstrip(keys[i])
-            newkeys[keyword] = true
-            tdsk[keyword]    = true
+            if keyword ~= "" then -- handle trailing comma
+                newkeys[keyword] = true
+                tdsk[keyword]    = true
+            end
         end
         return key, newkeys
     end
     local kv_sep           = whitespace^0 * colon * whitespace^0
     local blank_line       = whitespace^0 * eol
     local rest_of_line     = (1 - eol)^0  * eol
-    local comment_line     = semicolon^1 * rest_of_line    -- ignored
+    local comment_line     = whitespace^0 * semicolon^1 * rest_of_line    -- ignored
     local blank_or_comment = blank_line + comment_line
-    local key_char         = R("az", "AZ") + dash
+    --local key_char         = R("az", "AZ") + dash
+    local key_char         = (1 - colon - semicolon - whitespace - eol)
     local key              = C(key_char^1)
     local separator        = blank_or_comment^0
                            * whitespace^0 * dash^1 * whitespace^0
     local ncats = #cats
     for i=1, #data do
         local entry = data[i]
+        --table.print(entry)
         local keys  = entry["schlüssel"]
         if any then
             result[#result+1] = entry

File tex/context/third/bstellen/t-bibelstellen.mkiv

   \newdimen\current_fontsize
   \current_fontsize\dimexpr(\normal_fontsize)\relax
   \do_prepare_bodyfont_definitions
-  \let\current_fontsize\relax
+  \let\current_fontsize\relax%
 }
 
 \appendtoks
 }
 
 \def\do_do_do_fit_box{%
-  \stellenframe[height=\fitbox_targetht]{%
-    \switchtobodyfont[\the\current_fontsize]%
+  \stellen_frame[height=\fitbox_targetht]{%
+    %% next line due to
+    %% http://archive.contextgarden.net/message/20120603.201848.7d9b2319.en.html
+    \normalizebodyfontsize\bf_size{\the\current_fontsize}%
+    \switchtobodyfont[\bf_size]%
     \set_fit_box_interline_space
     \current_content
     \par%
 
 \def\do_do_fit_box{%
   \setbox\scratchbox\vbox{%
-    \stellenframe{%
+    \stellen_frame{%
       \set_fit_box_interline_space
-      \switchtobodyfont[\the\current_fontsize]%
+      \normalizebodyfontsize\bf_size{\the\current_fontsize}%
+      \switchtobodyfont[\bf_size]%
       \current_content
       \par%
     }%
 }
 
 \def\do_fit_box[#1]#2{%
-  \setupframed[stellenframe][#1]%
+  \setupframed[stellen_frame][#1]%
   \newdimen\current_fontsize
   \current_fontsize\dimexpr(\normal_fontsize)\relax
   \def\current_content{#2}%
 %                       auxiliary macros
 %······································································%
 
-\defineframed[stellenframe][
+\defineframed[stellen_frame][
         frame=off,
      topframe=off,
   bottomframe=off,
         align=lohi,
 ]
 
-% \def\calc_stellenframe_ht{%
+% \def\calc_stellen_frame_ht{%
 %   \dimexpr(\vsize/\bstellenparameter{rows})\relax%
 % }
 
 \appendtoks
-  % \calc_stellenframe_ht
-  \setupframed[stellenframe][
+  % \calc_stellen_frame_ht
+  \setupframed[stellen_frame][
     bottomframe=\bstellenparameter{frame},
      rightframe=\bstellenparameter{frame},
         loffset=\bstellenparameter{frameoffset},
         toffset=\bstellenparameter{frameoffset},
         boffset=\bstellenparameter{frameoffset},
         % height=\dimexpr(\vsize/\bstellenparameter{rows})\relax,
-        % height=\calc_stellenframe_ht,
+        % height=\calc_stellen_frame_ht,
   ]
+  \setupbodyfont[10pt]
 \to \everysetupbstellen
 
 %······································································%
           adapt=no,
     minfontsize=6pt,
        fontsize=16pt,
-       fontstep=1pt,
+       fontstep=4pt,
 ]
 
 \def\typesetstellen[#1]#2{%