protected ScalarEvent _scalarEvent(String value, Character style) { String yamlTag = _typeId; if (yamlTag != null) { _typeId = null; } String anchor = _objectId; if (anchor != null) { _objectId = null; } // 29-Nov-2017, tatu: Not 100% sure why we don't force explicit tags for // type id, but trying to do so seems to double up tag output... return new ScalarEvent(anchor, yamlTag, NO_TAGS, value, null, null, style); } }
protected ScalarEvent _scalarEvent(String value, Character style) { String yamlTag = _typeId; if (yamlTag != null) { _typeId = null; } String anchor = _objectId; if (anchor != null) { _objectId = null; } // 29-Nov-2017, tatu: Not 100% sure why we don't force explicit tags for // type id, but trying to do so seems to double up tag output... return new ScalarEvent(anchor, yamlTag, NO_TAGS, value, null, null, style); } }
/** * <pre> * block_mapping ::= BLOCK-MAPPING_START * ((KEY block_node_or_indentless_sequence?)? * (VALUE block_node_or_indentless_sequence?)?)* * BLOCK-END * </pre> */ private Event processEmptyScalar(Mark mark) { return new ScalarEvent(null, null, new ImplicitTuple(true, false), "", mark, mark, DumperOptions.ScalarStyle.PLAIN); } }
private void _writeScalarBinary(Base64Variant b64variant, byte[] data) throws IOException { // 15-Dec-2017, tatu: as per [dataformats-text#62], can not use SnakeYAML's internal // codec. Also: force use of linefeed variant if using default if (b64variant == Base64Variants.getDefaultVariant()) { b64variant = Base64Variants.MIME; } String encoded = b64variant.encode(data); _emitter.emit(new ScalarEvent(null, TAG_BINARY, EXPLICIT_TAGS, encoded, null, null, STYLE_BASE64)); }
private void _writeScalarBinary(Base64Variant b64variant, byte[] data) throws IOException { // 15-Dec-2017, tatu: as per [dataformats-text#62], can not use SnakeYAML's internal // codec. Also: force use of linefeed variant if using default if (b64variant == Base64Variants.getDefaultVariant()) { b64variant = Base64Variants.MIME; } String encoded = b64variant.encode(data); _emitter.emit(new ScalarEvent(null, TAG_BINARY, EXPLICIT_TAGS, encoded, null, null, STYLE_BASE64)); }
ImplicitTuple tuple = new ImplicitTuple(node.getTag().equals(detectedTag), node .getTag().equals(defaultTag)); ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple, scalarNode.getValue(), null, null, scalarNode.getStyle()); this.emitter.emit(event);
implicitValues = new ImplicitTuple(false, false); event = new ScalarEvent(anchor, tag, implicitValues, token.getValue(), startMark, endMark, token.getStyle()); state = states.pop(); event = new ScalarEvent(anchor, tag, new ImplicitTuple(implicit, false), "", startMark, endMark, DumperOptions.ScalarStyle.PLAIN); state = states.pop();
public SldTransformContext scalar(String value) throws IOException { yaml.emit( new ScalarEvent( null, null, new ImplicitTuple(true, false), value, null, null, DumperOptions.ScalarStyle.PLAIN)); return this; }
protected ScalarEvent _scalarEvent(String value, Character style) { String yamlTag = _typeId; if (yamlTag != null) { _typeId = null; } String anchor = _objectId; if (anchor != null) { _objectId = null; } return new ScalarEvent(anchor, yamlTag, DEFAULT_IMPLICIT, value, null, null, style); } }
protected ScalarEvent _scalarEvent(String value, DumperOptions.ScalarStyle style) { String yamlTag = _typeId; if (yamlTag != null) { _typeId = null; } String anchor = _objectId; if (anchor != null) { _objectId = null; } // 29-Nov-2017, tatu: Not 100% sure why we don't force explicit tags for // type id, but trying to do so seems to double up tag output... return new ScalarEvent(anchor, yamlTag, NO_TAGS, value, null, null, style); } }
/** * <pre> * block_mapping ::= BLOCK-MAPPING_START * ((KEY block_node_or_indentless_sequence?)? * (VALUE block_node_or_indentless_sequence?)?)* * BLOCK-END * </pre> */ private Event processEmptyScalar(Mark mark) { return new ScalarEvent(null, null, new ImplicitTuple(true, false), "", mark, mark, DumperOptions.ScalarStyle.PLAIN); } }
private void _writeScalarBinaryPatched(Base64Variant b64variant, byte[] data) throws IOException { String encoded = b64variant.encode(data); _emitter.emit(new ScalarEvent(null, TAG_BINARY, EXPLICIT_TAGS, encoded, null, null, STYLE_BASE64)); }
/** * <pre> * block_mapping ::= BLOCK-MAPPING_START * ((KEY block_node_or_indentless_sequence?)? * (VALUE block_node_or_indentless_sequence?)?)* * BLOCK-END * </pre> */ private Event processEmptyScalar(Mark mark) { return new ScalarEvent(null, null, new ImplicitTuple(true, false), "", mark, mark, (char) 0); } }
/** * <pre> * block_mapping ::= BLOCK-MAPPING_START * ((KEY block_node_or_indentless_sequence?)? * (VALUE block_node_or_indentless_sequence?)?)* * BLOCK-END * </pre> */ private Event processEmptyScalar(Mark mark) { return new ScalarEvent(null, null, new ImplicitTuple(true, false), "", mark, mark, (char) 0); } }
@Override protected ScalarEvent _scalarEvent(String value, Character style) { if (value.indexOf('\n') != -1) { style = Character.valueOf('|'); } ImplicitTuple implicit; String yamlTag = _typeId; if (yamlTag != null) { _typeId = null; implicit = new ImplicitTuple(false, false); // we want to always preserve the tags (if they are present) } else { implicit = new ImplicitTuple(true, true); } String anchor = _objectId; if (anchor != null) { _objectId = null; } return new ScalarEvent(anchor, yamlTag, implicit, value, null, null, style); }
public SldTransformContext scalar(String value) throws IOException { yaml.emit( new ScalarEvent( null, null, new ImplicitTuple(true, false), value, null, null, null)); return this; }
private void _writeScalarBinary(Base64Variant b64variant, byte[] data) throws IOException { // 15-Dec-2017, tatu: as per [dataformats-text#62], can not use SnakeYAML's internal // codec. Also: force use of linefeed variant if using default if (b64variant == Base64Variants.getDefaultVariant()) { b64variant = Base64Variants.MIME; } String encoded = b64variant.encode(data); _emitter.emit(new ScalarEvent(null, TAG_BINARY, EXPLICIT_TAGS, encoded, null, null, STYLE_BASE64)); }
private Event maybeSetAbsoluteUrlAsRelative(ScalarEvent scalarEvent) throws MalformedURLException { String oldUrl = scalarEvent.getValue(); try { URI uri = new URIBuilder(oldUrl).build(); if (uri.isAbsolute()) { String fileName = uri.getPath(); // Strip leading slash if (!fileName.isEmpty()) { fileName = fileName.substring(1); } scalarEvent = new ScalarEvent(scalarEvent.getAnchor(), scalarEvent.getTag(), scalarEvent.getImplicit(), fileName, scalarEvent.getStartMark(), scalarEvent.getEndMark(), scalarEvent.getStyle()); } } catch (URISyntaxException ex) { log.debug("Invalid URI in index.yaml", ex); } return scalarEvent; }
@JRubyMethod(required = 6) public IRubyObject scalar(ThreadContext context, IRubyObject[] args) { IRubyObject value = args[0]; IRubyObject anchor = args[1]; IRubyObject tag = args[2]; IRubyObject plain = args[3]; IRubyObject quoted = args[4]; IRubyObject style = args[5]; if (!(value instanceof RubyString)) { throw context.runtime.newTypeError(value, context.runtime.getString()); } ScalarEvent event = new ScalarEvent( anchor.isNil() ? null : anchor.asJavaString(), tag.isNil() ? null : tag.asJavaString(), new ImplicitTuple(plain.isTrue(), quoted.isTrue()), value.asJavaString(), NULL_MARK, NULL_MARK, SCALAR_STYLES[(int)style.convertToInteger().getLongValue()]); emit(context, event); return this; }
@JRubyMethod(required = 6) public IRubyObject scalar(ThreadContext context, IRubyObject[] args) { IRubyObject value = args[0]; IRubyObject anchor = args[1]; IRubyObject tag = args[2]; IRubyObject plain = args[3]; IRubyObject quoted = args[4]; IRubyObject style = args[5]; if (!(value instanceof RubyString)) { throw context.runtime.newTypeError(value, context.runtime.getString()); } ScalarEvent event = new ScalarEvent( anchor.isNil() ? null : anchor.asJavaString(), tag.isNil() ? null : tag.asJavaString(), new ImplicitTuple(plain.isTrue(), quoted.isTrue()), value.asJavaString(), NULL_MARK, NULL_MARK, SCALAR_STYLES[(int)style.convertToInteger().getLongValue()]); emit(context, event); return this; }