ditaconvert

package module
v0.0.0-...-c13b88d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkip = errors.New("")

Functions

func CanonicalPath

func CanonicalPath(name string) string

func ConvertImageMap

func ConvertImageMap(context *Context, dec *xml.Decoder, start xml.StartElement) error

func EmptyLinkSets

func EmptyLinkSets(links []Links) bool

func ExtractTitle

func ExtractTitle(data []byte, selector string) (title string, err error)

func HandleSettings

func HandleSettings(context *Context, dec *xml.Decoder, start xml.StartElement) error

<settings>

<settinghead>
  <settingnamehd>Setting name</settingnamehd>
  <settingdefaulthd>Default value</settingdefaulthd>
  <settingdeschd>Description</settingdeschd>
  <settingsamplehd>Example</settingsamplehd>
  <settinglevelshd>Levels where it can be defined</settinglevelshd>
</settinghead>
<setting id="ConfRefreshInterval">
  <settingname>ConfRefreshInterval</settingname>
  <settingdefault>30</settingdefault>
  <settingdesc>Interval in minutes, during which the agent does not have to <xref href="../CheckPluginChanges.dita">update the plugin configuration</xref>. After the interval, the agent compares the file system state against the database state to see if the EMR plugin configuration is up to date and runs the update, if necessary.</settingdesc>
  <settingsample>
    <codeblock>[Plugins]

ConfRefreshInterval=60</codeblock>

  </settingsample>
  <settinglevels>user, database, scriptpath, homedir</settinglevels>
</setting>
<setting id="SuppressDuplicateActivePluginsWarning">
  <settingname>SuppressDuplicateActivePluginsWarning</settingname>
  <settingdefault>N</settingdefault>
  <settingdesc>Option to switch off the duplicate active plugins warning. This warning message is displayed if there are 2 or more active plugins that use RTM files with matching names. The message is displayed after logging in and selecting a database, and it is only displayed to the Raintree Tech Support user "GO".</settingdesc>
  <settingsample>
    <codeblock>[Plugins]

SuppressDuplicateActivePluginsWarning=Y</codeblock>

  </settingsample>
  <settinglevels>user, database, scriptpath, homedir</settinglevels>
</setting>

</settings>

func HandleSimpleTable

func HandleSimpleTable(context *Context, dec *xml.Decoder, start xml.StartElement) error

<simpletable>

<sthead>
  <stentry>Type style</stentry>
  <stentry>Elements used</stentry>
</sthead>
<strow deliveryTarget="F1 PDF">
  <stentry>Bold</stentry>
  <stentry>b</stentry>
</strow>
<strow>
  <stentry>Italic</stentry>
  <stentry>i</stentry>
</strow>
<strow>
  <stentry>Underlined</stentry>
  <stentry>u</stentry>
</strow>

</simpletable>

func HandleTable

func HandleTable(context *Context, dec *xml.Decoder, start xml.StartElement) error

func InterLinkEntries

func InterLinkEntries(A, B []*Entry)

func IsBodyTag

func IsBodyTag(tag string) bool

checks wheter dita tag corresponds to some "root element"

func IsConref

func IsConref(token xml.Token) bool

func SameRootElement

func SameRootElement(a, b string) bool
func SortLinks(links []*Link)
func SplitLink(link string) (name, selector string)

func TODO

func TODO(context *Context, dec *xml.Decoder, start xml.StartElement) error

func WalkNodePath

func WalkNodePath(dec *xml.Decoder, selector string) (xml.StartElement, error)

Types

type Context

type Context struct {
	Index   *Index
	Topic   *Topic
	Rules   *Rules
	Encoder *html.Encoder
	Output  *bytes.Buffer

	DecodingPath string

	Errors []error
}

func NewConversion

func NewConversion(index *Index, topic *Topic) *Context

func (*Context) EmitWithChildren

func (context *Context) EmitWithChildren(dec *xml.Decoder, start xml.StartElement) error

func (*Context) Handle

func (context *Context) Handle(dec *xml.Decoder, token xml.Token) error

