case class RewriteRules(spanRules: Seq[RewriteRule[Span]] = Nil, blockRules: Seq[RewriteRule[Block]] = Nil, templateRules: Seq[RewriteRule[TemplateSpan]] = Nil) extends Product with Serializable
A set of rewrite rules describing a set of modifications to be applied to an AST of a document.
For reasons of type-safety the major element type blocks and spans (in markup documents) and template spans (in template documents) have their separate set of rules, as an element in a block position for example can usually only be replaced by another block and not by any other element type.
- Alphabetic
- By Inheritance
- RewriteRules
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RewriteRules(spanRules: Seq[RewriteRule[Span]] = Nil, blockRules: Seq[RewriteRule[Block]] = Nil, templateRules: Seq[RewriteRule[TemplateSpan]] = Nil)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def ++(other: RewriteRules): RewriteRules
Combines the rules defined in this instance with the rules defined in the specified other instance.
Combines the rules defined in this instance with the rules defined in the specified other instance. If a rule in this instance matches the same instance as another rule in the other instance, the rule in this instance will be applied first, before its result gets passed to the other function.
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val blockRules: Seq[RewriteRule[Block]]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def rewriteBlock(block: Block): Block
Rewrites the specified block based on the set of rules in this instance.
Rewrites the specified block based on the set of rules in this instance.
If the rule is not defined for the block or the rule returns a
Retain
action as a result the old block will be returned unchanged.If it returns
Replace
with a new block that block will be returned. If it returnsRemove
then an empty block container will be returned.The rewriting is performed bottom-up (depth-first), including any children (blocks and spans) of the specified block, therefore an element passed to the rule only contains children which have already been processed.
- def rewriteBlocks(blocks: Seq[Block]): Seq[Block]
Rewrites the specified sequence of blocks based on the set of rules in this instance.
Rewrites the specified sequence of blocks based on the set of rules in this instance.
If the rule is not defined for a specific block or the rule returns a
Retain
action as a result the old block remains in the tree unchanged.If it returns
Remove
then the block gets removed from the ast, if it returnsReplace
with a new block it will replace the old one.The size of the returned
Seq
is always between 0 and the number of blocks passed to this function.The rewriting is performed bottom-up (depth-first), therefore any element passed to the rule only contains children which have already been processed. If the blocks contain span elements, the span rules defined in this instance will also be applied recursively.
- def rewriteElement(element: Element): Element
Rewrites the specified element based on the set of rules in this instance.
Rewrites the specified element based on the set of rules in this instance.
If the rule is not defined for the element or the rule returns a
Retain
action as a result the old element will be returned unchanged.If it returns
Replace
with a new element that element will be returned. If it returnsRemove
then an empty element container will be returned.If the specified element type does not support rewriting, it is returned unchanged.
The rewriting is performed bottom-up (depth-first), including any children of the specified element, therefore an element passed to the rule only contains children which have already been processed.
- def rewriteSpan(span: Span): Span
Rewrites the specified span based on the set of rules in this instance.
Rewrites the specified span based on the set of rules in this instance.
If the rule is not defined for the span or the rule returns a
Retain
action as a result the old span will be returned unchanged.If it returns
Replace
with a new span that span will be returned. If it returnsRemove
then an empty span container will be returned.The rewriting is performed bottom-up (depth-first), including any children of the specified span, therefore an element passed to the rule only contains children which have already been processed.
- def rewriteSpans(spans: Seq[Span]): Seq[Span]
Rewrites the specified sequence of spans based on the set of rules in this instance.
Rewrites the specified sequence of spans based on the set of rules in this instance.
If the rule is not defined for a specific span or the rule returns a
Retain
action as a result the old span remains in the tree unchanged.If it returns
Remove
then the span gets removed from the ast, if it returnsReplace
with a new span it will replace the old one.The size of the returned
Seq
is always between 0 and the number of spans passed to this function.The rewriting is performed bottom-up (depth-first), therefore any element passed to the rule only contains children which have already been processed.
- def rewriteTemplateSpan(span: TemplateSpan): TemplateSpan
Rewrites the specified template span based on the set of rules in this instance.
Rewrites the specified template span based on the set of rules in this instance.
If the rule is not defined for the span or the rule returns a
Retain
action as a result the old span will be returned unchanged.If it returns
Replace
with a new span that span will be returned. If it returnsRemove
then an empty template span container will be returned.The rewriting is performed bottom-up (depth-first), including any children of the specified template span, therefore an element passed to the rule only contains children which have already been processed.
- def rewriteTemplateSpans(spans: Seq[TemplateSpan]): Seq[TemplateSpan]
Rewrites the specified sequence of template spans based on the set of rules in this instance.
Rewrites the specified sequence of template spans based on the set of rules in this instance.
If the rule is not defined for a specific span or the rule returns a
Retain
action as a result the old span remains in the tree unchanged.If it returns
Remove
then the span gets removed from the ast, if it returnsReplace
with a new span it will replace the old one.The size of the returned
Seq
is always between 0 and the number of template spans passed to this function.The rewriting is performed bottom-up (depth-first), therefore any element passed to the rule only contains children which have already been processed.
- val spanRules: Seq[RewriteRule[Span]]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- val templateRules: Seq[RewriteRule[TemplateSpan]]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()