Просмотр исходного кода

update aastex63 to use current acknowledgments element

George C. Privon 6 лет назад
Родитель
Сommit
96e5bca9d6
2 измененных файлов с 9 добавлено и 3 удалено
  1. 3 1
      aastex63/demo.md
  2. 6 2
      aastex63/filters/acknowledgments.lua

+ 3 - 1
aastex63/demo.md

@@ -279,7 +279,7 @@ Use of such a filter would make it easier to convert the Markdown source to othe
 Simple filters are straightforward to construct and I demonstrate one here.
 Simple filters are straightforward to construct and I demonstrate one here.
 With output formats besides \aastex\ in mind, the acknowledgments portion of the document has been delineated in the Markdown file as a macro: `{{acknowledgments}}`.
 With output formats besides \aastex\ in mind, the acknowledgments portion of the document has been delineated in the Markdown file as a macro: `{{acknowledgments}}`.
 However it is desirable to automatically convert this to the \TeX\ source appropriate for the journal's template.
 However it is desirable to automatically convert this to the \TeX\ source appropriate for the journal's template.
-For \aastex\, this is the `\acknowledgments` macro.
+For \aastex\, this is the `\acknowledgments{}` macro.
 The following filter, written in lua, performs this translation when included as part of the `pandoc` invocation:
 The following filter, written in lua, performs this translation when included as part of the `pandoc` invocation:
 
 
 ```{#ackfilter .numberLines caption="lua filter code for acknowledgements replacement"}
 ```{#ackfilter .numberLines caption="lua filter code for acknowledgements replacement"}
@@ -338,4 +338,6 @@ Comments, bug reports, and enhancements are welcome.
 
 
 I thank Kelly Hondula for comments on this manuscript and acknowledge support from the University of Florida.
 I thank Kelly Hondula for comments on this manuscript and acknowledge support from the University of Florida.
 
 
+{{end_acknowledgments}}
+
 # References
 # References

+ 6 - 2
aastex63/filters/acknowledgments.lua

@@ -1,7 +1,7 @@
 --[[
 --[[
 Simple pandoc filter to handle the {{acknowledgments}} macro.
 Simple pandoc filter to handle the {{acknowledgments}} macro.
 
 
-Copyright (C) 2018 George C. Privon
+Copyright (C) 2018-2019 George C. Privon
 
 
 This program is free software: you can redistribute it and/or modify
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 it under the terms of the GNU General Public License as published by
@@ -22,12 +22,16 @@ return {
     Str = function (elem)
     Str = function (elem)
         if elem.text == "{{acknowledgments}}" then
         if elem.text == "{{acknowledgments}}" then
             if string.find(FORMAT, "latex") then
             if string.find(FORMAT, "latex") then
-                return pandoc.RawInline("tex", "\\acknowledgements")
+                return pandoc.RawInline("tex", "\\acknowledgments{")
             elseif string.find(FORMAT, "html") then
             elseif string.find(FORMAT, "html") then
                 return pandoc.RawInline("html", "<h1>Acknowledgements</h1>")
                 return pandoc.RawInline("html", "<h1>Acknowledgements</h1>")
             else
             else
                 return elem
                 return elem
             end
             end
+        elseif elem.text == "{{end_acknowledgments}}" then
+            if string.find(FORMAT, "latex") then
+                return pandoc.RawInline("tex", "}")
+            end
         end
         end
     end,
     end,
   }
   }