func (*Context) HandleConref

func (context *Context) HandleConref(dec *xml.Decoder, start xml.StartElement) error

func (*Context) InlinedImageURL

func (context *Context) InlinedImageURL(href string) string

func (*Context) Parse

func (context *Context) Parse(data string) error

func (*Context) Recurse

func (context *Context) Recurse(dec *xml.Decoder) error

func (*Context) RecurseChildCount

func (context *Context) RecurseChildCount(dec *xml.Decoder) (error, int)

func (*Context) ResolveKeyRef

func (context *Context) ResolveKeyRef(keyref string) (abspath, itempath string)

func (*Context) ResolveLinkInfo

func (context *Context) ResolveLinkInfo(url string) (href, title, synopsis string, internal bool)

func (*Context) Run

func (context *Context) Run() error

func (*Context) ShouldSkip

func (context *Context) ShouldSkip(token xml.Token) bool

func (*Context) ShouldUnwrap

func (context *Context) ShouldUnwrap(token xml.Token) bool

type Dir

type Dir string

func (Dir) ReadFile

func (dir Dir) ReadFile(name string) (data []byte, modified time.Time, err error)

type Entry

type Entry struct {
	Title string
	Type  string

	CollType  dita.CollectionType
	Linking   dita.Linking
	TOC       bool
	LockTitle bool

	Children []*Entry
	Topic    *Topic
}

type FileSystem

type FileSystem interface {
	ReadFile(path string) (data []byte, modified time.Time, err error)
}

type Index

type Index struct {
	FileSystem

	KeyDef map[string]string

	// cpath(path) --> topic
	Topics map[string]*Topic
	Maps   map[string]*Map

	Nav *Entry

	Errors []error
}

func NewIndex

func NewIndex(fs FileSystem) *Index

func (*Index) LoadMap

func (index *Index) LoadMap(name string)

name should be a path relative FileSystem root

type Link struct {
	Topic *Topic
	Title string
	Type  string
	Scope string
	Href  string

	Selector string
}

func (*Link) FinalTitle

func (link *Link) FinalTitle() string
type Links struct {
	CollType   dita.CollectionType
	Parent     *Link
	Prev, Next *Link
	Siblings   []*Link
	Children   []*Link
}

func (*Links) IsEmpty

func (links *Links) IsEmpty() bool

type Map

type Map struct {
	Path    string
	Entries []*Entry
	Node    *dita.MapNode
}

type MapContext

type MapContext struct {
	*Index
	Dir      string
	Entry    *Entry
	CollType dita.CollectionType
	Linking  dita.Linking
	TOC      bool
}
func (context MapContext) AddFamilyLinks(entries []*Entry)
func (context MapContext) CreateRelatedLinks(a *Entry)

func (MapContext) LoadMap

func (context MapContext) LoadMap(filename string) []*Entry

func (MapContext) LoadTopic

func (context MapContext) LoadTopic(filename string) *Topic

func (MapContext) ProcessNode

func (context MapContext) ProcessNode(node *dita.MapNode) []*Entry

func (MapContext) ProcessRelRow

func (context MapContext) ProcessRelRow(node *dita.MapNode)

type Renaming

type Renaming struct{ Name, AddClass string }

type Rules

type Rules struct {
	CustomResolveLink func(url string) (href, title, synopsis string, internal bool)

	Rename map[string]Renaming
	Skip   map[string]bool
	Unwrap map[string]bool
	Custom map[string]TokenProcessor
}

func NewDefaultRules

func NewDefaultRules() *Rules

type TokenProcessor

type TokenProcessor func(*Context, *xml.Decoder, xml.StartElement) error

type Topic

type Topic struct {
	Path string

	Title      string
	ShortTitle string
	Synopsis   string

	Links               []Links
	RelatedLinksCreated bool

	Raw      []byte
	Modified time.Time
	Original *dita.Topic
}

type VFS

type VFS map[string]string

func (VFS) ReadFile

func (fs VFS) ReadFile(name string) (data []byte, modified time.Time, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL