| | |
| | | return false; |
| | | } |
| | | |
| | | public void staticPath() { |
| | | // 设置img的链接访问 |
| | | if ("img".equals(this.element.tagName())) { |
| | | String src = this.element.attr("src"); |
| | | if (StrUtil.isNotBlank(STATIC_URL)) { |
| | | this.element.attr("src", STATIC_URL + src); |
| | | } |
| | | } |
| | | |
| | | if ("link".equals(this.element.tagName())) { |
| | | String src = this.element.attr("href"); |
| | | if (StrUtil.isNotBlank(STATIC_URL)) { |
| | | this.element.attr("href", STATIC_URL + src); |
| | | } |
| | | } |
| | | |
| | | if ("script".equals(this.element.tagName())) { |
| | | String src = this.element.attr("src"); |
| | | if (StrUtil.isNotBlank(STATIC_URL)) { |
| | | this.element.attr("src", STATIC_URL + src); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void parser() { |
| | | staticPath(); |
| | | // 判断是否为最小节点,如果是且没有特殊标签,则跳过清空 |
| | | if (!isNeedEmpty()) { |
| | | return; |
| | |
| | | this.element.html(result); |
| | | } else if ("time".equals(key)) { |
| | | TimeTag time = parserTag(result, TimeTag.class); |
| | | String timeStr = DateUtil.format(DateUtil.parse(time.getText(), DatePattern.NORM_DATETIME_PATTERN), time.getFormat()); |
| | | String timeStr = DateUtil.format(DateUtil.parse(time.getDate(), DatePattern.NORM_DATETIME_PATTERN), time.getFormat()); |
| | | this.element.text(timeStr); |
| | | } else { |
| | | this.element.attr(key, result); |