Skip to content

Commit

Permalink
load util.lua via dofile
Browse files Browse the repository at this point in the history
  • Loading branch information
josineto committed Jul 27, 2021
1 parent e5b9191 commit 01cf8f2
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 16 deletions.
5 changes: 3 additions & 2 deletions abstract.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
-- date: february 2018 (first version)
-- license: GPL version 3 or later

local utilPath = string.match(PANDOC_SCRIPT_FILE, '.*[/\\]')
require ((utilPath or '') .. 'util')
local path = require 'pandoc.path'
utilPath = path.directory(PANDOC_SCRIPT_FILE)
dofile(path.join{utilPath, 'util.lua'})

local function getAbstractAttr()
local attributes = {}
Expand Down
5 changes: 3 additions & 2 deletions odt-anchors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
-- date: february 2018 (first version)
-- license: GPL version 3 or later

local utilPath = string.match(PANDOC_SCRIPT_FILE, '.*[/\\]')
require ((utilPath or '') .. 'util')
local path = require 'pandoc.path'
utilPath = path.directory(PANDOC_SCRIPT_FILE)
dofile(path.join{utilPath, 'util.lua'})

local function getBookmarkById(id)
local bookmarkStart = '<text:bookmark-start text:name=\"' .. id .. '\"/>'
Expand Down
5 changes: 3 additions & 2 deletions odt-bib-style.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

local bibliographyStyle = 'Bibliography_20_1'

local utilPath = string.match(PANDOC_SCRIPT_FILE, '.*[/\\]')
require ((utilPath or '') .. 'util')
local path = require 'pandoc.path'
utilPath = path.directory(PANDOC_SCRIPT_FILE)
dofile(path.join{utilPath, 'util.lua'})

function Div (div)
if FORMAT == 'odt' and div.attr and div.attr.classes[1] then
Expand Down
5 changes: 3 additions & 2 deletions odt-captions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
-- date: february 2018 (first version)
-- license: GPL version 3 or later

local utilPath = string.match(PANDOC_SCRIPT_FILE, '.*[/\\]')
require ((utilPath or '') .. 'util')
local path = require 'pandoc.path'
utilPath = path.directory(PANDOC_SCRIPT_FILE)
dofile(path.join{utilPath, 'util.lua'})

local function correctCaption(caption, id, sequenceName)
local newCaption = {}
Expand Down
5 changes: 3 additions & 2 deletions odt-custom-styles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
local useClassAsCustomStyle = true
local unnumberedStyle = 'Título_20_textual'

local utilPath = string.match(PANDOC_SCRIPT_FILE, '.*[/\\]')
require ((utilPath or '') .. 'util')
local path = require 'pandoc.path'
utilPath = path.directory(PANDOC_SCRIPT_FILE)
dofile(path.join{utilPath, 'util.lua'})

function getParaTags(style)
local startTag = '<text:p text:style-name=\"' .. style .. '\">'
Expand Down
5 changes: 3 additions & 2 deletions odt-lists.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ local numListStyle = 'Numbering_20_1'
local listParaStyle = 'List_20_1'
local numListParaStyle = 'Numbering_20_1'

local utilPath = string.match(PANDOC_SCRIPT_FILE, '.*[/\\]')
require ((utilPath or '') .. 'util')
local path = require 'pandoc.path'
utilPath = path.directory(PANDOC_SCRIPT_FILE)
dofile(path.join{utilPath, 'util.lua'})

local tags = {}
tags.listStart = '<text:list text:style-name=\"' .. listStyle .. '\">'
Expand Down
5 changes: 3 additions & 2 deletions odt-smallcaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@

local smallcapsStyle = 'Versalete'

local utilPath = string.match(PANDOC_SCRIPT_FILE, '.*[/\\]')
require ((utilPath or '') .. 'util')
local path = require 'pandoc.path'
utilPath = path.directory(PANDOC_SCRIPT_FILE)
dofile(path.join{utilPath, 'util.lua'})

function SmallCaps (sc)
if FORMAT == 'odt' then
Expand Down
2 changes: 1 addition & 1 deletion test/Test.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ <h1 class="title">Testing pandoc-odt-filters</h1>
</header>
<h1 class="unnumbered" id="sec:abstract">Testing <code>abstract.lua</code></h1>
<div id="abstractDiv" class="abstract">
<p>If this abstract appears as first section in document, with style configured in filter (<code>abstractODTStyle</code> variable), test passes.</p>
<p>If this abstract appears as first section in document, with <strong>no</strong> title in ODT but a title in HTML, test passes.</p>
</div>
<h1 data-number="1" id="sec:testing-odt-captions.lua-2-tests"><span class="header-section-number">1</span> Testing <code>odt-captions.lua</code> (2 tests)</h1>
<p>If image and table captions below get correct LibreOffice sequence field, 1st and 2nd tests pass.</p>
Expand Down
2 changes: 1 addition & 1 deletion test/Test.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author: José de Mattos Neto
date: 07-03-2018
abstract-title: Testing `abstract.lua`
abstract:
If this abstract appears as first section in document, with style configured in filter (`abstractODTStyle` variable), test passes.
If this abstract appears as first section in document, with **no** title in ODT but a title in HTML, test passes.
---

# Testing `odt-captions.lua` (2 tests)
Expand Down
Binary file modified test/Test.odt
Binary file not shown.

0 comments on commit 01cf8f2

Please sign in to comment.